feat(settings): add background model picker with KV cache performance warning
Exposes OLLAMA_BACKGROUND_MODEL as a per-user setting in General settings, alongside the Chat Model selector. Includes an inline warning when the same model is selected for both, explaining the KV cache performance impact. All background task callers (title generation, tag suggestions, project summaries, RSS classification) now read background_model from user settings, falling back to OLLAMA_BACKGROUND_MODEL env var. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -15,6 +15,7 @@ const toastStore = useToastStore();
|
||||
const pushStore = usePushStore();
|
||||
const assistantName = ref("");
|
||||
const defaultModel = ref("");
|
||||
const backgroundModel = ref("");
|
||||
const installedModels = ref<string[]>([]);
|
||||
const defaultChatModel = ref("");
|
||||
|
||||
@@ -708,6 +709,7 @@ onMounted(async () => {
|
||||
// Load notification preferences from user settings
|
||||
const allSettings = await apiGet<Record<string, string>>("/api/settings");
|
||||
defaultModel.value = allSettings.default_model ?? "";
|
||||
backgroundModel.value = allSettings.background_model ?? "";
|
||||
chatRetentionDays.value = allSettings.chat_retention_days !== undefined
|
||||
? Number(allSettings.chat_retention_days)
|
||||
: 90;
|
||||
@@ -929,6 +931,7 @@ async function saveAssistant() {
|
||||
await store.updateSettings({
|
||||
assistant_name: assistantName.value.trim() || "Fable",
|
||||
default_model: defaultModel.value,
|
||||
background_model: backgroundModel.value,
|
||||
});
|
||||
saved.value = true;
|
||||
setTimeout(() => (saved.value = false), 2000);
|
||||
@@ -1437,6 +1440,20 @@ function formatUserDate(iso: string): string {
|
||||
</select>
|
||||
<p class="field-hint">Model used for new conversations.</p>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="background-model">Background Model</label>
|
||||
<select id="background-model" v-model="backgroundModel" class="input">
|
||||
<option value="">Default (qwen2.5:0.5b)</option>
|
||||
<option v-for="m in installedModels" :key="m" :value="m">{{ m }}</option>
|
||||
</select>
|
||||
<p class="field-hint">
|
||||
Model used for background tasks: title generation, tag suggestions, project summaries, and RSS classification.
|
||||
Using a small dedicated model (e.g. qwen2.5:0.5b) keeps the chat model's KV cache warm between messages, significantly reducing response time.
|
||||
<span v-if="backgroundModel && backgroundModel === (defaultModel || defaultChatModel)" class="field-hint-warn">
|
||||
⚠ Setting this to the same model as Chat Model will wipe the KV cache after every background task, increasing response latency.
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<button class="btn-save" @click="saveAssistant" :disabled="saving">
|
||||
@@ -3078,6 +3095,11 @@ FABLE_API_KEY=<your-api-key></pre>
|
||||
font-size: 0.78rem;
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
.field-hint-warn {
|
||||
display: block;
|
||||
margin-top: 0.3rem;
|
||||
color: #f59e0b;
|
||||
}
|
||||
.actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
Reference in New Issue
Block a user