Enable automatic web search by default; improve toggle behavior and search planning.
CI / check (22) (push) Successful in 9m35s
CI / check (24) (push) Successful in 9m34s

This commit is contained in:
2026-10-06 08:50:03 +02:00
parent 674abf78f6
commit 7be654af11
17 changed files with 300 additions and 54 deletions
+3 -7
View File
@@ -6,14 +6,10 @@
/** @typedef {{role: string, content: string, thinking?: string, sources?: WebSource[]}} ChatMessage */
export function createWebSearchToggle(button) {
let enabled = false;
const reset = () => {
enabled = false;
render();
};
let enabled = true;
const render = () => {
button.setAttribute("aria-pressed", String(enabled));
button.title = enabled ? "Web search enabled" : "Search the web";
button.title = enabled ? "Automatic web search on — click to disable" : "Web search off — click to enable";
button.setAttribute("aria-label", button.title);
};
button.addEventListener("click", () => {
@@ -21,7 +17,7 @@ export function createWebSearchToggle(button) {
render();
});
render();
return {get enabled() { return enabled; }, reset};
return {get enabled() { return enabled; }};
}
/** @param {HTMLElement} container @param {WebSource[] | undefined} sources */