build: cloudflare config

This commit is contained in:
JOYCEQL
2025-06-16 23:12:18 +08:00
parent fdd43ec09e
commit 0ca0f8f48b
16 changed files with 2386 additions and 39 deletions
+6 -2
View File
@@ -1,15 +1,19 @@
import createNextIntlPlugin from "next-intl/plugin";
import path from "path";
import { fileURLToPath } from "url";
import { setupDevPlatform } from "@cloudflare/next-on-pages/next-dev";
const withNextIntl = createNextIntlPlugin();
if (process.env.NODE_ENV === "development") {
await setupDevPlatform();
}
/** @type {import('next').NextConfig} */
const config = {
typescript: {
ignoreBuildErrors: true,
},
output: "standalone",
// output: "export",
};
export default withNextIntl(config);
+7 -2
View File
@@ -7,7 +7,10 @@
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
"lint": "next lint",
"pages:build": "npx @cloudflare/next-on-pages",
"preview": "pnpm pages:build && wrangler pages dev",
"deploy": "pnpm pages:build && wrangler pages deploy"
},
"dependencies": {
"@radix-ui/react-accordion": "^1.2.2",
@@ -68,6 +71,7 @@
"zustand": "^4.5.4"
},
"devDependencies": {
"@cloudflare/next-on-pages": "^1.13.12",
"@types/lodash": "^4.17.13",
"@types/node": "^20",
"@types/react": "^18",
@@ -78,6 +82,7 @@
"postcss-normalize": "^13.0.1",
"sass": "^1.77.4",
"tailwindcss": "^3.4.1",
"typescript": "^5"
"typescript": "^5",
"wrangler": "^4.19.1"
}
}
+2324 -12
View File
File diff suppressed because it is too large Load Diff
@@ -8,6 +8,8 @@ import ChangelogTimeline from "@/components/shared/ChangelogTimeline";
import { getChangelog } from "@/lib/getChangelog";
import { cn } from "@/lib/utils";
export const runtime = "edge";
export default function ChangelogPage() {
const t = useTranslations("home");
const changelogEntries = getChangelog();
+1
View File
@@ -6,6 +6,7 @@ import Footer from "@/components/home/Footer";
import NewsAlert from "@/components/home/NewsAlert";
import FAQSection from "@/components/home/FAQSection";
export const runtime = "edge";
export default function LandingPage() {
return (
<div className="relative bg-gradient-to-b from-[#f8f9fb] to-white dark:from-gray-900 dark:to-gray-800">
+7 -6
View File
@@ -19,7 +19,7 @@ export async function POST(req: NextRequest) {
body: JSON.stringify({
model: modelConfig.requiresModelId ? model : modelConfig.defaultModel,
response_format: {
type: "json_object"
type: "json_object",
},
messages: [
{
@@ -41,14 +41,14 @@ export async function POST(req: NextRequest) {
]
}
请确保返回的格式可以正常解析`
请确保返回的格式可以正常解析`,
},
{
role: "user",
content: content
}
]
})
content: content,
},
],
}),
});
const data = await response.json();
@@ -61,3 +61,4 @@ export async function POST(req: NextRequest) {
);
}
}
export const runtime = "edge";
+2
View File
@@ -102,3 +102,5 @@ export async function POST(req: Request) {
);
}
}
export const runtime = "edge";
+1
View File
@@ -99,3 +99,4 @@ export async function GET(request: NextRequest) {
);
}
}
export const runtime = "edge";
+12 -7
View File
@@ -11,7 +11,7 @@ import {
SelectContent,
SelectItem,
SelectTrigger,
SelectValue
SelectValue,
} from "@/components/ui/select";
import { useAIConfigStore } from "@/store/useAIConfigStore";
import { cn } from "@/lib/utils";
@@ -32,7 +32,7 @@ const AISettingsPage = () => {
setOpenaiModelId,
setOpenaiApiEndpoint,
selectedModel,
setSelectedModel
setSelectedModel,
} = useAIConfigStore();
const [currentModel, setCurrentModel] = useState("");
@@ -88,7 +88,7 @@ const AISettingsPage = () => {
link: "https://platform.deepseek.com",
color: "text-purple-500",
bgColor: "bg-purple-50 dark:bg-purple-950/50",
isConfigured: !!deepseekApiKey
isConfigured: !!deepseekApiKey,
},
{
id: "doubao",
@@ -98,7 +98,7 @@ const AISettingsPage = () => {
link: "https://console.volcengine.com/ark",
color: "text-blue-500",
bgColor: "bg-blue-50 dark:bg-blue-950/50",
isConfigured: !!(doubaoApiKey && doubaoModelId)
isConfigured: !!(doubaoApiKey && doubaoModelId),
},
{
id: "openai",
@@ -108,8 +108,8 @@ const AISettingsPage = () => {
link: "https://platform.openai.com/api-keys",
color: "text-blue-500",
bgColor: "bg-blue-50 dark:bg-blue-950/50",
isConfigured: !!(openaiApiKey && openaiModelId && openaiApiEndpoint)
}
isConfigured: !!(openaiApiKey && openaiModelId && openaiApiEndpoint),
},
];
return (
@@ -220,7 +220,11 @@ const AISettingsPage = () => {
</div>
<Input
value={
model.id === "doubao" ? doubaoApiKey : model.id === "openai" ? openaiApiKey : deepseekApiKey
model.id === "doubao"
? doubaoApiKey
: model.id === "openai"
? openaiApiKey
: deepseekApiKey
}
onChange={(e) =>
handleApiKeyChange(
@@ -312,5 +316,6 @@ const AISettingsPage = () => {
</div>
);
};
export const runtime = "edge";
export default AISettingsPage;
+2
View File
@@ -1,5 +1,7 @@
import { redirect } from "next/navigation";
export const runtime = "edge";
export default function Dashboard() {
redirect("/app/dashboard/resumes");
}
+7 -6
View File
@@ -11,7 +11,7 @@ import {
CardContent,
CardDescription,
CardFooter,
CardTitle
CardTitle,
} from "@/components/ui/card";
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { cn } from "@/lib/utils";
@@ -33,7 +33,7 @@ const ResumeWorkbench = () => {
updateResumeFromFile,
addResume,
deleteResume,
createResume
createResume,
} = useResumeStore();
const router = useRouter();
const [hasConfiguredFolder, setHasConfiguredFolder] = React.useState(false);
@@ -110,7 +110,7 @@ const ResumeWorkbench = () => {
...config,
id: generateUUID(),
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString()
updatedAt: new Date().toISOString(),
};
addResume(newResume);
@@ -272,7 +272,7 @@ const ResumeWorkbench = () => {
exit={{ opacity: 0, y: -20 }}
transition={{
duration: 0.3,
delay: index * 0.1
delay: index * 0.1,
}}
whileHover={{ scale: 1.02 }}
whileTap={{ scale: 0.98 }}
@@ -310,7 +310,7 @@ const ResumeWorkbench = () => {
transition={{
type: "spring",
stiffness: 400,
damping: 17
damping: 17,
}}
>
<Button
@@ -332,7 +332,7 @@ const ResumeWorkbench = () => {
transition={{
type: "spring",
stiffness: 400,
damping: 17
damping: 17,
}}
>
<Button
@@ -358,5 +358,6 @@ const ResumeWorkbench = () => {
</motion.div>
);
};
export const runtime = "edge";
export default ResumesList;
+3 -2
View File
@@ -8,14 +8,14 @@ import {
CardContent,
CardDescription,
CardHeader,
CardTitle
CardTitle,
} from "@/components/ui/card";
import {
getFileHandle,
getConfig,
storeFileHandle,
storeConfig,
verifyPermission
verifyPermission,
} from "@/utils/fileSystem";
const SettingsPage = () => {
@@ -115,5 +115,6 @@ const SettingsPage = () => {
</div>
);
};
export const runtime = "edge";
export default SettingsPage;
+2
View File
@@ -218,4 +218,6 @@ const TemplatesPage = () => {
);
};
export const runtime = "edge";
export default TemplatesPage;
+4 -2
View File
@@ -10,11 +10,11 @@ type Props = {
};
export async function generateMetadata({
params: { locale }
params: { locale },
}: Props): Promise<Metadata> {
const t = await getTranslations({ locale, namespace: "common" });
return {
title: t("title")
title: t("title"),
};
}
export default async function LocaleLayout({ children }: Props) {
@@ -30,3 +30,5 @@ export default async function LocaleLayout({ children }: Props) {
</Document>
);
}
export const runtime = "edge";
+2
View File
@@ -153,6 +153,8 @@ const LayoutControls = memo(
LayoutControls.displayName = "LayoutControls";
export const runtime = "edge";
export default function Home() {
const [sidePanelCollapsed, setSidePanelCollapsed] = useState(false);
const [editPanelCollapsed, setEditPanelCollapsed] = useState(false);
+4
View File
@@ -0,0 +1,4 @@
name = "sorafm"
compatibility_date = "2024-09-23"
compatibility_flags = ["nodejs_compat"]
pages_build_output_dir = ".vercel/output/static"