mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-21 08:27:42 +08:00
refactor: replace history_split with current_input_file configuration
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -17,7 +17,6 @@ const DEFAULT_FORM = {
|
||||
responses: { store_ttl_seconds: 900 },
|
||||
embeddings: { provider: '' },
|
||||
auto_delete: { mode: 'none' },
|
||||
history_split: { enabled: false, trigger_after_turns: 1 },
|
||||
current_input_file: { enabled: true, min_chars: 0 },
|
||||
thinking_injection: { enabled: true, prompt: '', default_prompt: '' },
|
||||
model_aliases_text: '{}',
|
||||
@@ -52,8 +51,7 @@ function normalizeAutoDeleteMode(raw) {
|
||||
}
|
||||
|
||||
function fromServerForm(data) {
|
||||
const historySplitEnabled = Boolean(data.history_split?.enabled)
|
||||
const currentInputFileEnabled = historySplitEnabled ? false : (data.current_input_file?.enabled ?? true)
|
||||
const currentInputFileEnabled = data.current_input_file?.enabled ?? true
|
||||
return {
|
||||
admin: { jwt_expire_hours: Number(data.admin?.jwt_expire_hours || 24) },
|
||||
runtime: {
|
||||
@@ -74,10 +72,6 @@ function fromServerForm(data) {
|
||||
auto_delete: {
|
||||
mode: normalizeAutoDeleteMode(data.auto_delete),
|
||||
},
|
||||
history_split: {
|
||||
enabled: historySplitEnabled,
|
||||
trigger_after_turns: Number(data.history_split?.trigger_after_turns || 1),
|
||||
},
|
||||
current_input_file: {
|
||||
enabled: currentInputFileEnabled,
|
||||
min_chars: Number(data.current_input_file?.min_chars ?? 0),
|
||||
@@ -92,8 +86,7 @@ function fromServerForm(data) {
|
||||
}
|
||||
|
||||
function toServerPayload(form) {
|
||||
const historySplitEnabled = Boolean(form.history_split?.enabled)
|
||||
const currentInputFileEnabled = historySplitEnabled ? false : Boolean(form.current_input_file?.enabled)
|
||||
const currentInputFileEnabled = Boolean(form.current_input_file?.enabled)
|
||||
return {
|
||||
admin: { jwt_expire_hours: Number(form.admin.jwt_expire_hours) },
|
||||
runtime: {
|
||||
@@ -108,10 +101,6 @@ function toServerPayload(form) {
|
||||
responses: { store_ttl_seconds: Number(form.responses.store_ttl_seconds) },
|
||||
embeddings: { provider: String(form.embeddings.provider || '').trim() },
|
||||
auto_delete: { mode: normalizeAutoDeleteMode(form.auto_delete) },
|
||||
history_split: {
|
||||
enabled: historySplitEnabled,
|
||||
trigger_after_turns: Number(form.history_split?.trigger_after_turns || 1),
|
||||
},
|
||||
current_input_file: {
|
||||
enabled: currentInputFileEnabled,
|
||||
min_chars: Number(form.current_input_file?.min_chars ?? 0),
|
||||
|
||||
Reference in New Issue
Block a user