mirror of
https://git.zavage.net/Zavage-Software/search-with-chatgpt-powered-by-openai-extension.git
synced 2026-08-31 22:20:47 -06:00
fix: prefer the focused frame, bound model length, drop dead flag
This commit is contained in:
@@ -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,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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user