@myun/gimi-chat 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. package/dist/apis/fetch.d.ts +64 -0
  2. package/dist/apis/fetch.js +512 -0
  3. package/dist/apis/useApi.d.ts +57 -0
  4. package/dist/apis/useApi.js +378 -0
  5. package/dist/assets/image/Subtract.png +0 -0
  6. package/dist/assets/image/ai-logo.png +0 -0
  7. package/dist/assets/image/copyIcon.png +0 -0
  8. package/dist/assets/image/deepthinkActive.png +0 -0
  9. package/dist/assets/image/empty-img-dark.png +0 -0
  10. package/dist/assets/image/empty-img.png +0 -0
  11. package/dist/assets/image/like_active.png +0 -0
  12. package/dist/assets/image/love.png +0 -0
  13. package/dist/assets/image/retry.png +0 -0
  14. package/dist/assets/image/soundOut.png +0 -0
  15. package/dist/assets/image/unlike_active.png +0 -0
  16. package/dist/assets/image/unlove.png +0 -0
  17. package/dist/assets/lottie/ai-bg.json +1704 -0
  18. package/dist/assets/lottie/ai-loading.json +192 -0
  19. package/dist/assets/lottie/ai-output-loading.json +272 -0
  20. package/dist/assets/lottie/ai-output-normal.json +17694 -0
  21. package/dist/assets/lottie/ai-output-strengthen.json +17321 -0
  22. package/dist/assets/lottie/ai-voice-play.json +1 -0
  23. package/dist/assets/lottie/living.json +705 -0
  24. package/dist/assets/lottie/myun-living.json +726 -0
  25. package/dist/assets/lottie/myun-loading.json +530 -0
  26. package/dist/components/ai-chat-dialogue/index.d.ts +16 -0
  27. package/dist/components/ai-chat-dialogue/index.js +1056 -0
  28. package/dist/components/ai-chat-dialogue/index.module.scss +272 -0
  29. package/dist/components/ai-chat-dialogue/message-parser.d.ts +36 -0
  30. package/dist/components/ai-chat-dialogue/message-parser.js +52 -0
  31. package/dist/components/ai-chat-dialogue/tlv.d.ts +7 -0
  32. package/dist/components/ai-chat-dialogue/tlv.js +32 -0
  33. package/dist/components/ai-chat-dialogue/volc-voice-call-client.d.ts +47 -0
  34. package/dist/components/ai-chat-dialogue/volc-voice-call-client.js +246 -0
  35. package/dist/components/ai-correction/index.d.ts +5 -0
  36. package/dist/components/ai-correction/index.js +45 -0
  37. package/dist/components/ai-loading/index.d.ts +3 -0
  38. package/dist/components/ai-loading/index.js +14 -0
  39. package/dist/components/ai-loading/index.module.scss +11 -0
  40. package/dist/components/answer-item/index.d.ts +27 -0
  41. package/dist/components/answer-item/index.js +194 -0
  42. package/dist/components/answer-item/index.module.scss +295 -0
  43. package/dist/components/ask-card/index.d.ts +10 -0
  44. package/dist/components/ask-card/index.js +76 -0
  45. package/dist/components/ask-card/index.module.scss +125 -0
  46. package/dist/components/chat-input/index.d.ts +31 -0
  47. package/dist/components/chat-input/index.js +433 -0
  48. package/dist/components/chat-input/index.module.scss +44 -0
  49. package/dist/components/chat-voice/VoiceCommunication.d.ts +7 -0
  50. package/dist/components/chat-voice/VoiceCommunication.js +69 -0
  51. package/dist/components/chat-voice/VoiceRecord.d.ts +7 -0
  52. package/dist/components/chat-voice/VoiceRecord.js +34 -0
  53. package/dist/components/conversation-delete/index.d.ts +5 -0
  54. package/dist/components/conversation-delete/index.js +24 -0
  55. package/dist/components/dots-loading/index.d.ts +2 -0
  56. package/dist/components/dots-loading/index.js +11 -0
  57. package/dist/components/dots-loading/index.module.scss +45 -0
  58. package/dist/components/empty/index.d.ts +9 -0
  59. package/dist/components/empty/index.js +32 -0
  60. package/dist/components/empty/index.module.scss +27 -0
  61. package/dist/components/excel-components/ExcelCard.d.ts +11 -0
  62. package/dist/components/excel-components/ExcelCard.js +35 -0
  63. package/dist/components/excel-components/ExcelExcuting.d.ts +10 -0
  64. package/dist/components/excel-components/ExcelExcuting.js +263 -0
  65. package/dist/components/excel-components/ExcelFailCard.d.ts +9 -0
  66. package/dist/components/excel-components/ExcelFailCard.js +20 -0
  67. package/dist/components/excel-components/ExcelSuccessCard.d.ts +5 -0
  68. package/dist/components/excel-components/ExcelSuccessCard.js +50 -0
  69. package/dist/components/excel-components/index.module.scss +210 -0
  70. package/dist/components/excel-components/styles.module.scss +186 -0
  71. package/dist/components/file-card/fileCardSidebar.d.ts +8 -0
  72. package/dist/components/file-card/fileCardSidebar.js +56 -0
  73. package/dist/components/file-card/index.d.ts +15 -0
  74. package/dist/components/file-card/index.js +97 -0
  75. package/dist/components/file-card/index.module.scss +139 -0
  76. package/dist/components/file-preview/index.d.ts +3 -0
  77. package/dist/components/file-preview/index.js +229 -0
  78. package/dist/components/file-preview/index.module.scss +120 -0
  79. package/dist/components/file-upload/index.d.ts +16 -0
  80. package/dist/components/file-upload/index.js +238 -0
  81. package/dist/components/file-upload/uploadV1.d.ts +16 -0
  82. package/dist/components/file-upload/uploadV1.js +267 -0
  83. package/dist/components/gimi-sidebar/index.d.ts +17 -0
  84. package/dist/components/gimi-sidebar/index.js +41 -0
  85. package/dist/components/gimi-sidebar/index.module.scss +136 -0
  86. package/dist/components/header/index.d.ts +5 -0
  87. package/dist/components/header/index.js +20 -0
  88. package/dist/components/header/index.module.scss +26 -0
  89. package/dist/components/iconfont-com/index.d.ts +11 -0
  90. package/dist/components/iconfont-com/index.js +29 -0
  91. package/dist/components/index.d.ts +1 -0
  92. package/dist/components/index.js +1 -0
  93. package/dist/components/knowledge-trace/KnowledgeIconComponent.d.ts +7 -0
  94. package/dist/components/knowledge-trace/KnowledgeIconComponent.js +101 -0
  95. package/dist/components/knowledge-trace/classList.d.ts +6 -0
  96. package/dist/components/knowledge-trace/classList.js +72 -0
  97. package/dist/components/knowledge-trace/documentList.d.ts +6 -0
  98. package/dist/components/knowledge-trace/documentList.js +75 -0
  99. package/dist/components/knowledge-trace/index.d.ts +18 -0
  100. package/dist/components/knowledge-trace/index.js +155 -0
  101. package/dist/components/knowledge-trace/index.module.scss +262 -0
  102. package/dist/components/knowledge-trace/interfaces.d.ts +166 -0
  103. package/dist/components/knowledge-trace/interfaces.js +1 -0
  104. package/dist/components/knowledge-trace/videoList.d.ts +6 -0
  105. package/dist/components/knowledge-trace/videoList.js +91 -0
  106. package/dist/components/lottie-img/index.d.ts +8 -0
  107. package/dist/components/lottie-img/index.js +99 -0
  108. package/dist/components/message-actions/CopyButton.d.ts +7 -0
  109. package/dist/components/message-actions/CopyButton.js +33 -0
  110. package/dist/components/message-actions/LikeButton.d.ts +7 -0
  111. package/dist/components/message-actions/LikeButton.js +34 -0
  112. package/dist/components/message-actions/RegenerateButton.d.ts +5 -0
  113. package/dist/components/message-actions/RegenerateButton.js +27 -0
  114. package/dist/components/message-actions/UnLikeButton.d.ts +7 -0
  115. package/dist/components/message-actions/UnLikeButton.js +34 -0
  116. package/dist/components/message-actions/VoicePlay.d.ts +10 -0
  117. package/dist/components/message-actions/VoicePlay.js +74 -0
  118. package/dist/components/message-list/index.d.ts +19 -0
  119. package/dist/components/message-list/index.js +167 -0
  120. package/dist/components/message-list/index.module.scss +304 -0
  121. package/dist/components/no-microphone-root/index.d.ts +6 -0
  122. package/dist/components/no-microphone-root/index.js +36 -0
  123. package/dist/components/no-microphone-root/index.module.scss +42 -0
  124. package/dist/components/preset-agent-content/index.d.ts +8 -0
  125. package/dist/components/preset-agent-content/index.js +24 -0
  126. package/dist/components/preset-agent-content/index.module.scss +48 -0
  127. package/dist/components/quoted-content/index.d.ts +0 -0
  128. package/dist/components/quoted-content/index.js +171 -0
  129. package/dist/components/quoted-content/index.module.scss +76 -0
  130. package/dist/components/reasoning-content/index.d.ts +6 -0
  131. package/dist/components/reasoning-content/index.js +116 -0
  132. package/dist/components/reasoning-content/index.module.scss +164 -0
  133. package/dist/components/reference-content/index.d.ts +28 -0
  134. package/dist/components/reference-content/index.js +125 -0
  135. package/dist/components/reference-content/index.module.scss +73 -0
  136. package/dist/components/templates/CommonChat.d.ts +5 -0
  137. package/dist/components/templates/CommonChat.js +218 -0
  138. package/dist/components/templates/GimiChatComponent.d.ts +4 -0
  139. package/dist/components/templates/GimiChatComponent.js +23 -0
  140. package/dist/components/templates/demo/demo.d.ts +2 -0
  141. package/dist/components/templates/demo/demo.js +110 -0
  142. package/dist/components/templates/index.module.scss +119 -0
  143. package/dist/components/upload-list/index.d.ts +15 -0
  144. package/dist/components/upload-list/index.js +90 -0
  145. package/dist/components/upload-list/index.module.scss +119 -0
  146. package/dist/components/voice-bars/index.d.ts +4 -0
  147. package/dist/components/voice-bars/index.js +174 -0
  148. package/dist/components/voice-check-dialog/index.d.ts +8 -0
  149. package/dist/components/voice-check-dialog/index.js +163 -0
  150. package/dist/components/voice-check-dialog/index.module.scss +9 -0
  151. package/dist/components/voice-recording/index.d.ts +9 -0
  152. package/dist/components/voice-recording/index.js +54 -0
  153. package/dist/components/voice-recording/index.module.scss +41 -0
  154. package/dist/components/work-flow-content/demo.d.ts +3 -0
  155. package/dist/components/work-flow-content/demo.js +11 -0
  156. package/dist/components/work-flow-content/index.d.ts +6 -0
  157. package/dist/components/work-flow-content/index.js +55 -0
  158. package/dist/components/work-flow-content/index.module.scss +23 -0
  159. package/dist/constants.d.ts +24 -0
  160. package/dist/constants.js +24 -0
  161. package/dist/hooks/useChatActions.d.ts +12 -0
  162. package/dist/hooks/useChatActions.js +207 -0
  163. package/dist/hooks/useChatHistory.d.ts +8 -0
  164. package/dist/hooks/useChatHistory.js +225 -0
  165. package/dist/hooks/useChatMessage.d.ts +49 -0
  166. package/dist/hooks/useChatMessage.js +87 -0
  167. package/dist/hooks/useChatRecommend.d.ts +8 -0
  168. package/dist/hooks/useChatRecommend.js +126 -0
  169. package/dist/hooks/useChatStream.d.ts +20 -0
  170. package/dist/hooks/useChatStream.js +244 -0
  171. package/dist/hooks/useChatUI.d.ts +32 -0
  172. package/dist/hooks/useChatUI.js +134 -0
  173. package/dist/hooks/useChatVoice.d.ts +11 -0
  174. package/dist/hooks/useChatVoice.js +379 -0
  175. package/dist/hooks/useCommonChatAPI.d.ts +27 -0
  176. package/dist/hooks/useCommonChatAPI.js +1276 -0
  177. package/dist/hooks/useFile.d.ts +13 -0
  178. package/dist/hooks/useFile.js +288 -0
  179. package/dist/hooks/useKnowledgeService.d.ts +17 -0
  180. package/dist/hooks/useKnowledgeService.js +210 -0
  181. package/dist/hooks/useLastEventId.d.ts +8 -0
  182. package/dist/hooks/useLastEventId.js +66 -0
  183. package/dist/hooks/useLongPoll.d.ts +3 -0
  184. package/dist/hooks/useLongPoll.js +111 -0
  185. package/dist/hooks/useScroll.d.ts +4 -0
  186. package/dist/hooks/useScroll.js +172 -0
  187. package/dist/index.d.ts +1 -0
  188. package/dist/index.js +1 -0
  189. package/dist/interfaces/chatMessage.d.ts +139 -0
  190. package/dist/interfaces/fileInterface.d.ts +10 -0
  191. package/dist/interfaces/fileInterface.js +11 -0
  192. package/dist/interfaces/knowledgeTrace.d.ts +177 -0
  193. package/dist/store/hooks.d.ts +4 -0
  194. package/dist/store/hooks.js +3 -0
  195. package/dist/store/index.d.ts +7 -0
  196. package/dist/store/index.js +7 -0
  197. package/dist/store/slices/gimiMenuSlice.d.ts +95 -0
  198. package/dist/store/slices/gimiMenuSlice.js +251 -0
  199. package/dist/utils/chatInputUtil.d.ts +19 -0
  200. package/dist/utils/chatInputUtil.js +45 -0
  201. package/dist/utils/tools.d.ts +50 -0
  202. package/dist/utils/tools.js +474 -0
  203. package/dist/utils/voice-stream.d.ts +119 -0
  204. package/dist/utils/voice-stream.js +1162 -0
  205. package/package.json +2 -3
  206. package/LICENSE +0 -21
