mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-08 18:35:35 +08:00
refactor: remove legacy compatibility configuration and UI components
This commit is contained in:
@@ -1,34 +0,0 @@
|
||||
import { ShieldAlert } from 'lucide-react'
|
||||
|
||||
export default function CompatibilitySection({ t, form, setForm }) {
|
||||
return (
|
||||
<div className="bg-card border border-border rounded-xl p-5 space-y-4">
|
||||
<div className="flex items-center gap-2">
|
||||
<ShieldAlert className="w-4 h-4 text-muted-foreground" />
|
||||
<h3 className="font-semibold">{t('settings.compatibilityTitle')}</h3>
|
||||
</div>
|
||||
<p className="text-sm text-muted-foreground">{t('settings.compatibilityDesc')}</p>
|
||||
<div className="flex items-center justify-between gap-4">
|
||||
<label className="text-sm font-medium">{t('settings.stripReferenceMarkers')}</label>
|
||||
<button
|
||||
type="button"
|
||||
role="switch"
|
||||
aria-checked={form.compat?.strip_reference_markers ?? true}
|
||||
onClick={() => setForm((prev) => ({
|
||||
...prev,
|
||||
compat: { ...prev.compat, strip_reference_markers: !Boolean(prev.compat?.strip_reference_markers ?? true) },
|
||||
}))}
|
||||
className={`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${
|
||||
form.compat?.strip_reference_markers ?? true ? 'bg-primary' : 'bg-muted'
|
||||
}`}
|
||||
>
|
||||
<span
|
||||
className={`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${
|
||||
form.compat?.strip_reference_markers ?? true ? 'translate-x-6' : 'translate-x-1'
|
||||
}`}
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -6,7 +6,6 @@ import SecuritySection from './SecuritySection'
|
||||
import RuntimeSection from './RuntimeSection'
|
||||
import BehaviorSection from './BehaviorSection'
|
||||
import CurrentInputFileSection from './CurrentInputFileSection'
|
||||
import CompatibilitySection from './CompatibilitySection'
|
||||
import AutoDeleteSection from './AutoDeleteSection'
|
||||
import ModelSection from './ModelSection'
|
||||
import BackupSection from './BackupSection'
|
||||
@@ -98,8 +97,6 @@ export default function SettingsContainer({ onRefresh, onMessage, authFetch, onF
|
||||
|
||||
<CurrentInputFileSection t={t} form={form} setForm={setForm} />
|
||||
|
||||
<CompatibilitySection t={t} form={form} setForm={setForm} />
|
||||
|
||||
<AutoDeleteSection t={t} form={form} setForm={setForm} />
|
||||
|
||||
<ModelSection t={t} form={form} setForm={setForm} />
|
||||
|
||||
@@ -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 },
|
||||
compat: { strip_reference_markers: true },
|
||||
responses: { store_ttl_seconds: 900 },
|
||||
embeddings: { provider: '' },
|
||||
auto_delete: { mode: 'none' },
|
||||
@@ -60,9 +59,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),
|
||||
},
|
||||
compat: {
|
||||
strip_reference_markers: data.compat?.strip_reference_markers ?? true,
|
||||
},
|
||||
responses: {
|
||||
store_ttl_seconds: Number(data.responses?.store_ttl_seconds || 900),
|
||||
},
|
||||
@@ -95,9 +91,6 @@ function toServerPayload(form) {
|
||||
global_max_inflight: Number(form.runtime.global_max_inflight),
|
||||
token_refresh_interval_hours: Number(form.runtime.token_refresh_interval_hours),
|
||||
},
|
||||
compat: {
|
||||
strip_reference_markers: Boolean(form.compat?.strip_reference_markers ?? true),
|
||||
},
|
||||
responses: { store_ttl_seconds: Number(form.responses.store_ttl_seconds) },
|
||||
embeddings: { provider: String(form.embeddings.provider || '').trim() },
|
||||
auto_delete: { mode: normalizeAutoDeleteMode(form.auto_delete) },
|
||||
|
||||
@@ -397,9 +397,6 @@
|
||||
"currentInputFileDesc": "Enabled by default. Once the character threshold is reached, upload the full context as a DS2API_HISTORY.txt context file.",
|
||||
"currentInputFileMinChars": "Current input threshold (characters)",
|
||||
"currentInputFileHelp": "Default is 0, which uses independent split for any non-empty input.",
|
||||
"compatibilityTitle": "Compatibility",
|
||||
"compatibilityDesc": "Compatibility controls that keep stream output closer to the wire format or safer for the web UI.",
|
||||
"stripReferenceMarkers": "Strip [reference:N] markers",
|
||||
"modelTitle": "Model mapping",
|
||||
"modelAliases": "Global model aliases (JSON)",
|
||||
"autoDeleteTitle": "Session Cleanup Policy",
|
||||
@@ -485,4 +482,4 @@
|
||||
"four": "Trigger a redeploy to apply the updated environment variables."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -397,9 +397,6 @@
|
||||
"currentInputFileDesc": "默认开启。达到字符阈值后,将完整上下文上传为 DS2API_HISTORY.txt 上下文文件。",
|
||||
"currentInputFileMinChars": "当前输入阈值(字符数)",
|
||||
"currentInputFileHelp": "默认 0,表示只要有输入就会使用独立拆分。",
|
||||
"compatibilityTitle": "兼容性设置",
|
||||
"compatibilityDesc": "用于控制输出格式兼容性,避免把模型原始流里的标记直接暴露到前端。",
|
||||
"stripReferenceMarkers": "移除 [reference:N] 标记",
|
||||
"modelTitle": "模型映射",
|
||||
"modelAliases": "全局模型映射(JSON)",
|
||||
"autoDeleteTitle": "会话删除策略",
|
||||
@@ -485,4 +482,4 @@
|
||||
"four": "触发重新部署以应用新的环境变量。"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user