增加不同上下文模式

This commit is contained in:
CJACK
2026-04-26 14:21:15 +08:00
parent c09a4b51a5
commit 22e951b4c4
23 changed files with 129 additions and 14 deletions

View File

@@ -46,6 +46,23 @@ export default function BehaviorSection({ t, form, setForm }) {
<span className="text-xs text-muted-foreground block">{t('settings.thinkingInjectionDesc')}</span>
</div>
</label>
<label className="text-sm space-y-2 md:col-span-2">
<span className="text-muted-foreground">{t('settings.thinkingInjectionPrompt')}</span>
<textarea
rows={5}
value={form.thinking_injection?.prompt || ''}
placeholder={form.thinking_injection?.default_prompt || ''}
onChange={(e) => setForm((prev) => ({
...prev,
thinking_injection: {
...prev.thinking_injection,
prompt: e.target.value,
},
}))}
className="w-full bg-background border border-border rounded-lg px-3 py-2 resize-y min-h-32"
/>
<p className="text-xs text-muted-foreground">{t('settings.thinkingInjectionPromptHelp')}</p>
</label>
</div>
</div>
)

View File

@@ -19,7 +19,7 @@ const DEFAULT_FORM = {
auto_delete: { mode: 'none' },
history_split: { enabled: false, trigger_after_turns: 1 },
current_input_file: { enabled: true, min_chars: 0 },
thinking_injection: { enabled: true },
thinking_injection: { enabled: true, prompt: '', default_prompt: '' },
model_aliases_text: '{}',
}
@@ -84,6 +84,8 @@ function fromServerForm(data) {
},
thinking_injection: {
enabled: data.thinking_injection?.enabled ?? true,
prompt: data.thinking_injection?.prompt || '',
default_prompt: data.thinking_injection?.default_prompt || '',
},
model_aliases_text: JSON.stringify(data.model_aliases || {}, null, 2),
}
@@ -116,6 +118,7 @@ function toServerPayload(form) {
},
thinking_injection: {
enabled: Boolean(form.thinking_injection?.enabled ?? true),
prompt: String(form.thinking_injection?.prompt || '').trim(),
},
}
}

View File

@@ -375,6 +375,8 @@
"embeddingsProvider": "Embeddings provider",
"thinkingInjectionEnabled": "Thinking format injection",
"thinkingInjectionDesc": "Append a structured <think> checklist to the latest user message before prompt assembly.",
"thinkingInjectionPrompt": "Thinking format prompt",
"thinkingInjectionPromptHelp": "Leave empty to use the built-in default prompt shown as the input placeholder.",
"historySplitTitle": "Context Split",
"historySplitDesc": "Choose one context-splitting mode to avoid inlining very long prompts.",
"historySplitEnabled": "Turn split (second turn by default)",

View File

@@ -375,6 +375,8 @@
"embeddingsProvider": "Embeddings Provider",
"thinkingInjectionEnabled": "思考格式注入",
"thinkingInjectionDesc": "在组装 prompt 前,将结构化 <think> 检查清单追加到最新用户消息末尾。",
"thinkingInjectionPrompt": "思考格式提示词",
"thinkingInjectionPromptHelp": "留空时使用内置默认提示词;默认内容会显示在输入框占位文本中。",
"historySplitTitle": "上下文拆分",
"historySplitDesc": "选择一种上下文拆分方式,减少超长 prompt 直接内联。",
"historySplitEnabled": "轮次拆分(默认第二轮)",