fix: prefer the focused frame, bound model length, drop dead flag

This commit is contained in:
golem
2026-08-01 23:15:46 -06:00
parent d7821e3dc7
commit 51bf4d5c01
6 changed files with 37 additions and 13 deletions
+1 -1
View File
@@ -9,7 +9,7 @@
<form id="settings" autocomplete="off">
<div class="field">
<label for="model">Model <span class="tag">experimental</span></label>
<input type="text" id="model" placeholder="auto" spellcheck="false" />
<input type="text" id="model" placeholder="auto" spellcheck="false" maxlength="200" />
<p class="hint">
ChatGPT may ignore this and use your account default. Leave blank to
always use your account default.
-8
View File
@@ -8,12 +8,8 @@ const field = (id) => document.getElementById(id);
let saveTimer = null;
let statusTimer = null;
// Suppresses the change/input handlers while we are programmatically writing
// values into the form, so a remote sync cannot trigger a save loop.
let applying = false;
function render(settings) {
applying = true;
for (const [id, value] of Object.entries(settings)) {
const element = field(id);
// Never overwrite the control the user is actively editing — this page's
@@ -27,7 +23,6 @@ function render(settings) {
element.value = value;
}
}
applying = false;
}
function collect() {
@@ -60,9 +55,6 @@ async function persist(settings) {
// Debounced so typing in a text field cannot approach any write-rate quota.
function scheduleSave() {
if (applying) {
return;
}
clearTimeout(saveTimer);
saveTimer = setTimeout(() => persist(collect()), SAVE_DEBOUNCE_MS);
}