feat: make chat model routing configurable

This commit is contained in:
2026-07-31 17:57:26 +08:00
parent 85a6da5949
commit ab2c945f0b
22 changed files with 567 additions and 88 deletions

View File

@@ -148,6 +148,7 @@ const modelForm = reactive({
allowSummary: 1,
allowReport: 1,
allowFixedInfo: 1,
allowSimpleKnowledge: 1,
allowDeepChat: 1,
});
@@ -311,6 +312,7 @@ function modelSceneLabel(scene: string) {
background_report: "周期报告",
background_summary: "摘要沉淀",
fixed_info: "固定信息问答",
simple_knowledge: "简单知识问答",
knowledge_grounded: "知识问答",
general_chat: "通用对话",
} as Record<string, string>)[scene] || scene || "未分类";
@@ -707,6 +709,7 @@ async function quickAddModel() {
allowSummary: 1,
allowReport: 1,
allowFixedInfo: 1,
allowSimpleKnowledge: 1,
allowDeepChat: 1,
});
ElMessage.success(`${provider.label} 模型已新增`);
@@ -814,6 +817,7 @@ function editModel(row: ModelItem) {
allowSummary: row.allowSummary ?? 1,
allowReport: row.allowReport ?? 1,
allowFixedInfo: row.allowFixedInfo ?? 1,
allowSimpleKnowledge: row.allowSimpleKnowledge ?? 1,
allowDeepChat: row.allowDeepChat ?? 1,
});
}
@@ -849,6 +853,7 @@ function resetModelForm() {
allowSummary: 1,
allowReport: 1,
allowFixedInfo: 1,
allowSimpleKnowledge: 1,
allowDeepChat: 1,
});
}
@@ -905,7 +910,7 @@ function normalizeSystemSettingValue(setting: (typeof systemSettingDefinitions)[
if (setting.type === "switch") {
return ["1", "true", "yes", "on", "启用"].includes(rawValue.toLowerCase());
}
if (setting.type === "text" || setting.type === "password") {
if (setting.type === "text" || setting.type === "password" || setting.type === "select") {
return rawValue;
}
const parsed = Number(rawValue);
@@ -1463,6 +1468,7 @@ function formatRecordDateTime(value: string, boundary: "start" | "end") {
<div>
<div class="entitlement-capabilities">
<el-checkbox v-model="modelForm.allowFixedInfo" :true-value="1" :false-value="0">固定信息</el-checkbox>
<el-checkbox v-model="modelForm.allowSimpleKnowledge" :true-value="1" :false-value="0">简单知识</el-checkbox>
<el-checkbox v-model="modelForm.allowDeepChat" :true-value="1" :false-value="0">深度对话</el-checkbox>
<el-checkbox v-model="modelForm.allowSummary" :true-value="1" :false-value="0">摘要沉淀</el-checkbox>
<el-checkbox v-model="modelForm.allowReport" :true-value="1" :false-value="0">周期报告</el-checkbox>
@@ -1491,6 +1497,7 @@ function formatRecordDateTime(value: string, boundary: "start" | "end") {
<div class="model-capability-tags">
<el-tag v-if="row.allowDeepChat === 1" size="small">深度对话</el-tag>
<el-tag v-if="row.allowFixedInfo === 1" size="small">固定信息</el-tag>
<el-tag v-if="row.allowSimpleKnowledge === 1" size="small">简单知识</el-tag>
<el-tag v-if="row.allowSummary === 1" size="small" type="success">摘要</el-tag>
<el-tag v-if="row.allowReport === 1" size="small" type="warning">报告</el-tag>
</div>
@@ -1544,6 +1551,18 @@ function formatRecordDateTime(value: string, boundary: "start" | "end") {
type="password"
show-password
/>
<el-select
v-else-if="setting.type === 'select'"
v-model="systemSettingValues[setting.key]"
:placeholder="setting.placeholder"
>
<el-option
v-for="option in setting.options || []"
:key="option.value"
:label="option.label"
:value="option.value"
/>
</el-select>
<el-switch v-else v-model="systemSettingValues[setting.key]" />
<small>{{ setting.description }}</small>
</label>