mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-09 02:45:29 +08:00
refactor: remove configurable toolcall policy and fix to feature matching with high-confidence early emit
This commit is contained in:
@@ -3,35 +3,6 @@ export default function BehaviorSection({ t, form, setForm }) {
|
||||
<div className="bg-card border border-border rounded-xl p-5 space-y-4">
|
||||
<h3 className="font-semibold">{t('settings.behaviorTitle')}</h3>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<label className="text-sm space-y-2">
|
||||
<span className="text-muted-foreground">{t('settings.toolcallMode')}</span>
|
||||
<select
|
||||
value={form.toolcall.mode}
|
||||
onChange={(e) => setForm((prev) => ({
|
||||
...prev,
|
||||
toolcall: { ...prev.toolcall, mode: e.target.value },
|
||||
}))}
|
||||
className="w-full bg-background border border-border rounded-lg px-3 py-2"
|
||||
>
|
||||
<option value="feature_match">feature_match</option>
|
||||
<option value="off">off</option>
|
||||
</select>
|
||||
</label>
|
||||
<label className="text-sm space-y-2">
|
||||
<span className="text-muted-foreground">{t('settings.earlyEmitConfidence')}</span>
|
||||
<select
|
||||
value={form.toolcall.early_emit_confidence}
|
||||
onChange={(e) => setForm((prev) => ({
|
||||
...prev,
|
||||
toolcall: { ...prev.toolcall, early_emit_confidence: e.target.value },
|
||||
}))}
|
||||
className="w-full bg-background border border-border rounded-lg px-3 py-2"
|
||||
>
|
||||
<option value="high">high</option>
|
||||
<option value="low">low</option>
|
||||
<option value="off">off</option>
|
||||
</select>
|
||||
</label>
|
||||
<label className="text-sm space-y-2">
|
||||
<span className="text-muted-foreground">{t('settings.responsesTTL')}</span>
|
||||
<input
|
||||
|
||||
@@ -13,7 +13,6 @@ const MAX_AUTO_FETCH_FAILURES = 3
|
||||
const DEFAULT_FORM = {
|
||||
admin: { jwt_expire_hours: 24 },
|
||||
runtime: { account_max_inflight: 2, account_max_queue: 10, global_max_inflight: 10, token_refresh_interval_hours: 6 },
|
||||
toolcall: { mode: 'feature_match', early_emit_confidence: 'high' },
|
||||
responses: { store_ttl_seconds: 900 },
|
||||
embeddings: { provider: '' },
|
||||
auto_delete: { sessions: false },
|
||||
@@ -47,10 +46,6 @@ function fromServerForm(data) {
|
||||
global_max_inflight: Number(data.runtime?.global_max_inflight || 10),
|
||||
token_refresh_interval_hours: Number(data.runtime?.token_refresh_interval_hours || 6),
|
||||
},
|
||||
toolcall: {
|
||||
mode: data.toolcall?.mode || 'feature_match',
|
||||
early_emit_confidence: data.toolcall?.early_emit_confidence || 'high',
|
||||
},
|
||||
responses: {
|
||||
store_ttl_seconds: Number(data.responses?.store_ttl_seconds || 900),
|
||||
},
|
||||
@@ -74,10 +69,6 @@ function toServerPayload(form) {
|
||||
global_max_inflight: Number(form.runtime.global_max_inflight),
|
||||
token_refresh_interval_hours: Number(form.runtime.token_refresh_interval_hours),
|
||||
},
|
||||
toolcall: {
|
||||
mode: String(form.toolcall.mode || '').trim(),
|
||||
early_emit_confidence: String(form.toolcall.early_emit_confidence || '').trim(),
|
||||
},
|
||||
responses: { store_ttl_seconds: Number(form.responses.store_ttl_seconds) },
|
||||
embeddings: { provider: String(form.embeddings.provider || '').trim() },
|
||||
auto_delete: { sessions: Boolean(form.auto_delete?.sessions) },
|
||||
|
||||
@@ -228,8 +228,6 @@
|
||||
"globalMaxInflight": "Global max inflight",
|
||||
"tokenRefreshIntervalHours": "Managed token refresh interval (hours)",
|
||||
"behaviorTitle": "Behavior",
|
||||
"toolcallMode": "Toolcall mode",
|
||||
"earlyEmitConfidence": "Early emit confidence",
|
||||
"responsesTTL": "Responses store TTL (seconds)",
|
||||
"embeddingsProvider": "Embeddings provider",
|
||||
"modelTitle": "Model mapping",
|
||||
|
||||
@@ -228,8 +228,6 @@
|
||||
"globalMaxInflight": "全局并发上限",
|
||||
"tokenRefreshIntervalHours": "托管账号 Token 刷新间隔(小时)",
|
||||
"behaviorTitle": "行为设置",
|
||||
"toolcallMode": "Toolcall 模式",
|
||||
"earlyEmitConfidence": "早发置信度",
|
||||
"responsesTTL": "Responses 缓存 TTL(秒)",
|
||||
"embeddingsProvider": "Embeddings Provider",
|
||||
"modelTitle": "模型映射",
|
||||
|
||||
Reference in New Issue
Block a user