diff --git a/internal/loki/ui/index.html b/internal/loki/ui/index.html index c6e99da..8a26934 100644 --- a/internal/loki/ui/index.html +++ b/internal/loki/ui/index.html @@ -5279,6 +5279,21 @@ function closeModal(){ hideModal('modal'); document.getElementById('modal').clas async function saveItem(){ const K = KINDS[editingKind]; const name = document.getElementById('m-name').value.trim(); + // Interrupteur « Raisonnement » : on matérialise son état dans le preset AVANT + // de lire le contenu. onchange ne part que sur une interaction : un switch + // laissé sur off à la création n'écrivait donc jamais REASONING=, et la clé + // ABSENTE laisse le moteur raisonner malgré l'interrupteur affiché sur off + // (amont, issue #46). Décoché → REASONING=off explicite. Coché → on, sauf si + // une valeur active plus précise (auto/deepseek) est déjà là : on la garde. + if(editingKind==='preset'){ + const rsw = document.getElementById('s-reasoning'); + if(rsw){ + const cur = cfgReadKey('REASONING'); + const active = /^(on|1|true|auto|deepseek)$/i.test(cur); + if(!rsw.checked){ if(!/^off$/i.test(cur)) cfgWriteKey('REASONING', 'off'); } + else if(!active){ cfgWriteKey('REASONING', 'on'); } + } + } const content = document.getElementById('m-content').value; if(!name){ toast('nom requis'); return; } // Presets: keyed by id (filename); duplicate display names are allowed. diff --git a/internal/loki/ui/src/js/07-models.js b/internal/loki/ui/src/js/07-models.js index 06adb7a..983b530 100644 --- a/internal/loki/ui/src/js/07-models.js +++ b/internal/loki/ui/src/js/07-models.js @@ -827,6 +827,21 @@ function closeModal(){ hideModal('modal'); document.getElementById('modal').clas async function saveItem(){ const K = KINDS[editingKind]; const name = document.getElementById('m-name').value.trim(); + // Interrupteur « Raisonnement » : on matérialise son état dans le preset AVANT + // de lire le contenu. onchange ne part que sur une interaction : un switch + // laissé sur off à la création n'écrivait donc jamais REASONING=, et la clé + // ABSENTE laisse le moteur raisonner malgré l'interrupteur affiché sur off + // (amont, issue #46). Décoché → REASONING=off explicite. Coché → on, sauf si + // une valeur active plus précise (auto/deepseek) est déjà là : on la garde. + if(editingKind==='preset'){ + const rsw = document.getElementById('s-reasoning'); + if(rsw){ + const cur = cfgReadKey('REASONING'); + const active = /^(on|1|true|auto|deepseek)$/i.test(cur); + if(!rsw.checked){ if(!/^off$/i.test(cur)) cfgWriteKey('REASONING', 'off'); } + else if(!active){ cfgWriteKey('REASONING', 'on'); } + } + } const content = document.getElementById('m-content').value; if(!name){ toast('nom requis'); return; } // Presets: keyed by id (filename); duplicate display names are allowed.