feat(admin): configure model providers from database

This commit is contained in:
Jesse_Chen
2026-08-07 20:03:20 +08:00
parent d63f10dcc2
commit 3089316d2e
31 changed files with 871 additions and 1430 deletions
+11 -4
View File
@@ -6,7 +6,6 @@ import {
getJyotishAgent,
runConsultationWorkflow,
} from "@/mastra";
import { languageModelConfigurationMessage } from "@/mastra/model";
import { blocksPromptExtraction } from "@/lib/consult-safety";
import {
consultationEntrypointSchema,
@@ -148,6 +147,16 @@ export async function POST(request: Request) {
chatSession.model_config_version,
);
if (!sessionModel) {
return NextResponse.json(
{
error: "模型暂不可用",
message: "当前会话绑定的数据库模型配置不可用,请联系管理员,本次不会扣点。",
},
{ status: 503 },
);
}
if (parsed.data.entrypoint === "birth_time_rectification") {
return NextResponse.json(
{
@@ -406,9 +415,7 @@ export async function POST(request: Request) {
{
error: "暂时无法生成解读",
message: "咨询服务暂时不可用,请稍后再试。",
recovery: languageModelConfigurationMessage()
? "当前没有可用的咨询模型,请联系管理员。"
: "稍后重试,或换一个模型继续。",
recovery: "稍后重试,或换一个模型继续。",
},
{ status: 503 },
);