@hkyhy/marsun-components-core 0.1.11 → 0.1.15

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 (165) hide show
  1. package/README.md +31 -6
  2. package/dist/components/AgentHub/Chat/Action/CreateButton.js +8 -0
  3. package/dist/components/AgentHub/Chat/Action/CreateButton.js.map +1 -0
  4. package/dist/components/AgentHub/Chat/Action/ManageActionButtons.js +20 -0
  5. package/dist/components/AgentHub/Chat/Action/ManageActionButtons.js.map +1 -0
  6. package/dist/components/AgentHub/Chat/Action/SessionActionButtons.js +24 -0
  7. package/dist/components/AgentHub/Chat/Action/SessionActionButtons.js.map +1 -0
  8. package/dist/components/AgentHub/Chat/Action/handlers.d.ts +0 -5
  9. package/dist/components/AgentHub/Chat/Detail/ChatInput/index.js +65 -0
  10. package/dist/components/AgentHub/Chat/Detail/ChatInput/index.js.map +1 -0
  11. package/dist/components/AgentHub/Chat/Detail/ChatInput/style.module.scss.js +12 -0
  12. package/dist/components/AgentHub/Chat/Detail/ChatInput/style.module.scss.js.map +1 -0
  13. package/dist/components/AgentHub/Chat/Detail/ChatPanel/index.d.ts +31 -0
  14. package/dist/components/AgentHub/Chat/Detail/ChatPanel/index.js +85 -0
  15. package/dist/components/AgentHub/Chat/Detail/ChatPanel/index.js.map +1 -0
  16. package/dist/components/AgentHub/Chat/Detail/ChatPanel/style.module.scss.js +14 -0
  17. package/dist/components/AgentHub/Chat/Detail/ChatPanel/style.module.scss.js.map +1 -0
  18. package/dist/components/AgentHub/Chat/Detail/ChatSuggestionRow/index.d.ts +9 -0
  19. package/dist/components/AgentHub/Chat/Detail/ChatSuggestionRow/index.js +22 -0
  20. package/dist/components/AgentHub/Chat/Detail/ChatSuggestionRow/index.js.map +1 -0
  21. package/dist/components/AgentHub/Chat/Detail/ChatSuggestionRow/style.module.scss.js +8 -0
  22. package/dist/components/AgentHub/Chat/Detail/ChatSuggestionRow/style.module.scss.js.map +1 -0
  23. package/dist/components/AgentHub/Chat/Detail/CitationContent/index.js +21 -0
  24. package/dist/components/AgentHub/Chat/Detail/CitationContent/index.js.map +1 -0
  25. package/dist/components/AgentHub/Chat/Detail/CitationContent/style.module.scss.js +8 -0
  26. package/dist/components/AgentHub/Chat/Detail/CitationContent/style.module.scss.js.map +1 -0
  27. package/dist/components/AgentHub/Chat/Detail/CitationInlineBadge/index.js +17 -0
  28. package/dist/components/AgentHub/Chat/Detail/CitationInlineBadge/index.js.map +1 -0
  29. package/dist/components/AgentHub/Chat/Detail/CitationInlineBadge/style.module.scss.js +7 -0
  30. package/dist/components/AgentHub/Chat/Detail/CitationInlineBadge/style.module.scss.js.map +1 -0
  31. package/dist/components/AgentHub/Chat/Detail/CitationMarkdownContent/index.js +68 -0
  32. package/dist/components/AgentHub/Chat/Detail/CitationMarkdownContent/index.js.map +1 -0
  33. package/dist/components/AgentHub/Chat/Detail/CitationMarkdownContent/style.module.scss.js +7 -0
  34. package/dist/components/AgentHub/Chat/Detail/CitationMarkdownContent/style.module.scss.js.map +1 -0
  35. package/dist/components/AgentHub/Chat/Detail/CitationPanel/index.js +247 -0
  36. package/dist/components/AgentHub/Chat/Detail/CitationPanel/index.js.map +1 -0
  37. package/dist/components/AgentHub/Chat/Detail/CitationPanel/style.module.scss.js +31 -0
  38. package/dist/components/AgentHub/Chat/Detail/CitationPanel/style.module.scss.js.map +1 -0
  39. package/dist/components/AgentHub/Chat/Detail/MermaidBlock/index.js +43 -0
  40. package/dist/components/AgentHub/Chat/Detail/MermaidBlock/index.js.map +1 -0
  41. package/dist/components/AgentHub/Chat/Detail/MermaidBlock/style.module.scss.js +8 -0
  42. package/dist/components/AgentHub/Chat/Detail/MermaidBlock/style.module.scss.js.map +1 -0
  43. package/dist/components/AgentHub/Chat/Detail/MessageActions/index.js +103 -0
  44. package/dist/components/AgentHub/Chat/Detail/MessageActions/index.js.map +1 -0
  45. package/dist/components/AgentHub/Chat/Detail/MessageActions/style.module.scss.js +14 -0
  46. package/dist/components/AgentHub/Chat/Detail/MessageActions/style.module.scss.js.map +1 -0
  47. package/dist/components/AgentHub/Chat/Detail/MessageEditPopover/index.js +58 -0
  48. package/dist/components/AgentHub/Chat/Detail/MessageEditPopover/index.js.map +1 -0
  49. package/dist/components/AgentHub/Chat/Detail/MessageEditPopover/style.module.scss.js +9 -0
  50. package/dist/components/AgentHub/Chat/Detail/MessageEditPopover/style.module.scss.js.map +1 -0
  51. package/dist/components/AgentHub/Chat/Detail/MessageItem/index.js +309 -0
  52. package/dist/components/AgentHub/Chat/Detail/MessageItem/index.js.map +1 -0
  53. package/dist/components/AgentHub/Chat/Detail/MessageItem/style.module.scss.js +24 -0
  54. package/dist/components/AgentHub/Chat/Detail/MessageItem/style.module.scss.js.map +1 -0
  55. package/dist/components/AgentHub/Chat/Detail/ThinkingSection/index.js +122 -0
  56. package/dist/components/AgentHub/Chat/Detail/ThinkingSection/index.js.map +1 -0
  57. package/dist/components/AgentHub/Chat/Detail/ThinkingSection/style.module.scss.js +25 -0
  58. package/dist/components/AgentHub/Chat/Detail/ThinkingSection/style.module.scss.js.map +1 -0
  59. package/dist/components/AgentHub/Chat/Detail/index.d.ts +12 -0
  60. package/dist/components/AgentHub/Chat/Form/Form.js +37 -0
  61. package/dist/components/AgentHub/Chat/Form/Form.js.map +1 -0
  62. package/dist/components/AgentHub/Chat/List/ChatCard/index.js +86 -0
  63. package/dist/components/AgentHub/Chat/List/ChatCard/index.js.map +1 -0
  64. package/dist/components/AgentHub/Chat/List/ChatCard/style.module.scss.js +25 -0
  65. package/dist/components/AgentHub/Chat/List/ChatCard/style.module.scss.js.map +1 -0
  66. package/dist/components/AgentHub/Chat/List/FilterBar.js +17 -0
  67. package/dist/components/AgentHub/Chat/List/FilterBar.js.map +1 -0
  68. package/dist/components/AgentHub/Chat/List/SessionSidebar/index.js +156 -0
  69. package/dist/components/AgentHub/Chat/List/SessionSidebar/index.js.map +1 -0
  70. package/dist/components/AgentHub/Chat/List/SessionSidebar/style.module.scss.js +28 -0
  71. package/dist/components/AgentHub/Chat/List/SessionSidebar/style.module.scss.js.map +1 -0
  72. package/dist/components/AgentHub/Chat/Modal/FormModal.js +58 -0
  73. package/dist/components/AgentHub/Chat/Modal/FormModal.js.map +1 -0
  74. package/dist/components/AgentHub/Chat/hooks/useAutoScrollToBottom.js +35 -0
  75. package/dist/components/AgentHub/Chat/hooks/useAutoScrollToBottom.js.map +1 -0
  76. package/dist/components/AgentHub/Chat/hooks/useChat.js +51 -0
  77. package/dist/components/AgentHub/Chat/hooks/useChat.js.map +1 -0
  78. package/dist/components/AgentHub/Chat/hooks/useChatSessions.js +60 -0
  79. package/dist/components/AgentHub/Chat/hooks/useChatSessions.js.map +1 -0
  80. package/dist/components/AgentHub/Chat/hooks/useSSECompletion.js +69 -0
  81. package/dist/components/AgentHub/Chat/hooks/useSSECompletion.js.map +1 -0
  82. package/dist/components/AgentHub/Chat/hooks/useTypewriter.js +39 -0
  83. package/dist/components/AgentHub/Chat/hooks/useTypewriter.js.map +1 -0
  84. package/dist/components/AgentHub/Chat/index.d.ts +1 -0
  85. package/dist/components/AgentHub/Chat/utils/citationContent.js +169 -0
  86. package/dist/components/AgentHub/Chat/utils/citationContent.js.map +1 -0
  87. package/dist/components/AgentHub/Chat/utils/messageContent.js +85 -0
  88. package/dist/components/AgentHub/Chat/utils/messageContent.js.map +1 -0
  89. package/dist/components/AgentHub/Chat/utils/sanitizeMermaidChart.js +22 -0
  90. package/dist/components/AgentHub/Chat/utils/sanitizeMermaidChart.js.map +1 -0
  91. package/dist/components/AgentHub/Chat/utils/sessionMessages.js +151 -0
  92. package/dist/components/AgentHub/Chat/utils/sessionMessages.js.map +1 -0
  93. package/dist/components/AgentHub/KnowledgeBase/Action/CreateButton.js +8 -0
  94. package/dist/components/AgentHub/KnowledgeBase/Action/CreateButton.js.map +1 -0
  95. package/dist/components/AgentHub/KnowledgeBase/Action/ManageActionButtons.js +20 -0
  96. package/dist/components/AgentHub/KnowledgeBase/Action/ManageActionButtons.js.map +1 -0
  97. package/dist/components/AgentHub/KnowledgeBase/Detail/DocumentTable/index.js +110 -0
  98. package/dist/components/AgentHub/KnowledgeBase/Detail/DocumentTable/index.js.map +1 -0
  99. package/dist/components/AgentHub/KnowledgeBase/Detail/DocumentTable/style.module.scss.js +7 -0
  100. package/dist/components/AgentHub/KnowledgeBase/Detail/DocumentTable/style.module.scss.js.map +1 -0
  101. package/dist/components/AgentHub/KnowledgeBase/Detail/ParseStatusTag/index.js +18 -0
  102. package/dist/components/AgentHub/KnowledgeBase/Detail/ParseStatusTag/index.js.map +1 -0
  103. package/dist/components/AgentHub/KnowledgeBase/Detail/ParseStatusTag/style.module.scss.js +7 -0
  104. package/dist/components/AgentHub/KnowledgeBase/Detail/ParseStatusTag/style.module.scss.js.map +1 -0
  105. package/dist/components/AgentHub/KnowledgeBase/Form/Form.js +31 -0
  106. package/dist/components/AgentHub/KnowledgeBase/Form/Form.js.map +1 -0
  107. package/dist/components/AgentHub/KnowledgeBase/List/FilterBar.js +17 -0
  108. package/dist/components/AgentHub/KnowledgeBase/List/FilterBar.js.map +1 -0
  109. package/dist/components/AgentHub/KnowledgeBase/List/KnowledgeCard/index.js +118 -0
  110. package/dist/components/AgentHub/KnowledgeBase/List/KnowledgeCard/index.js.map +1 -0
  111. package/dist/components/AgentHub/KnowledgeBase/List/KnowledgeCard/style.module.scss.js +23 -0
  112. package/dist/components/AgentHub/KnowledgeBase/List/KnowledgeCard/style.module.scss.js.map +1 -0
  113. package/dist/components/AgentHub/KnowledgeBase/Modal/FormModal.js +47 -0
  114. package/dist/components/AgentHub/KnowledgeBase/Modal/FormModal.js.map +1 -0
  115. package/dist/components/AgentHub/KnowledgeBase/constants/types.js +28 -0
  116. package/dist/components/AgentHub/KnowledgeBase/constants/types.js.map +1 -0
  117. package/dist/components/AgentHub/KnowledgeBase/hooks/useKBDocuments.js +21 -0
  118. package/dist/components/AgentHub/KnowledgeBase/hooks/useKBDocuments.js.map +1 -0
  119. package/dist/components/AgentHub/KnowledgeBase/hooks/useKnowledgeBase.js +32 -0
  120. package/dist/components/AgentHub/KnowledgeBase/hooks/useKnowledgeBase.js.map +1 -0
  121. package/dist/components/Filter/FilterDateRange/index.d.ts +2 -0
  122. package/dist/components/Filter/FilterDateRange/index.js +62 -51
  123. package/dist/components/Filter/FilterDateRange/index.js.map +1 -1
  124. package/dist/components/Filter/FilterSelect/index.d.ts +6 -2
  125. package/dist/components/Filter/FilterSelect/index.js +132 -107
  126. package/dist/components/Filter/FilterSelect/index.js.map +1 -1
  127. package/dist/components/Filter/FilterTrigger/index.d.ts +2 -2
  128. package/dist/components/Filter/FilterTrigger/index.js.map +1 -1
  129. package/dist/components/Filter/FilterTrigger/style.module.scss.js +4 -4
  130. package/dist/components/Filter/index.d.ts +1 -1
  131. package/dist/components/Icons/index.js +153 -145
  132. package/dist/components/Icons/index.js.map +1 -1
  133. package/dist/components/LlmFormattedText/LlmFormattedText/index.d.ts +8 -0
  134. package/dist/components/LlmFormattedText/LlmFormattedText/index.js +42 -0
  135. package/dist/components/LlmFormattedText/LlmFormattedText/index.js.map +1 -0
  136. package/dist/components/LlmFormattedText/LlmFormattedText/style.module.scss.js +17 -0
  137. package/dist/components/LlmFormattedText/LlmFormattedText/style.module.scss.js.map +1 -0
  138. package/dist/components/LlmFormattedText/index.d.ts +4 -0
  139. package/dist/components/LlmFormattedText/parseLlmText.d.ts +14 -0
  140. package/dist/components/LlmFormattedText/parseLlmText.js +77 -0
  141. package/dist/components/LlmFormattedText/parseLlmText.js.map +1 -0
  142. package/dist/components/Sparkline/Sparkline/index.d.ts +11 -0
  143. package/dist/components/Sparkline/Sparkline/index.js +46 -0
  144. package/dist/components/Sparkline/Sparkline/index.js.map +1 -0
  145. package/dist/components/Sparkline/Sparkline/style.module.scss.js +8 -0
  146. package/dist/components/Sparkline/Sparkline/style.module.scss.js.map +1 -0
  147. package/dist/components/Sparkline/index.d.ts +2 -0
  148. package/dist/components/TooltipInfo/TooltipInfo.js +29 -20
  149. package/dist/components/TooltipInfo/TooltipInfo.js.map +1 -1
  150. package/dist/components/index.d.ts +2 -0
  151. package/dist/index.d.ts +5 -1
  152. package/dist/index.js +291 -175
  153. package/dist/index.js.map +1 -1
  154. package/dist/marsun-components-core.css +1 -1
  155. package/dist/styles/global.css +1 -1
  156. package/dist/theme/constants.d.ts +47 -1
  157. package/dist/theme/constants.js +50 -5
  158. package/dist/theme/constants.js.map +1 -1
  159. package/dist/theme/index.d.ts +2 -2
  160. package/dist/theme/index.js +8 -6
  161. package/dist/theme/theme.d.ts +10 -0
  162. package/dist/theme/theme.js +24 -34
  163. package/dist/theme/theme.js.map +1 -1
  164. package/dist/theme/tokens.css +139 -0
  165. package/package.json +6 -3
