fix(kimi): support API-key setup for Kimi Code
This commit is contained in:
@@ -11,6 +11,10 @@ interface KVNamespace {
|
||||
}
|
||||
|
||||
async function getKv(): Promise<KVNamespace | undefined> {
|
||||
if (process.env.NEXT_PHASE === "phase-production-build") {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
try {
|
||||
const mod = await import("@opennextjs/cloudflare");
|
||||
const ctx = await mod.getCloudflareContext({ async: true });
|
||||
|
||||
+16
-8
@@ -23,20 +23,28 @@ interface CloudflareEnv {
|
||||
GITHUB_REPO?: string;
|
||||
}
|
||||
|
||||
function envFromProcess(): CloudflareEnv {
|
||||
return {
|
||||
DEEPSEEK_API_KEY: process.env.DEEPSEEK_API_KEY,
|
||||
DEEPSEEK_BASE_URL: process.env.DEEPSEEK_BASE_URL,
|
||||
DEEPSEEK_MODEL: process.env.DEEPSEEK_MODEL,
|
||||
GITHUB_TOKEN: process.env.GITHUB_TOKEN,
|
||||
CRON_SECRET: process.env.CRON_SECRET,
|
||||
GITHUB_REPO: process.env.GITHUB_REPO,
|
||||
};
|
||||
}
|
||||
|
||||
export async function getEnv(): Promise<CloudflareEnv> {
|
||||
if (process.env.NEXT_PHASE === "phase-production-build") {
|
||||
return envFromProcess();
|
||||
}
|
||||
|
||||
try {
|
||||
const mod = await import("@opennextjs/cloudflare");
|
||||
const ctx = await mod.getCloudflareContext({ async: true });
|
||||
return ctx.env as CloudflareEnv;
|
||||
} catch {
|
||||
return {
|
||||
DEEPSEEK_API_KEY: process.env.DEEPSEEK_API_KEY,
|
||||
DEEPSEEK_BASE_URL: process.env.DEEPSEEK_BASE_URL,
|
||||
DEEPSEEK_MODEL: process.env.DEEPSEEK_MODEL,
|
||||
GITHUB_TOKEN: process.env.GITHUB_TOKEN,
|
||||
CRON_SECRET: process.env.CRON_SECRET,
|
||||
GITHUB_REPO: process.env.GITHUB_REPO,
|
||||
};
|
||||
return envFromProcess();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ interface GhIssue { number: number; title: string; html_url: string; body: strin
|
||||
const FALLBACK_SHIPPED: RoadmapItem[] = [
|
||||
{
|
||||
title: "v0.8.45",
|
||||
note: "Moonshot/Kimi OAuth, provider-surface sync, and current Windows install/runtime guidance",
|
||||
note: "Moonshot/Kimi provider support, API-key setup guidance, provider-surface sync, and current Windows install/runtime guidance",
|
||||
href: "https://github.com/Hmbown/CodeWhale/releases/tag/v0.8.45",
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user