@agentscope-ai/chat 1.1.39 → 1.1.41-beta.1764749089549

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.
Files changed (233) hide show
  1. package/bin/starter_webui.zip +0 -0
  2. package/components/AgentScopeRuntimeWebUI/core/AgentScopeRuntime/Response/Builder.tsx +8 -4
  3. package/components/ImageGenerator/index.tsx +1 -1
  4. package/components/Markdown/Markdown.tsx +105 -0
  5. package/components/Markdown/{Markdown/defaultComponents → core/components}/CodeBlock.tsx +1 -1
  6. package/components/Markdown/core/components/Null.tsx +1 -0
  7. package/components/Markdown/core/components/Raw.tsx +18 -0
  8. package/components/Markdown/{Markdown → core}/hooks/useCitationsData.tsx +3 -7
  9. package/components/Markdown/core/hooks/useCursorContent.tsx +15 -0
  10. package/components/Markdown/{Markdown/hooks/useTyping.ts → core/hooks/useTyping.tsx} +4 -1
  11. package/components/Markdown/core/index.tsx +18 -0
  12. package/components/Markdown/{plugins → core/plugins}/citations/CitationComponent.tsx +5 -3
  13. package/components/Markdown/{plugins → core/plugins}/citations/index.tsx +3 -4
  14. package/components/Markdown/{plugins → core/plugins}/cursor/Underline.tsx +1 -1
  15. package/components/Markdown/{plugins → core/plugins}/cursor/index.tsx +8 -8
  16. package/components/Markdown/demo/cursor.tsx +2 -3
  17. package/components/Markdown/index.en-US.md +1 -2
  18. package/components/Markdown/index.tsx +6 -0
  19. package/components/Markdown/index.zh-CN.md +1 -2
  20. package/components/Markdown/{Markdown/style.ts → styles.ts} +12 -21
  21. package/components/Markdown/types.tsx +94 -0
  22. package/components/index.ts +1 -3
  23. package/lib/AgentScopeRuntimeWebUI/core/AgentScopeRuntime/Response/Builder.js +5 -3
  24. package/lib/ImageGenerator/index.js +1 -1
  25. package/lib/Markdown/Markdown.d.ts +4 -0
  26. package/lib/Markdown/Markdown.js +110 -0
  27. package/lib/Markdown/core/components/Null.d.ts +2 -0
  28. package/lib/Markdown/core/components/Null.js +3 -0
  29. package/lib/Markdown/core/components/Raw.d.ts +8 -0
  30. package/lib/Markdown/core/components/Raw.js +13 -0
  31. package/lib/Markdown/core/hooks/useCitationsData.d.ts +6 -0
  32. package/lib/Markdown/{Markdown → core}/hooks/useCitationsData.js +1 -1
  33. package/lib/Markdown/core/hooks/useCursorContent.d.ts +4 -0
  34. package/lib/Markdown/core/hooks/useCursorContent.js +14 -0
  35. package/lib/Markdown/core/hooks/useTyping.d.ts +5 -0
  36. package/lib/Markdown/{Markdown → core}/hooks/useTyping.js +3 -2
  37. package/lib/Markdown/core/index.d.ts +2 -0
  38. package/lib/Markdown/{Markdown/hooks/useAnimation.js → core/index.js} +23 -23
  39. package/lib/Markdown/{plugins → core/plugins}/citations/CitationComponent.js +5 -5
  40. package/lib/Markdown/{plugins → core/plugins}/citations/index.d.ts +1 -2
  41. package/lib/Markdown/{plugins → core/plugins}/citations/index.js +1 -1
  42. package/lib/Markdown/{plugins → core/plugins}/cursor/Dot.js +1 -1
  43. package/lib/Markdown/{plugins → core/plugins}/cursor/Underline.js +1 -1
  44. package/lib/Markdown/{plugins → core/plugins}/cursor/index.js +4 -4
  45. package/lib/Markdown/index.d.ts +2 -1
  46. package/lib/Markdown/styles.js +32 -0
  47. package/lib/Markdown/types.d.ts +78 -0
  48. package/lib/index.d.ts +0 -2
  49. package/lib/index.js +0 -2
  50. package/package.json +7 -31
  51. package/components/AGUI/components/HelpModal/icons.tsx +0 -68
  52. package/components/AGUI/components/HelpModal/index.tsx +0 -1
  53. package/components/AGUI/components/HelpModal/modal.tsx +0 -101
  54. package/components/AGUI/components/chat/Button.tsx +0 -18
  55. package/components/AGUI/components/chat/Chat.tsx +0 -780
  56. package/components/AGUI/components/chat/ChatContext.tsx +0 -248
  57. package/components/AGUI/components/chat/CodeBlock.tsx +0 -406
  58. package/components/AGUI/components/chat/Header.tsx +0 -22
  59. package/components/AGUI/components/chat/Icons.tsx +0 -237
  60. package/components/AGUI/components/chat/ImageUploadQueue.tsx +0 -77
  61. package/components/AGUI/components/chat/Input.tsx +0 -24
  62. package/components/AGUI/components/chat/Markdown.tsx +0 -134
  63. package/components/AGUI/components/chat/Messages.tsx +0 -259
  64. package/components/AGUI/components/chat/Modal.tsx +0 -133
  65. package/components/AGUI/components/chat/Popup.tsx +0 -57
  66. package/components/AGUI/components/chat/PoweredByTag.tsx +0 -29
  67. package/components/AGUI/components/chat/Sidebar.tsx +0 -74
  68. package/components/AGUI/components/chat/Suggestion.tsx +0 -132
  69. package/components/AGUI/components/chat/Suggestions.tsx +0 -20
  70. package/components/AGUI/components/chat/Textarea.tsx +0 -61
  71. package/components/AGUI/components/chat/Window.tsx +0 -152
  72. package/components/AGUI/components/chat/index.tsx +0 -11
  73. package/components/AGUI/components/chat/messages/AssistantMessage.tsx +0 -69
  74. package/components/AGUI/components/chat/messages/RenderActionExecutionMessage.tsx +0 -129
  75. package/components/AGUI/components/chat/messages/RenderAgentStateMessage.tsx +0 -116
  76. package/components/AGUI/components/chat/messages/RenderImageMessage.tsx +0 -64
  77. package/components/AGUI/components/chat/messages/RenderResultMessage.tsx +0 -26
  78. package/components/AGUI/components/chat/messages/RenderTextMessage.tsx +0 -51
  79. package/components/AGUI/components/chat/messages/UserMessage.tsx +0 -10
  80. package/components/AGUI/components/chat/props.ts +0 -186
  81. package/components/AGUI/components/index.ts +0 -1
  82. package/components/AGUI/context/index.ts +0 -1
  83. package/components/AGUI/hooks/index.ts +0 -1
  84. package/components/AGUI/hooks/use-copilot-chat-suggestions.tsx +0 -122
  85. package/components/AGUI/hooks/use-copy-to-clipboard.tsx +0 -29
  86. package/components/AGUI/hooks/use-dark-mode.ts +0 -10
  87. package/components/AGUI/hooks/use-push-to-talk.tsx +0 -166
  88. package/components/AGUI/index.tsx +0 -4
  89. package/components/AGUI/lib/utils.test.ts +0 -7
  90. package/components/AGUI/lib/utils.ts +0 -27
  91. package/components/AGUI/styles.css +0 -0
  92. package/components/AGUI/types/css.ts +0 -0
  93. package/components/AGUI/types/index.ts +0 -1
  94. package/components/AGUI/types/suggestions.ts +0 -6
  95. package/components/Markdown/Markdown/AnimationNode.tsx +0 -89
  96. package/components/Markdown/Markdown/Markdown.tsx +0 -61
  97. package/components/Markdown/Markdown/core/Parser.ts +0 -52
  98. package/components/Markdown/Markdown/core/Renderer.ts +0 -121
  99. package/components/Markdown/Markdown/core/index.ts +0 -4
  100. package/components/Markdown/Markdown/hooks/index.ts +0 -4
  101. package/components/Markdown/Markdown/hooks/useAnimation.tsx +0 -27
  102. package/components/Markdown/Markdown/hooks/useStreaming.ts +0 -503
  103. package/components/Markdown/Markdown/index.tsx +0 -198
  104. package/components/Markdown/Markdown/interface.ts +0 -217
  105. package/components/Markdown/demo/typing.tsx +0 -82
  106. package/components/Markdown/index.ts +0 -1
  107. package/components/Markdown/plugins/latex/index.ts +0 -109
  108. package/components/Markdown/plugins/type.ts +0 -71
  109. package/lib/AGUI/components/HelpModal/icons.d.ts +0 -5
  110. package/lib/AGUI/components/HelpModal/icons.js +0 -84
  111. package/lib/AGUI/components/HelpModal/index.d.ts +0 -1
  112. package/lib/AGUI/components/HelpModal/index.js +0 -1
  113. package/lib/AGUI/components/HelpModal/modal.d.ts +0 -1
  114. package/lib/AGUI/components/HelpModal/modal.js +0 -104
  115. package/lib/AGUI/components/chat/Button.d.ts +0 -2
  116. package/lib/AGUI/components/chat/Button.js +0 -27
  117. package/lib/AGUI/components/chat/Chat.d.ts +0 -242
  118. package/lib/AGUI/components/chat/Chat.js +0 -634
  119. package/lib/AGUI/components/chat/ChatContext.d.ts +0 -142
  120. package/lib/AGUI/components/chat/ChatContext.js +0 -75
  121. package/lib/AGUI/components/chat/CodeBlock.d.ts +0 -12
  122. package/lib/AGUI/components/chat/CodeBlock.js +0 -398
  123. package/lib/AGUI/components/chat/Header.d.ts +0 -2
  124. package/lib/AGUI/components/chat/Header.js +0 -28
  125. package/lib/AGUI/components/chat/Icons.d.ts +0 -16
  126. package/lib/AGUI/components/chat/Icons.js +0 -247
  127. package/lib/AGUI/components/chat/ImageUploadQueue.d.ts +0 -11
  128. package/lib/AGUI/components/chat/ImageUploadQueue.js +0 -65
  129. package/lib/AGUI/components/chat/Input.d.ts +0 -2
  130. package/lib/AGUI/components/chat/Input.js +0 -30
  131. package/lib/AGUI/components/chat/Markdown.d.ts +0 -7
  132. package/lib/AGUI/components/chat/Markdown.js +0 -187
  133. package/lib/AGUI/components/chat/Messages.d.ts +0 -7
  134. package/lib/AGUI/components/chat/Messages.js +0 -242
  135. package/lib/AGUI/components/chat/Modal.d.ts +0 -43
  136. package/lib/AGUI/components/chat/Modal.js +0 -113
  137. package/lib/AGUI/components/chat/Popup.d.ts +0 -49
  138. package/lib/AGUI/components/chat/Popup.js +0 -64
  139. package/lib/AGUI/components/chat/PoweredByTag.d.ts +0 -3
  140. package/lib/AGUI/components/chat/PoweredByTag.js +0 -27
  141. package/lib/AGUI/components/chat/Sidebar.d.ts +0 -2
  142. package/lib/AGUI/components/chat/Sidebar.js +0 -85
  143. package/lib/AGUI/components/chat/Suggestion.d.ts +0 -16
  144. package/lib/AGUI/components/chat/Suggestion.js +0 -146
  145. package/lib/AGUI/components/chat/Suggestions.d.ts +0 -2
  146. package/lib/AGUI/components/chat/Suggestions.js +0 -21
  147. package/lib/AGUI/components/chat/Textarea.d.ts +0 -11
  148. package/lib/AGUI/components/chat/Textarea.js +0 -60
  149. package/lib/AGUI/components/chat/Window.d.ts +0 -2
  150. package/lib/AGUI/components/chat/Window.js +0 -115
  151. package/lib/AGUI/components/chat/index.d.ts +0 -11
  152. package/lib/AGUI/components/chat/index.js +0 -11
  153. package/lib/AGUI/components/chat/messages/AssistantMessage.d.ts +0 -2
  154. package/lib/AGUI/components/chat/messages/AssistantMessage.js +0 -56
  155. package/lib/AGUI/components/chat/messages/RenderActionExecutionMessage.d.ts +0 -2
  156. package/lib/AGUI/components/chat/messages/RenderActionExecutionMessage.js +0 -114
  157. package/lib/AGUI/components/chat/messages/RenderAgentStateMessage.d.ts +0 -2
  158. package/lib/AGUI/components/chat/messages/RenderAgentStateMessage.js +0 -97
  159. package/lib/AGUI/components/chat/messages/RenderImageMessage.d.ts +0 -2
  160. package/lib/AGUI/components/chat/messages/RenderImageMessage.js +0 -61
  161. package/lib/AGUI/components/chat/messages/RenderResultMessage.d.ts +0 -2
  162. package/lib/AGUI/components/chat/messages/RenderResultMessage.js +0 -27
  163. package/lib/AGUI/components/chat/messages/RenderTextMessage.d.ts +0 -2
  164. package/lib/AGUI/components/chat/messages/RenderTextMessage.js +0 -47
  165. package/lib/AGUI/components/chat/messages/UserMessage.d.ts +0 -2
  166. package/lib/AGUI/components/chat/messages/UserMessage.js +0 -9
  167. package/lib/AGUI/components/chat/props.d.ts +0 -157
  168. package/lib/AGUI/components/index.d.ts +0 -1
  169. package/lib/AGUI/components/index.js +0 -1
  170. package/lib/AGUI/context/index.d.ts +0 -1
  171. package/lib/AGUI/context/index.js +0 -1
  172. package/lib/AGUI/hooks/index.d.ts +0 -1
  173. package/lib/AGUI/hooks/index.js +0 -1
  174. package/lib/AGUI/hooks/use-copilot-chat-suggestions.d.ts +0 -87
  175. package/lib/AGUI/hooks/use-copilot-chat-suggestions.js +0 -95
  176. package/lib/AGUI/hooks/use-copy-to-clipboard.d.ts +0 -7
  177. package/lib/AGUI/hooks/use-copy-to-clipboard.js +0 -34
  178. package/lib/AGUI/hooks/use-dark-mode.d.ts +0 -1
  179. package/lib/AGUI/hooks/use-dark-mode.js +0 -4
  180. package/lib/AGUI/hooks/use-push-to-talk.d.ts +0 -16
  181. package/lib/AGUI/hooks/use-push-to-talk.js +0 -260
  182. package/lib/AGUI/index.d.ts +0 -4
  183. package/lib/AGUI/index.js +0 -4
  184. package/lib/AGUI/lib/utils.d.ts +0 -2
  185. package/lib/AGUI/lib/utils.js +0 -52
  186. package/lib/AGUI/styles.css +0 -0
  187. package/lib/AGUI/types/css.d.ts +0 -0
  188. package/lib/AGUI/types/css.js +0 -0
  189. package/lib/AGUI/types/index.d.ts +0 -1
  190. package/lib/AGUI/types/index.js +0 -1
  191. package/lib/AGUI/types/suggestions.d.ts +0 -6
  192. package/lib/AGUI/types/suggestions.js +0 -1
  193. package/lib/Markdown/Markdown/AnimationNode.d.ts +0 -20
  194. package/lib/Markdown/Markdown/AnimationNode.js +0 -84
  195. package/lib/Markdown/Markdown/Markdown.d.ts +0 -4
  196. package/lib/Markdown/Markdown/Markdown.js +0 -58
  197. package/lib/Markdown/Markdown/core/Parser.d.ts +0 -16
  198. package/lib/Markdown/Markdown/core/Parser.js +0 -65
  199. package/lib/Markdown/Markdown/core/Renderer.d.ts +0 -24
  200. package/lib/Markdown/Markdown/core/Renderer.js +0 -137
  201. package/lib/Markdown/Markdown/core/index.d.ts +0 -3
  202. package/lib/Markdown/Markdown/core/index.js +0 -3
  203. package/lib/Markdown/Markdown/hooks/index.d.ts +0 -3
  204. package/lib/Markdown/Markdown/hooks/index.js +0 -3
  205. package/lib/Markdown/Markdown/hooks/useAnimation.d.ts +0 -4
  206. package/lib/Markdown/Markdown/hooks/useCitationsData.d.ts +0 -7
  207. package/lib/Markdown/Markdown/hooks/useStreaming.d.ts +0 -3
  208. package/lib/Markdown/Markdown/hooks/useStreaming.js +0 -521
  209. package/lib/Markdown/Markdown/hooks/useTyping.d.ts +0 -4
  210. package/lib/Markdown/Markdown/index.d.ts +0 -84
  211. package/lib/Markdown/Markdown/index.js +0 -161
  212. package/lib/Markdown/Markdown/interface.d.ts +0 -203
  213. package/lib/Markdown/Markdown/interface.js +0 -1
  214. package/lib/Markdown/Markdown/style.js +0 -32
  215. package/lib/Markdown/plugins/latex/index.d.ts +0 -9
  216. package/lib/Markdown/plugins/latex/index.js +0 -97
  217. package/lib/Markdown/plugins/type.d.ts +0 -60
  218. package/lib/Markdown/plugins/type.js +0 -1
  219. /package/components/Markdown/{Markdown/defaultComponents/DisabledImage.tsx → core/components/DisableImage.tsx} +0 -0
  220. /package/components/Markdown/{Markdown/defaultComponents → core/components}/Media.tsx +0 -0
  221. /package/components/Markdown/{plugins → core/plugins}/cursor/Dot.tsx +0 -0
  222. /package/lib/Markdown/{Markdown/defaultComponents → core/components}/CodeBlock.d.ts +0 -0
  223. /package/lib/Markdown/{Markdown/defaultComponents → core/components}/CodeBlock.js +0 -0
  224. /package/lib/Markdown/{Markdown/defaultComponents/DisabledImage.d.ts → core/components/DisableImage.d.ts} +0 -0
  225. /package/lib/Markdown/{Markdown/defaultComponents/DisabledImage.js → core/components/DisableImage.js} +0 -0
  226. /package/lib/Markdown/{Markdown/defaultComponents → core/components}/Media.d.ts +0 -0
  227. /package/lib/Markdown/{Markdown/defaultComponents → core/components}/Media.js +0 -0
  228. /package/lib/Markdown/{plugins → core/plugins}/citations/CitationComponent.d.ts +0 -0
  229. /package/lib/Markdown/{plugins → core/plugins}/cursor/Dot.d.ts +0 -0
  230. /package/lib/Markdown/{plugins → core/plugins}/cursor/Underline.d.ts +0 -0
  231. /package/lib/Markdown/{plugins → core/plugins}/cursor/index.d.ts +0 -0
  232. /package/lib/Markdown/{Markdown/style.d.ts → styles.d.ts} +0 -0
  233. /package/lib/{AGUI/components/chat/props.js → Markdown/types.js} +0 -0