package/README.md CHANGED
@@ -20,7 +20,20 @@ npm install @hkyhy/marsun-components-core antd react react-dom
20
20
  ## 快速开始
21
21
 
22
22
  ```tsx
23
- import { MarsunCoreProvider, SemanticTag, FetchTreeSelect } from '@hkyhy/marsun-components-core';
23
+ import '@hkyhy/marsun-components-core/styles';
24
+ import '@hkyhy/marsun-components-core/tokens';
25
+
26
+ import {
27
+ MarsunCoreProvider,
28
+ SemanticTag,
29
+ ChatPanel,
30
+ SessionSidebar,
31
+ applyThemeToCssVariables,
32
+ generateTheme,
33
+ } from '@hkyhy/marsun-components-core';
34
+
35
+ const primaryColor = '#1677ff';
36
+ applyThemeToCssVariables(primaryColor);
24
37
 
25
38
  <MarsunCoreProvider
26
39
  auth={{
@@ -29,17 +42,29 @@ import { MarsunCoreProvider, SemanticTag, FetchTreeSelect } from '@hkyhy/marsun-
29
42
  hasAnyRole: (roles) => roles.some((r) => userRoles.includes(r)),
30
43
  }}
31
44
  fetch={{ baseUrl: '/api', headers: { Authorization: `Bearer ${token}` } }}
45
+ primaryColor={primaryColor}
46
+ themeConfig={generateTheme(primaryColor)}
32
47
  >
33
48
  <SemanticTag color="primary">标签</SemanticTag>
34
- <FetchTreeSelect
35
- treeData={treeData}
36
- // 或 fetch 模式:
37
- // fetchUrl="/departments/tree"
38
- // transformData={(raw) => raw.data}
49
+ <ChatPanel
50
+ messages={[]}
51
+ inputValue=""
52
+ onInputChange={() => {}}
53
+ onSend={() => {}}
39
54
  />
40
55
  </MarsunCoreProvider>
41
56
  ```
