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>
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user