Files
zhimingge/lib/ai/config.ts
T
dekun dba0245cb1 Replace RSC streaming with /api/ai Route Handler for Docker reliability.
Server Actions + createStreamableValue kept failing in production; fetch-based text stream avoids RSC serialization issues and shows readable error messages.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-10 22:39:09 +08:00

22 lines
533 B
TypeScript

export function getOpenAiBaseUrl(): string {
return (
process.env.OPENAI_BASE_URL ??
process.env.OPENAI_API_BASE ??
"https://op.bz121.com/v1"
);
}
export function getOpenAiModel(): string {
return process.env.OPENAI_MODEL ?? "huihui_ai/gemma-4-abliterated:e4b";
}
export function getOpenAiApiKey(): string {
const apiKey = process.env.OPENAI_API_KEY?.trim();
if (!apiKey) {
throw new Error(
"未配置 OPENAI_API_KEY,请在 .env.local 或 Docker env_file 中设置",
);
}
return apiKey;
}