42
57
 
58
+ ### 主题与 Token
59
+
60
+ | 导入路径 | 用途 |
61
+ | --- | --- |
62
+ | `@hkyhy/marsun-components-core/tokens` | 静态 CSS 变量默认值(布局、灰阶、标签色等) |
63
+ | `@hkyhy/marsun-components-core/theme` | `generateTheme`, `applyThemeToCssVariables`, `PALETTE`, `LAYOUT_TOKENS` |
64
+ | `@hkyhy/marsun-components-core/styles` | 组件库打包样式 |
65
+
66
+ 项目可在 `src/styles/tokens.css` 扩展领域变量,详见 showcase 内 `frontend-dev-spec` → `theme.md`。
67
+
43
68
  ## 设计原则
44
69
 
45
70
  - **零业务依赖**:无 `departmentPath`、`personOption` 等领域工具;`transformData` 由消费方实现
@@ -0,0 +1,8 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { Plus as r } from "../../../Icons/index.js";
3
+ import { Button as m } from "antd";
4
+ const n = ({ onClick: o }) => /* @__PURE__ */ t(m, { type: "primary", icon: /* @__PURE__ */ t(r, {}), onClick: o, children: "新建助手" });
5
+ export {
6
+ n as default
7
+ };
8
+ //# sourceMappingURL=CreateButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CreateButton.js","sources":["../../../../../src/components/AgentHub/Chat/Action/CreateButton.tsx"],"sourcesContent":["import { Plus } from '@/components/Icons';\nimport { Button } from 'antd';\nimport React from 'react';\n\nexport interface ChatCreateButtonProps {\n onClick?: () => void;\n}\n\nconst CreateButton: React.FC<ChatCreateButtonProps> = ({ onClick }) => (\n <Button type=\"primary\" icon={<Plus />} onClick={onClick}>\n 新建助手\n </Button>\n);\n\nexport default CreateButton;\n"],"names":["CreateButton","onClick","jsx","Button","Plus"],"mappings":";;;AAQA,MAAMA,IAAgD,CAAC,EAAE,SAAAC,EAAA,MACvD,gBAAAC,EAACC,GAAA,EAAO,MAAK,WAAU,MAAM,gBAAAD,EAACE,GAAA,CAAA,CAAK,GAAI,SAAAH,GAAkB,UAAA,OAAA,CAEzD;"}
@@ -0,0 +1,20 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { Plus as r } from "../../../Icons/index.js";
3
+ import i from "@kne/button-group";
4
+ const s = ({ onCreateClick: t }) => /* @__PURE__ */ o(
5
+ i,
6
+ {
7
+ list: [
8
+ {
9
+ children: "新建助手",
10
+ type: "primary",
11
+ icon: /* @__PURE__ */ o(r, {}),
12
+ onClick: t
13
+ }
14
+ ]
15
+ }
16
+ );
17
+ export {
18
+ s as default
19
+ };
20
+ //# sourceMappingURL=ManageActionButtons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ManageActionButtons.js","sources":["../../../../../src/components/AgentHub/Chat/Action/ManageActionButtons.tsx"],"sourcesContent":["import { Plus } from '@/components/Icons';\nimport ButtonGroup from '@kne/button-group';\nimport React from 'react';\n\nexport interface ChatManageActionButtonsProps {\n onCreateClick: () => void;\n}\n\nconst ManageActionButtons: React.FC<ChatManageActionButtonsProps> = ({ onCreateClick }) => (\n <ButtonGroup\n list={[\n {\n children: '新建助手',\n type: 'primary',\n icon: <Plus />,\n onClick: onCreateClick,\n },\n ]}\n />\n);\n\nexport default ManageActionButtons;\n"],"names":["ManageActionButtons","onCreateClick","jsx","ButtonGroup","Plus"],"mappings":";;;AAQA,MAAMA,IAA8D,CAAC,EAAE,eAAAC,EAAA,MACrE,gBAAAC;AAAA,EAACC;AAAA,EAAA;AAAA,IACC,MAAM;AAAA,MACJ;AAAA,QACE,UAAU;AAAA,QACV,MAAM;AAAA,QACN,wBAAOC,GAAA,EAAK;AAAA,QACZ,SAASH;AAAA,MAAA;AAAA,IACX;AAAA,EACF;AACF;"}
@@ -0,0 +1,24 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { Trash2 as r } from "../../../Icons/index.js";
3
+ import n from "@kne/button-group";
4
+ const f = ({
5
+ streaming: t = !1,
6
+ clearDisabled: s = !1,
7
+ onClearConversation: i
8
+ }) => /* @__PURE__ */ o(
9
+ n,
10
+ {
11
+ list: [
12
+ {
13
+ children: "清空对话",
14
+ icon: /* @__PURE__ */ o(r, {}),
15
+ disabled: t || s,
16
+ onClick: i
17
+ }
18
+ ]
19
+ }
20
+ );
21
+ export {
22
+ f as default
23
+ };
24
+ //# sourceMappingURL=SessionActionButtons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SessionActionButtons.js","sources":["../../../../../src/components/AgentHub/Chat/Action/SessionActionButtons.tsx"],"sourcesContent":["import { Trash2 } from '@/components/Icons';\nimport ButtonGroup from '@kne/button-group';\nimport React from 'react';\n\nexport interface SessionActionButtonsProps {\n streaming?: boolean;\n clearDisabled?: boolean;\n onClearConversation: () => void;\n}\n\nconst SessionActionButtons: React.FC<SessionActionButtonsProps> = ({\n streaming = false,\n clearDisabled = false,\n onClearConversation,\n}) => (\n <ButtonGroup\n list={[\n {\n children: '清空对话',\n icon: <Trash2 />,\n disabled: streaming || clearDisabled,\n onClick: onClearConversation,\n },\n ]}\n />\n);\n\nexport default SessionActionButtons;\n"],"names":["SessionActionButtons","streaming","clearDisabled","onClearConversation","jsx","ButtonGroup","Trash2"],"mappings":";;;AAUA,MAAMA,IAA4D,CAAC;AAAA,EACjE,WAAAC,IAAY;AAAA,EACZ,eAAAC,IAAgB;AAAA,EAChB,qBAAAC;AACF,MACE,gBAAAC;AAAA,EAACC;AAAA,EAAA;AAAA,IACC,MAAM;AAAA,MACJ;AAAA,QACE,UAAU;AAAA,QACV,wBAAOC,GAAA,EAAO;AAAA,QACd,UAAUL,KAAaC;AAAA,QACvB,SAASC;AAAA,MAAA;AAAA,IACX;AAAA,EACF;AACF;"}
@@ -4,8 +4,3 @@ export type ChatActionHandlers = {
4
4
  onCreate?: () => void;
5
5
  onEdit?: (id: string) => void;
6
6
  };
