@assistkick/create 1.28.0 → 1.29.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/package.json +1 -1
- package/templates/assistkick-product-system/packages/frontend/src/components/ChatMessageContent.tsx +1 -40
- package/templates/assistkick-product-system/packages/frontend/src/components/ToolDetailView.tsx +2 -28
- package/templates/assistkick-product-system/packages/frontend/src/components/markdownComponents.tsx +50 -0
package/package.json
CHANGED
package/templates/assistkick-product-system/packages/frontend/src/components/ChatMessageContent.tsx
CHANGED
|
@@ -8,14 +8,11 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import ReactMarkdown from 'react-markdown';
|
|
11
|
-
import type { Components } from 'react-markdown';
|
|
12
11
|
import remarkGfm from 'remark-gfm';
|
|
13
|
-
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
|
|
14
|
-
import { oneDark } from 'react-syntax-highlighter/dist/esm/styles/prism';
|
|
15
12
|
import type { ContentBlock, ToolResultBlock, ToolUseBlock } from '../hooks/use_chat_stream';
|
|
16
13
|
import { ToolUseCard } from './ToolUseCard';
|
|
17
14
|
import { HighlightedText, countMatches } from './HighlightedText';
|
|
18
|
-
import {
|
|
15
|
+
import { markdownComponents } from './markdownComponents';
|
|
19
16
|
|
|
20
17
|
interface ChatMessageContentProps {
|
|
21
18
|
content: ContentBlock[];
|
|
@@ -70,42 +67,6 @@ const chatMarkdownClass = [
|
|
|
70
67
|
'[&_td]:px-2.5 [&_td]:py-1 [&_td]:border [&_td]:border-edge [&_td]:text-xs',
|
|
71
68
|
].join(' ');
|
|
72
69
|
|
|
73
|
-
/**
|
|
74
|
-
* Custom react-markdown components for syntax-highlighted code blocks.
|
|
75
|
-
* Fenced blocks (```lang) get Prism highlighting; inline `code` stays as a styled <code>.
|
|
76
|
-
*/
|
|
77
|
-
const markdownComponents: Components = {
|
|
78
|
-
code({ className, children, ...props }) {
|
|
79
|
-
const match = /language-(\w+)/.exec(className || '');
|
|
80
|
-
const codeString = String(children).replace(/\n$/, '');
|
|
81
|
-
|
|
82
|
-
// Fenced code block — has a language class set by react-markdown
|
|
83
|
-
if (match) {
|
|
84
|
-
// Mermaid code blocks render as interactive SVG diagrams
|
|
85
|
-
if (match[1] === 'mermaid') {
|
|
86
|
-
return <MermaidBlock code={codeString} />;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return (
|
|
90
|
-
<SyntaxHighlighter
|
|
91
|
-
style={oneDark}
|
|
92
|
-
language={match[1]}
|
|
93
|
-
PreTag="div"
|
|
94
|
-
customStyle={{ margin: 0, borderRadius: 6, fontSize: 12 }}
|
|
95
|
-
>
|
|
96
|
-
{codeString}
|
|
97
|
-
</SyntaxHighlighter>
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// Inline code
|
|
102
|
-
return (
|
|
103
|
-
<code className={className} {...props}>
|
|
104
|
-
{children}
|
|
105
|
-
</code>
|
|
106
|
-
);
|
|
107
|
-
},
|
|
108
|
-
};
|
|
109
70
|
|
|
110
71
|
export const ChatMessageContent = ({ content, isStreaming, searchQuery = '', activeMatchIndex = -1, matchIndexOffset = 0 }: ChatMessageContentProps) => {
|
|
111
72
|
const resultMap = buildResultMap(content);
|
package/templates/assistkick-product-system/packages/frontend/src/components/ToolDetailView.tsx
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
|
|
8
8
|
import { oneDark } from 'react-syntax-highlighter/dist/esm/styles/prism';
|
|
9
9
|
import ReactMarkdown from 'react-markdown';
|
|
10
|
-
import type { Components } from 'react-markdown';
|
|
11
10
|
import remarkGfm from 'remark-gfm';
|
|
12
11
|
import type { ToolResultBlock } from '../hooks/use_chat_stream';
|
|
12
|
+
import { markdownComponents } from './markdownComponents';
|
|
13
13
|
|
|
14
14
|
/** Map common file extensions to Prism language identifiers. */
|
|
15
15
|
const extToLang: Record<string, string> = {
|
|
@@ -76,32 +76,6 @@ const stripLineNumbers = (text: string): { code: string; startLine: number } =>
|
|
|
76
76
|
};
|
|
77
77
|
};
|
|
78
78
|
|
|
79
|
-
/** Markdown components for Agent output — syntax-highlighted fenced code blocks. */
|
|
80
|
-
const mdComponents: Components = {
|
|
81
|
-
code({ className, children, ...props }) {
|
|
82
|
-
const match = /language-(\w+)/.exec(className || '');
|
|
83
|
-
const codeString = String(children).replace(/\n$/, '');
|
|
84
|
-
|
|
85
|
-
if (match) {
|
|
86
|
-
return (
|
|
87
|
-
<SyntaxHighlighter
|
|
88
|
-
style={oneDark}
|
|
89
|
-
language={match[1]}
|
|
90
|
-
PreTag="div"
|
|
91
|
-
customStyle={{ margin: 0, borderRadius: 6, fontSize: 12 }}
|
|
92
|
-
>
|
|
93
|
-
{codeString}
|
|
94
|
-
</SyntaxHighlighter>
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
return (
|
|
99
|
-
<code className={className} {...props}>
|
|
100
|
-
{children}
|
|
101
|
-
</code>
|
|
102
|
-
);
|
|
103
|
-
},
|
|
104
|
-
};
|
|
105
79
|
|
|
106
80
|
/** Tailwind classes for markdown rendering inside tool detail panels. */
|
|
107
81
|
const mdClass = [
|
|
@@ -249,7 +223,7 @@ const AgentDetailView = ({ input, result }: Omit<ToolDetailViewProps, 'toolName'
|
|
|
249
223
|
</pre>
|
|
250
224
|
) : (
|
|
251
225
|
<div className={mdClass}>
|
|
252
|
-
<ReactMarkdown remarkPlugins={[remarkGfm]} components={
|
|
226
|
+
<ReactMarkdown remarkPlugins={[remarkGfm]} components={markdownComponents}>
|
|
253
227
|
{content || '(empty)'}
|
|
254
228
|
</ReactMarkdown>
|
|
255
229
|
</div>
|
package/templates/assistkick-product-system/packages/frontend/src/components/markdownComponents.tsx
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared react-markdown component overrides used across all markdown renderers.
|
|
3
|
+
*
|
|
4
|
+
* - ol/ul: inline list-style-type to reliably override Tailwind v4 preflight reset
|
|
5
|
+
* - code: syntax-highlighted fenced blocks (Prism) + mermaid diagram rendering
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { Components } from 'react-markdown';
|
|
9
|
+
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
|
|
10
|
+
import { oneDark } from 'react-syntax-highlighter/dist/esm/styles/prism';
|
|
11
|
+
import { MermaidBlock } from './MermaidBlock';
|
|
12
|
+
|
|
13
|
+
export const markdownComponents: Components = {
|
|
14
|
+
ol({ children, ...props }) {
|
|
15
|
+
return <ol {...props} style={{ listStyleType: 'decimal' }}>{children}</ol>;
|
|
16
|
+
},
|
|
17
|
+
ul({ children, ...props }) {
|
|
18
|
+
return <ul {...props} style={{ listStyleType: 'disc' }}>{children}</ul>;
|
|
19
|
+
},
|
|
20
|
+
code({ className, children, ...props }) {
|
|
21
|
+
const match = /language-(\w+)/.exec(className || '');
|
|
22
|
+
const codeString = String(children).replace(/\n$/, '');
|
|
23
|
+
|
|
24
|
+
// Fenced code block — has a language class set by react-markdown
|
|
25
|
+
if (match) {
|
|
26
|
+
// Mermaid code blocks render as interactive SVG diagrams
|
|
27
|
+
if (match[1] === 'mermaid') {
|
|
28
|
+
return <MermaidBlock code={codeString} />;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<SyntaxHighlighter
|
|
33
|
+
style={oneDark}
|
|
34
|
+
language={match[1]}
|
|
35
|
+
PreTag="div"
|
|
36
|
+
customStyle={{ margin: 0, borderRadius: 6, fontSize: 12 }}
|
|
37
|
+
>
|
|
38
|
+
{codeString}
|
|
39
|
+
</SyntaxHighlighter>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Inline code
|
|
44
|
+
return (
|
|
45
|
+
<code className={className} {...props}>
|
|
46
|
+
{children}
|
|
47
|
+
</code>
|
|
48
|
+
);
|
|
49
|
+
},
|
|
50
|
+
};
|