dba0245cb1
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>
22 lines
533 B
TypeScript
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;
|
|
}
|