@@ -0,0 +1,218 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+ import React from 'react';
3
+ import { store } from "../../store";
4
+ import { useAppDispatch, useAppSelector } from "../../store/hooks";
5
+ import { setBaseUrl, setToken, setPlatform, setConversationId, setAgentDetail, setBussinessParams } from "../../store/slices/gimiMenuSlice";
6
+ import useCommonChatAPI from "../../hooks/useCommonChatAPI";
7
+ import { replaceBraces } from "../../utils/tools";
8
+ import styles from "./index.module.scss";
9
+ import ChatInput from "../chat-input";
10
+ import MessageList from "../message-list";
11
+ import PresetAgentContent from "../preset-agent-content";
12
+ import useChatVoice from "../../hooks/useChatVoice";
13
+ import { useChatUI } from "../../hooks/useChatUI";
14
+ import { IconChevronDown } from '@douyinfe/semi-icons';
15
+ import KonwledgeTrace from "../knowledge-trace";
16
+ import FileCardSideBar from "../file-card/fileCardSidebar";
17
+ import OfficeFilePreviewPanel from "../file-preview";
18
+ import AiLoading from "../ai-loading";
19
+ var CommonChat = /*#__PURE__*/React.forwardRef(function (props, ref) {
20
+ var _props$businessType = props.businessType,
21
+ businessType = _props$businessType === void 0 ? 'chat' : _props$businessType,
22
+ _props$showInput = props.showInput,
23
+ showInput = _props$showInput === void 0 ? true : _props$showInput,
24
+ baseUrl = props.baseUrl,
25
+ token = props.token,
26
+ _props$showHeader = props.showHeader,
27
+ showHeader = _props$showHeader === void 0 ? true : _props$showHeader,
28
+ _props$chatInputConfi = props.chatInputConfig,
29
+ chatInputConfig = _props$chatInputConfi === void 0 ? {
30
+ enableVoiceRecord: true,
31
+ enableVoiceChat: true,
32
+ enableFileUpload: true
33
+ } : _props$chatInputConfi,
34
+ _props$platform = props.platform,
35
+ platform = _props$platform === void 0 ? 'myun' : _props$platform,
36
+ _props$defaultMessage = props.defaultMessages,
37
+ defaultMessages = _props$defaultMessage === void 0 ? [] : _props$defaultMessage,
38
+ agentDetail = props.agentDetail,
39
+ agentId = props.agentId,
40
+ _props$showPrologue = props.showPrologue,
41
+ showPrologue = _props$showPrologue === void 0 ? true : _props$showPrologue,
42
+ _props$model = props.model,
43
+ model = _props$model === void 0 ? 'fullscreen' : _props$model,
44
+ conversationId = props.conversationId,
45
+ bussinessParams = props.bussinessParams;
46
+ var dispatch = useAppDispatch();
47
+ var containerRef = React.useRef(null);
48
+ var chatInputRef = React.useRef(null);
49
+ var messageList = useAppSelector(function (state) {
50
+ return state.gimiMenu.messageList;
51
+ });
52
+ var agentObj = useAppSelector(function (state) {
53
+ return state.gimiMenu.agentObj;
54
+ });
55
+ var storedBaseUrl = useAppSelector(function (state) {
56
+ return state.gimiMenu.baseUrl;
57
+ });
58
+ var storedToken = useAppSelector(function (state) {
59
+ return state.gimiMenu.token;
60
+ });
61
+ var chatUI = useChatUI();
62
+ var _useChatVoice = useChatVoice(),
63
+ isRecording = _useChatVoice.isRecording,
64
+ recordingCount = _useChatVoice.recordingCount,
65
+ asrText = _useChatVoice.asrText,
66
+ shortAsrClick = _useChatVoice.shortAsrClick,
67
+ isExecuting = _useChatVoice.isExecuting,
68
+ playTTSByText = _useChatVoice.playTTSByText,
69
+ stopTTSByText = _useChatVoice.stopTTSByText,
70
+ isPlaying = _useChatVoice.isPlaying;
71
+ var _useCommonChatAPI = useCommonChatAPI(containerRef, businessType, stopTTSByText, isPlaying, agentId),
72
+ headerValue = _useCommonChatAPI.headerValue,
73
+ msgLoading = _useCommonChatAPI.msgLoading,
74
+ onSucessExcel = _useCommonChatAPI.onSucessExcel,
75
+ handleInterrupt = _useCommonChatAPI.handleInterrupt,
76
+ onFailureExcel = _useCommonChatAPI.onFailureExcel,
77
+ onRetryExcel = _useCommonChatAPI.onRetryExcel,
78
+ disableSend = _useCommonChatAPI.disableSend,
79
+ inputModelRef = _useCommonChatAPI.inputModelRef,
80
+ isMoreLoading = _useCommonChatAPI.isMoreLoading,
81
+ startConversationAndChat = _useCommonChatAPI.startConversationAndChat,
82
+ getContentMessageList = _useCommonChatAPI.getContentMessageList,
83
+ hasMore = _useCommonChatAPI.hasMore,
84
+ handleSend = _useCommonChatAPI.handleSend,
85
+ scrollBottomForce = _useCommonChatAPI.scrollBottomForce,
86
+ showBackBottom = _useCommonChatAPI.showBackBottom,
87
+ isScrolling = _useCommonChatAPI.isScrolling,
88
+ regenerate = _useCommonChatAPI.regenerate,
89
+ startAICorrection = _useCommonChatAPI.startAICorrection;
90
+ React.useImperativeHandle(ref, function () {
91
+ return {
92
+ messageList: messageList,
93
+ agentDetail: agentObj,
94
+ conversationId: store.getState().gimiMenu.conversationId,
95
+ inputEditor: chatInputRef.current
96
+ };
97
+ });
98
+ React.useEffect(function () {
99
+ // 组件初始化
100
+ dispatch(setBaseUrl({
101
+ baseUrl: baseUrl || ''
102
+ }));
103
+ dispatch(setToken({
104
+ token: token || ''
105
+ }));
106
+ dispatch(setPlatform({
107
+ platform: platform
108
+ }));
109
+ dispatch(setConversationId({
110
+ conversationId: conversationId || null
111
+ }));
112
+ dispatch(setAgentDetail({
113
+ agentDetail: agentDetail || {}
114
+ }));
115
+ dispatch(setBussinessParams({
116
+ bussinessParams: bussinessParams || {}
117
+ }));
118
+ }, [baseUrl, token, agentDetail, platform, conversationId, bussinessParams]);
119
+ React.useEffect(function () {
120
+ if (bussinessParams !== null && bussinessParams !== void 0 && bussinessParams.QUESTION_ID && bussinessParams !== null && bussinessParams !== void 0 && bussinessParams.ANSWER_ID && businessType === 'correction' && storedBaseUrl && storedToken) {
121
+ startAICorrection(bussinessParams.ANSWER_ID, bussinessParams.QUESTION_ID);
122
+ }
123
+ }, [bussinessParams, storedBaseUrl, storedToken, businessType]);
124
+ var disableVoiceCommunication = React.useMemo(function () {
125
+ var lastedMessage = messageList[messageList.length - 1];
126
+ var content = (lastedMessage === null || lastedMessage === void 0 ? void 0 : lastedMessage.content) || '';
127
+ if (content.indexOf('<excel>') > -1) return true;
128
+ if (['ask', 'skill'].includes((lastedMessage === null || lastedMessage === void 0 ? void 0 : lastedMessage.moduleType) || '')) return true;
129
+ return false;
130
+ }, [messageList]);
131
+ var onHistoryReload = function onHistoryReload() {
132
+ hasMore.current = true;
133
+ getContentMessageList(1, 10);
134
+ };
135
+ var setInputValue = React.useCallback(function (content) {
136
+ var _chatInputRef$current;
137
+ (_chatInputRef$current = chatInputRef.current) === null || _chatInputRef$current === void 0 || _chatInputRef$current.setValue(content);
138
+ }, []);
139
+
140
+ // const onInputValueChange = React.useCallback((content: string) => {
141
+ // setInputValue(content);
142
+ // }, []);
143
+
144
+ var handleInputSend = React.useCallback(function (val, agent, isSystemAuto) {
145
+ var _chatInputRef$current2;
146
+ (_chatInputRef$current2 = chatInputRef.current) === null || _chatInputRef$current2 === void 0 || _chatInputRef$current2.setValue('');
147
+ if (!conversationId) {
148
+ startConversationAndChat(val);
149
+ return;
150
+ }
151
+ handleSend(val, agent, isSystemAuto);
152
+ }, [handleSend, startConversationAndChat, conversationId]);
153
+ return /*#__PURE__*/React.createElement("div", {
154
+ className: styles.main,
155
+ id: "myun_gimi_design_chat"
156
+ }, /*#__PURE__*/React.createElement("div", {
157
+ className: styles.chat_content
158
+ }, showHeader && headerValue && /*#__PURE__*/React.createElement("div", {
159
+ className: styles.content_header
160
+ }, replaceBraces(headerValue)), /*#__PURE__*/React.createElement("div", {
161
+ className: styles.scroll_wrapper
162
+ }, /*#__PURE__*/React.createElement("div", {
163
+ className: "".concat(styles.scroll_container, " ").concat(isScrolling ? styles.scrolling : ''),
164
+ ref: containerRef
165
+ }, showPrologue && messageList.length === 0 && !isMoreLoading && /*#__PURE__*/React.createElement(PresetAgentContent, {
166
+ prologue: (agentObj === null || agentObj === void 0 ? void 0 : agentObj.prologue) || '',
167
+ questionList: (agentObj === null || agentObj === void 0 ? void 0 : agentObj.questionList) || [],
168
+ setInputValue: setInputValue
169
+ }), isMoreLoading ? /*#__PURE__*/React.createElement("div", {
170
+ style: {
171
+ height: '100%'
172
+ }
173
+ }, /*#__PURE__*/React.createElement(AiLoading, null)) : /*#__PURE__*/React.createElement(MessageList, _extends({
174
+ chatList: messageList || defaultMessages,
175
+ handleSend: handleSend,
176
+ inputModelRef: inputModelRef,
177
+ msgLoading: msgLoading,
178
+ onSucessExcel: onSucessExcel,
179
+ onFailureExcel: onFailureExcel,
180
+ onRegenerateClick: regenerate,
181
+ onRetryExcel: onRetryExcel,
182
+ chatUI: chatUI,
183
+ model: model,
184
+ isPlaying: isPlaying,
185
+ playTTSByText: playTTSByText,
186
+ stopTTSByText: stopTTSByText
187
+ }, props.messageConfig))), showBackBottom && /*#__PURE__*/React.createElement("div", {
188
+ className: styles.backBottomBtn,
189
+ onClick: function onClick() {
190
+ return scrollBottomForce(true);
191
+ }
192
+ }, /*#__PURE__*/React.createElement(IconChevronDown, {
193
+ size: "large"
194
+ }))), showInput && /*#__PURE__*/React.createElement(ChatInput, _extends({
195
+ ref: chatInputRef
196
+ }, chatInputConfig, {
197
+ onSend: handleInputSend,
198
+ disabled: disableSend || isMoreLoading,
199
+ showDefaultPrompt: messageList.length === 0,
200
+ defaultPrompt: (agentObj === null || agentObj === void 0 ? void 0 : agentObj.defaultPrompt) || ''
201
+ // onContentChange={onInputValueChange}
202
+ ,
203
+ onInterrupt: handleInterrupt,
204
+ isRecording: isRecording,
205
+ isVoiceGetting: isExecuting,
206
+ recordingCount: recordingCount,
207
+ asrText: asrText,
208
+ shortAsrClick: shortAsrClick,
209
+ disableVoiceCommunication: disableVoiceCommunication,
210
+ onHistoryReload: onHistoryReload
211
+ }, props.chatInputConfig))), /*#__PURE__*/React.createElement(KonwledgeTrace, _extends({}, props.sidebarConfig, {
212
+ chatList: messageList || defaultMessages,
213
+ isOverFlow: model === 'fullscreen' ? false : true
214
+ })), /*#__PURE__*/React.createElement(FileCardSideBar, _extends({}, props.sidebarConfig, {
215
+ isOverFlow: model === 'fullscreen' ? false : true
216
+ })), /*#__PURE__*/React.createElement(OfficeFilePreviewPanel, null));
217
+ });
218
+ export default CommonChat;
@@ -0,0 +1,4 @@
1
+ import { CommonChatProps, CommonChatRef } from '../../types/chat';
2
+ import React from 'react';
3
+ declare const GimiChatComponent: React.ForwardRefExoticComponent<CommonChatProps & React.RefAttributes<CommonChatRef>>;
4
+ export default GimiChatComponent;
@@ -0,0 +1,23 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+ import { store } from "../../store";
3
+ import CommonChat from "./CommonChat";
4
+ import React from 'react';
5
+ import { Provider } from 'react-redux';
6
+ var GimiChatComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
7
+ var commonChatRef = React.useRef(null);
8
+ React.useImperativeHandle(ref, function () {
9
+ var _commonChatRef$curren, _commonChatRef$curren2, _commonChatRef$curren3, _commonChatRef$curren4;
10
+ return {
11
+ messageList: ((_commonChatRef$curren = commonChatRef.current) === null || _commonChatRef$curren === void 0 ? void 0 : _commonChatRef$curren.messageList) || [],
12
+ agentDetail: ((_commonChatRef$curren2 = commonChatRef.current) === null || _commonChatRef$curren2 === void 0 ? void 0 : _commonChatRef$curren2.agentDetail) || {},
13
+ conversationId: ((_commonChatRef$curren3 = commonChatRef.current) === null || _commonChatRef$curren3 === void 0 ? void 0 : _commonChatRef$curren3.conversationId) || null,
14
+ inputEditor: ((_commonChatRef$curren4 = commonChatRef.current) === null || _commonChatRef$curren4 === void 0 ? void 0 : _commonChatRef$curren4.inputEditor) || null
15
+ };
16
+ });
17
+ return /*#__PURE__*/React.createElement(Provider, {
18
+ store: store
19
+ }, /*#__PURE__*/React.createElement(CommonChat, _extends({}, props, {
20
+ ref: commonChatRef
21
+ })));
22
+ });
23
+ export default GimiChatComponent;
@@ -0,0 +1,2 @@
1
+ import React from "react";
2
+ export default function Demo(): React.JSX.Element;
@@ -0,0 +1,110 @@
1
+ import GimiChatComponent from "../GimiChatComponent";
2
+ import React from "react";
3
+ export default function Demo() {
4
+ return /*#__PURE__*/React.createElement("div", {
5
+ style: {
6
+ height: '600px'
7
+ }
8
+ }, /*#__PURE__*/React.createElement(GimiChatComponent, {
9
+ baseUrl: 't-mgateway.gaodunwangxiao.com',
10
+ businessType: "correction",
11
+ token: 'eyJhZ2VuY3kiOjk1NTU1LCJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJHYW9kdW4iLCJpYXQiOjE3Njg4OTEyMzIsInN1YiI6IjE1Mjg4NzQiLCJpc3MiOiJHYW9kdW4iLCJleHAiOjE3NzE0ODMyMzJ9.6JpEbaJnxMKiER78Ko5irwVpGFfKOP1zxYSUYXPL00Y',
12
+ platform: "myun",
13
+ agentId: 79
14
+ // bussinessParams={
15
+ // {
16
+ // "ANSWER_ID": 19923,
17
+ // "QUESTION_ID": 77595
18
+ // }
19
+ // }
20
+ // agentDetail={{
21
+ // "agentIcon": "https://mstatic.gaodunwangxiao.com/image/2025/09/24/Excel建模-1758706152601.png",
22
+ // "agentId": 65,
23
+ // "agentIntroduce": "帮你智能搭建财务数据表格信息",
24
+ // "agentMode": "workflow",
25
+ // "agentName": "智能Excel建模",
26
+ // "agentState": 1,
27
+ // "agentType": "product",
28
+ // "botId": "BOT1757402118115",
29
+ // "botInstructionId": 0,
30
+ // "characterSetting": null,
31
+ // "conversationType": 2,
32
+ // "customizeInstructContent": null,
33
+ // "defaultPrompt": "我要生成一个{{输入模板名称,如PVM模板}},用于{{输入使用场景,如分析收入增长主要驱动力}}。关键数据:{{输入数据}}",
34
+ // "inputPrompt": "",
35
+ // "isCustomizeInstruct": 0,
36
+ // "isEnableRelated": 1,
37
+ // "isEnableVoiceCall": 0,
38
+ // "maxLength": null,
39
+ // "modeType": null,
40
+ // "openUploadFile": 1,
41
+ // "productId": 36842,
42
+ // "prologue": "帮你智能搭建财务数据表格信息",
43
+ // "questionList": [
44
+ // {
45
+ // "id": 127,
46
+ // "question": "会计是现代社会经济活动开展的重要基础,也是推动国际经贸往来的重要保障"
47
+ // },
48
+ // {
49
+ // "id": 128,
50
+ // "question": "全面预算的执行和监控中可以采用什么方式做好业务支持和预算管控?"
51
+ // }
52
+ // ],
53
+ // "showName": "智能Excel建模",
54
+ // "showNameStatus": 1,
55
+ // "sourceModelId": null,
56
+ // "temperature": null,
57
+ // "voiceConfigs": [
58
+ // {
59
+ // "emotions": [
60
+ // {
61
+ // "name": "悲伤",
62
+ // "param": "sad"
63
+ // },
64
+ // {
65
+ // "name": "恐惧",
66
+ // "param": "fear"
67
+ // },
68
+ // {
69
+ // "name": "厌恶",
70
+ // "param": "hate"
71
+ // },
72
+ // {
73
+ // "name": "中性",
74
+ // "param": "neutral"
75
+ // }
76
+ // ],
77
+ // "gender": "female",
78
+ // "isSupportMix": 0,
79
+ // "languageCode": "zh-CN",
80
+ // "languageId": 1,
81
+ // "languageName": "中文",
82
+ // "scene": "多情感",
83
+ // "toneId": 2,
84
+ // "toneName": "甜心小美(多情感)",
85
+ // "voiceType": "zh_female_tianxinxiaomei_emo_v2_mars_bigtts"
86
+ // }
87
+ // ],
88
+ // "workflowList": [
89
+ // {
90
+ // "botFlowId": "MC-2CDBD8AB38B6410A8C14EE503C9ADBCE",
91
+ // "workflowId": 315,
92
+ // "workflowName": "excel生成926(第3版)"
93
+ // }
94
+ // ]
95
+ // }}
96
+ ,
97
+ showPrologue: true,
98
+ model: 'fullscreen'
99
+ // conversationId={8394}
100
+ ,
101
+ chatInputConfig: {
102
+ enableFileUpload: true,
103
+ enableVoiceChat: true,
104
+ enableVoiceRecord: true
105
+ },
106
+ messageConfig: {
107
+ enableRegenerate: true
108
+ }
109
+ }));
110
+ }
@@ -0,0 +1,119 @@
1
+ .main {
2
+ width: 100%;
3
+ height: 100%;
4
+ display: flex;
5
+ gap: 20px;
6
+ overflow: hidden;
7
+ position: relative;
8
+ }
9
+
10
+ .chat_content {
11
+ flex: 1;
12
+ height: 100%;
13
+ display: flex;
14
+ flex-direction: column;
15
+ min-width: 0;
16
+ position: relative;
17
+ }
18
+
19
+ .scroll_wrapper {
20
+ flex: 1;
21
+ position: relative;
22
+ width: 100%;
23
+ min-height: 0;
24
+ }
25
+
26
+ .scroll_container {
27
+ height: 100%;
28
+ overflow-y: auto;
29
+ overflow-x: hidden;
30
+ width: 100%;
31
+ position: relative;
32
+
33
+ &::-webkit-scrollbar {
34
+ width: 6px;
35
+ height: 6px;
36
+ }
37
+
38
+ &::-webkit-scrollbar-thumb {
39
+ border-radius: 6px;
40
+ background: transparent;
41
+ }
42
+
43
+ &::-webkit-scrollbar-track {
44
+ background: transparent;
45
+ border-radius: 6px;
46
+ }
47
+
48
+ &.scrolling {
49
+ &::-webkit-scrollbar-thumb {
50
+ background: rgba(144, 147, 153, 0.3);
51
+ }
52
+ }
53
+
54
+ &::-webkit-scrollbar-thumb:hover {
55
+ background: rgba(144, 147, 153, 0.5);
56
+ }
57
+ }
58
+
59
+ .backBottomBtn {
60
+ position: absolute;
61
+ bottom: 20px;
62
+ right: 20px;
63
+ width: 40px;
64
+ height: 40px;
65
+ background: #fff;
66
+ border-radius: 50%;
67
+ box-shadow: 0 4px 14px 0 rgba(0, 0, 0, 0.1);
68
+ display: flex;
69
+ align-items: center;
70
+ justify-content: center;
71
+ cursor: pointer;
72
+ z-index: 10;
73
+ transition: all 0.3s;
74
+ color: #1c1f23;
75
+
76
+ &:hover {
77
+ background: #f2f3f5;
78
+ }
79
+ }
80
+
81
+ .content_header {
82
+ width: 100%;
83
+ height: 50px;
84
+ display: flex;
85
+ align-items: center;
86
+ justify-content: center;
87
+ font-family: PingFangSC, PingFang SC;
88
+ font-weight: 500;
89
+ font-size: 16px;
90
+ color: #2e394c;
91
+ line-height: 22px;
92
+ text-align: center;
93
+ font-style: normal;
94
+ position: relative;
95
+
96
+ // margin-top: 20px;
97
+ .content_header_title {
98
+ width: 340px;
99
+ height: 100%;
100
+ line-height: 50px;
101
+ overflow: hidden;
102
+ /* 隐藏溢出内容 */
103
+ white-space: nowrap;
104
+ /* 强制文本不换行 */
105
+ text-overflow: ellipsis;
106
+ /* 超出部分显示省略号 */
107
+ }
108
+
109
+ .text_shanow {
110
+ z-index: 5;
111
+ pointer-events: none;
112
+ background: linear-gradient(rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0) 100%);
113
+ width: 97%;
114
+ height: 32px;
115
+ position: absolute;
116
+ top: 100%;
117
+ left: 1px;
118
+ }
119
+ }
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { FileStatus } from '../../interfaces/fileInterface';
3
+ interface UploadFileProps {
4
+ file: {
5
+ fileType?: string;
6
+ fileName?: string;
7
+ status: FileStatus;
8
+ [key: string]: any;
9
+ };
10
+ handleDelFile?: () => void;
11
+ handleReTry?: (file: any) => void;
12
+ showDel?: boolean;
13
+ }
14
+ declare const UploadFile: React.FC<UploadFileProps>;
15
+ export default UploadFile;
@@ -0,0 +1,90 @@
1
+ import React from 'react';
2
+ import styles from "./index.module.scss";
3
+ import reTry from "../../assets/image/retry.png";
4
+ import { FileStatus } from "../../interfaces/fileInterface";
5
+ import { formatSizeToKB } from "../../utils/tools";
6
+ var UploadFile = function UploadFile(_ref) {
7
+ var file = _ref.file,
8
+ handleDelFile = _ref.handleDelFile,
9
+ handleReTry = _ref.handleReTry,
10
+ _ref$showDel = _ref.showDel,
11
+ showDel = _ref$showDel === void 0 ? true : _ref$showDel;
12
+ // 使用useMemo缓存icon,避免每次渲染重新计算
13
+ var _React$useMemo = React.useMemo(function () {
14
+ var _file$fileName, _file$name;
15
+ if (!file) return {};
16
+ var fileType = file.fileName ? ((_file$fileName = file.fileName) === null || _file$fileName === void 0 ? void 0 : _file$fileName.split('.').pop()) || '' : ((_file$name = file.name) === null || _file$name === void 0 ? void 0 : _file$name.split('.').pop()) || '';
17
+ var fileName = file.fileName ? file.fileName : file.name;
18
+ var fileSize = formatSizeToKB(file.fileSize || file.size);
19
+ var iconMap = {
20
+ txt: 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202509/17/b46c7_20250917144926.png',
21
+ xlsx: 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202509/17/0094f_20250917144837.png'
22
+ };
23
+ return {
24
+ fileIcon: iconMap[fileType.toLowerCase()] || '',
25
+ fileName: fileName,
26
+ fileSize: fileSize
27
+ };
28
+ }, [file]),
29
+ fileIcon = _React$useMemo.fileIcon,
30
+ fileName = _React$useMemo.fileName,
31
+ fileSize = _React$useMemo.fileSize; // 更精确的依赖
32
+
33
+ // 缓存事件处理函数
34
+ var handleRetryClick = React.useCallback(function () {
35
+ if (handleReTry && file) {
36
+ handleReTry(file);
37
+ }
38
+ }, [handleReTry, file]);
39
+ var handleDeleteClick = React.useCallback(function () {
40
+ if (handleDelFile) {
41
+ handleDelFile();
42
+ }
43
+ }, [handleDelFile]);
44
+ if (!file) return null; // 空状态处理
45
+
46
+ var isError = file.status === FileStatus.UPLOAD_FAILED || file.status === FileStatus.ANALYSE_FAILED || file.status === FileStatus.NETWORK_ERROR;
47
+ var isLoading = [FileStatus.PADDING, FileStatus.RETRING, FileStatus.UPLOADING].includes(file.status);
48
+ return /*#__PURE__*/React.createElement("div", {
49
+ className: styles.uploadBox
50
+ }, /*#__PURE__*/React.createElement("div", {
51
+ className: styles.uploadIcon
52
+ }, /*#__PURE__*/React.createElement("img", {
53
+ src: fileIcon,
54
+ alt: "file-icon"
55
+ })), /*#__PURE__*/React.createElement("div", {
56
+ className: styles.uploadName
57
+ }, /*#__PURE__*/React.createElement("div", {
58
+ className: styles.uploadfileName
59
+ }, /*#__PURE__*/React.createElement("div", {
60
+ className: styles.fileName
61
+ }, fileName)), (fileSize || isError) && /*#__PURE__*/React.createElement("div", {
62
+ className: styles.sizeText
63
+ }, fileSize && !isError && /*#__PURE__*/React.createElement("span", {
64
+ className: styles.size
65
+ }, fileSize), isError && /*#__PURE__*/React.createElement("span", {
66
+ className: styles.errorText
67
+ }, file.status === FileStatus.UPLOAD_FAILED ? '上传失败' : file.status === FileStatus.NETWORK_ERROR ? '网络错误' : '解析失败'))), isLoading && /*#__PURE__*/React.createElement("div", {
68
+ className: styles.uploadLoading
69
+ }, /*#__PURE__*/React.createElement("span", null, file.status === FileStatus.PADDING ? '解析中...' : file.status === FileStatus.UPLOADING ? '上传中...' : '重试中...'), /*#__PURE__*/React.createElement("img", {
70
+ src: "https://simg01.gaodunwangxiao.com/uploadfiles/tmp/upload/202509/07/0a0fa_20250907093927.gif",
71
+ alt: "loading"
72
+ })), isError && /*#__PURE__*/React.createElement("div", {
73
+ className: styles.uploadError,
74
+ onClick: handleRetryClick
75
+ }, "\u91CD\u8BD5", /*#__PURE__*/React.createElement("img", {
76
+ src: reTry,
77
+ alt: "",
78
+ style: {
79
+ width: 16,
80
+ height: 16
81
+ }
82
+ })), showDel && /*#__PURE__*/React.createElement("div", {
83
+ className: styles.delIcon,
84
+ onClick: handleDeleteClick
85
+ }, /*#__PURE__*/React.createElement("img", {
86
+ src: "https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202509/12/6fa3e_20250912145501.png",
87
+ alt: "delete"
88
+ })));
89
+ };
90
+ export default UploadFile;