@galaxycore/ai-chat 0.11.1 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/README.md +1 -1
- package/dist/markdown-math-BpVxivj8.js +3 -0
- package/dist/markdown.d.ts +32 -3
- package/dist/markdown.js +163 -22
- package/dist/markdown.js.map +1 -1
- package/dist/styles.css +11 -0
- package/docs/api-reference.md +25 -1
- package/docs/publishing.md +5 -5
- package/package.json +8 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.12.0
|
|
4
|
+
|
|
5
|
+
- Upgrade Streamdown to 2.8 and make `MarkdownResponse` a complete assistant Markdown renderer: CJK-friendly emphasis (`@streamdown/cjk`), single-newline line breaks (`remark-breaks`), `<br>` tags outside code and tables treated as newlines (`normalizeBreakTags`), and code highlighting, KaTeX math and Mermaid diagrams loaded on demand only when a reply contains them. Code blocks show a copy button; line numbers are off so the block stays styled without Tailwind.
|
|
6
|
+
- Wrap tables in a labelled, keyboard-focusable scroll region (`tableLabel`). Add `className`, `renderLink`, `codeRenderers`, `remarkPlugins`, `components`, `translations`, `mode` and `tableLabel` to `MarkdownResponse` and export `MarkdownResponseProps` / `MarkdownLinkRenderer`. Remote images, non-HTTP(S) links and unsanitized HTML stay blocked by default.
|
|
7
|
+
|
|
3
8
|
## 0.11.1
|
|
4
9
|
|
|
5
10
|
- Portal the `ChatContextUsage` breakdown popover into `document.body` with `position: fixed` anchored to the enclosing composer (`.gc-chat__composer` / `.ai-chat-composer`) and inheriting resolved theme variables, so scrollable or `overflow: hidden` composer containers never clip it.
|
package/README.md
CHANGED
|
@@ -100,7 +100,7 @@ export function Conversation({ id, initialMessages = [] }: {
|
|
|
100
100
|
|
|
101
101
|
`gateway.health()` 返回能力,宿主可据此显示功能。当前 pi 网关 `streaming/tools/cancel/sessionRestore=true`,`streamReplay/regenerate/attachments=false`;不要启用当前运行时不支持的重新生成或附件按钮。
|
|
102
102
|
|
|
103
|
-
助手回答默认渲染 Markdown,用户输入保留原文。Streamdown 随包自动安装;`renderText` 可覆盖默认渲染,`@galaxycore/ai-chat/markdown` 的 `MarkdownResponse` 入口保持兼容。包提供基础样式,无需 Tailwind;默认禁用远程图片加载,外链仅接受 HTTP(S)
|
|
103
|
+
助手回答默认渲染 Markdown,用户输入保留原文。Streamdown 随包自动安装;`renderText` 可覆盖默认渲染,`@galaxycore/ai-chat/markdown` 的 `MarkdownResponse` 入口保持兼容。包提供基础样式,无需 Tailwind;默认禁用远程图片加载,外链仅接受 HTTP(S)/站内绝对路径。中日韩强调修复和单换行保留默认开启;代码高亮、数学公式和 Mermaid 按内容懒加载。宿主可通过 `renderLink`、`codeRenderers`、`remarkPlugins` 和 `components` 扩展。
|
|
104
104
|
|
|
105
105
|
## 三种使用层次
|
|
106
106
|
|
package/dist/markdown.d.ts
CHANGED
|
@@ -1,9 +1,38 @@
|
|
|
1
1
|
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
import { Components, CustomRenderer, StreamdownProps, StreamdownTranslations } from "streamdown";
|
|
2
4
|
//#region src/markdown.d.ts
|
|
3
|
-
/**
|
|
4
|
-
export
|
|
5
|
+
/** Return `undefined` to fall back to the default safe external link. */
|
|
6
|
+
export type MarkdownLinkRenderer = (link: {
|
|
7
|
+
href?: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}) => ReactNode | undefined;
|
|
11
|
+
export interface MarkdownResponseProps {
|
|
5
12
|
text: string;
|
|
6
13
|
isStreaming?: boolean;
|
|
7
|
-
|
|
14
|
+
className?: string;
|
|
15
|
+
/** Extra remark plugins. Streamdown parses each top-level block separately, so plugins see one block at a time. */
|
|
16
|
+
remarkPlugins?: StreamdownProps['remarkPlugins'];
|
|
17
|
+
/** Element overrides merged over the safe defaults. Keep identities stable to preserve completed blocks. */
|
|
18
|
+
components?: Components;
|
|
19
|
+
/** Host-specific links such as citations. Receives the raw href before the HTTP(S) safety check. */
|
|
20
|
+
renderLink?: MarkdownLinkRenderer;
|
|
21
|
+
/** Fenced code renderers by language. They take precedence over syntax highlighting. */
|
|
22
|
+
codeRenderers?: CustomRenderer[];
|
|
23
|
+
translations?: Partial<StreamdownTranslations>;
|
|
24
|
+
/** `static` parses the whole text as one document, for host plugins that must see every block at once. Defaults to `streaming`. */
|
|
25
|
+
mode?: StreamdownProps['mode'];
|
|
26
|
+
/** Accessible name of the keyboard-scrollable table region. Defaults to "Table". */
|
|
27
|
+
tableLabel?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Models often write `<br>` for line breaks. Outside code and tables it becomes a newline, so a
|
|
31
|
+
* leading tag cannot turn the following Markdown into a raw HTML block; table cells keep it as a
|
|
32
|
+
* cell line break.
|
|
33
|
+
*/
|
|
34
|
+
export declare function normalizeBreakTags(text: string): string;
|
|
35
|
+
/** Default assistant streaming Markdown. Remote images require an explicit host renderer. */
|
|
36
|
+
export declare function MarkdownResponse(props: MarkdownResponseProps): import("react").JSX.Element;
|
|
8
37
|
//#endregion
|
|
9
38
|
//# sourceMappingURL=markdown.d.ts.map
|
package/dist/markdown.js
CHANGED
|
@@ -1,41 +1,182 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
3
|
import { i as safeUrl } from "./utils-DqBGBYA1.js";
|
|
4
|
-
import { memo } from "react";
|
|
5
|
-
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
import {
|
|
4
|
+
import { createContext, memo, useContext, useEffect, useMemo, useState } from "react";
|
|
5
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
6
|
+
import { cjk } from "@streamdown/cjk";
|
|
7
|
+
import remarkBreaks from "remark-breaks";
|
|
8
|
+
import { Streamdown, defaultRemarkPlugins } from "streamdown";
|
|
7
9
|
//#region src/markdown.tsx
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
const MarkdownOptionsContext = createContext({ tableLabel: "Table" });
|
|
11
|
+
function MarkdownLink({ href, title, children }) {
|
|
12
|
+
const { renderLink } = useContext(MarkdownOptionsContext);
|
|
13
|
+
const custom = renderLink?.({
|
|
14
|
+
href,
|
|
15
|
+
title,
|
|
16
|
+
children
|
|
17
|
+
});
|
|
18
|
+
if (custom !== void 0) return /* @__PURE__ */ jsx(Fragment, { children: custom });
|
|
19
|
+
const safe = safeUrl(href);
|
|
20
|
+
return safe ? /* @__PURE__ */ jsx("a", {
|
|
21
|
+
href: safe,
|
|
22
|
+
title,
|
|
23
|
+
target: "_blank",
|
|
24
|
+
rel: "noopener noreferrer",
|
|
25
|
+
children
|
|
26
|
+
}) : /* @__PURE__ */ jsx("span", { children });
|
|
27
|
+
}
|
|
28
|
+
const defaultComponents = {
|
|
29
|
+
a: ({ href, title, children }) => /* @__PURE__ */ jsx(MarkdownLink, {
|
|
30
|
+
href,
|
|
31
|
+
title,
|
|
32
|
+
children
|
|
33
|
+
}),
|
|
18
34
|
img: ({ alt }) => /* @__PURE__ */ jsx("span", {
|
|
19
35
|
className: "gc-chat__image-alt",
|
|
20
36
|
children: alt || "[image]"
|
|
21
|
-
})
|
|
37
|
+
}),
|
|
38
|
+
strong: ({ children }) => /* @__PURE__ */ jsx("strong", {
|
|
39
|
+
"data-streamdown": "strong",
|
|
40
|
+
children
|
|
41
|
+
}),
|
|
42
|
+
table: ({ children }) => /* @__PURE__ */ jsx(MarkdownTable, { children })
|
|
43
|
+
};
|
|
44
|
+
function MarkdownTable({ children }) {
|
|
45
|
+
const { tableLabel } = useContext(MarkdownOptionsContext);
|
|
46
|
+
return /* @__PURE__ */ jsx("div", {
|
|
47
|
+
"data-streamdown": "table-wrapper",
|
|
48
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
49
|
+
role: "region",
|
|
50
|
+
"aria-label": tableLabel,
|
|
51
|
+
tabIndex: 0,
|
|
52
|
+
children: /* @__PURE__ */ jsx("table", {
|
|
53
|
+
"data-streamdown": "table",
|
|
54
|
+
children
|
|
55
|
+
})
|
|
56
|
+
})
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
const breakTag = /<\/?br\s*\/?>/gi;
|
|
60
|
+
/**
|
|
61
|
+
* Models often write `<br>` for line breaks. Outside code and tables it becomes a newline, so a
|
|
62
|
+
* leading tag cannot turn the following Markdown into a raw HTML block; table cells keep it as a
|
|
63
|
+
* cell line break.
|
|
64
|
+
*/
|
|
65
|
+
function normalizeBreakTags(text) {
|
|
66
|
+
if (!/<\/?br/i.test(text)) return text;
|
|
67
|
+
let fence;
|
|
68
|
+
return text.split("\n").map((line) => {
|
|
69
|
+
const marker = /^ {0,3}(`{3,}|~{3,})/.exec(line)?.[1];
|
|
70
|
+
if (fence) {
|
|
71
|
+
if (marker && marker[0] === fence[0] && marker.length >= fence.length) fence = void 0;
|
|
72
|
+
return line;
|
|
73
|
+
}
|
|
74
|
+
if (marker) {
|
|
75
|
+
fence = marker;
|
|
76
|
+
return line;
|
|
77
|
+
}
|
|
78
|
+
if (line.includes("|")) return line;
|
|
79
|
+
return line.split(/(`+[^`]*`+)/).map((part, index) => index % 2 ? part : part.replace(breakTag, "\n")).join("");
|
|
80
|
+
}).join("\n");
|
|
81
|
+
}
|
|
82
|
+
const baseRemarkPlugins = [...Object.values(defaultRemarkPlugins), remarkBreaks];
|
|
83
|
+
const controls = {
|
|
84
|
+
code: {
|
|
85
|
+
copy: true,
|
|
86
|
+
download: false
|
|
87
|
+
},
|
|
88
|
+
table: false,
|
|
89
|
+
mermaid: false
|
|
90
|
+
};
|
|
91
|
+
const loaders = {
|
|
92
|
+
code: () => import("@streamdown/code").then((module) => module.code),
|
|
93
|
+
math: () => import("./markdown-math-BpVxivj8.js").then((module) => module.math),
|
|
94
|
+
mermaid: () => import("@streamdown/mermaid").then((module) => module.mermaid)
|
|
22
95
|
};
|
|
96
|
+
const loaded = {};
|
|
97
|
+
const pending = /* @__PURE__ */ new Map();
|
|
98
|
+
function requiredPlugins(text) {
|
|
99
|
+
const needed = [];
|
|
100
|
+
if (/^ {0,3}(?:```|~~~)/m.test(text)) needed.push("code");
|
|
101
|
+
if (/^ {0,3}(?:```|~~~)\s*mermaid\b/im.test(text)) needed.push("mermaid");
|
|
102
|
+
if (text.includes("$$")) needed.push("math");
|
|
103
|
+
return needed;
|
|
104
|
+
}
|
|
105
|
+
function loadPlugin(name) {
|
|
106
|
+
let request = pending.get(name);
|
|
107
|
+
if (!request) {
|
|
108
|
+
request = loaders[name]().then((plugin) => {
|
|
109
|
+
loaded[name] = plugin;
|
|
110
|
+
}, () => {
|
|
111
|
+
pending.delete(name);
|
|
112
|
+
});
|
|
113
|
+
pending.set(name, request);
|
|
114
|
+
}
|
|
115
|
+
return request;
|
|
116
|
+
}
|
|
117
|
+
function useMarkdownPlugins(text) {
|
|
118
|
+
const missing = requiredPlugins(text).filter((name) => !loaded[name]).join(",");
|
|
119
|
+
const [, setVersion] = useState(0);
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
if (!missing) return;
|
|
122
|
+
let active = true;
|
|
123
|
+
Promise.all(missing.split(",").map((name) => loadPlugin(name))).then(() => {
|
|
124
|
+
if (active) setVersion((version) => version + 1);
|
|
125
|
+
});
|
|
126
|
+
return () => {
|
|
127
|
+
active = false;
|
|
128
|
+
};
|
|
129
|
+
}, [missing]);
|
|
130
|
+
const { code, math, mermaid } = loaded;
|
|
131
|
+
return useMemo(() => ({
|
|
132
|
+
cjk,
|
|
133
|
+
code,
|
|
134
|
+
math,
|
|
135
|
+
mermaid
|
|
136
|
+
}), [
|
|
137
|
+
code,
|
|
138
|
+
math,
|
|
139
|
+
mermaid
|
|
140
|
+
]);
|
|
141
|
+
}
|
|
23
142
|
/** Default assistant streaming Markdown. Remote images require an explicit host renderer. */
|
|
24
143
|
function MarkdownResponse(props) {
|
|
25
144
|
return /* @__PURE__ */ jsx(MemoizedMarkdown, { ...props });
|
|
26
145
|
}
|
|
27
|
-
const MemoizedMarkdown = memo(function Markdown({ text, isStreaming = false }) {
|
|
146
|
+
const MemoizedMarkdown = memo(function Markdown({ text, isStreaming = false, className, remarkPlugins, components, renderLink, codeRenderers, translations, mode, tableLabel = "Table" }) {
|
|
147
|
+
const basePlugins = useMarkdownPlugins(text);
|
|
148
|
+
const plugins = useMemo(() => codeRenderers?.length ? {
|
|
149
|
+
...basePlugins,
|
|
150
|
+
renderers: codeRenderers
|
|
151
|
+
} : basePlugins, [basePlugins, codeRenderers]);
|
|
152
|
+
const mergedRemarkPlugins = useMemo(() => remarkPlugins?.length ? [...baseRemarkPlugins, ...remarkPlugins] : baseRemarkPlugins, [remarkPlugins]);
|
|
153
|
+
const mergedComponents = useMemo(() => components ? {
|
|
154
|
+
...defaultComponents,
|
|
155
|
+
...components
|
|
156
|
+
} : defaultComponents, [components]);
|
|
157
|
+
const options = useMemo(() => ({
|
|
158
|
+
renderLink,
|
|
159
|
+
tableLabel
|
|
160
|
+
}), [renderLink, tableLabel]);
|
|
28
161
|
return /* @__PURE__ */ jsx("div", {
|
|
29
|
-
className: "gc-chat__markdown",
|
|
30
|
-
children: /* @__PURE__ */ jsx(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
162
|
+
className: className ? `gc-chat__markdown ${className}` : "gc-chat__markdown",
|
|
163
|
+
children: /* @__PURE__ */ jsx(MarkdownOptionsContext, {
|
|
164
|
+
value: options,
|
|
165
|
+
children: /* @__PURE__ */ jsx(Streamdown, {
|
|
166
|
+
mode,
|
|
167
|
+
isAnimating: isStreaming,
|
|
168
|
+
controls,
|
|
169
|
+
lineNumbers: false,
|
|
170
|
+
plugins,
|
|
171
|
+
remarkPlugins: mergedRemarkPlugins,
|
|
172
|
+
components: mergedComponents,
|
|
173
|
+
translations,
|
|
174
|
+
children: normalizeBreakTags(text)
|
|
175
|
+
})
|
|
35
176
|
})
|
|
36
177
|
});
|
|
37
178
|
});
|
|
38
179
|
//#endregion
|
|
39
|
-
export { MarkdownResponse };
|
|
180
|
+
export { MarkdownResponse, normalizeBreakTags };
|
|
40
181
|
|
|
41
182
|
//# sourceMappingURL=markdown.js.map
|
package/dist/markdown.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.js","names":[],"sources":["../src/markdown.tsx"],"sourcesContent":["\"use client\";\n\nimport { memo } from 'react';\nimport { Streamdown, type Components } from 'streamdown';\nimport { safeUrl } from './utils';\n\n// Stable component identities let completed Markdown blocks retain their DOM,\n// including focused links, while only the trailing block continues to change.\nconst components: Components = {\n a: ({ href, children }) => {\n const safe = safeUrl(href);\n return safe ? <a href={safe} target=\"_blank\" rel=\"noopener noreferrer\">{children}</a> : <span>{children}</span>;\n },\n img: ({ alt }) => <span className=\"gc-chat__image-alt\">{alt || '[image]'}</span>,\n};\n\n/** Default assistant streaming Markdown. Remote images require an explicit host renderer. */\nexport function MarkdownResponse(props: { text: string; isStreaming?: boolean }) {\n return <MemoizedMarkdown {...props} />;\n}\n\nconst MemoizedMarkdown = memo(function Markdown({ text, isStreaming = false }: { text: string; isStreaming?: boolean }) {\n return <div className=\"gc-chat__markdown\"><Streamdown isAnimating={isStreaming} controls={false}\n components={components}>{text}</Streamdown></div>;\n});\n"],"mappings":";;;;;;;AAQA,MAAM,aAAyB;CAC7B,IAAI,EAAE,MAAM,eAAe;EACzB,MAAM,OAAO,QAAQ,IAAI;EACzB,OAAO,OAAO,oBAAC,KAAD;GAAG,MAAM;GAAM,QAAO;GAAS,KAAI;GAAuB;EAAY,CAAA,IAAI,oBAAC,QAAD,EAAO,SAAe,CAAA;CAChH;CACA,MAAM,EAAE,UAAU,oBAAC,QAAD;EAAM,WAAU;EAAsB,UAAA,OAAO;CAAgB,CAAA;AACjF;;AAGA,SAAgB,iBAAiB,OAAgD;CAC/E,OAAO,oBAAC,kBAAD,EAAkB,GAAI,MAAQ,CAAA;AACvC;AAEA,MAAM,mBAAmB,KAAK,SAAS,SAAS,EAAE,MAAM,cAAc,SAAkD;CACtH,OAAO,oBAAC,OAAD;EAAK,WAAU;EAAoB,UAAA,oBAAC,YAAD;GAAY,aAAa;GAAa,UAAU;GAC5E;GAAa,UAAA;EAAiB,CAAA;CAAM,CAAA;AACpD,CAAC"}
|
|
1
|
+
{"version":3,"file":"markdown.js","names":[],"sources":["../src/markdown.tsx"],"sourcesContent":["\"use client\";\n\nimport { cjk } from '@streamdown/cjk';\nimport { createContext, memo, useContext, useEffect, useMemo, useState, type ComponentProps, type ReactNode } from 'react';\nimport remarkBreaks from 'remark-breaks';\nimport {\n defaultRemarkPlugins,\n Streamdown,\n type Components,\n type ControlsConfig,\n type CustomRenderer,\n type PluginConfig,\n type StreamdownProps,\n type StreamdownTranslations,\n} from 'streamdown';\nimport { safeUrl } from './utils';\n\n/** Return `undefined` to fall back to the default safe external link. */\nexport type MarkdownLinkRenderer = (link: { href?: string; title?: string; children: ReactNode }) => ReactNode | undefined;\n\nexport interface MarkdownResponseProps {\n text: string;\n isStreaming?: boolean;\n className?: string;\n /** Extra remark plugins. Streamdown parses each top-level block separately, so plugins see one block at a time. */\n remarkPlugins?: StreamdownProps['remarkPlugins'];\n /** Element overrides merged over the safe defaults. Keep identities stable to preserve completed blocks. */\n components?: Components;\n /** Host-specific links such as citations. Receives the raw href before the HTTP(S) safety check. */\n renderLink?: MarkdownLinkRenderer;\n /** Fenced code renderers by language. They take precedence over syntax highlighting. */\n codeRenderers?: CustomRenderer[];\n translations?: Partial<StreamdownTranslations>;\n /** `static` parses the whole text as one document, for host plugins that must see every block at once. Defaults to `streaming`. */\n mode?: StreamdownProps['mode'];\n /** Accessible name of the keyboard-scrollable table region. Defaults to \"Table\". */\n tableLabel?: string;\n}\n\n// Per-render host options travel by context so component identities stay stable.\nconst MarkdownOptionsContext = createContext<{ renderLink?: MarkdownLinkRenderer; tableLabel: string }>({ tableLabel: 'Table' });\n\nfunction MarkdownLink({ href, title, children }: ComponentProps<'a'>) {\n const { renderLink } = useContext(MarkdownOptionsContext);\n const custom = renderLink?.({ href, title, children });\n if (custom !== undefined) return <>{custom}</>;\n const safe = safeUrl(href);\n return safe ? <a href={safe} title={title} target=\"_blank\" rel=\"noopener noreferrer\">{children}</a> : <span>{children}</span>;\n}\n\n// Stable component identities let completed Markdown blocks retain their DOM,\n// including focused links, while only the trailing block continues to change.\nconst defaultComponents: Components = {\n a: ({ href, title, children }) => <MarkdownLink href={href} title={title}>{children}</MarkdownLink>,\n img: ({ alt }) => <span className=\"gc-chat__image-alt\">{alt || '[image]'}</span>,\n // Keep the semantic element; Streamdown's default renders a styled span.\n strong: ({ children }) => <strong data-streamdown=\"strong\">{children}</strong>,\n // Wide tables scroll inside a focusable region so keyboard users can reach every column.\n table: ({ children }) => <MarkdownTable>{children}</MarkdownTable>,\n};\n\nfunction MarkdownTable({ children }: { children?: ReactNode }) {\n const { tableLabel } = useContext(MarkdownOptionsContext);\n return <div data-streamdown=\"table-wrapper\">\n <div role=\"region\" aria-label={tableLabel} tabIndex={0}><table data-streamdown=\"table\">{children}</table></div>\n </div>;\n}\n\nconst breakTag = /<\\/?br\\s*\\/?>/gi;\n\n/**\n * Models often write `<br>` for line breaks. Outside code and tables it becomes a newline, so a\n * leading tag cannot turn the following Markdown into a raw HTML block; table cells keep it as a\n * cell line break.\n */\nexport function normalizeBreakTags(text: string): string {\n if (!/<\\/?br/i.test(text)) return text;\n let fence: string | undefined;\n return text.split('\\n').map(line => {\n const marker = /^ {0,3}(`{3,}|~{3,})/.exec(line)?.[1];\n if (fence) {\n if (marker && marker[0] === fence[0] && marker.length >= fence.length) fence = undefined;\n return line;\n }\n if (marker) { fence = marker; return line; }\n if (line.includes('|')) return line;\n // Even segments sit outside inline code spans.\n return line.split(/(`+[^`]*`+)/).map((part, index) => index % 2 ? part : part.replace(breakTag, '\\n')).join('');\n }).join('\\n');\n}\n\n// Single newlines in model prose stay visible, matching mainstream AI chats.\nconst baseRemarkPlugins = [...Object.values(defaultRemarkPlugins), remarkBreaks];\nconst controls: ControlsConfig = { code: { copy: true, download: false }, table: false, mermaid: false };\n\ntype LazyPlugin = 'code' | 'math' | 'mermaid';\ntype LoadedPlugins = Pick<PluginConfig, LazyPlugin>;\n\n// Heavy renderers load only when a reply needs them; until then the content stays readable as plain code or text.\nconst loaders: { [K in LazyPlugin]: () => Promise<NonNullable<PluginConfig[K]>> } = {\n code: () => import('@streamdown/code').then(module => module.code),\n math: () => import('./markdown-math').then(module => module.math),\n mermaid: () => import('@streamdown/mermaid').then(module => module.mermaid),\n};\nconst loaded: LoadedPlugins = {};\nconst pending = new Map<LazyPlugin, Promise<void>>();\n\nfunction requiredPlugins(text: string): LazyPlugin[] {\n const needed: LazyPlugin[] = [];\n if (/^ {0,3}(?:```|~~~)/m.test(text)) needed.push('code');\n if (/^ {0,3}(?:```|~~~)\\s*mermaid\\b/im.test(text)) needed.push('mermaid');\n if (text.includes('$$')) needed.push('math');\n return needed;\n}\n\nfunction loadPlugin(name: LazyPlugin): Promise<void> {\n let request = pending.get(name);\n if (!request) {\n request = loaders[name]().then(\n plugin => { (loaded as Record<LazyPlugin, unknown>)[name] = plugin; },\n // A failed chunk keeps the plain rendering; a later reply may retry.\n () => { pending.delete(name); },\n );\n pending.set(name, request);\n }\n return request;\n}\n\nfunction useMarkdownPlugins(text: string): PluginConfig {\n const missing = requiredPlugins(text).filter(name => !loaded[name]).join(',');\n const [, setVersion] = useState(0);\n useEffect(() => {\n if (!missing) return;\n let active = true;\n void Promise.all(missing.split(',').map(name => loadPlugin(name as LazyPlugin))).then(() => {\n if (active) setVersion(version => version + 1);\n });\n return () => { active = false; };\n }, [missing]);\n const { code, math, mermaid } = loaded;\n // Streamdown compares plugin config by identity, so it changes only when a plugin arrives.\n return useMemo(() => ({ cjk, code, math, mermaid }), [code, math, mermaid]);\n}\n\n/** Default assistant streaming Markdown. Remote images require an explicit host renderer. */\nexport function MarkdownResponse(props: MarkdownResponseProps) {\n return <MemoizedMarkdown {...props} />;\n}\n\nconst MemoizedMarkdown = memo(function Markdown({ text, isStreaming = false, className, remarkPlugins, components, renderLink, codeRenderers, translations, mode, tableLabel = 'Table' }: MarkdownResponseProps) {\n const basePlugins = useMarkdownPlugins(text);\n const plugins = useMemo(() => codeRenderers?.length ? { ...basePlugins, renderers: codeRenderers } : basePlugins, [basePlugins, codeRenderers]);\n const mergedRemarkPlugins = useMemo(() => remarkPlugins?.length ? [...baseRemarkPlugins, ...remarkPlugins] : baseRemarkPlugins, [remarkPlugins]);\n const mergedComponents = useMemo(() => components ? { ...defaultComponents, ...components } : defaultComponents, [components]);\n const options = useMemo(() => ({ renderLink, tableLabel }), [renderLink, tableLabel]);\n return <div className={className ? `gc-chat__markdown ${className}` : 'gc-chat__markdown'}>\n <MarkdownOptionsContext value={options}>\n <Streamdown mode={mode} isAnimating={isStreaming} controls={controls} lineNumbers={false} plugins={plugins} remarkPlugins={mergedRemarkPlugins}\n components={mergedComponents} translations={translations}>{normalizeBreakTags(text)}</Streamdown>\n </MarkdownOptionsContext>\n </div>;\n});\n"],"mappings":"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"}
|
package/dist/styles.css
CHANGED
|
@@ -180,6 +180,16 @@
|
|
|
180
180
|
.gc-chat__markdown [data-streamdown='strong'] { font-weight: 600; }
|
|
181
181
|
.gc-chat__markdown [data-streamdown='code-block'] { min-width: 0; max-width: 100%; margin: 16px 0; border: 1px solid var(--gc-chat-border); border-radius: 12px; overflow: hidden; background: var(--gc-chat-surface); }
|
|
182
182
|
.gc-chat__markdown [data-streamdown='code-block-header'] { padding: 6px 13px; border-bottom: 1px solid var(--gc-chat-border); background: var(--gc-chat-bg); color: var(--gc-chat-muted); font-size: 11px; font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace; }
|
|
183
|
+
.gc-chat__markdown [data-streamdown='code-block'] { position: relative; }
|
|
184
|
+
.gc-chat__markdown [data-streamdown='code-block'] > div:has(> [data-streamdown='code-block-actions']) { position: absolute; top: 3px; right: 6px; z-index: 1; }
|
|
185
|
+
.gc-chat__markdown [data-streamdown='code-block-actions'] { display: flex; align-items: center; gap: 4px; }
|
|
186
|
+
.gc-chat__markdown [data-streamdown='code-block-copy-button'] { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--gc-chat-muted); cursor: pointer; }
|
|
187
|
+
.gc-chat__markdown [data-streamdown='code-block-copy-button']:hover { background: var(--gc-chat-surface-hover); color: var(--gc-chat-text, inherit); }
|
|
188
|
+
.gc-chat__markdown [data-streamdown='code-block-copy-button']:focus-visible { outline: 2px solid var(--gc-chat-accent); outline-offset: 1px; }
|
|
189
|
+
.gc-chat__markdown [data-streamdown='code-block-copy-button'] svg { width: 14px; height: 14px; }
|
|
190
|
+
.gc-chat__markdown [data-streamdown='mermaid-block'] { margin: 16px 0; padding: 12px; overflow: auto; border: 1px solid var(--gc-chat-border); border-radius: 12px; background: var(--gc-chat-surface); }
|
|
191
|
+
.gc-chat__markdown [data-streamdown='mermaid'] svg { max-width: 100%; height: auto; }
|
|
192
|
+
.gc-chat__markdown .katex-display { margin: 12px 0; overflow-x: auto; overflow-y: hidden; }
|
|
183
193
|
.gc-chat__markdown [data-streamdown='code-block-body'] { overflow: auto; max-width: 100%; padding: 12px 14px; }
|
|
184
194
|
.gc-chat__markdown [data-streamdown='code-block-body'] pre { margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; overflow: visible; }
|
|
185
195
|
.gc-chat__markdown [data-streamdown='code-block-body'] code { display: block; width: max-content; min-width: 100%; font-size: 12px; white-space: pre; }
|
|
@@ -187,6 +197,7 @@
|
|
|
187
197
|
.gc-chat__markdown [data-streamdown='code-block-body'] code > span > span { color: var(--sdm-c, inherit); background: var(--sdm-tbg, transparent); }
|
|
188
198
|
.gc-chat__markdown [data-streamdown='table-wrapper'] { max-width: 100%; margin: 16px 0; overflow: hidden; border: 1px solid var(--gc-chat-border); border-radius: 10px; }
|
|
189
199
|
.gc-chat__markdown [data-streamdown='table-wrapper'] > div { max-width: 100%; overflow: auto; }
|
|
200
|
+
.gc-chat__markdown [data-streamdown='table-wrapper'] > [role='region']:focus-visible { outline: 2px solid var(--gc-chat-accent); outline-offset: -2px; }
|
|
190
201
|
.gc-chat__markdown [data-streamdown='table'] { margin: 0; min-width: 100%; font-size: 12px; line-height: 1.75; }
|
|
191
202
|
.gc-chat__markdown [data-streamdown='table-header'] { background: var(--gc-chat-surface-hover); }
|
|
192
203
|
.gc-chat__markdown [data-streamdown='table-header-cell'], .gc-chat__markdown [data-streamdown='table-cell'] { min-width: 100px; padding: 10px 12px; }
|
package/docs/api-reference.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
| `/context` | `useChatContext`、`ContextTray`、`createTextSelectionAdapter` |
|
|
13
13
|
| `/appearance` | `ChatAppearanceProvider`、`ChatIcon`、`ChatIconButton` 和类型 |
|
|
14
14
|
| `/voice` | `useSpeechInput`、`createBrowserSpeechAdapter`、语音契约与错误类型 |
|
|
15
|
-
| `/markdown` | `MarkdownResponse`;Streamdown
|
|
15
|
+
| `/markdown` | `MarkdownResponse`、`MarkdownResponseProps`、`MarkdownLinkRenderer`;Streamdown 及其中日韩、代码高亮、公式和 Mermaid 插件随包自动安装 |
|
|
16
16
|
| `/styles.css` | 组件作用域样式;不依赖 Tailwind |
|
|
17
17
|
|
|
18
18
|
`@galaxycore/ai-chat-gateway` 是单独的服务器包,只能在 Node 服务端导入。
|
|
@@ -170,3 +170,27 @@ const describeTool: ToolPresentationResolver = ({ part }) => {
|
|
|
170
170
|
仅活跃消息的准备/运行状态显示动画。聊天闲置但工具尚无最终结果时显示“等待结果”,不会伪造完成或中断;客户端工具可能在传输结束后继续执行。`preliminary` 输出不计为最终完成。最终停止/中断信息应来自运行时或宿主业务 renderer,不能从网络闲置状态推断。
|
|
171
171
|
|
|
172
172
|
`renderers[part.type]` > `tools[toolName]` > 默认动作行。前两种完整 renderer 不受 `toolPresentation` 干预。示例的 **工具体验** 页面 `#/examples/tool-activity` 使用明确标注的演示数据,可切换运行、成功、失败、审批和等待状态;不会执行真实工具。
|
|
173
|
+
|
|
174
|
+
## MarkdownResponse
|
|
175
|
+
|
|
176
|
+
助手回答的默认渲染器,基于 Streamdown,也可以单独从 `@galaxycore/ai-chat/markdown` 引入。内置能力:
|
|
177
|
+
|
|
178
|
+
- 流式未闭合语法修复(remend)与按块缓存,已完成的块保留 DOM 和焦点。
|
|
179
|
+
- 中日韩强调修复:`**` 紧邻全角标点和汉字时也能正确加粗。
|
|
180
|
+
- 单个换行保留为换行,和主流 AI 对话一致。
|
|
181
|
+
- 代码高亮(Shiki)、公式(KaTeX,`$$…$$`)和 Mermaid 图表按内容懒加载,未用到时不进入首屏;加载失败时保留纯文本代码。代码块带复制按钮。
|
|
182
|
+
- 安全默认值:不加载模型给出的图片,只显示替代文本;外链只接受 HTTP(S) 和站内绝对路径;HTML 经过清洗。
|
|
183
|
+
|
|
184
|
+
| Prop | 类型 | 说明 |
|
|
185
|
+
| --- | --- | --- |
|
|
186
|
+
| `text` | `string` | Markdown 文本 |
|
|
187
|
+
| `isStreaming` | `boolean` | 是否仍在生成 |
|
|
188
|
+
| `className` | `string` | 追加到 `.gc-chat__markdown` 容器 |
|
|
189
|
+
| `renderLink` | `({ href, title, children }) => ReactNode \| undefined` | 宿主链接(例如引用角标);返回 `undefined` 时使用默认安全链接 |
|
|
190
|
+
| `codeRenderers` | `CustomRenderer[]` | 按代码块语言替换渲染,优先于语法高亮 |
|
|
191
|
+
| `remarkPlugins` | `PluggableList` | 追加在内置 GFM、中日韩和换行插件之后;Streamdown 按块解析,插件一次只看到一个顶层块 |
|
|
192
|
+
| `components` | `Components` | 覆盖元素渲染;保持引用稳定以免已完成的块重新挂载 |
|
|
193
|
+
| `translations` | `Partial<StreamdownTranslations>` | 复制按钮等控件文案 |
|
|
194
|
+
| `mode` | `'streaming' \| 'static'` | `static` 一次解析整段文本,供需要看到全部块的宿主插件使用;默认 `streaming` |
|
|
195
|
+
| `tableLabel` | `string` | 可键盘滚动的表格区域名称,默认 `Table` |
|
|
196
|
+
|
package/docs/publishing.md
CHANGED
|
@@ -36,7 +36,7 @@ mkdir -p artifacts
|
|
|
36
36
|
npm pack --pack-destination artifacts
|
|
37
37
|
|
|
38
38
|
# 消费项目:替换为真实文件的绝对路径
|
|
39
|
-
npm install /absolute/path/to/galaxycore-ai-chat-0.
|
|
39
|
+
npm install /absolute/path/to/galaxycore-ai-chat-0.12.0.tgz
|
|
40
40
|
npm install ai@^7.0.137 @ai-sdk/react@^4.0.140
|
|
41
41
|
```
|
|
42
42
|
|
|
@@ -53,7 +53,7 @@ npm run check
|
|
|
53
53
|
npm pack --dry-run
|
|
54
54
|
mkdir -p artifacts
|
|
55
55
|
npm pack --pack-destination artifacts
|
|
56
|
-
tar -tzf artifacts/galaxycore-ai-chat-0.
|
|
56
|
+
tar -tzf artifacts/galaxycore-ai-chat-0.12.0.tgz
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
`check` 执行类型检查、组件与网关测试、库构建和可部署示例构建;示例构建包含文档站。`prepack` 构建库,`prepublishOnly` 执行完整检查。tarball 应包含公开 JS 入口、声明、CSS、README 和文档,不应包含模型凭据、认证配置或业务数据。
|
|
@@ -85,12 +85,12 @@ CI 构建和测试步骤无需发布凭据。发布 job 可使用 CI secret 注
|
|
|
85
85
|
|
|
86
86
|
## 版本与发布
|
|
87
87
|
|
|
88
|
-
当前组件版本为 `0.
|
|
88
|
+
当前组件版本为 `0.12.0`,网关版本为 `0.2.0`,两者独立升级。0.x 阶段,修复使用 patch,新增功能和未冻结接口调整使用 minor,并在 changelog 说明兼容性。稳定 API 后再发布 1.0。
|
|
89
89
|
|
|
90
90
|
下面以 npmjs.org 公开发布为例。命令会实际上传产物,应在完成验收后由发布负责人执行;发布私有 registry 时替换地址,并按该服务调整可见性参数:
|
|
91
91
|
|
|
92
92
|
```sh
|
|
93
|
-
npm publish ./artifacts/galaxycore-ai-chat-0.
|
|
93
|
+
npm publish ./artifacts/galaxycore-ai-chat-0.12.0.tgz \
|
|
94
94
|
--access public --tag latest \
|
|
95
95
|
--registry=https://registry.npmjs.org/
|
|
96
96
|
```
|
|
@@ -98,7 +98,7 @@ npm publish ./artifacts/galaxycore-ai-chat-0.11.1.tgz \
|
|
|
98
98
|
使用 tarball 发布时,先显式执行完整检查,不依赖源仓库的生命周期脚本一定被触发。`latest` 是不指定版本安装时使用的标签,不代表 API 已冻结。需要独立试用通道时,可以采用预发布版本及 `next` 标签。发布后检查远端版本和完整性:
|
|
99
99
|
|
|
100
100
|
```sh
|
|
101
|
-
npm view @galaxycore/ai-chat@0.
|
|
101
|
+
npm view @galaxycore/ai-chat@0.12.0 version dist.integrity \
|
|
102
102
|
--registry=https://registry.npmjs.org/
|
|
103
103
|
npm dist-tag ls @galaxycore/ai-chat \
|
|
104
104
|
--registry=https://registry.npmjs.org/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galaxycore/ai-chat",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Composable React AI chat for GalaxyCore, powered by Vercel AI SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -109,7 +109,13 @@
|
|
|
109
109
|
"vitest": "5.0.4"
|
|
110
110
|
},
|
|
111
111
|
"dependencies": {
|
|
112
|
+
"@streamdown/cjk": "^1.0.5",
|
|
113
|
+
"@streamdown/code": "^2.0.1",
|
|
114
|
+
"@streamdown/math": "^1.0.4",
|
|
115
|
+
"@streamdown/mermaid": "^1.0.4",
|
|
116
|
+
"katex": "^0.16.47",
|
|
112
117
|
"lucide-react": "1.55.0",
|
|
113
|
-
"
|
|
118
|
+
"remark-breaks": "^4.0.0",
|
|
119
|
+
"streamdown": "^2.8.1"
|
|
114
120
|
}
|
|
115
121
|
}
|