Add reasoning effort
This commit is contained in:
@@ -15,6 +15,7 @@ import { WakeLock } from './wakelock.js';
|
||||
const STREAM_ENDPOINT = '/v1/chat/voice/stream';
|
||||
const SYSTEM_MESSAGE_KEY = 'odidere_system_message';
|
||||
const MAX_TURNS_KEY = 'odidere_max_turns';
|
||||
const REASONING_BUDGET_KEY = 'odidere_reasoning_budget';
|
||||
const MUTE_KEY = 'odidere_mute';
|
||||
const ICONS_URL = '/static/icons.svg';
|
||||
|
||||
@@ -111,6 +112,9 @@ class Odidere {
|
||||
'compose-settings-close',
|
||||
);
|
||||
this.$maxTurnsInput = document.getElementById('max-turns-input');
|
||||
this.$reasoningBudgetInput = document.getElementById(
|
||||
'reasoning-budget-input',
|
||||
);
|
||||
this.$compose = document.querySelector('.compose');
|
||||
|
||||
this.init();
|
||||
@@ -268,9 +272,6 @@ class Odidere {
|
||||
if (e.target === this.$composeSettingsOverlay)
|
||||
this._closeComposeSettings();
|
||||
});
|
||||
this.$maxTurnsInput.addEventListener('input', () => {
|
||||
this._setMaxTurns(this.$maxTurnsInput.value);
|
||||
});
|
||||
|
||||
// --- Model/voice change persistence ---
|
||||
this.settings.$model.addEventListener('change', () =>
|
||||
@@ -640,6 +641,11 @@ class Odidere {
|
||||
payload.max_iterations = maxTurns;
|
||||
}
|
||||
|
||||
const reasoningBudget = this._getReasoningBudget();
|
||||
if (reasoningBudget !== null) {
|
||||
payload.thinking_budget_tokens = reasoningBudget;
|
||||
}
|
||||
|
||||
// Clear attachments and location after building payload.
|
||||
this.clearAttachments();
|
||||
this.clearLocation();
|
||||
@@ -1170,11 +1176,14 @@ class Odidere {
|
||||
|
||||
_openComposeSettings() {
|
||||
this.$maxTurnsInput.value = this._getMaxTurns();
|
||||
this.$reasoningBudgetInput.value = this._getReasoningBudget() ?? -1;
|
||||
this.$composeSettingsOverlay.classList.add('open');
|
||||
this.$composeSettingsClose.focus();
|
||||
}
|
||||
|
||||
_closeComposeSettings() {
|
||||
this._setMaxTurns(this.$maxTurnsInput.value);
|
||||
this._setReasoningBudget(this.$reasoningBudgetInput.value);
|
||||
this.$composeSettingsOverlay.classList.remove('open');
|
||||
this.$composeSettings.focus();
|
||||
}
|
||||
@@ -1188,6 +1197,16 @@ class Odidere {
|
||||
localStorage.setItem(MAX_TURNS_KEY, String(value));
|
||||
}
|
||||
|
||||
_getReasoningBudget() {
|
||||
const stored = localStorage.getItem(REASONING_BUDGET_KEY);
|
||||
if (stored === null) return null;
|
||||
return Number(stored);
|
||||
}
|
||||
|
||||
_setReasoningBudget(value) {
|
||||
localStorage.setItem(REASONING_BUDGET_KEY, String(value));
|
||||
}
|
||||
|
||||
// ====================
|
||||
// TWO-PRESS SAFETY PATTERNS
|
||||
// ====================
|
||||
|
||||
Reference in New Issue
Block a user