diff --git a/webui/browser/fixture.tsx b/webui/browser/fixture.tsx index b77465443..3d7c25628 100644 --- a/webui/browser/fixture.tsx +++ b/webui/browser/fixture.tsx @@ -27,6 +27,7 @@ import { DiagramFixture } from "./diagram-fixture"; import { TypographyFixture } from "./typography-fixture"; import { CodeWrappingFixture } from "./code-wrapping-fixture"; import { InlineReferencesFixture } from "./inline-references-fixture"; +import { InlineFileReferenceFixture } from "./inline-file-reference-fixture"; import { HistoryBoundaryFixture } from "./history-boundary-fixture"; import { installHistoryBoundaryPreviewApi } from "./history-boundary-preview"; import { ChatFailureFixture } from "./chat-failure-fixture"; @@ -297,6 +298,8 @@ createRoot(document.getElementById("root")!).render( ? : parameters.get("case") === "inline-references" ? + : parameters.get("case") === "inline-file-reference" + ? : parameters.get("case") === "idle-compaction" ? : parameters.get("case") === "history-hydration" diff --git a/webui/browser/inline-file-reference-fixture.tsx b/webui/browser/inline-file-reference-fixture.tsx new file mode 100644 index 000000000..ab6ff2002 --- /dev/null +++ b/webui/browser/inline-file-reference-fixture.tsx @@ -0,0 +1,44 @@ +import { useState } from "react"; + +import { FileActionsProvider } from "@/components/FileActions"; +import { FilePreviewAvailabilityProvider } from "@/components/FilePreviewAvailabilityContext"; +import { MessageBubble } from "@/components/MessageBubble"; +import { ThemeProvider, useTheme } from "@/hooks/useTheme"; + +const references = [ + "notes/ready.md", + `notes/${"long directory/".repeat(16)}report.md`, + String.raw`C:\Users\reader\My Docs\report.md`, + "pytest tests/test_agent.py", + "cat \t~/My Docs/report.md", + "这是一段说明文字,最后引用 /tmp/sample.txt", + "notes/chart.png", + `notes/${"segment".repeat(30)}.md`, +]; +const source = references.map(text => `Before \`${text}\` after.`).join("\n\n") + + "\n\n[Short report](notes/ready.md)"; +const resolve = async (path: string) => path.startsWith("notes/"); + +export function InlineFileReferenceFixture() { + const { theme } = useTheme(); + const [text, setText] = useState(source); + const [streaming, setStreaming] = useState(true); + const [opened, setOpened] = useState(""); + return ({ path, relative_path: path }), + loadPreview: async (path) => ({ + path, display_path: path, project_path: path, size: 68, kind: "image", mime_type: "image/png", + data_url: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+/l9sAAAAASUVORK5CYII=", + }), + }}> +
+