add response versioning support in messages for regeneration improvements

This commit is contained in:
2026-09-22 14:48:13 +02:00
parent 7602692341
commit 72e429b1b3
15 changed files with 591 additions and 86 deletions
+4 -3
View File
@@ -217,9 +217,10 @@ test("chat search integrates with streaming, persistence, personas, settings, re
const botId = messages.at(-1).id;
const retry = await api(`/chats/${chatId}/messages/${botId}/retry`, {});
assert.equal(retry.status, 200);
assert.deepEqual(retry.body.message.sources, [source]);
assert.deepEqual(retry.body.message.sources, []);
await api(`/chats/${chatId}/messages/${botId}/versions/0`, {});
assert.equal(searchCount, 1);
assert.ok(calls.at(-1).messages.some((message) => message.content.includes(source.snippet)));
assert.ok(!calls.at(-1).messages.some((message) => message.content.includes(source.snippet)));
const branch = await api(`/chats/${chatId}/messages/${botId}/branch`, {confirmed: true});
assert.deepEqual(branch.body.messages.at(-1).sources, [source]);
const exported = (await api(`/exports/chats/${chatId}?format=json`)).body;
@@ -228,7 +229,7 @@ test("chat search integrates with streaming, persistence, personas, settings, re
const imported = await api("/imports/workspace", {workspace, allowDuplicates: true});
assert.equal(imported.status, 200);
const allMessages = app.locals.db.prepare("SELECT sources FROM chat_messages WHERE sources IS NOT NULL").all();
assert.ok(allMessages.length >= 6);
assert.ok(allMessages.length >= 4);
for (const message of allMessages) assert.deepEqual(JSON.parse(message.sources), [source]);
emptySearch = true;