Spaces:
Running
Running
Sync from felladrin/MiniSearch@190c476
Browse files
changelog.md
CHANGED
|
@@ -2,8 +2,13 @@
|
|
| 2 |
|
| 3 |
Notable changes, grouped by date, most recent first.
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
## 2026-11-26
|
| 6 |
|
|
|
|
| 7 |
- A search's saved images no longer lose the first search's or a follow-up's images when you leave the search before both arrive. Whichever image search finished last replaced the other's images in history, so restoring that search later showed only one set. Images that arrive after you left a search are now added to the ones it already saved.
|
| 8 |
- A follow-up answer no longer disappears when the same search is restored from history while that answer is still coming. If the answer arrived while the restore was reading the saved chat, the restore put back the older list without it, and the next message sent then removed it from history too. The question being answered also vanished from the chat until its answer arrived. Restoring the search already on screen now leaves a chat that is still answering as it is; restoring any other search still shows that search's saved chat.
|
| 9 |
- A follow-up question no longer disappears when "AI response" is turned off and back on while it is still being answered. Turning the setting off stopped the follow-up and saved the question with "The answer was interrupted.", but the chat shown after turning it back on was rebuilt without it, and the next message sent from that chat then removed it from history too. The question and its note now stay, on screen and in history.
|
|
|
|
| 2 |
|
| 3 |
Notable changes, grouped by date, most recent first.
|
| 4 |
|
| 5 |
+
## 2026-11-27
|
| 6 |
+
|
| 7 |
+
- Restoring another search from history while a follow-up is being answered now stops that follow-up. The old chat stayed on screen under the restored search, so sending was blocked until the old answer ended, and that answer was built from the restored search's results and then suggested a question about the old search. The follow-up is now cancelled when the restore switches searches: its question is saved under its own search with "The answer was interrupted.", and the restored chat can be used at once.
|
| 8 |
+
|
| 9 |
## 2026-11-26
|
| 10 |
|
| 11 |
+
- Restoring the search already on screen while a follow-up is being answered keeps the live text results and page excerpts used by that answer.
|
| 12 |
- A search's saved images no longer lose the first search's or a follow-up's images when you leave the search before both arrive. Whichever image search finished last replaced the other's images in history, so restoring that search later showed only one set. Images that arrive after you left a search are now added to the ones it already saved.
|
| 13 |
- A follow-up answer no longer disappears when the same search is restored from history while that answer is still coming. If the answer arrived while the restore was reading the saved chat, the restore put back the older list without it, and the next message sent then removed it from history too. The question being answered also vanished from the chat until its answer arrived. Restoring the search already on screen now leaves a chat that is still answering as it is; restoring any other search still shows that search's saved chat.
|
| 14 |
- A follow-up question no longer disappears when "AI response" is turned off and back on while it is still being answered. Turning the setting off stopped the follow-up and saved the question with "The answer was interrupted.", but the chat shown after turning it back on was rebuilt without it, and the next message sent from that chat then removed it from history too. The question and its note now stay, on screen and in history.
|
client/components/AiResponse/AiResponseSection.test.tsx
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { act, cleanup, render } from "@testing-library/react";
|
| 2 |
+
import { type ReactNode, useEffect } from "react";
|
| 3 |
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
| 4 |
+
import {
|
| 5 |
+
getChatSession,
|
| 6 |
+
getSettings,
|
| 7 |
+
settingsPubSub,
|
| 8 |
+
updateChatMessages,
|
| 9 |
+
updateChatSession,
|
| 10 |
+
updateResponseImmediately,
|
| 11 |
+
updateTextGenerationState,
|
| 12 |
+
} from "@/modules/pubSub";
|
| 13 |
+
import AiResponseSection from "./AiResponseSection";
|
| 14 |
+
|
| 15 |
+
const [updateSettings] = settingsPubSub;
|
| 16 |
+
|
| 17 |
+
vi.mock("@mantine/code-highlight", () => ({
|
| 18 |
+
CodeHighlightAdapterProvider: ({ children }: { children: ReactNode }) =>
|
| 19 |
+
children,
|
| 20 |
+
}));
|
| 21 |
+
vi.mock("@mantine/code-highlight/styles.css", () => ({}));
|
| 22 |
+
vi.mock("@/modules/shiki", () => ({ shikiAdapter: {} }));
|
| 23 |
+
vi.mock("./AiResponseContent", () => ({ default: () => null }));
|
| 24 |
+
|
| 25 |
+
const chatLifecycle = { mounts: 0, unmounts: 0 };
|
| 26 |
+
|
| 27 |
+
// What the chat's unmount does (abort the follow-up, save it as interrupted
|
| 28 |
+
// under its own search, drop the suggestion) is covered in
|
| 29 |
+
// ChatInterface.test.tsx; this only checks when the chat is remounted.
|
| 30 |
+
vi.mock("./ChatInterface", () => ({
|
| 31 |
+
default: () => {
|
| 32 |
+
useEffect(() => {
|
| 33 |
+
chatLifecycle.mounts += 1;
|
| 34 |
+
return () => {
|
| 35 |
+
chatLifecycle.unmounts += 1;
|
| 36 |
+
};
|
| 37 |
+
}, []);
|
| 38 |
+
return null;
|
| 39 |
+
},
|
| 40 |
+
}));
|
| 41 |
+
|
| 42 |
+
beforeEach(() => {
|
| 43 |
+
chatLifecycle.mounts = 0;
|
| 44 |
+
chatLifecycle.unmounts = 0;
|
| 45 |
+
updateSettings({ ...getSettings(), enableAiResponse: true });
|
| 46 |
+
updateResponseImmediately("Answer A");
|
| 47 |
+
updateChatMessages([]);
|
| 48 |
+
updateTextGenerationState("completed");
|
| 49 |
+
});
|
| 50 |
+
|
| 51 |
+
afterEach(() => {
|
| 52 |
+
cleanup();
|
| 53 |
+
});
|
| 54 |
+
|
| 55 |
+
describe("AiResponseSection", () => {
|
| 56 |
+
it("remounts the chat for a new chat session, and only then", () => {
|
| 57 |
+
render(<AiResponseSection />);
|
| 58 |
+
expect(chatLifecycle).toEqual({ mounts: 1, unmounts: 0 });
|
| 59 |
+
|
| 60 |
+
act(() => {
|
| 61 |
+
updateResponseImmediately("Answer B");
|
| 62 |
+
updateChatMessages([
|
| 63 |
+
{ role: "user", content: "A follow-up" },
|
| 64 |
+
{ role: "assistant", content: "Its answer" },
|
| 65 |
+
]);
|
| 66 |
+
});
|
| 67 |
+
expect(chatLifecycle).toEqual({ mounts: 1, unmounts: 0 });
|
| 68 |
+
|
| 69 |
+
act(() => updateChatSession(getChatSession() + 1));
|
| 70 |
+
expect(chatLifecycle).toEqual({ mounts: 2, unmounts: 1 });
|
| 71 |
+
});
|
| 72 |
+
});
|
client/components/AiResponse/AiResponseSection.tsx
CHANGED
|
@@ -4,6 +4,7 @@ import { useMemo } from "react";
|
|
| 4 |
import { useScreenWakeLock } from "@/hooks/useScreenWakeLock";
|
| 5 |
import {
|
| 6 |
chatMessagesPubSub,
|
|
|
|
| 7 |
isRestoringFromHistoryPubSub,
|
| 8 |
modelLoadingProgressPubSub,
|
| 9 |
modelSizeInMegabytesPubSub,
|
|
@@ -37,6 +38,7 @@ export default function AiResponseSection() {
|
|
| 37 |
const [modelSizeInMegabytes] = usePubSub(modelSizeInMegabytesPubSub);
|
| 38 |
const [chatMessages] = usePubSub(chatMessagesPubSub);
|
| 39 |
const [isRestoringFromHistory] = usePubSub(isRestoringFromHistoryPubSub);
|
|
|
|
| 40 |
|
| 41 |
useScreenWakeLock(statesKeepingTheScreenAwake.includes(textGenerationState));
|
| 42 |
|
|
@@ -61,6 +63,7 @@ export default function AiResponseSection() {
|
|
| 61 |
|
| 62 |
{textGenerationState === "completed" && (
|
| 63 |
<ChatInterface
|
|
|
|
| 64 |
initialQuery={query}
|
| 65 |
initialResponse={response}
|
| 66 |
initialMessages={
|
|
@@ -104,5 +107,6 @@ export default function AiResponseSection() {
|
|
| 104 |
modelLoadingProgress,
|
| 105 |
modelSizeInMegabytes,
|
| 106 |
isRestoringFromHistory,
|
|
|
|
| 107 |
]);
|
| 108 |
}
|
|
|
|
| 4 |
import { useScreenWakeLock } from "@/hooks/useScreenWakeLock";
|
| 5 |
import {
|
| 6 |
chatMessagesPubSub,
|
| 7 |
+
chatSessionPubSub,
|
| 8 |
isRestoringFromHistoryPubSub,
|
| 9 |
modelLoadingProgressPubSub,
|
| 10 |
modelSizeInMegabytesPubSub,
|
|
|
|
| 38 |
const [modelSizeInMegabytes] = usePubSub(modelSizeInMegabytesPubSub);
|
| 39 |
const [chatMessages] = usePubSub(chatMessagesPubSub);
|
| 40 |
const [isRestoringFromHistory] = usePubSub(isRestoringFromHistoryPubSub);
|
| 41 |
+
const [chatSession] = usePubSub(chatSessionPubSub);
|
| 42 |
|
| 43 |
useScreenWakeLock(statesKeepingTheScreenAwake.includes(textGenerationState));
|
| 44 |
|
|
|
|
| 63 |
|
| 64 |
{textGenerationState === "completed" && (
|
| 65 |
<ChatInterface
|
| 66 |
+
key={chatSession}
|
| 67 |
initialQuery={query}
|
| 68 |
initialResponse={response}
|
| 69 |
initialMessages={
|
|
|
|
| 107 |
modelLoadingProgress,
|
| 108 |
modelSizeInMegabytes,
|
| 109 |
isRestoringFromHistory,
|
| 110 |
+
chatSession,
|
| 111 |
]);
|
| 112 |
}
|
client/hooks/useHistoryRestore.test.ts
CHANGED
|
@@ -9,15 +9,21 @@ import {
|
|
| 9 |
import {
|
| 10 |
chatGenerationStatePubSub,
|
| 11 |
chatMessagesPubSub,
|
|
|
|
| 12 |
getLlmTextSearchResults,
|
|
|
|
| 13 |
getSuppressNextFollowUp,
|
| 14 |
imageSearchResultsPubSub,
|
| 15 |
imageSearchStatePubSub,
|
| 16 |
isRestoringFromHistoryPubSub,
|
| 17 |
textSearchResultsPubSub,
|
| 18 |
updateImageSearchResults,
|
|
|
|
|
|
|
| 19 |
updateSuppressNextFollowUp,
|
|
|
|
| 20 |
} from "@/modules/pubSub";
|
|
|
|
| 21 |
import { useHistoryRestore } from "./useHistoryRestore";
|
| 22 |
|
| 23 |
/** A chat turn as history stores it: never a system message. */
|
|
@@ -133,6 +139,45 @@ describe("useHistoryRestore", () => {
|
|
| 133 |
expect(imageSearchStatePubSub[2]()).toBe("completed");
|
| 134 |
});
|
| 135 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
it.each([
|
| 137 |
{ name: "image-only entry", payload: { imageResults } },
|
| 138 |
{ name: "legacy image-only entry", payload: { results: imageResults } },
|
|
@@ -312,4 +357,25 @@ describe("useHistoryRestore", () => {
|
|
| 312 |
expect(getChatMessages()).toEqual(savedTurns);
|
| 313 |
});
|
| 314 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 315 |
});
|
|
|
|
| 9 |
import {
|
| 10 |
chatGenerationStatePubSub,
|
| 11 |
chatMessagesPubSub,
|
| 12 |
+
getChatSession,
|
| 13 |
getLlmTextSearchResults,
|
| 14 |
+
getPageContents,
|
| 15 |
getSuppressNextFollowUp,
|
| 16 |
imageSearchResultsPubSub,
|
| 17 |
imageSearchStatePubSub,
|
| 18 |
isRestoringFromHistoryPubSub,
|
| 19 |
textSearchResultsPubSub,
|
| 20 |
updateImageSearchResults,
|
| 21 |
+
updateLlmTextSearchResults,
|
| 22 |
+
updatePageContents,
|
| 23 |
updateSuppressNextFollowUp,
|
| 24 |
+
updateTextSearchResults,
|
| 25 |
} from "@/modules/pubSub";
|
| 26 |
+
import type { TextSearchResults } from "@/modules/types";
|
| 27 |
import { useHistoryRestore } from "./useHistoryRestore";
|
| 28 |
|
| 29 |
/** A chat turn as history stores it: never a system message. */
|
|
|
|
| 139 |
expect(imageSearchStatePubSub[2]()).toBe("completed");
|
| 140 |
});
|
| 141 |
|
| 142 |
+
it.each([
|
| 143 |
+
{ searchRunId: "live-run", generating: true, keepsGrounding: true },
|
| 144 |
+
{ searchRunId: "other-run", generating: true, keepsGrounding: false },
|
| 145 |
+
{ searchRunId: "live-run", generating: false, keepsGrounding: false },
|
| 146 |
+
])(
|
| 147 |
+
"restores text grounding for $searchRunId with generating=$generating",
|
| 148 |
+
async ({ searchRunId, generating, keepsGrounding }) => {
|
| 149 |
+
const savedText: TextSearchResults = [
|
| 150 |
+
["Saved text", "Saved snippet", "https://example.com/text"],
|
| 151 |
+
];
|
| 152 |
+
const liveText: TextSearchResults = [
|
| 153 |
+
...savedText,
|
| 154 |
+
["Follow-up result", "Fresh snippet", "https://example.com/follow-up"],
|
| 155 |
+
];
|
| 156 |
+
const excerpts = {
|
| 157 |
+
"https://example.com/text": "First excerpt",
|
| 158 |
+
"https://example.com/follow-up": "Fresh excerpt",
|
| 159 |
+
};
|
| 160 |
+
setCurrentSearchRunId("live-run");
|
| 161 |
+
updateChatGenerationState({
|
| 162 |
+
isGeneratingResponse: generating,
|
| 163 |
+
isGeneratingFollowUpQuestion: false,
|
| 164 |
+
});
|
| 165 |
+
updateTextSearchResults(liveText);
|
| 166 |
+
updateLlmTextSearchResults(liveText);
|
| 167 |
+
updatePageContents(excerpts);
|
| 168 |
+
vi.mocked(getLatestLlmResponseForEntry).mockResolvedValueOnce(
|
| 169 |
+
"Saved AI answer.",
|
| 170 |
+
);
|
| 171 |
+
|
| 172 |
+
await restoreEntry({ searchRunId, textResults });
|
| 173 |
+
|
| 174 |
+
const expectedText = keepsGrounding ? liveText : savedText;
|
| 175 |
+
expect(textSearchResultsPubSub[2]()).toEqual(expectedText);
|
| 176 |
+
expect(getLlmTextSearchResults()).toEqual(expectedText);
|
| 177 |
+
expect(getPageContents()).toEqual(keepsGrounding ? excerpts : {});
|
| 178 |
+
},
|
| 179 |
+
);
|
| 180 |
+
|
| 181 |
it.each([
|
| 182 |
{ name: "image-only entry", payload: { imageResults } },
|
| 183 |
{ name: "legacy image-only entry", payload: { results: imageResults } },
|
|
|
|
| 357 |
expect(getChatMessages()).toEqual(savedTurns);
|
| 358 |
});
|
| 359 |
});
|
| 360 |
+
|
| 361 |
+
it.each([
|
| 362 |
+
{ searchRunId: "run-2", startsNewChat: true },
|
| 363 |
+
{ searchRunId: "run-1", startsNewChat: false },
|
| 364 |
+
])(
|
| 365 |
+
"starts a new chat session only when another search is restored ($searchRunId)",
|
| 366 |
+
async ({ searchRunId, startsNewChat }) => {
|
| 367 |
+
setCurrentSearchRunId("run-1");
|
| 368 |
+
updateChatGenerationState({
|
| 369 |
+
isGeneratingResponse: true,
|
| 370 |
+
isGeneratingFollowUpQuestion: false,
|
| 371 |
+
});
|
| 372 |
+
const sessionBefore = getChatSession();
|
| 373 |
+
|
| 374 |
+
await restoreEntry({ searchRunId });
|
| 375 |
+
|
| 376 |
+
expect(getChatSession()).toBe(
|
| 377 |
+
startsNewChat ? sessionBefore + 1 : sessionBefore,
|
| 378 |
+
);
|
| 379 |
+
},
|
| 380 |
+
);
|
| 381 |
});
|
client/hooks/useHistoryRestore.ts
CHANGED
|
@@ -14,8 +14,10 @@ import {
|
|
| 14 |
import { postMessageToParentWindow } from "../modules/parentWindow";
|
| 15 |
import {
|
| 16 |
getChatGenerationState,
|
|
|
|
| 17 |
updateChatInput,
|
| 18 |
updateChatMessages,
|
|
|
|
| 19 |
updateFollowUpQuestion,
|
| 20 |
updateImageSearchResults,
|
| 21 |
updateImageSearchState,
|
|
@@ -63,15 +65,14 @@ export function useHistoryRestore(
|
|
| 63 |
const keepsChat =
|
| 64 |
searchRunId === getCurrentSearchRunId() &&
|
| 65 |
getChatGenerationState().isGeneratingResponse;
|
|
|
|
|
|
|
|
|
|
| 66 |
setCurrentSearchRunId(searchRunId);
|
| 67 |
|
| 68 |
updateIsRestoringFromHistory(true);
|
| 69 |
-
// Excerpts belong to the search that fetched them; a follow-up on the
|
| 70 |
-
// restored entry must not be grounded on the live search's pages.
|
| 71 |
-
updatePageContents({});
|
| 72 |
updateFollowUpQuestion("");
|
| 73 |
updateChatInput("");
|
| 74 |
-
updateTextSearchStale(false);
|
| 75 |
|
| 76 |
const queryString = `q=${encodeURIComponent(selectedQuery)}`;
|
| 77 |
postMessageToParentWindow({ queryString, hash: "" });
|
|
@@ -79,26 +80,24 @@ export function useHistoryRestore(
|
|
| 79 |
|
| 80 |
document.title = selectedQuery;
|
| 81 |
|
| 82 |
-
if (
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
} else {
|
| 99 |
-
updateTextSearchResults([]);
|
| 100 |
updateTextSearchState("completed");
|
| 101 |
-
updateLlmTextSearchResults(
|
| 102 |
}
|
| 103 |
|
| 104 |
if (hasImageResults(entry)) {
|
|
|
|
| 14 |
import { postMessageToParentWindow } from "../modules/parentWindow";
|
| 15 |
import {
|
| 16 |
getChatGenerationState,
|
| 17 |
+
getChatSession,
|
| 18 |
updateChatInput,
|
| 19 |
updateChatMessages,
|
| 20 |
+
updateChatSession,
|
| 21 |
updateFollowUpQuestion,
|
| 22 |
updateImageSearchResults,
|
| 23 |
updateImageSearchState,
|
|
|
|
| 65 |
const keepsChat =
|
| 66 |
searchRunId === getCurrentSearchRunId() &&
|
| 67 |
getChatGenerationState().isGeneratingResponse;
|
| 68 |
+
if (searchRunId !== getCurrentSearchRunId()) {
|
| 69 |
+
updateChatSession(getChatSession() + 1);
|
| 70 |
+
}
|
| 71 |
setCurrentSearchRunId(searchRunId);
|
| 72 |
|
| 73 |
updateIsRestoringFromHistory(true);
|
|
|
|
|
|
|
|
|
|
| 74 |
updateFollowUpQuestion("");
|
| 75 |
updateChatInput("");
|
|
|
|
| 76 |
|
| 77 |
const queryString = `q=${encodeURIComponent(selectedQuery)}`;
|
| 78 |
postMessageToParentWindow({ queryString, hash: "" });
|
|
|
|
| 80 |
|
| 81 |
document.title = selectedQuery;
|
| 82 |
|
| 83 |
+
if (!keepsChat) {
|
| 84 |
+
// Replacing the chat also replaces the source material it can use.
|
| 85 |
+
updatePageContents({});
|
| 86 |
+
updateTextSearchStale(false);
|
| 87 |
+
const results = hasTextResults(entry)
|
| 88 |
+
? getResultsFromEntry(entry)
|
| 89 |
+
: null;
|
| 90 |
+
const textTuples: TextSearchResults =
|
| 91 |
+
results?.type === "text"
|
| 92 |
+
? results.items.map(({ title, snippet, url }) => [
|
| 93 |
+
title,
|
| 94 |
+
snippet,
|
| 95 |
+
url,
|
| 96 |
+
])
|
| 97 |
+
: [];
|
| 98 |
+
updateTextSearchResults(textTuples);
|
|
|
|
|
|
|
| 99 |
updateTextSearchState("completed");
|
| 100 |
+
updateLlmTextSearchResults(textTuples);
|
| 101 |
}
|
| 102 |
|
| 103 |
if (hasImageResults(entry)) {
|
client/modules/pubSub.ts
CHANGED
|
@@ -345,6 +345,15 @@ export const isRestoringFromHistoryPubSub = createPubSub(false);
|
|
| 345 |
|
| 346 |
export const [updateIsRestoringFromHistory] = isRestoringFromHistoryPubSub;
|
| 347 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 348 |
export const suppressNextFollowUpPubSub = createPubSub(false);
|
| 349 |
|
| 350 |
export const [updateSuppressNextFollowUp, , getSuppressNextFollowUp] =
|
|
|
|
| 345 |
|
| 346 |
export const [updateIsRestoringFromHistory] = isRestoringFromHistoryPubSub;
|
| 347 |
|
| 348 |
+
/**
|
| 349 |
+
* Changes when a history restore switches to another search, so the chat is
|
| 350 |
+
* mounted again for it. The old chat's unmount aborts its follow-up and drops
|
| 351 |
+
* its pending suggestion, which would otherwise land in the restored chat.
|
| 352 |
+
*/
|
| 353 |
+
export const chatSessionPubSub = createPubSub(0);
|
| 354 |
+
|
| 355 |
+
export const [updateChatSession, , getChatSession] = chatSessionPubSub;
|
| 356 |
+
|
| 357 |
export const suppressNextFollowUpPubSub = createPubSub(false);
|
| 358 |
|
| 359 |
export const [updateSuppressNextFollowUp, , getSuppressNextFollowUp] =
|
docs/failure-injection.md
CHANGED
|
@@ -56,6 +56,7 @@ needed.
|
|
| 56 |
| Keyword fallback also returns nothing | Text search state stays `completed` with the no-results alert | `client/modules/textGeneration.degradation.test.ts` |
|
| 57 |
| Stop on an internal-API answer, also while the stream is silent, or an error frame | The request is aborted and its stream cancelled, so the server stops streaming and counts the run abandoned | `client/modules/textGenerationWithInternalApi.test.ts` › cancelling the stream |
|
| 58 |
| Stop, a new search or closing the chat while another answer is also running | Only that answer's request is aborted, at once even before its first chunk; the other answer finishes | `client/modules/textGenerationWithOpenAi.test.ts` › aborts only the request of the chat whose signal aborts, `client/modules/textGeneration.inference.test.ts` › cancels the previous search's answer, and Stop cancels the current one, `client/components/AiResponse/ChatInterface.test.tsx` › aborts the chat answer when the chat unmounts |
|
|
|
|
| 59 |
| SearXNG is down on the client | Text search state becomes `failed`, keyword fallback does not fire | `client/modules/textGeneration.degradation.test.ts` |
|
| 60 |
| Client search fails after a previous search populated the LLM channel | The grounding channel is cleared, so the AI can't ground on the previous query's results; when image search is on and it answers, the channel is repopulated with the (image)-tagged titles and URLs instead | `client/modules/textGeneration.degradation.test.ts` |
|
| 61 |
| Text search fails and the image search answers | The answer waits for the image results and grounds on their (image)-tagged titles and URLs, and the failed-state alert says so | `client/modules/textGeneration.degradation.test.ts` › search degradation |
|
|
|
|
| 56 |
| Keyword fallback also returns nothing | Text search state stays `completed` with the no-results alert | `client/modules/textGeneration.degradation.test.ts` |
|
| 57 |
| Stop on an internal-API answer, also while the stream is silent, or an error frame | The request is aborted and its stream cancelled, so the server stops streaming and counts the run abandoned | `client/modules/textGenerationWithInternalApi.test.ts` › cancelling the stream |
|
| 58 |
| Stop, a new search or closing the chat while another answer is also running | Only that answer's request is aborted, at once even before its first chunk; the other answer finishes | `client/modules/textGenerationWithOpenAi.test.ts` › aborts only the request of the chat whose signal aborts, `client/modules/textGeneration.inference.test.ts` › cancels the previous search's answer, and Stop cancels the current one, `client/components/AiResponse/ChatInterface.test.tsx` › aborts the chat answer when the chat unmounts |
|
| 59 |
+
| Another search is restored from history while a follow-up is being answered | The follow-up is aborted and saved under its own search with the interrupted note, and the restored chat accepts a send at once with no suggestion from the old search | `client/components/AiResponse/AiResponseSection.test.tsx` › remounts the chat for a new chat session, and only then, `client/components/AiResponse/ChatInterface.test.tsx` › aborts the chat answer when the chat unmounts, `client/hooks/useHistoryRestore.test.ts` › starts a new chat session only when another search is restored |
|
| 60 |
| SearXNG is down on the client | Text search state becomes `failed`, keyword fallback does not fire | `client/modules/textGeneration.degradation.test.ts` |
|
| 61 |
| Client search fails after a previous search populated the LLM channel | The grounding channel is cleared, so the AI can't ground on the previous query's results; when image search is on and it answers, the channel is repopulated with the (image)-tagged titles and URLs instead | `client/modules/textGeneration.degradation.test.ts` |
|
| 62 |
| Text search fails and the image search answers | The answer waits for the image results and grounds on their (image)-tagged titles and URLs, and the failed-state alert says so | `client/modules/textGeneration.degradation.test.ts` › search degradation |
|