@@ -1,217 +0,0 @@
1
- import type { Config as DOMPurifyConfig } from 'dompurify';
2
- import type { DOMNode } from 'html-react-parser';
3
- import type { MarkedExtension, Tokens } from 'marked';
4
- import type { CSSProperties, JSX } from 'react';
5
-
6
- export interface AnimationConfig {
7
- /**
8
- * @description 淡入动画的持续时间(毫秒)
9
- * @description The duration of the fade-in animation in milliseconds
10
- * @default 200
11
- */
12
- fadeDuration?: number;
13
- /**
14
- * @description 动画的缓动函数
15
- * @description Easing function for the animation
16
- * @default 'ease-in-out'
17
- */
18
- easing?: string;
19
- }
20
-
21
- type Token = Tokens.Generic;
22
-
23
- interface SteamingOption {
24
- /**
25
- * @description 指示是否还有后续内容块,为 false 时刷新所有缓存并完成渲染
26
- * @description Indicates whether more content chunks are expected. When false, flushes all cached content and completes rendering
27
- * @default false
28
- */
29
- hasNextChunk?: boolean;
30
- /**
31
- * @description 为块级元素(p、li、h1、h2、h3、h4)启用文字淡入动画
32
- * @description Enables text fade-in animation for block elements (p, li, h1, h2, h3, h4)
33
- * @default false
34
- */
35
- enableAnimation?: boolean;
36
- /**
37
- * @description 文字出现动画效果的配置
38
- * @description Configuration for text appearance animation effects
39
- */
40
- animationConfig?: AnimationConfig;
41
- /**
42
- * @description 启用英文单词缓存,单词会在遇到空格或标点后才整体显示
43
- * @description Enable English word caching, words will be displayed as a whole after encountering spaces or punctuation
44
- * @default false
45
- */
46
- enableWordCaching?: boolean;
47
- /**
48
- * @description 启用 LaTeX 公式缓存,公式会在完整后才整体显示($...$、$$...$$、\(...\)、\[...\])
49
- * @description Enable LaTeX formula caching, formulas will be displayed as a whole when complete ($...$, $$...$$, \(...\), \[...\])
50
- * @default true
51
- */
52
- enableMathCaching?: boolean;
53
- }
54
-
55
- type StreamStatus = 'loading' | 'done';
56
-
57
- type ComponentProps<
58
- T extends Record<string, unknown> = Record<string, unknown>,
59
- > = React.HTMLAttributes<HTMLElement> & {
60
- /**
61
- * @description 组件对应的 DOM 节点,包含解析后的 DOM 节点信息
62
- * @description Component Element from html-react-parser, contains the parsed DOM node information
63
- */
64
- domNode: DOMNode;
65
- /**
66
- * @description 流式状态,`loading` 表示正在加载,`done` 表示加载完成
67
- * @description Streaming status, `loading` indicates streaming in progress, `done` indicates streaming complete
68
- */
69
- streamStatus: StreamStatus;
70
- } & T;
71
-
72
- interface MarkdownProps {
73
- citations?: {
74
- /**
75
- * @description 引用的标题
76
- * @descriptionEn Title of the citation
77
- */
78
- title?: string;
79
- /**
80
- * @description 引用的URL地址
81
- * @descriptionEn URL address of the citation
82
- */
83
- url?: string;
84
- /**
85
- * @description 引用的内容
86
- * @descriptionEn Content of the citation
87
- */
88
- content?: string;
89
- /**
90
- * @description 引用的渲染函数
91
- * @descriptionEn Rendering function of the citation
92
- */
93
- render?: (props: {
94
- text: string;
95
- url: string;
96
- title: string;
97
- content: string;
98
- }) => React.ReactNode;
99
- }[];
100
- /**
101
- * @description 引用映射对象,用于快速查找引用信息
102
- * @descriptionEn Citation mapping object for quick lookup of reference information
103
- */
104
- citationsMap?: Record<
105
- string,
106
- {
107
- /**
108
- * @description 引用的标题
109
- * @descriptionEn Title of the citation
110
- */
111
- title?: string;
112
- /**
113
- * @description 引用的URL地址
114
- * @descriptionEn URL address of the citation
115
- */
116
- url?: string;
117
- /**
118
- * @description 引用的内容
119
- * @descriptionEn Content of the citation
120
- */
121
- content?: string;
122
- /**
123
- * @description 引用的渲染函数
124
- * @descriptionEn Rendering function of the citation
125
- */
126
- render?: (props: {
127
- text: string;
128
- url: string;
129
- title: string;
130
- content: string;
131
- }) => React.ReactNode;
132
- }
133
- >;
134
- /**
135
- * @description 光标样式类型,支持点状、下划线或布尔值控制
136
- * @description Cursor style type, supports dot, underline, or boolean control
137
- */
138
- cursor?: boolean | 'dot' | 'underline';
139
- /**
140
- * @description 基础字体大小,影响整个Markdown内容的字体大小
141
- * @description Base font size that affects the font size of the entire Markdown content
142
- */
143
- baseFontSize?: number;
144
- /**
145
- * @description 基础行高,影响文本的行间距
146
- * @description Base line height that affects text line spacing
147
- */
148
- baseLineHeight?: number;
149
- /**
150
- * @description 需要渲染的 Markdown 内容
151
- * @description Markdown content to be rendered
152
- */
153
- content?: string;
154
- /**
155
- * @description Markdown 内容,作为 `content` 属性的别名
156
- * @description Markdown content, alias for `content` property
157
- */
158
- children?: string;
159
- /**
160
- * @description 用于替换 HTML 元素的自定义 React 组件映射,组件会接收 domNode、streamStatus 等属性
161
- * @description Custom React components to replace HTML elements, components receive domNode, streamStatus, etc.
162
- */
163
- components?: {
164
- [tagName: string]:
165
- | React.ComponentType<ComponentProps>
166
- | keyof JSX.IntrinsicElements;
167
- };
168
- /**
169
- * @description 流式渲染行为的配置
170
- * @description Configuration for streaming rendering behavior
171
- */
172
- streaming?: SteamingOption;
173
- /**
174
- * @description Markdown 解析和扩展的 Marked.js 配置
175
- * @description Marked.js configuration for Markdown parsing and extensions
176
- */
177
- config?: MarkedExtension;
178
- /**
179
- * @description 根元素的额外 CSS 类名
180
- * @description Additional CSS class name for the root container
181
- */
182
- rootClassName?: string;
183
- /**
184
- * @description 根容器的额外 CSS 类名
185
- * @description Additional CSS class name for the root container
186
- */
187
- className?: string;
188
- /**
189
- * @description 段落元素的自定义 HTML 标签,防止自定义组件包含块级元素时的验证错误
190
- * @description Custom HTML tag for paragraph elements, prevents validation errors when custom components contain block-level elements
191
- * @default 'p'
192
- */
193
- paragraphTag?: keyof JSX.IntrinsicElements;
194
- /**
195
- * @description 根容器的内联样式
196
- * @description Inline styles for the root container
197
- */
198
- style?: CSSProperties;
199
- /**
200
- * @description 组件的 CSS 类名前缀
201
- * @description CSS class name prefix for the component
202
- */
203
- prefixCls?: string;
204
- /**
205
- * @description 是否为所有锚点标签添加 `target="_blank"`
206
- * @description Whether to add `target="_blank"` to all anchor tags
207
- * @default false
208
- */
209
- openLinksInNewTab?: boolean;
210
- /**
211
- * @description HTML 净化和 XSS 防护的 DOMPurify 配置
212
- * @description DOMPurify configuration for HTML sanitization and XSS protection
213
- */
214
- dompurifyConfig?: DOMPurifyConfig;
215
- }
216
-
217
- export type { ComponentProps, MarkdownProps, StreamStatus, Token, Tokens };
@@ -1,82 +0,0 @@
1
- import { Markdown } from '@agentscope-ai/chat';
2
- import { Flex } from 'antd';
3
-
4
- const fullContentZh = `# 出师表
5
- 臣亮言:先帝创业未半而中道崩殂,今天下三分,益州疲弊,此诚危急存亡之秋也。
6
-
7
- 然侍卫之臣不懈于内,忠志之士忘身于外者,盖追先帝之殊遇,欲报之于陛下也。
8
-
9
- 诚宜开张圣听,以光先帝遗德,恢弘志士之气,不宜妄自菲薄,引喻失义,以塞忠谏之路也。
10
-
11
- 亲贤臣,远小人,此先汉所以兴隆也;亲小人,远贤臣,此后汉所以倾颓也。
12
-
13
- 先帝在时,每与臣论此事,未尝不叹息痛恨于桓、灵也。
14
-
15
- 臣本布衣,躬耕于南阳,苟全性命于乱世,不求闻达于诸侯。
16
-
17
- 先帝不以臣卑鄙,猥自枉屈,三顾臣于草庐之中,咨臣以当世之事,由是感激,遂许先帝以驱驰。
18
-
19
- 先帝知臣谨慎,故临崩寄臣以大事也。
20
-
21
- 受命以来,夙夜忧叹,恐托付不效,以伤先帝之明,故五月渡泸,深入不毛。
22
-
23
- 今南方已定,兵甲已足,当奖率三军,北定中原,庶竭驽钝,攘除奸凶,兴复汉室,还于旧都。
24
-
25
- 此臣所以报先帝而忠陛下之职分也。
26
-
27
- 愿陛下托臣以讨贼兴复之效,不效,则治臣之罪,以告先帝之灵。
28
-
29
- 陛下亦宜自谋,以咨诹善道,察纳雅言。深追先帝遗诏,臣不胜受恩感激。今当远离,临表涕零,不知所言。`;
30
-
31
- const fullContentEn = `# 出师表
32
-
33
- Permit me to observe: the late emperor was taken from us before he could finish his life's work, the restoration of the Han. Today, the empire is still divided in three, and our very survival is threatened.
34
-
35
- Yet still the officials at court and the soldiers throughout the realm remain loyal to you, your majesty. Because they remember the late emperor, all of them, and they wish to repay his kindness in service to you.
36
-
37
- This is the moment to extend your divine influence, to honor the memory of the late Emperor and strengthen the morale of your officers. It is not the time to listen to bad advice, or close your ears to the suggestions of loyal men.
38
-
39
- The emperors of the Western Han chose their courtiers wisely, and their dynasty flourished. The emperors of the Eastern Han chose poorly, and they doomed the empire to ruin.
40
-
41
- Whenever the late Emperor discussed this problem with me, he lamented the failings of Emperors Huan and Ling.
42
-
43
- I began as a common man, farming in my fields in Nanyang, doing what I could to survive in an age of chaos. I never had any interest in making a name for myself as a noble.
44
-
45
- The late Emperor was not ashamed to visit my cottage and seek my advice. Grateful for his regard, I responded to his appeal and threw myself into his service.
46
-
47
- The late Emperor always appreciated my caution and, in his final days, entrusted me with his cause.
48
-
49
- Since that moment, I have been tormented day and night by the fear that I might let him down. That is why I crossed the Lu river at the height of summer, and entered the wastelands beyond.
50
-
51
- Now the south has been subdued, and our forces are fully armed. I should lead our soldiers to conquer the northern heartland and attempt to remove the hateful traitors, restore the house of Han, and return it to the former capital.
52
-
53
- This is the way I mean to honor my debt to the late Emperor and fulfill my duty to you.
54
-
55
- My only desire is to be permitted to drive out the traitors and restore the Han. If I should let you down, punish my offense and report it to the spirit of the late Emperor.
56
-
57
- Your Majesty, consider your course of action carefully. Seek out good advice, and never forget the late words of the late Emperor. I depart now on a long expedition, and I will be forever grateful if you heed my advice. Blinded by my own tears, I know not what I write.`;
58
-
59
-
60
- export default function () {
61
- return <Flex gap={32}>
62
- <div style={{ flex: 1 }}>
63
-
64
- <Markdown
65
- typing={50}
66
- enableAnimation={true}
67
- enableWordCaching={true}
68
- content={fullContentZh}
69
- />
70
- </div>
71
-
72
- <div style={{ flex: 1 }}>
73
-
74
- <Markdown
75
- cursor="underline"
76
- typing={12.5}
77
- enableWordCaching={true}
78
- content={fullContentEn}
79
- />
80
- </div>
81
- </Flex>
82
- }
@@ -1 +0,0 @@
1
- export { default, type MarkdownProps } from './Markdown';
@@ -1,109 +0,0 @@
1
- import katex, { type KatexOptions } from 'katex';
2
- import { TokenizerAndRendererExtension } from 'marked';
3
-
4
- import 'katex/dist/katex.min.css';
5
-
6
- const inlineRuleNonStandard =
7
- /^(?:\${1,2}([^$]{1,10000}?)\${1,2}|\\\(([\s\S]{1,10000}?)\\\)|\\\[((?:\\.|[^\\]){1,10000}?)\\\])/;
8
- const blockRule = /^(\${1,2})\n([\s\S]{1,10000}?)\n\1(?:\n|$)|^\\\[((?:\\.|[^\\]){1,10000}?)\\\]/;
9
-
10
- type LatexOption = {
11
- katexOptions?: KatexOptions;
12
- replaceAlignStart?: boolean;
13
- };
14
-
15
- type Token = {
16
- text: string;
17
- displayMode: boolean;
18
- };
19
-
20
- type Render = (token: Token) => string;
21
-
22
- type ILevel = 'inline' | 'block';
23
-
24
- // fix katex not support align*: https://github.com/KaTeX/KaTeX/issues/1007
25
- function replaceAlign(text: string) {
26
- return text ? text.replace(/\{align\*\}/g, '{aligned}') : text;
27
- }
28
-
29
- function createRenderer(options: KatexOptions, newlineAfter: boolean) {
30
- return (token: Token) =>
31
- katex.renderToString(token.text, {
32
- ...options,
33
- displayMode: token.displayMode,
34
- }) + (newlineAfter ? '\n' : '');
35
- }
36
-
37
- function inlineKatex(renderer: Render, replaceAlignStart: boolean) {
38
- const ruleReg = inlineRuleNonStandard;
39
- return {
40
- name: 'inlineKatex',
41
- level: 'inline' as ILevel,
42
- start(src: string) {
43
- if (!src.includes('$') && !src.includes('\\(')) return;
44
-
45
- const indices = [src.indexOf('$'), src.indexOf('\\(')].filter((idx) => idx !== -1);
46
-
47
- if (indices.length === 0) return;
48
-
49
- const katexIndex = Math.min(...indices);
50
- const possibleKatex = src.slice(katexIndex);
51
-
52
- if (possibleKatex.match(ruleReg)) {
53
- return katexIndex;
54
- }
55
- },
56
- tokenizer(src: string) {
57
- const match = src.match(inlineRuleNonStandard);
58
- if (match) {
59
- let text = (match[1] || match[2]).trim();
60
- if (replaceAlignStart) {
61
- text = replaceAlign(text);
62
- }
63
- return {
64
- type: 'inlineKatex',
65
- raw: match[0],
66
- text,
67
- displayMode: false,
68
- };
69
- }
70
- },
71
- renderer,
72
- };
73
- }
74
-
75
- function blockKatex(renderer: Render, replaceAlignStart: boolean) {
76
- return {
77
- name: 'blockKatex',
78
- level: 'block' as ILevel,
79
- tokenizer(src: string) {
80
- const match = src.match(blockRule);
81
- if (match) {
82
- let text = replaceAlign(match[2] || match[3].trim());
83
- if (replaceAlignStart) {
84
- text = replaceAlign(text);
85
- }
86
- return {
87
- type: 'blockKatex',
88
- raw: match[0],
89
- text,
90
- displayMode: true,
91
- };
92
- }
93
- },
94
- renderer,
95
- };
96
- }
97
-
98
- const Latex = (options?: LatexOption): TokenizerAndRendererExtension[] => {
99
- const { replaceAlignStart = true, katexOptions = { output: 'html' } } = options || {};
100
-
101
- const inlineRenderer = createRenderer(katexOptions, false);
102
- const blockRenderer = createRenderer(katexOptions, true);
103
- return [
104
- inlineKatex(inlineRenderer, replaceAlignStart),
105
- blockKatex(blockRenderer, replaceAlignStart),
106
- ];
107
- };
108
-
109
- export default Latex;
@@ -1,71 +0,0 @@
1
- import type { KatexOptions } from 'katex';
2
- import type { TokenizerAndRendererExtension } from 'marked';
3
- import type { ReactNode } from 'react';
4
- import type { SyntaxHighlighterProps } from 'react-syntax-highlighter';
5
-
6
- export type LatexOption = {
7
- katexOptions?: KatexOptions;
8
- replaceAlignStart?: boolean;
9
- };
10
-
11
- type HighlightCodeType = 'root' | 'header' | 'headerTitle' | 'code';
12
- export type HighlightCodeProps = {
13
- lang?: string;
14
- children: string;
15
- header?: ReactNode | null;
16
- prefixCls?: string;
17
- style?: React.CSSProperties;
18
- className?: string;
19
- highlightProps?: Partial<SyntaxHighlighterProps>;
20
- // Semantic
21
- classNames?: Partial<Record<HighlightCodeType, string>>;
22
- styles?: Partial<Record<HighlightCodeType, React.CSSProperties>>;
23
- };
24
-
25
- type MermaidType = 'root' | 'header' | 'graph' | 'code';
26
- export type MermaidProps = {
27
- children: string;
28
- header?: ReactNode | null;
29
- prefixCls?: string;
30
- style?: React.CSSProperties;
31
- className?: string;
32
- highlightProps?: Partial<SyntaxHighlighterProps>;
33
- // Semantic
34
- classNames?: Partial<Record<MermaidType, string>>;
35
- styles?: Partial<Record<MermaidType, React.CSSProperties>>;
36
- };
37
-
38
- interface BaseComponentConfig {
39
- style: React.CSSProperties;
40
- styles: Record<string, React.CSSProperties>;
41
- className: string;
42
- classNames: Record<string, string>;
43
- }
44
-
45
- type ComponentConfig<
46
- CompProps extends Record<PropertyKey, any>,
47
- PickType extends keyof CompProps = keyof BaseComponentConfig,
48
- > = Pick<CompProps, PickType>;
49
-
50
- export interface MarkdownComponentsConfig {
51
- highlightCode?: ComponentConfig<HighlightCodeProps>;
52
- mermaid?: ComponentConfig<MermaidProps>;
53
- }
54
-
55
- export type PluginsType = {
56
- /**
57
- * @desc 渲染数学公式Latex语法。
58
- * @descEN Rendering mathematical formulas using Latex syntax.
59
- */
60
- Latex: (options?: LatexOption) => TokenizerAndRendererExtension[];
61
- /**
62
- * @desc 渲染代码高亮。
63
- * @descEN Highlight the rendering code.
64
- */
65
- HighlightCode: (props: HighlightCodeProps) => React.ReactNode;
66
- /**
67
- * @desc 渲染 Mermaid 图表。
68
- * @descEN Rendering the Mermaid Chart.
69
- */
70
- Mermaid: (props: MermaidProps) => React.ReactNode;
71
- };
@@ -1,5 +0,0 @@
1
- export declare const LifeBuoyIcon: () => import("react/jsx-runtime").JSX.Element;
2
- export declare const CloseIcon: () => import("react/jsx-runtime").JSX.Element;
3
- export declare const LoadingSpinnerIcon: ({ color }: {
4
- color?: string;
5
- }) => import("react/jsx-runtime").JSX.Element;
@@ -1,84 +0,0 @@
1
- import React from "react";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { jsxs as _jsxs } from "react/jsx-runtime";
4
- export var LifeBuoyIcon = function LifeBuoyIcon() {
5
- return /*#__PURE__*/_jsx("svg", {
6
- xmlns: "http://www.w3.org/2000/svg",
7
- width: "24",
8
- height: "24",
9
- viewBox: "0 0 24 24",
10
- fill: "none",
11
- stroke: "currentColor",
12
- strokeWidth: "2",
13
- strokeLinecap: "round",
14
- strokeLinejoin: "round",
15
- className: "icon icon-tabler icons-tabler-outline icon-tabler-lifebuoy",
16
- children: /*#__PURE__*/_jsxs("g", {
17
- transform: "translate(0, -1)",
18
- children: [/*#__PURE__*/_jsx("path", {
19
- stroke: "none",
20
- d: "M0 0h24v24H0z",
21
- fill: "none"
22
- }), /*#__PURE__*/_jsx("path", {
23
- d: "M12 12m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0"
24
- }), /*#__PURE__*/_jsx("path", {
25
- d: "M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"
26
- }), /*#__PURE__*/_jsx("path", {
27
- d: "M15 15l3.35 3.35"
28
- }), /*#__PURE__*/_jsx("path", {
29
- d: "M9 15l-3.35 3.35"
30
- }), /*#__PURE__*/_jsx("path", {
31
- d: "M5.65 5.65l3.35 3.35"
32
- }), /*#__PURE__*/_jsx("path", {
33
- d: "M18.35 5.65l-3.35 3.35"
34
- })]
35
- })
36
- });
37
- };
38
- export var CloseIcon = function CloseIcon() {
39
- return /*#__PURE__*/_jsx("svg", {
40
- xmlns: "http://www.w3.org/2000/svg",
41
- fill: "none",
42
- viewBox: "0 0 24 24",
43
- strokeWidth: "1.5",
44
- stroke: "currentColor",
45
- width: "20",
46
- height: "20",
47
- children: /*#__PURE__*/_jsx("path", {
48
- strokeLinecap: "round",
49
- strokeLinejoin: "round",
50
- d: "M6 18L18 6M6 6l12 12"
51
- })
52
- });
53
- };
54
- export var LoadingSpinnerIcon = function LoadingSpinnerIcon(_ref) {
55
- var _ref$color = _ref.color,
56
- color = _ref$color === void 0 ? "rgb(107 114 128)" : _ref$color;
57
- return /*#__PURE__*/_jsxs("svg", {
58
- style: {
59
- animation: "copilotKitSpinAnimation 1s linear infinite",
60
- color: color
61
- },
62
- width: "24",
63
- height: "24",
64
- xmlns: "http://www.w3.org/2000/svg",
65
- fill: "none",
66
- viewBox: "0 0 24 24",
67
- children: [/*#__PURE__*/_jsx("circle", {
68
- style: {
69
- opacity: 0.25
70
- },
71
- cx: "12",
72
- cy: "12",
73
- r: "10",
74
- stroke: "currentColor",
75
- strokeWidth: "4"
76
- }), /*#__PURE__*/_jsx("path", {
77
- style: {
78
- opacity: 0.75
79
- },
80
- fill: "currentColor",
81
- d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
82
- })]
83
- });
84
- };
@@ -1 +0,0 @@
1
- export { CopilotKitHelpModal } from "./modal";
@@ -1 +0,0 @@
1
- export { CopilotKitHelpModal } from "./modal";
@@ -1 +0,0 @@
1
- export declare function CopilotKitHelpModal(): import("react/jsx-runtime").JSX.Element;
@@ -1,104 +0,0 @@
1
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
- import React, { useState, useRef, useEffect } from "react";
8
- import { CloseIcon } from "./icons";
9
- import { jsx as _jsx } from "react/jsx-runtime";
10
- import { jsxs as _jsxs } from "react/jsx-runtime";
11
- export function CopilotKitHelpModal() {
12
- var _useState = useState(false),
13
- _useState2 = _slicedToArray(_useState, 2),
14
- showHelpModal = _useState2[0],
15
- setShowHelpModal = _useState2[1];
16
- var buttonRef = useRef(null);
17
- var popoverRef = useRef(null);
18
-
19
- // Close popover when clicking outside
20
- useEffect(function () {
21
- var handleClickOutside = function handleClickOutside(event) {
22
- if (popoverRef.current && !popoverRef.current.contains(event.target) && buttonRef.current && !buttonRef.current.contains(event.target)) {
23
- setShowHelpModal(false);
24
- }
25
- };
26
- if (showHelpModal) {
27
- document.addEventListener("mousedown", handleClickOutside);
28
- }
29
- return function () {
30
- document.removeEventListener("mousedown", handleClickOutside);
31
- };
32
- }, [showHelpModal]);
33
- var HelpButton = function HelpButton() {
34
- return /*#__PURE__*/_jsx("button", {
35
- ref: buttonRef,
36
- onClick: function onClick() {
37
- return setShowHelpModal(!showHelpModal);
38
- },
39
- className: "copilotKitDebugMenuTriggerButton relative",
40
- "aria-label": "Open Help",
41
- children: "Help"
42
- });
43
- };
44
- return /*#__PURE__*/_jsxs("div", {
45
- className: "relative",
46
- children: [/*#__PURE__*/_jsx(HelpButton, {}), showHelpModal && /*#__PURE__*/_jsx("div", {
47
- ref: popoverRef,
48
- className: "absolute mt-2 z-50",
49
- style: {
50
- top: "100%",
51
- right: "-120px",
52
- width: "380px"
53
- },
54
- children: /*#__PURE__*/_jsxs("div", {
55
- className: "copilotKitHelpModal rounded-lg shadow-xl w-full p-4 flex-col relative",
56
- children: [/*#__PURE__*/_jsx("button", {
57
- className: "copilotKitHelpModalCloseButton absolute text-gray-400 hover:text-gray-600 focus:outline-none",
58
- style: {
59
- top: "10px",
60
- right: "10px"
61
- },
62
- onClick: function onClick() {
63
- return setShowHelpModal(false);
64
- },
65
- "aria-label": "Close",
66
- children: /*#__PURE__*/_jsx(CloseIcon, {})
67
- }), /*#__PURE__*/_jsx("div", {
68
- className: "w-full flex mb-6 justify-center",
69
- children: /*#__PURE__*/_jsx("h2", {
70
- className: "text-2xl font-bold",
71
- children: "Help Options"
72
- })
73
- }), /*#__PURE__*/_jsxs("div", {
74
- className: "space-y-4 mb-4",
75
- children: [/*#__PURE__*/_jsx("div", {
76
- className: "copilotKitHelpItemButton",
77
- children: /*#__PURE__*/_jsx("a", {
78
- href: "https://docs.copilotkit.ai/coagents/troubleshooting/common-issues",
79
- target: "_blank",
80
- rel: "noopener noreferrer",
81
- children: "Visit the Troubleshooting and FAQ section in the docs"
82
- })
83
- }), /*#__PURE__*/_jsx("div", {
84
- className: "copilotKitHelpItemButton",
85
- children: /*#__PURE__*/_jsx("a", {
86
- href: "https://go.copilotkit.ai/dev-console-support-discord",
87
- target: "_blank",
88
- rel: "noopener noreferrer",
89
- children: "Go to Discord Support Channel (Community Support)"
90
- })
91
- }), /*#__PURE__*/_jsx("div", {
92
- className: "copilotKitHelpItemButton",
93
- children: /*#__PURE__*/_jsx("a", {
94
- href: "https://go.copilotkit.ai/dev-console-support-slack",
95
- target: "_blank",
96
- rel: "noopener noreferrer",
97
- children: "Apply for Priority Direct Slack Support"
98
- })
99
- })]
100
- })]
101
- })
102
- })]
103
- });
104
- }