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
+6 -3
View File
@@ -22,7 +22,10 @@ async function fixture(t) {
});
await new Promise(resolve => search.listen(0, "127.0.0.1", resolve));
const modelService = {
async generateReply() { return `Original ${++sequence}`; },
async generateReply(_model, _messages, options) {
if (options.format?.properties?.search) return '{"search":false,"query":""}';
return `Original ${++sequence}`;
},
async streamReply(model, messages, chunk, options) {
calls.push({model, messages, options});
if (options.reasoning) options.onThinking("New reasoning", "New reasoning");
@@ -59,7 +62,7 @@ async function fixture(t) {
};
await api("/register", {username: "regenerator", password: "test-password"});
const chatId = (await (await api("/chats", {title: "Versions"})).json()).chat.id;
await api("/chat", {chatId, message: "Search the web for the latest satellite launch news today"});
await api("/chat", {chatId, message: "Search the web for the latest satellite launch news today", webSearch: false});
await api("/chat", {chatId, message: "Later private question"});
const messages = (await (await api(`/chats/${chatId}/messages`)).json()).messages;
const bot = messages[1];
@@ -122,7 +125,7 @@ test("regeneration streams before commit in the same message; versions retain so
assert.equal((await s.history())[1].content, "Edited original");
assert.equal((await s.api(`${s.path}/versions/99`, {})).status, 400);
s.setMode("success");
const third = await (await s.api(`${s.path}/retry/stream`, {})).text();
const third = await (await s.api(`${s.path}/retry/stream`, {webSearch: false})).text();
assert.match(third, /event: done/);
const thirdMessage = (await s.history())[1];
assert.equal(thirdMessage.versionCount, 3);