feat(admin): configure model providers from database
This commit is contained in:
@@ -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 },
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user