7
- export type KnowledgeBaseActionHandlers = {
8
- onDelete?: (id: string) => Promise<void>;
9
- onCreate?: () => void;
10
- onUpload?: (datasetId: string) => void;
11
- };
@@ -0,0 +1,65 @@
1
+ import { jsxs as r, jsx as a } from "react/jsx-runtime";
2
+ import { Pause as u, Send as d } from "../../../../Icons/index.js";
3
+ import { Input as y, Button as p } from "antd";
4
+ import t from "./style.module.scss.js";
5
+ import n from "classnames";
6
+ const E = ({
7
+ value: e,
8
+ loading: c,
9
+ onChange: o,
10
+ onSend: s,
11
+ onStop: h,
12
+ placeholder: m = "输入问题… Enter 发送,Shift+Enter 换行"
13
+ }) => {
14
+ const l = (i) => {
15
+ i.key === "Enter" && !i.shiftKey && (i.preventDefault(), !c && e.trim() && s());
16
+ };
17
+ return /* @__PURE__ */ r("div", { className: n("chat-input-root", t["chat-input-root"]), children: [
18
+ /* @__PURE__ */ r("div", { className: n("chat-input-container", t["chat-input-container"]), children: [
19
+ /* @__PURE__ */ a(
20
+ y.TextArea,
21
+ {
22
+ value: e,
23
+ onChange: (i) => o(i.target.value),
24
+ onKeyDown: l,
25
+ placeholder: m,
26
+ autoSize: { minRows: 1, maxRows: 5 },
27
+ disabled: c,
28
+ variant: "borderless",
29
+ className: n("chat-input-wrapper", t["chat-input-wrapper"])
30
+ }
31
+ ),
32
+ c ? /* @__PURE__ */ a(
33
+ p,
34
+ {
35
+ type: "primary",
36
+ danger: !0,
37
+ icon: /* @__PURE__ */ a(u, {}),
38
+ onClick: h,
39
+ "aria-label": "停止生成",
40
+ className: n("chat-input-inner", t["chat-input-inner"])
41
+ }
42
+ ) : /* @__PURE__ */ a(
43
+ p,
44
+ {
45
+ type: "primary",
46
+ icon: /* @__PURE__ */ a(d, {}),
47
+ onClick: s,
48
+ disabled: !e.trim(),
49
+ className: n("chat-input-inner", t["chat-input-inner"])
50
+ }
51
+ )
52
+ ] }),
53
+ /* @__PURE__ */ r("div", { className: n("chat-input-header", t["chat-input-header"]), children: [
54
+ /* @__PURE__ */ a("span", { className: n("chat-input-body", t["chat-input-body"]), children: "Enter 发送 · Shift+Enter 换行" }),
55
+ e.length > 0 && /* @__PURE__ */ r("span", { className: n("chat-input-body", t["chat-input-body"]), children: [
56
+ e.length,
57
+ " 字"
58
+ ] })
59
+ ] })
60
+ ] });
61
+ };
62
+ export {
63
+ E as default
64
+ };
65
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../../../src/components/AgentHub/Chat/Detail/ChatInput/index.tsx"],"sourcesContent":["import { Pause, Send } from '@/components/Icons';\nimport { Button, Input } from 'antd';\nimport React from 'react';\nimport styles from './style.module.scss';\nimport classNames from 'classnames';\n\nexport interface ChatInputProps {\n value: string;\n loading: boolean;\n onChange: (v: string) => void;\n onSend: () => void;\n onStop?: () => void;\n placeholder?: string;\n}\n\nconst ChatInput: React.FC<ChatInputProps> = ({\n value,\n loading,\n onChange,\n onSend,\n onStop,\n placeholder = '输入问题… Enter 发送,Shift+Enter 换行',\n}) => {\n const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault();\n if (!loading && value.trim()) {\n onSend();\n }\n }\n };\n\n return (\n <div className={classNames('chat-input-root', styles['chat-input-root'])}>\n <div className={classNames('chat-input-container', styles['chat-input-container'])}>\n <Input.TextArea\n value={value}\n onChange={(e) => onChange(e.target.value)}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n autoSize={{ minRows: 1, maxRows: 5 }}\n disabled={loading}\n variant=\"borderless\"\n className={classNames('chat-input-wrapper', styles['chat-input-wrapper'])}\n />\n\n {loading ? (\n <Button\n type=\"primary\"\n danger\n icon={<Pause />}\n onClick={onStop}\n aria-label=\"停止生成\"\n className={classNames('chat-input-inner', styles['chat-input-inner'])}\n />\n ) : (\n <Button\n type=\"primary\"\n icon={<Send />}\n onClick={onSend}\n disabled={!value.trim()}\n className={classNames('chat-input-inner', styles['chat-input-inner'])}\n />\n )}\n </div>\n\n <div className={classNames('chat-input-header', styles['chat-input-header'])}>\n <span className={classNames('chat-input-body', styles['chat-input-body'])}>Enter 发送 · Shift+Enter 换行</span>\n {value.length > 0 && <span className={classNames('chat-input-body', styles['chat-input-body'])}>{value.length} 字</span>}\n </div>\n </div>\n );\n};\n\nexport default ChatInput;\n"],"names":["ChatInput","value","loading","onChange","onSend","onStop","placeholder","handleKeyDown","e","jsxs","classNames","styles","jsx","Input","Button","Pause","Send"],"mappings":";;;;;AAeA,MAAMA,IAAsC,CAAC;AAAA,EAC3C,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,aAAAC,IAAc;AAChB,MAAM;AACJ,QAAMC,IAAgB,CAACC,MAAgD;AACrE,IAAIA,EAAE,QAAQ,WAAW,CAACA,EAAE,aAC1BA,EAAE,eAAA,GACE,CAACN,KAAWD,EAAM,UACpBG,EAAA;AAAA,EAGN;AAEA,SACE,gBAAAK,EAAC,SAAI,WAAWC,EAAW,mBAAmBC,EAAO,iBAAiB,CAAC,GACrE,UAAA;AAAA,IAAA,gBAAAF,EAAC,SAAI,WAAWC,EAAW,wBAAwBC,EAAO,sBAAsB,CAAC,GAC/E,UAAA;AAAA,MAAA,gBAAAC;AAAA,QAACC,EAAM;AAAA,QAAN;AAAA,UACC,OAAAZ;AAAA,UACA,UAAU,CAACO,MAAML,EAASK,EAAE,OAAO,KAAK;AAAA,UACxC,WAAWD;AAAA,UACX,aAAAD;AAAA,UACA,UAAU,EAAE,SAAS,GAAG,SAAS,EAAA;AAAA,UACjC,UAAUJ;AAAA,UACV,SAAQ;AAAA,UACR,WAAWQ,EAAW,sBAAsBC,EAAO,oBAAoB,CAAC;AAAA,QAAA;AAAA,MAAA;AAAA,MAGzET,IACC,gBAAAU;AAAA,QAACE;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,QAAM;AAAA,UACN,wBAAOC,GAAA,EAAM;AAAA,UACb,SAASV;AAAA,UACT,cAAW;AAAA,UACX,WAAWK,EAAW,oBAAoBC,EAAO,kBAAkB,CAAC;AAAA,QAAA;AAAA,MAAA,IAGtE,gBAAAC;AAAA,QAACE;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,wBAAOE,GAAA,EAAK;AAAA,UACZ,SAASZ;AAAA,UACT,UAAU,CAACH,EAAM,KAAA;AAAA,UACjB,WAAWS,EAAW,oBAAoBC,EAAO,kBAAkB,CAAC;AAAA,QAAA;AAAA,MAAA;AAAA,IACtE,GAEJ;AAAA,IAEA,gBAAAF,EAAC,SAAI,WAAWC,EAAW,qBAAqBC,EAAO,mBAAmB,CAAC,GACzE,UAAA;AAAA,MAAA,gBAAAC,EAAC,QAAA,EAAK,WAAWF,EAAW,mBAAmBC,EAAO,iBAAiB,CAAC,GAAG,UAAA,4BAAA,CAAyB;AAAA,MACnGV,EAAM,SAAS,KAAK,gBAAAQ,EAAC,QAAA,EAAK,WAAWC,EAAW,mBAAmBC,EAAO,iBAAiB,CAAC,GAAI,UAAA;AAAA,QAAAV,EAAM;AAAA,QAAO;AAAA,MAAA,EAAA,CAAE;AAAA,IAAA,EAAA,CAClH;AAAA,EAAA,GACF;AAEJ;"}
@@ -0,0 +1,12 @@
1
+ const t = {
2
+ "chat-input-root": "_chat-input-root_1iegn_1",
3
+ "chat-input-container": "_chat-input-container_1iegn_12",
4
+ "chat-input-wrapper": "_chat-input-wrapper_1iegn_28",
5
+ "chat-input-inner": "_chat-input-inner_1iegn_34",
6
+ "chat-input-header": "_chat-input-header_1iegn_50",
7
+ "chat-input-body": "_chat-input-body_1iegn_59"
8
+ };
9
+ export {
10
+ t as default
11
+ };
12
+ //# sourceMappingURL=style.module.scss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -0,0 +1,31 @@
1
+ import { ChatMessage } from '../../../types';
2
+ import { default as React } from 'react';
3
+ import { ChatInputProps } from '../ChatInput';
4
+ import { MessageItemProps } from '../MessageItem';
5
+ export interface ChatPanelProps {
6
+ title?: string;
7
+ subtitle?: string;
8
+ showHeader?: boolean;
9
+ showCloseButton?: boolean;
10
+ onClose?: () => void;
11
+ showSuggestions?: boolean;
12
+ suggestions?: string[];
13
+ onSuggestionClick?: (text: string) => void;
14
+ messages: ChatMessage[];
15
+ showEmptyHint?: boolean;
16
+ emptyPlaceholder?: string;
17
+ onCitationClick?: MessageItemProps['onCitationClick'];
18
+ onEditMessage?: MessageItemProps['onEditMessage'];
19
+ onResendMessage?: MessageItemProps['onResendMessage'];
20
+ editDisabled?: boolean;
21
+ inputValue: string;
22
+ inputLoading?: boolean;
23
+ onInputChange: (v: string) => void;
24
+ onSend: () => void;
25
+ onStop?: ChatInputProps['onStop'];
26
+ inputPlaceholder?: string;
27
+ showInput?: boolean;
28
+ className?: string;
29
+ }
30
+ declare const ChatPanel: React.FC<ChatPanelProps>;
31
+ export default ChatPanel;
@@ -0,0 +1,85 @@
1
+ import { jsxs as t, jsx as l } from "react/jsx-runtime";
2
+ import { Button as M } from "antd";
3
+ import { useRef as f } from "react";
4
+ import n from "classnames";
5
+ import P from "../ChatInput/index.js";
6
+ import T from "../ChatSuggestionRow/index.js";
7
+ import V from "../MessageItem/index.js";
8
+ import e from "./style.module.scss.js";
9
+ import { useAutoScrollToBottom as q } from "../../hooks/useAutoScrollToBottom.js";
10
+ import E from "../../../../VirtualScrollbar/VirtualScrollbar/index.js";
11
+ const Y = ({
12
+ title: r,
13
+ subtitle: o,
14
+ showHeader: u = !0,
15
+ showCloseButton: N = !1,
16
+ onClose: c,
17
+ showSuggestions: g = !1,
18
+ suggestions: s = [],
19
+ onSuggestionClick: i,
20
+ messages: a,
21
+ showEmptyHint: v = !0,
22
+ emptyPlaceholder: C = "点击上方建议,或直接输入问题",
23
+ onCitationClick: S,
24
+ onEditMessage: w,
25
+ onResendMessage: R,
26
+ editDisabled: y,
27
+ inputValue: b,
28
+ inputLoading: m = !1,
29
+ onInputChange: x,
30
+ onSend: j,
31
+ onStop: B,
32
+ inputPlaceholder: I,
33
+ showInput: k = !0,
34
+ className: z
35
+ }) => {
36
+ const p = f(null), h = f(null), { handleScroll: A } = q(p, h, {
37
+ enabled: a.length > 0,
38
+ trigger: a
39
+ }), D = g && s.length > 0 && typeof i == "function";
40
+ return /* @__PURE__ */ t("div", { className: n("chat-panel", e["chat-panel"], z), children: [
41
+ u ? /* @__PURE__ */ t("div", { className: n("chat-panel-head", e["chat-panel-head"]), children: [
42
+ /* @__PURE__ */ t("div", { children: [
43
+ r ? /* @__PURE__ */ l("strong", { className: e["chat-panel-title"], children: r }) : null,
44
+ o ? /* @__PURE__ */ l("span", { className: e["chat-panel-subtitle"], children: o }) : null
45
+ ] }),
46
+ N && c ? /* @__PURE__ */ l(M, { type: "link", size: "small", onClick: c, children: "收起" }) : null
47
+ ] }) : null,
48
+ D ? /* @__PURE__ */ l(T, { suggestions: s, onSelect: i }) : null,
49
+ /* @__PURE__ */ l(
50
+ E,
51
+ {
52
+ className: n("chat-panel-messages", e["chat-panel-messages"]),
53
+ wrapperClassName: e["chat-panel-messages-wrapper"],
54
+ onScroll: A,
55
+ ref: p,
56
+ children: /* @__PURE__ */ l("div", { ref: h, children: a.length === 0 && v ? /* @__PURE__ */ l("p", { className: e["chat-panel-empty"], children: C }) : a.map((d) => /* @__PURE__ */ l(
57
+ V,
58
+ {
59
+ message: d,
60
+ onCitationClick: S,
61
+ onEditMessage: w,
62
+ onResendMessage: R,
63
+ editDisabled: y || m
64
+ },
65
+ d.id
66
+ )) })
67
+ }
68
+ ),
69
+ k ? /* @__PURE__ */ l("div", { className: e["chat-panel-input"], children: /* @__PURE__ */ l(
70
+ P,
71
+ {
72
+ value: b,
73
+ loading: m,
74
+ onChange: x,
75
+ onSend: j,
76
+ onStop: B,
77
+ placeholder: I
78
+ }
79
+ ) }) : null
80
+ ] });
81
+ };
82
+ export {
83
+ Y as default
84
+ };
85
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../../../src/components/AgentHub/Chat/Detail/ChatPanel/index.tsx"],"sourcesContent":["import type { ChatMessage } from '@/components/AgentHub/types';\nimport { VirtualScrollbar } from '@/components/VirtualScrollbar';\nimport { Button } from 'antd';\nimport React, { useRef } from 'react';\nimport classNames from 'classnames';\nimport { useAutoScrollToBottom } from '../../hooks';\nimport ChatInput from '../ChatInput';\nimport type { ChatInputProps } from '../ChatInput';\nimport ChatSuggestionRow from '../ChatSuggestionRow';\nimport MessageItem from '../MessageItem';\nimport type { MessageItemProps } from '../MessageItem';\nimport styles from './style.module.scss';\n\nexport interface ChatPanelProps {\n title?: string;\n subtitle?: string;\n showHeader?: boolean;\n showCloseButton?: boolean;\n onClose?: () => void;\n\n showSuggestions?: boolean;\n suggestions?: string[];\n onSuggestionClick?: (text: string) => void;\n\n messages: ChatMessage[];\n showEmptyHint?: boolean;\n emptyPlaceholder?: string;\n onCitationClick?: MessageItemProps['onCitationClick'];\n onEditMessage?: MessageItemProps['onEditMessage'];\n onResendMessage?: MessageItemProps['onResendMessage'];\n editDisabled?: boolean;\n\n inputValue: string;\n inputLoading?: boolean;\n onInputChange: (v: string) => void;\n onSend: () => void;\n onStop?: ChatInputProps['onStop'];\n inputPlaceholder?: string;\n showInput?: boolean;\n\n className?: string;\n}\n\nconst ChatPanel: React.FC<ChatPanelProps> = ({\n title,\n subtitle,\n showHeader = true,\n showCloseButton = false,\n onClose,\n showSuggestions = false,\n suggestions = [],\n onSuggestionClick,\n messages,\n showEmptyHint = true,\n emptyPlaceholder = '点击上方建议,或直接输入问题',\n onCitationClick,\n onEditMessage,\n onResendMessage,\n editDisabled,\n inputValue,\n inputLoading = false,\n onInputChange,\n onSend,\n onStop,\n inputPlaceholder,\n showInput = true,\n className,\n}) => {\n const scrollContainerRef = useRef<HTMLDivElement>(null);\n const messagesContentRef = useRef<HTMLDivElement>(null);\n\n const { handleScroll } = useAutoScrollToBottom(scrollContainerRef, messagesContentRef, {\n enabled: messages.length > 0,\n trigger: messages,\n });\n\n const showSuggestionRow =\n showSuggestions && suggestions.length > 0 && typeof onSuggestionClick === 'function';\n\n return (\n <div className={classNames('chat-panel', styles['chat-panel'], className)}>\n {showHeader ? (\n <div className={classNames('chat-panel-head', styles['chat-panel-head'])}>\n <div>\n {title ? <strong className={styles['chat-panel-title']}>{title}</strong> : null}\n {subtitle ? <span className={styles['chat-panel-subtitle']}>{subtitle}</span> : null}\n </div>\n {showCloseButton && onClose ? (\n <Button type=\"link\" size=\"small\" onClick={onClose}>\n 收起\n </Button>\n ) : null}\n </div>\n ) : null}\n\n {showSuggestionRow ? (\n <ChatSuggestionRow suggestions={suggestions} onSelect={onSuggestionClick} />\n ) : null}\n\n <VirtualScrollbar\n className={classNames('chat-panel-messages', styles['chat-panel-messages'])}\n wrapperClassName={styles['chat-panel-messages-wrapper']}\n onScroll={handleScroll}\n ref={scrollContainerRef}\n >\n <div ref={messagesContentRef}>\n {messages.length === 0 && showEmptyHint ? (\n <p className={styles['chat-panel-empty']}>{emptyPlaceholder}</p>\n ) : (\n messages.map((message) => (\n <MessageItem\n key={message.id}\n message={message}\n onCitationClick={onCitationClick}\n onEditMessage={onEditMessage}\n onResendMessage={onResendMessage}\n editDisabled={editDisabled || inputLoading}\n />\n ))\n )}\n </div>\n </VirtualScrollbar>\n\n {showInput ? (\n <div className={styles['chat-panel-input']}>\n <ChatInput\n value={inputValue}\n loading={inputLoading}\n onChange={onInputChange}\n onSend={onSend}\n onStop={onStop}\n placeholder={inputPlaceholder}\n />\n </div>\n ) : null}\n </div>\n );\n};\n\nexport default ChatPanel;\n"],"names":["ChatPanel","title","subtitle","showHeader","showCloseButton","onClose","showSuggestions","suggestions","onSuggestionClick","messages","showEmptyHint","emptyPlaceholder","onCitationClick","onEditMessage","onResendMessage","editDisabled","inputValue","inputLoading","onInputChange","onSend","onStop","inputPlaceholder","showInput","className","scrollContainerRef","useRef","messagesContentRef","handleScroll","useAutoScrollToBottom","showSuggestionRow","jsxs","classNames","styles","jsx","Button","ChatSuggestionRow","VirtualScrollbar","message","MessageItem","ChatInput"],"mappings":";;;;;;;;;;AA2CA,MAAMA,IAAsC,CAAC;AAAA,EAC3C,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,iBAAAC,IAAkB;AAAA,EAClB,SAAAC;AAAA,EACA,iBAAAC,IAAkB;AAAA,EAClB,aAAAC,IAAc,CAAA;AAAA,EACd,mBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,kBAAAC,IAAmB;AAAA,EACnB,iBAAAC;AAAA,EACA,eAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,YAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,eAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,WAAAC;AACF,MAAM;AACJ,QAAMC,IAAqBC,EAAuB,IAAI,GAChDC,IAAqBD,EAAuB,IAAI,GAEhD,EAAE,cAAAE,EAAA,IAAiBC,EAAsBJ,GAAoBE,GAAoB;AAAA,IACrF,SAASjB,EAAS,SAAS;AAAA,IAC3B,SAASA;AAAA,EAAA,CACV,GAEKoB,IACJvB,KAAmBC,EAAY,SAAS,KAAK,OAAOC,KAAsB;AAE5E,SACE,gBAAAsB,EAAC,SAAI,WAAWC,EAAW,cAAcC,EAAO,YAAY,GAAGT,CAAS,GACrE,UAAA;AAAA,IAAApB,IACC,gBAAA2B,EAAC,SAAI,WAAWC,EAAW,mBAAmBC,EAAO,iBAAiB,CAAC,GACrE,UAAA;AAAA,MAAA,gBAAAF,EAAC,OAAA,EACE,UAAA;AAAA,QAAA7B,sBAAS,UAAA,EAAO,WAAW+B,EAAO,kBAAkB,GAAI,aAAM,IAAY;AAAA,QAC1E9B,sBAAY,QAAA,EAAK,WAAW8B,EAAO,qBAAqB,GAAI,aAAS,IAAU;AAAA,MAAA,GAClF;AAAA,MACC5B,KAAmBC,IAClB,gBAAA4B,EAACC,GAAA,EAAO,MAAK,QAAO,MAAK,SAAQ,SAAS7B,GAAS,UAAA,KAAA,CAEnD,IACE;AAAA,IAAA,EAAA,CACN,IACE;AAAA,IAEHwB,IACC,gBAAAI,EAACE,GAAA,EAAkB,aAAA5B,GAA0B,UAAUC,GAAmB,IACxE;AAAA,IAEJ,gBAAAyB;AAAA,MAACG;AAAA,MAAA;AAAA,QACC,WAAWL,EAAW,uBAAuBC,EAAO,qBAAqB,CAAC;AAAA,QAC1E,kBAAkBA,EAAO,6BAA6B;AAAA,QACtD,UAAUL;AAAA,QACV,KAAKH;AAAA,QAEL,4BAAC,OAAA,EAAI,KAAKE,GACP,UAAAjB,EAAS,WAAW,KAAKC,IACxB,gBAAAuB,EAAC,OAAE,WAAWD,EAAO,kBAAkB,GAAI,UAAArB,EAAA,CAAiB,IAE5DF,EAAS,IAAI,CAAC4B,MACZ,gBAAAJ;AAAA,UAACK;AAAA,UAAA;AAAA,YAEC,SAAAD;AAAA,YACA,iBAAAzB;AAAA,YACA,eAAAC;AAAA,YACA,iBAAAC;AAAA,YACA,cAAcC,KAAgBE;AAAA,UAAA;AAAA,UALzBoB,EAAQ;AAAA,QAAA,CAOhB,EAAA,CAEL;AAAA,MAAA;AAAA,IAAA;AAAA,IAGDf,IACC,gBAAAW,EAAC,OAAA,EAAI,WAAWD,EAAO,kBAAkB,GACvC,UAAA,gBAAAC;AAAA,MAACM;AAAA,MAAA;AAAA,QACC,OAAOvB;AAAA,QACP,SAASC;AAAA,QACT,UAAUC;AAAA,QACV,QAAAC;AAAA,QACA,QAAAC;AAAA,QACA,aAAaC;AAAA,MAAA;AAAA,IAAA,GAEjB,IACE;AAAA,EAAA,GACN;AAEJ;"}
@@ -0,0 +1,14 @@
1
+ const a = {
2
+ "chat-panel": "_chat-panel_j7eqa_1",
3
+ "chat-panel-head": "_chat-panel-head_j7eqa_9",
4
+ "chat-panel-title": "_chat-panel-title_j7eqa_20",
5
+ "chat-panel-subtitle": "_chat-panel-subtitle_j7eqa_28",
6
+ "chat-panel-messages-wrapper": "_chat-panel-messages-wrapper_j7eqa_35",
7
+ "chat-panel-messages": "_chat-panel-messages_j7eqa_35",
8
+ "chat-panel-empty": "_chat-panel-empty_j7eqa_45",
9
+ "chat-panel-input": "_chat-panel-input_j7eqa_52"
10
+ };
11
+ export {
12
+ a as default
13
+ };
14
+ //# sourceMappingURL=style.module.scss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
@@ -0,0 +1,9 @@
1
+ import { default as React } from 'react';
2
+ export interface ChatSuggestionRowProps {
3
+ suggestions: string[];
4
+ onSelect: (text: string) => void;
5
+ visible?: boolean;
6
+ className?: string;
7
+ }
8
+ declare const ChatSuggestionRow: React.FC<ChatSuggestionRowProps>;
9
+ export default ChatSuggestionRow;
@@ -0,0 +1,22 @@
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import r from "classnames";
3
+ import e from "./style.module.scss.js";
4
+ const h = ({
5
+ suggestions: o,
6
+ onSelect: a,
7
+ visible: i = !0,
8
+ className: n
9
+ }) => !i || !o.length ? null : /* @__PURE__ */ s("div", { className: r("chat-suggestion-row", e["chat-suggestion-row"], n), children: o.map((t) => /* @__PURE__ */ s(
10
+ "button",
11
+ {
12
+ type: "button",
13
+ className: r("chat-suggestion-chip", e["chat-suggestion-chip"]),
14
+ onClick: () => a(t),
15
+ children: t
16
+ },
17
+ t
18
+ )) });
19
+ export {
20
+ h as default
21
+ };
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../../../src/components/AgentHub/Chat/Detail/ChatSuggestionRow/index.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport styles from './style.module.scss';\n\nexport interface ChatSuggestionRowProps {\n suggestions: string[];\n onSelect: (text: string) => void;\n visible?: boolean;\n className?: string;\n}\n\nconst ChatSuggestionRow: React.FC<ChatSuggestionRowProps> = ({\n suggestions,\n onSelect,\n visible = true,\n className,\n}) => {\n if (!visible || !suggestions.length) return null;\n\n return (\n <div className={classNames('chat-suggestion-row', styles['chat-suggestion-row'], className)}>\n {suggestions.map((text) => (\n <button\n key={text}\n type=\"button\"\n className={classNames('chat-suggestion-chip', styles['chat-suggestion-chip'])}\n onClick={() => onSelect(text)}\n >\n {text}\n </button>\n ))}\n </div>\n );\n};\n\nexport default ChatSuggestionRow;\n"],"names":["ChatSuggestionRow","suggestions","onSelect","visible","className","jsx","classNames","styles","text"],"mappings":";;;AAWA,MAAMA,IAAsD,CAAC;AAAA,EAC3D,aAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,WAAAC;AACF,MACM,CAACD,KAAW,CAACF,EAAY,SAAe,OAG1C,gBAAAI,EAAC,OAAA,EAAI,WAAWC,EAAW,uBAAuBC,EAAO,qBAAqB,GAAGH,CAAS,GACvF,UAAAH,EAAY,IAAI,CAACO,MAChB,gBAAAH;AAAA,EAAC;AAAA,EAAA;AAAA,IAEC,MAAK;AAAA,IACL,WAAWC,EAAW,wBAAwBC,EAAO,sBAAsB,CAAC;AAAA,IAC5E,SAAS,MAAML,EAASM,CAAI;AAAA,IAE3B,UAAAA;AAAA,EAAA;AAAA,EALIA;AAAA,CAOR,GACH;"}
@@ -0,0 +1,8 @@
1
+ const s = {
2
+ "chat-suggestion-row": "_chat-suggestion-row_1l9qy_1",
3
+ "chat-suggestion-chip": "_chat-suggestion-chip_1l9qy_9"
4
+ };
5
+ export {
6
+ s as default
7
+ };
8
+ //# sourceMappingURL=style.module.scss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -0,0 +1,21 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { useMemo as e } from "react";
3
+ import a from "react-markdown";
4
+ import m from "remark-gfm";
5
+ import n from "./style.module.scss.js";
6
+ import r from "classnames";
7
+ import { prepareCitationContent as c, sanitizeCitationHtml as s } from "../../utils/citationContent.js";
8
+ const C = ({ content: i }) => {
9
+ const t = e(() => c(i), [i]);
10
+ return t.body ? t.isHtml ? /* @__PURE__ */ o(
11
+ "div",
12
+ {
13
+ className: r("citation-content-citation-rich-content", n["citation-content-citation-rich-content"]),
14
+ dangerouslySetInnerHTML: { __html: s(t.body) }
15
+ }
16
+ ) : /* @__PURE__ */ o("div", { className: r("markdown-preview", r("citation-content-footer", n["citation-content-footer"])), children: /* @__PURE__ */ o(a, { remarkPlugins: [m], children: t.body }) }) : null;
17
+ };
18
+ export {
19
+ C as default
20
+ };
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../../../src/components/AgentHub/Chat/Detail/CitationContent/index.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport ReactMarkdown from 'react-markdown';\nimport remarkGfm from 'remark-gfm';\nimport { prepareCitationContent, sanitizeCitationHtml } from '../../utils';\nimport styles from './style.module.scss';\nimport classNames from 'classnames';\n\nexport interface CitationContentProps {\n content: string;\n}\n\nconst CitationContent: React.FC<CitationContentProps> = ({ content }) => {\n const prepared = useMemo(() => prepareCitationContent(content), [content]);\n\n if (!prepared.body) return null;\n\n if (prepared.isHtml) {\n return (\n <div\n className={classNames('citation-content-citation-rich-content', styles['citation-content-citation-rich-content'])}\n dangerouslySetInnerHTML={{ __html: sanitizeCitationHtml(prepared.body) }}\n />\n );\n }\n\n return (\n <div className={classNames('markdown-preview', classNames('citation-content-footer', styles['citation-content-footer']))}>\n <ReactMarkdown remarkPlugins={[remarkGfm]}>{prepared.body}</ReactMarkdown>\n </div>\n );\n};\n\nexport default CitationContent;\n"],"names":["CitationContent","content","prepared","useMemo","prepareCitationContent","jsx","classNames","styles","sanitizeCitationHtml","ReactMarkdown","remarkGfm"],"mappings":";;;;;;;AAWA,MAAMA,IAAkD,CAAC,EAAE,SAAAC,QAAc;AACvE,QAAMC,IAAWC,EAAQ,MAAMC,EAAuBH,CAAO,GAAG,CAACA,CAAO,CAAC;AAEzE,SAAKC,EAAS,OAEVA,EAAS,SAET,gBAAAG;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,EAAW,0CAA0CC,EAAO,wCAAwC,CAAC;AAAA,MAChH,yBAAyB,EAAE,QAAQC,EAAqBN,EAAS,IAAI,EAAA;AAAA,IAAE;AAAA,EAAA,IAM3E,gBAAAG,EAAC,SAAI,WAAWC,EAAW,oBAAoBA,EAAW,2BAA2BC,EAAO,yBAAyB,CAAC,CAAC,GACrH,UAAA,gBAAAF,EAACI,KAAc,eAAe,CAACC,CAAS,GAAI,UAAAR,EAAS,MAAK,GAC5D,IAdyB;AAgB7B;"}
@@ -0,0 +1,8 @@
1
+ const t = {
2
+ "citation-content-footer": "_citation-content-footer_olxly_1",
3
+ "citation-content-citation-rich-content": "_citation-content-citation-rich-content_olxly_7"
4
+ };
5
+ export {
6
+ t as default
7
+ };
8
+ //# sourceMappingURL=style.module.scss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -0,0 +1,17 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import o from "./style.module.scss.js";
3
+ import a from "classnames";
4
+ const l = ({ number: t, onClick: i }) => /* @__PURE__ */ e(
5
+ "button",
6
+ {
7
+ type: "button",
8
+ onClick: i,
9
+ className: a("text-primary", "citation-inline-badge-row", o["citation-inline-badge-row"]),
10
+ title: `查看引用来源 ${t}`,
11
+ children: t
12
+ }
13
+ );
14
+ export {
15
+ l as default
16
+ };
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../../../src/components/AgentHub/Chat/Detail/CitationInlineBadge/index.tsx"],"sourcesContent":["import styles from './style.module.scss';\nimport classNames from 'classnames';\nimport React from 'react';\n\nexport interface CitationInlineBadgeProps {\n number: number;\n onClick?: () => void;\n}\n\nconst CitationInlineBadge: React.FC<CitationInlineBadgeProps> = ({ number, onClick }) => {\n return (\n <button\n type=\"button\"\n onClick={onClick}\n className={classNames('text-primary', 'citation-inline-badge-row', styles['citation-inline-badge-row'])}\n title={`查看引用来源 ${number}`}\n >\n {number}\n </button>\n );\n};\n\nexport default CitationInlineBadge;\n"],"names":["CitationInlineBadge","number","onClick","jsx","classNames","styles"],"mappings":";;;AASA,MAAMA,IAA0D,CAAC,EAAE,QAAAC,GAAQ,SAAAC,QAEvE,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,MAAK;AAAA,IACL,SAAAD;AAAA,IACA,WAAWE,EAAW,gBAAgB,6BAA6BC,EAAO,2BAA2B,CAAC;AAAA,IACtG,OAAO,UAAUJ,CAAM;AAAA,IAEtB,UAAAA;AAAA,EAAA;AAAA;"}
@@ -0,0 +1,7 @@
1
+ const i = {
2
+ "citation-inline-badge-row": "_citation-inline-badge-row_1g1kb_1"
3
+ };
4
+ export {
5
+ i as default
6
+ };
7
+ //# sourceMappingURL=style.module.scss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -0,0 +1,68 @@
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import b, { useMemo as k, useCallback as w, Suspense as x } from "react";
3
+ import M from "react-markdown";
4
+ import y from "remark-gfm";
5
+ import C from "../CitationInlineBadge/index.js";
6
+ import N from "./style.module.scss.js";
7
+ import f from "classnames";
8
+ import { normalizeDisplayText as I, normalizeAssistantMarkdown as z } from "../../utils/messageContent.js";
9
+ import { extractCitationIdsFromContent as B, injectCitationMarkdownLinks as j, citationIdToIndex as v, parseCitationLinkHref as D, citationDisplayNumber as L } from "../../utils/citationContent.js";
10
+ const R = b.lazy(() => import("../MermaidBlock/index.js")), E = ({
11
+ content: s,
12
+ citations: e,
13
+ citationSourceContent: o,
14
+ onCitationClick: m,
15
+ className: u,
16
+ deferMermaid: i = !1
17
+ }) => {
18
+ const c = k(() => {
19
+ const r = I(z(s));
20
+ return B(r).length > 0 || e.length > 0 ? j(r) : r;
21
+ }, [s, e.length]), d = w(
22
+ (r) => {
23
+ !e.length || !m || m(
24
+ e,
25
+ v(r, e.length, o)
26
+ );
27
+ },
28
+ [e, o, m]
29
+ ), g = k(
30
+ () => ({
31
+ code: ({ className: r, children: t, ...a }) => {
32
+ var p;
33
+ const l = (p = /language-(\w+)/.exec(r || "")) == null ? void 0 : p[1], h = String(t).replace(/\n$/, "");
34
+ return l === "mermaid" ? /* @__PURE__ */ n(
35
+ x,
36
+ {
37
+ fallback: /* @__PURE__ */ n("div", { className: f("mermaid-block", "mermaid-block--loading", f("citation-markdown-content-col", N["citation-markdown-content-col"])), children: "图表加载中…" }),
38
+ children: /* @__PURE__ */ n(R, { chart: h, enabled: !i })
39
+ }
40
+ ) : /* @__PURE__ */ n("code", { className: r, ...a, children: t });
41
+ },
42
+ a: ({ href: r, children: t }) => {
43
+ const a = D(r);
44
+ if (a !== null) {
45
+ const l = L(
46
+ a,
47
+ e.length,
48
+ o
49
+ );
50
+ return /* @__PURE__ */ n(
51
+ C,
52
+ {
53
+ number: l,
54
+ onClick: () => d(a)
55
+ }
56
+ );
57
+ }
58
+ return /* @__PURE__ */ n("a", { href: r, target: "_blank", rel: "noopener noreferrer", className: "text-primary", children: t });
59
+ }
60
+ }),
61
+ [e.length, o, i, d]
62
+ );
63
+ return c.trim() ? /* @__PURE__ */ n("div", { className: u, children: /* @__PURE__ */ n(M, { remarkPlugins: [y], components: g, children: c }) }) : null;
64
+ };
65
+ export {
66
+ E as default
67
+ };
68
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../../../src/components/AgentHub/Chat/Detail/CitationMarkdownContent/index.tsx"],"sourcesContent":["import type { Citation } from '@/components/AgentHub/types';\nimport React, { Suspense, useCallback, useMemo } from 'react';\nimport type { Components } from 'react-markdown';\nimport ReactMarkdown from 'react-markdown';\nimport remarkGfm from 'remark-gfm';\nimport {\n citationDisplayNumber,\n citationIdToIndex,\n extractCitationIdsFromContent,\n injectCitationMarkdownLinks,\n normalizeAssistantMarkdown,\n normalizeDisplayText,\n parseCitationLinkHref,\n} from '../../utils';\nimport CitationInlineBadge from '../CitationInlineBadge';\nimport styles from './style.module.scss';\nimport classNames from 'classnames';\n\nconst MermaidBlock = React.lazy(() => import('../MermaidBlock'));\n\nexport interface CitationMarkdownContentProps {\n content: string;\n citations: Citation[];\n citationSourceContent: string;\n onCitationClick?: (citations: Citation[], index?: number) => void;\n className?: string;\n deferMermaid?: boolean;\n}\n\nconst CitationMarkdownContent: React.FC<CitationMarkdownContentProps> = ({\n content,\n citations,\n citationSourceContent,\n onCitationClick,\n className,\n deferMermaid = false,\n}) => {\n const markdownContent = useMemo(() => {\n const text = normalizeDisplayText(normalizeAssistantMarkdown(content));\n const hasMarkers = extractCitationIdsFromContent(text).length > 0;\n return hasMarkers || citations.length > 0 ? injectCitationMarkdownLinks(text) : text;\n }, [content, citations.length]);\n\n const handleCitationBadgeClick = useCallback(\n (citationId: number) => {\n if (!citations.length || !onCitationClick) return;\n onCitationClick(\n citations,\n citationIdToIndex(citationId, citations.length, citationSourceContent),\n );\n },\n [citations, citationSourceContent, onCitationClick],\n );\n\n const markdownComponents = useMemo<Components>(\n () => ({\n code: ({ className, children, ...props }) => {\n const lang = /language-(\\w+)/.exec(className || '')?.[1];\n const source = String(children).replace(/\\n$/, '');\n if (lang === 'mermaid') {\n return (\n <Suspense\n fallback={\n <div className={classNames('mermaid-block', 'mermaid-block--loading', classNames('citation-markdown-content-col', styles['citation-markdown-content-col']))}>\n 图表加载中…\n </div>\n }\n >\n <MermaidBlock chart={source} enabled={!deferMermaid} />\n </Suspense>\n );\n }\n return (\n <code className={className} {...props}>\n {children}\n </code>\n );\n },\n a: ({ href, children }) => {\n const citationId = parseCitationLinkHref(href);\n if (citationId !== null) {\n const displayNumber = citationDisplayNumber(\n citationId,\n citations.length,\n citationSourceContent,\n );\n return (\n <CitationInlineBadge\n number={displayNumber}\n onClick={() => handleCitationBadgeClick(citationId)}\n />\n );\n }\n return (\n <a href={href} target=\"_blank\" rel=\"noopener noreferrer\" className=\"text-primary\">\n {children}\n </a>\n );\n },\n }),\n [citations.length, citationSourceContent, deferMermaid, handleCitationBadgeClick],\n );\n\n if (!markdownContent.trim()) return null;\n\n return (\n <div className={className}>\n <ReactMarkdown remarkPlugins={[remarkGfm]} components={markdownComponents}>\n {markdownContent}\n </ReactMarkdown>\n </div>\n );\n};\n\nexport default CitationMarkdownContent;\n"],"names":["MermaidBlock","React","CitationMarkdownContent","content","citations","citationSourceContent","onCitationClick","className","deferMermaid","markdownContent","useMemo","text","normalizeDisplayText","normalizeAssistantMarkdown","extractCitationIdsFromContent","injectCitationMarkdownLinks","handleCitationBadgeClick","useCallback","citationId","citationIdToIndex","markdownComponents","children","props","lang","_a","source","jsx","Suspense","classNames","styles","href","parseCitationLinkHref","displayNumber","citationDisplayNumber","CitationInlineBadge","ReactMarkdown","remarkGfm"],"mappings":";;;;;;;;;AAkBA,MAAMA,IAAeC,EAAM,KAAK,MAAM,OAAO,0BAAiB,CAAC,GAWzDC,IAAkE,CAAC;AAAA,EACvE,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,uBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,cAAAC,IAAe;AACjB,MAAM;AACJ,QAAMC,IAAkBC,EAAQ,MAAM;AACpC,UAAMC,IAAOC,EAAqBC,EAA2BV,CAAO,CAAC;AAErE,WADmBW,EAA8BH,CAAI,EAAE,SAAS,KAC3CP,EAAU,SAAS,IAAIW,EAA4BJ,CAAI,IAAIA;AAAA,EAClF,GAAG,CAACR,GAASC,EAAU,MAAM,CAAC,GAExBY,IAA2BC;AAAA,IAC/B,CAACC,MAAuB;AACtB,MAAI,CAACd,EAAU,UAAU,CAACE,KAC1BA;AAAA,QACEF;AAAA,QACAe,EAAkBD,GAAYd,EAAU,QAAQC,CAAqB;AAAA,MAAA;AAAA,IAEzE;AAAA,IACA,CAACD,GAAWC,GAAuBC,CAAe;AAAA,EAAA,GAG9Cc,IAAqBV;AAAA,IACzB,OAAO;AAAA,MACL,MAAM,CAAC,EAAE,WAAAH,GAAW,UAAAc,GAAU,GAAGC,QAAY;;AAC3C,cAAMC,KAAOC,IAAA,iBAAiB,KAAKjB,KAAa,EAAE,MAArC,gBAAAiB,EAAyC,IAChDC,IAAS,OAAOJ,CAAQ,EAAE,QAAQ,OAAO,EAAE;AACjD,eAAIE,MAAS,YAET,gBAAAG;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,UACE,gBAAAD,EAAC,OAAA,EAAI,WAAWE,EAAW,iBAAiB,0BAA0BA,EAAW,iCAAiCC,EAAO,+BAA+B,CAAC,CAAC,GAAG,UAAA,UAE7J;AAAA,YAGF,4BAAC7B,GAAA,EAAa,OAAOyB,GAAQ,SAAS,CAACjB,EAAA,CAAc;AAAA,UAAA;AAAA,QAAA,sBAKxD,QAAA,EAAK,WAAWD,GAAY,GAAGe,GAC7B,UAAAD,GACH;AAAA,MAEJ;AAAA,MACA,GAAG,CAAC,EAAE,MAAAS,GAAM,UAAAT,QAAe;AACzB,cAAMH,IAAaa,EAAsBD,CAAI;AAC7C,YAAIZ,MAAe,MAAM;AACvB,gBAAMc,IAAgBC;AAAA,YACpBf;AAAA,YACAd,EAAU;AAAA,YACVC;AAAA,UAAA;AAEF,iBACE,gBAAAqB;AAAA,YAACQ;AAAA,YAAA;AAAA,cACC,QAAQF;AAAA,cACR,SAAS,MAAMhB,EAAyBE,CAAU;AAAA,YAAA;AAAA,UAAA;AAAA,QAGxD;AACA,eACE,gBAAAQ,EAAC,OAAE,MAAAI,GAAY,QAAO,UAAS,KAAI,uBAAsB,WAAU,gBAChE,UAAAT,EAAA,CACH;AAAA,MAEJ;AAAA,IAAA;AAAA,IAEF,CAACjB,EAAU,QAAQC,GAAuBG,GAAcQ,CAAwB;AAAA,EAAA;AAGlF,SAAKP,EAAgB,KAAA,IAGnB,gBAAAiB,EAAC,OAAA,EAAI,WAAAnB,GACH,UAAA,gBAAAmB,EAACS,GAAA,EAAc,eAAe,CAACC,CAAS,GAAG,YAAYhB,GACpD,UAAAX,EAAA,CACH,GACF,IAPkC;AAStC;"}
@@ -0,0 +1,7 @@
1
+ const t = {
2
+ "citation-markdown-content-col": "_citation-markdown-content-col_1157p_1"
3
+ };
4
+ export {
5
+ t as default
6
+ };
7
+ //# sourceMappingURL=style.module.scss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}