Skip to content

Your lightweight open-source personal agent.

fix(webui): remove Mermaid preparation status text (#6380)

chengyongrudf63526ddfb3
diff --git a/webui/src/components/markdown-diagrams/MarkdownCodeBlock.tsx b/webui/src/components/markdown-diagrams/MarkdownCodeBlock.tsx
index fe27598d1..a58aad852 100644
--- a/webui/src/components/markdown-diagrams/MarkdownCodeBlock.tsx
+++ b/webui/src/components/markdown-diagrams/MarkdownCodeBlock.tsx
@@ -17,9 +17,7 @@ export function MarkdownCodeBlock({ code, language }: { code: string; language?:
const { streaming, highlight } = useContext(MarkdownCodeContext);
const source = <CodeBlock language={language || "text"} code={code} className="my-3" highlight={highlight} showLineNumbers={code.includes("\n")} />;
if (language?.toLowerCase() !== "mermaid") return source;
- const preparing = <div aria-busy={streaming}>
- <p className="my-1 text-xs text-muted-foreground" role="status">{t("diagram.preparing")}</p>{source}
- </div>;
+ const preparing = <div aria-busy={streaming}>{source}</div>;
if (streaming) return preparing;
return <DiagramBoundary key={code} fallback={<><p className="text-xs text-muted-foreground" role="status">{t("diagram.errors.load")}</p>{source}</>}>
<Suspense fallback={preparing}><MermaidBlock source={code} /></Suspense>
diff --git a/webui/src/components/markdown-diagrams/MermaidBlock.tsx b/webui/src/components/markdown-diagrams/MermaidBlock.tsx
index 9aa11dc4a..b79ff922d 100644
--- a/webui/src/components/markdown-diagrams/MermaidBlock.tsx
+++ b/webui/src/components/markdown-diagrams/MermaidBlock.tsx
@@ -141,7 +141,6 @@ export default function MermaidBlock({ source }: { source: string }) {
{showSource ? <CodeBlock language="mermaid" code={source} chrome="none" highlight={false} showLineNumbers={source.includes("\n")} />
: image ? <div className="flex justify-center p-3"><img src={image.url} alt={image.label || t("diagram.title")} width={image.width} height={image.height} className="max-h-[28rem] max-w-full object-contain" /></div>
: <div className="px-3 py-2" style={{ minHeight: height.current || undefined }}>
- <p className="m-0 py-1 text-xs text-muted-foreground" role="status">{t("diagram.preparing")}</p>
{!height.current && <CodeBlock language="mermaid" code={source} chrome="none" highlight={false} />}
</div>}
</div>;
diff --git a/webui/src/i18n/locales/en/common.json b/webui/src/i18n/locales/en/common.json
index c64a83286..4b0c41689 100644
--- a/webui/src/i18n/locales/en/common.json
+++ b/webui/src/i18n/locales/en/common.json
@@ -2561,7 +2561,6 @@
"copy": "Copy source",
"enlarge": "Enlarge diagram",
"title": "Mermaid diagram",
- "preparing": "Preparing diagram…",
"errors": {
"syntax": "Check the diagram syntax in the source.",
"unsupported": "This diagram type is not supported. View the source.",
diff --git a/webui/src/i18n/locales/es/common.json b/webui/src/i18n/locales/es/common.json
index 32845f3f2..e9f9e7926 100644
--- a/webui/src/i18n/locales/es/common.json
+++ b/webui/src/i18n/locales/es/common.json
@@ -2362,7 +2362,6 @@
"copy": "Copiar código fuente",
"enlarge": "Ampliar diagrama",
"title": "Diagrama Mermaid",
- "preparing": "Preparando diagrama…",
"errors": {
"syntax": "Comprueba la sintaxis del diagrama en el código fuente.",
"unsupported": "Este tipo de diagrama no es compatible. Consulta el código fuente.",
diff --git a/webui/src/i18n/locales/fr/common.json b/webui/src/i18n/locales/fr/common.json
index f9d99040e..04a0c30f9 100644
--- a/webui/src/i18n/locales/fr/common.json
+++ b/webui/src/i18n/locales/fr/common.json
@@ -2361,7 +2361,6 @@
"copy": "Copier la source",
"enlarge": "Agrandir le diagramme",
"title": "Diagramme Mermaid",
- "preparing": "Préparation du diagramme…",
"errors": {
"syntax": "Vérifiez la syntaxe du diagramme dans la source.",
"unsupported": "Ce type de diagramme n'est pas pris en charge. Consultez la source.",
diff --git a/webui/src/i18n/locales/id/common.json b/webui/src/i18n/locales/id/common.json
index bbd00a930..0444f948d 100644
--- a/webui/src/i18n/locales/id/common.json
+++ b/webui/src/i18n/locales/id/common.json
@@ -2361,7 +2361,6 @@
"copy": "Salin sumber",
"enlarge": "Perbesar diagram",
"title": "Diagram Mermaid",
- "preparing": "Menyiapkan diagram…",
"errors": {
"syntax": "Periksa sintaks diagram pada sumber.",
"unsupported": "Jenis diagram ini belum didukung. Lihat sumber.",
diff --git a/webui/src/i18n/locales/ja/common.json b/webui/src/i18n/locales/ja/common.json
index e25905062..bec031c4a 100644
--- a/webui/src/i18n/locales/ja/common.json
+++ b/webui/src/i18n/locales/ja/common.json
@@ -2361,7 +2361,6 @@
"copy": "ソースをコピー",
"enlarge": "図を拡大",
"title": "Mermaid 図",
- "preparing": "図を準備中…",
"errors": {
"syntax": "ソースの図の構文を確認してください。",
"unsupported": "この図の種類には対応していません。ソースを確認してください。",
diff --git a/webui/src/i18n/locales/ko/common.json b/webui/src/i18n/locales/ko/common.json
index cb2952551..0d11a6a3e 100644
--- a/webui/src/i18n/locales/ko/common.json
+++ b/webui/src/i18n/locales/ko/common.json
@@ -2361,7 +2361,6 @@
"copy": "소스 복사",
"enlarge": "다이어그램 확대",
"title": "Mermaid 다이어그램",
- "preparing": "다이어그램 준비 중…",
"errors": {
"syntax": "소스의 다이어그램 문법을 확인하세요.",
"unsupported": "지원하지 않는 다이어그램 유형입니다. 소스를 확인하세요.",
diff --git a/webui/src/i18n/locales/pt-BR/common.json b/webui/src/i18n/locales/pt-BR/common.json
index 2c33fa6e4..11a734035 100644
--- a/webui/src/i18n/locales/pt-BR/common.json
+++ b/webui/src/i18n/locales/pt-BR/common.json
@@ -2375,7 +2375,6 @@
"copy": "Copiar código-fonte",
"enlarge": "Ampliar diagrama",
"title": "Diagrama Mermaid",
- "preparing": "Preparando diagrama…",
"errors": {
"syntax": "Confira a sintaxe do diagrama no código-fonte.",
"unsupported": "Este tipo de diagrama não é compatível. Consulte o código-fonte.",
diff --git a/webui/src/i18n/locales/vi/common.json b/webui/src/i18n/locales/vi/common.json
index a48dab44b..c1a7a3f5c 100644
--- a/webui/src/i18n/locales/vi/common.json
+++ b/webui/src/i18n/locales/vi/common.json
@@ -2361,7 +2361,6 @@
"copy": "Sao chép mã nguồn",
"enlarge": "Phóng to sơ đồ",
"title": "Sơ đồ Mermaid",
- "preparing": "Đang chuẩn bị sơ đồ…",
"errors": {
"syntax": "Hãy kiểm tra cú pháp sơ đồ trong mã nguồn.",
"unsupported": "Chưa hỗ trợ loại sơ đồ này. Hãy xem mã nguồn.",
diff --git a/webui/src/i18n/locales/zh-CN/common.json b/webui/src/i18n/locales/zh-CN/common.json
index f88d75d8a..3d3978af4 100644
--- a/webui/src/i18n/locales/zh-CN/common.json
+++ b/webui/src/i18n/locales/zh-CN/common.json
@@ -2561,7 +2561,6 @@
"copy": "复制源码",
"enlarge": "放大查看",
"title": "Mermaid 图表",
- "preparing": "正在准备图表…",
"errors": {
"syntax": "图表语法有误,请检查源码。",
"unsupported": "暂不支持此类图表,可查看源码。",
diff --git a/webui/src/i18n/locales/zh-TW/common.json b/webui/src/i18n/locales/zh-TW/common.json
index 21e7b4ec6..25ffb70e4 100644
--- a/webui/src/i18n/locales/zh-TW/common.json
+++ b/webui/src/i18n/locales/zh-TW/common.json
@@ -2361,7 +2361,6 @@
"copy": "複製原始碼",
"enlarge": "放大檢視",
"title": "Mermaid 圖表",
- "preparing": "正在準備圖表…",
"errors": {
"syntax": "圖表語法有誤,請檢查原始碼。",
"unsupported": "尚不支援此類圖表,可檢視原始碼。",
diff --git a/webui/src/tests/mermaid-block.test.tsx b/webui/src/tests/mermaid-block.test.tsx
index 5ce02b437..bad68478b 100644
--- a/webui/src/tests/mermaid-block.test.tsx
+++ b/webui/src/tests/mermaid-block.test.tsx
@@ -43,6 +43,7 @@ describe("Mermaid message fences", () => {
const tree = view.container.querySelector(".markdown-content");
expect(runtime.request).not.toHaveBeenCalled();
expect(view.container).toHaveTextContent("开始 --> 完成");
+ expect(screen.queryByRole("status")).not.toBeInTheDocument();
view.rerender(<MessageBubble message={{ ...message, isStreaming: false }} />);
await waitFor(() => expect(jobs).toHaveLength(1));
expect(jobs[0].input.source).toBe(code);