+
{streaming && p.onStop && (
{check.isError && (
diff --git a/nextjs-frontend/components/chat/chat-app.tsx b/nextjs-frontend/components/chat/chat-app.tsx
index 92ad8d423..a76a4a156 100644
--- a/nextjs-frontend/components/chat/chat-app.tsx
+++ b/nextjs-frontend/components/chat/chat-app.tsx
@@ -16,6 +16,7 @@ import { Composer, ScopeBar } from "@/components/chat/composer";
import { ConversationList } from "@/components/chat/conversations";
import { useApprovals, useChat, useChats, useLlmStatus, useStopAnswer } from "@/components/chat/data";
import { EmptyChat } from "@/components/chat/empty";
+import { ExportMenu, useChatExport } from "@/components/chat/export";
import { NamespaceOffer, spokenPick } from "@/components/chat/namespace-offer";
import { fromApiScope, scopeFromParams, toApiScope, type Scope } from "@/components/chat/scope";
import { CitationSheet, SourcesPanel, SourcesSheet } from "@/components/chat/sources";
@@ -132,6 +133,17 @@ export function ChatApp() {
const [queue, setQueue] = useState([]);
const threadRef = useRef(null);
+ // The browser prints the conversation, or one message and its question, when the server can't make its PDF.
+ const [printing, setPrinting] = useState<{ message?: number } | null>(null);
+ useEffect(() => {
+ if (!printing) return;
+ const done = () => setPrinting(null);
+ window.addEventListener("afterprint", done, { once: true });
+ window.print();
+ return () => window.removeEventListener("afterprint", done);
+ }, [printing]);
+ const exporter = useChatExport(activeId, chat.data?.title, (message) => setPrinting({ message }));
+
// A new conversation starts from the top-bar namespace unless a link says otherwise.
useEffect(() => {
if (activeId == null && !search.toString()) setDraftScope(topNs ? { namespaces: [topNs] } : {});
@@ -665,7 +677,7 @@ export function ChatApp() {
return (
@@ -675,7 +687,7 @@ export function ChatApp() {