@copilotkit/react-ui 1.56.2 → 1.56.4
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/dist/index.cjs +16 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +16 -9
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +16 -9
- package/dist/index.umd.js.map +1 -1
- package/package.json +4 -4
- package/src/components/chat/Markdown.tsx +20 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@copilotkit/react-ui",
|
|
3
|
-
"version": "1.56.
|
|
3
|
+
"version": "1.56.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
"rehype-raw": "^7.0.0",
|
|
49
49
|
"remark-gfm": "^4.0.1",
|
|
50
50
|
"remark-math": "^6.0.0",
|
|
51
|
-
"@copilotkit/react-core": "1.56.
|
|
52
|
-
"@copilotkit/
|
|
53
|
-
"@copilotkit/
|
|
51
|
+
"@copilotkit/react-core": "1.56.4",
|
|
52
|
+
"@copilotkit/shared": "1.56.4",
|
|
53
|
+
"@copilotkit/runtime-client-gql": "1.56.4"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/react": "^19.1.0",
|
|
@@ -122,39 +122,42 @@ const defaultComponents: Components = {
|
|
|
122
122
|
),
|
|
123
123
|
};
|
|
124
124
|
|
|
125
|
-
const MemoizedReactMarkdown: FC<Options> = memo(
|
|
126
|
-
ReactMarkdown,
|
|
127
|
-
(prevProps, nextProps) =>
|
|
128
|
-
prevProps.children === nextProps.children &&
|
|
129
|
-
prevProps.components === nextProps.components &&
|
|
130
|
-
prevProps.urlTransform === nextProps.urlTransform,
|
|
131
|
-
);
|
|
125
|
+
const MemoizedReactMarkdown: FC<Options> = memo(ReactMarkdown);
|
|
132
126
|
|
|
133
|
-
type MarkdownProps = {
|
|
127
|
+
type MarkdownProps = Omit<Options, "children"> & {
|
|
134
128
|
content: string;
|
|
135
|
-
components?: Components;
|
|
136
|
-
urlTransform?: Options["urlTransform"];
|
|
137
129
|
};
|
|
138
130
|
|
|
139
131
|
export const Markdown = ({
|
|
140
132
|
content,
|
|
141
133
|
components,
|
|
142
|
-
|
|
134
|
+
remarkPlugins,
|
|
135
|
+
rehypePlugins,
|
|
136
|
+
...rest
|
|
143
137
|
}: MarkdownProps) => {
|
|
144
138
|
const mergedComponents = useMemo(
|
|
145
139
|
() => ({ ...defaultComponents, ...components }),
|
|
146
140
|
[components],
|
|
147
141
|
);
|
|
142
|
+
const mergedRemarkPlugins = useMemo<Options["remarkPlugins"]>(
|
|
143
|
+
() => [
|
|
144
|
+
remarkGfm,
|
|
145
|
+
[remarkMath, { singleDollarTextMath: false }],
|
|
146
|
+
...(remarkPlugins ?? []),
|
|
147
|
+
],
|
|
148
|
+
[remarkPlugins],
|
|
149
|
+
);
|
|
150
|
+
const mergedRehypePlugins = useMemo<Options["rehypePlugins"]>(
|
|
151
|
+
() => [rehypeRaw, ...(rehypePlugins ?? [])],
|
|
152
|
+
[rehypePlugins],
|
|
153
|
+
);
|
|
148
154
|
return (
|
|
149
155
|
<div className="copilotKitMarkdown">
|
|
150
156
|
<MemoizedReactMarkdown
|
|
157
|
+
{...rest}
|
|
151
158
|
components={mergedComponents}
|
|
152
|
-
remarkPlugins={
|
|
153
|
-
|
|
154
|
-
[remarkMath, { singleDollarTextMath: false }],
|
|
155
|
-
]}
|
|
156
|
-
rehypePlugins={[rehypeRaw]}
|
|
157
|
-
{...(urlTransform !== undefined ? { urlTransform } : {})}
|
|
159
|
+
remarkPlugins={mergedRemarkPlugins}
|
|
160
|
+
rehypePlugins={mergedRehypePlugins}
|
|
158
161
|
>
|
|
159
162
|
{content}
|
|
160
163
|
</MemoizedReactMarkdown>
|