feat: 提升并发容量默认配置

This commit is contained in:
2026-08-03 17:42:17 +08:00
parent 8ee4d65b7b
commit 8e6da99dcb
6 changed files with 130 additions and 9 deletions

View File

@@ -1067,6 +1067,12 @@ async function clearFeishuCache() {
v-model="systemSettingValues[setting.key]"
/>
<small>{{ setting.description }}</small>
<small
v-if="setting.valueHint"
class="setting-value-hint"
>
{{ setting.valueHint(systemSettingValues[setting.key]) }}
</small>
</label>
</div>
</div>

View File

@@ -16,6 +16,7 @@ export interface SystemSettingDefinition {
placeholder?: string;
options?: SystemSettingOption[];
description: string;
valueHint?: (value: SystemSettingValue) => string;
}
export interface SystemSettingSection {
@@ -181,28 +182,29 @@ export const systemSettingSections: SystemSettingSection[] = [
key: "chat_max_active_requests",
label: "问答最大并发数",
type: "number",
defaultValue: 2,
defaultValue: 30,
min: 1,
max: 1000,
description: "同一后端进程内同时进入飞书和模型生成链路的最大请求数。",
description: "用户正式问答的全局执行上限Redis 可用时由所有后端实例共享,超过后进入排队。",
valueHint: concurrentCapacityHint,
},
{
key: "chat_max_queue_size",
label: "问答最大排队数",
type: "number",
defaultValue: 20,
defaultValue: 90,
min: 0,
max: 10000,
description: "超过最大并发后允许等待的请求数量,超过后直接提示稍后再试。",
description: "超过最大并发后允许等待的请求数量。默认按并发数的 3 倍预留,避免课程结束后的集中提问被直接拒绝。",
},
{
key: "chat_queue_timeout_seconds",
label: "问答排队超时(秒)",
type: "number",
defaultValue: 60,
defaultValue: 90,
min: 1,
max: 3600,
description: "请求在排队中超过该时间后自动结束并提示用户稍后再试。",
description: "请求在排队中超过该时间后自动结束。默认 90 秒可覆盖 30 并发下约三轮请求释放。",
},
{
key: "chat_active_lease_seconds",
@@ -292,4 +294,16 @@ export const systemSettingSections: SystemSettingSection[] = [
},
];
function concurrentCapacityHint(value: SystemSettingValue) {
const concurrency = Math.max(1, Number(value) || 1);
const lower = roundDownToTen((concurrency * 120) / 25 / 1.4);
const upper = roundDownToTen((concurrency * 120) / 25 / 1.2);
const capacity = lower === upper ? `${lower}` : `${lower}${upper}`;
return `容量估算:按单次问答约 25 秒并预留 20%40% 波动,当前 ${concurrency} 并发可承接 2 分钟内${capacity}集中提问。实际能力还受模型服务商额度和回答时长影响。`;
}
function roundDownToTen(value: number) {
return Math.max(1, Math.floor(value / 10) * 10);
}
export const systemSettingDefinitions = systemSettingSections.flatMap((section) => section.settings);

View File

@@ -1725,6 +1725,14 @@ textarea {
line-height: 1.5;
}
.setting-field > .setting-value-hint {
padding: 9px 11px;
border: 1px solid #cde6dc;
border-radius: 8px;
background: #f3faf7;
color: #246b52;
}
.setting-field .el-input-number,
.setting-field .el-input,
.setting-field .el-select {