@myun/gimi-chat 0.0.3 → 0.0.5

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.css +230 -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.css +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.css +266 -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.css +122 -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.css +42 -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.css +41 -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.css +24 -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.css +212 -0
  70. package/dist/components/excel-components/styles.module.css +178 -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.css +139 -0
  76. package/dist/components/file-preview/index.d.ts +3 -0
  77. package/dist/components/file-preview/index.js +227 -0
  78. package/dist/components/file-preview/index.module.css +83 -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.css +118 -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.css +19 -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.css +254 -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 +164 -0
  120. package/dist/components/message-list/index.module.css +261 -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.css +48 -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.css +46 -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.css +80 -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.css +169 -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.css +84 -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 +109 -0
  142. package/dist/components/templates/index.module.css +109 -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.css +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.css +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.css +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.css +24 -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 +5 -6
  206. package/LICENSE +0 -21
@@ -0,0 +1,169 @@
1
+ @charset "UTF-8";
2
+ .container {
3
+ max-width: clamp(380px, 60vw, 800px);
4
+ padding: 0 20px;
5
+ border-left: 2px solid #d9dce5;
6
+ margin-bottom: 16px;
7
+ user-select: none;
8
+ }
9
+ .container .header {
10
+ width: 100%;
11
+ height: 22px;
12
+ display: flex;
13
+ align-items: center;
14
+ cursor: pointer;
15
+ }
16
+ .container .header .title {
17
+ height: 16px;
18
+ font-family: PingFangSC, PingFang SC;
19
+ font-weight: 600;
20
+ font-size: 16px;
21
+ color: #2e394c;
22
+ line-height: 16px;
23
+ text-align: left;
24
+ font-style: normal;
25
+ display: flex;
26
+ margin-right: 4px;
27
+ }
28
+ .container .thinkQuery {
29
+ width: 100%;
30
+ }
31
+ .container .thinkQuery .queryTitle {
32
+ margin-top: 8px;
33
+ min-height: 26px;
34
+ font-family: PingFangSC, PingFang SC;
35
+ font-weight: 400;
36
+ font-size: 14px;
37
+ color: #7d91b3;
38
+ line-height: 26px;
39
+ text-align: left;
40
+ font-style: normal;
41
+ }
42
+ .container .deepThink {
43
+ width: 100%;
44
+ }
45
+ .container .deepThink .deepThink_content {
46
+ margin-top: 4px;
47
+ }
48
+ .container .deeping {
49
+ margin-top: 8px;
50
+ overflow-y: scroll;
51
+ }
52
+ .container .deepThinkPack {
53
+ width: 100%;
54
+ position: relative;
55
+ }
56
+ .container .deepThinkPack .deepThink_content_pack {
57
+ margin-top: 13px;
58
+ display: flex;
59
+ }
60
+ .container .deepThinkPack .text_shanow_up {
61
+ z-index: 2;
62
+ pointer-events: none;
63
+ background: #ffffff;
64
+ filter: blur(10px);
65
+ width: 97%;
66
+ height: 25px;
67
+ position: absolute;
68
+ top: -6px;
69
+ }
70
+ .container .deepThinkPack .text_shanow_down {
71
+ z-index: 2;
72
+ pointer-events: none;
73
+ background: #ffffff;
74
+ filter: blur(10px);
75
+ width: 97%;
76
+ height: 25px;
77
+ position: absolute;
78
+ bottom: 1px;
79
+ }
80
+
81
+ .deeping::-webkit-scrollbar-track {
82
+ background-color: transparent;
83
+ }
84
+
85
+ .deeping::-webkit-scrollbar {
86
+ width: 6px;
87
+ }
88
+
89
+ .deeping::-webkit-scrollbar-thumb {
90
+ border-radius: 8px;
91
+ background: #d9d9d9;
92
+ opacity: 0;
93
+ display: none;
94
+ transition: opacity 0.3s ease;
95
+ }
96
+
97
+ .deeping::-webkit-scrollbar-thumb:hover {
98
+ border-radius: 8px;
99
+ background: rgba(0, 0, 0, 0.15);
100
+ }
101
+
102
+ .expand {
103
+ padding-bottom: 20px;
104
+ }
105
+
106
+ .label {
107
+ margin-top: 20px;
108
+ height: 26px;
109
+ font-family: PingFangSC, PingFang SC;
110
+ font-weight: 400;
111
+ font-size: 14px;
112
+ color: #2e394c;
113
+ line-height: 26px;
114
+ text-align: left;
115
+ font-style: normal;
116
+ }
117
+
118
+ .icon {
119
+ display: flex;
120
+ align-items: center;
121
+ justify-self: center;
122
+ margin-right: 4px;
123
+ }
124
+
125
+ .answerLoading {
126
+ width: 40px;
127
+ margin-left: -10px;
128
+ margin-bottom: 20px;
129
+ margin: 10px 0 10px -10px;
130
+ }
131
+
132
+ .loadingContainer {
133
+ display: flex;
134
+ justify-content: center;
135
+ align-items: center;
136
+ margin-left: 8px;
137
+ }
138
+
139
+ .loadingDots {
140
+ display: flex;
141
+ gap: 3px; /* 减小间距 */
142
+ }
143
+
144
+ .dot {
145
+ width: 8px; /* 减小大小 */
146
+ height: 8px; /* 减小大小 */
147
+ background-color: #4086ff; /* 换成antd主题浅蓝色 */
148
+ border-radius: 50%;
149
+ will-change: transform; /* 告诉浏览器提前优化动画 */
150
+ animation: bounce 0.8s infinite ease-in-out both; /* 减小动画变化幅度 */
151
+ }
152
+
153
+ .dot:nth-child(1) {
154
+ animation-delay: -0.24s; /* 调整延迟 */
155
+ }
156
+
157
+ .dot:nth-child(2) {
158
+ animation-delay: -0.12s; /* 调整延迟 */
159
+ }
160
+
161
+ @keyframes bounce {
162
+ 0%, 85%, 100% {
163
+ /* 减小动画变化幅度 */
164
+ transform: scale(0.6);
165
+ }
166
+ 40% {
167
+ transform: scale(1);
168
+ }
169
+ }
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ export interface IQuoteTeachModel {
3
+ teachModelId: number;
4
+ teachModelName: string;
5
+ type?: string;
6
+ duration: number;
7
+ canCancel?: boolean;
8
+ }
9
+ export interface IQuoteProduct {
10
+ productId: number;
11
+ productName: string;
12
+ canCancel?: boolean;
13
+ }
14
+ export declare const TeachModelReferenceContent: React.FC<{
15
+ item: IQuoteTeachModel;
16
+ showDuration: boolean;
17
+ }>;
18
+ export declare const ProductReferenceContent: React.FC<{
19
+ item: IQuoteProduct;
20
+ }>;
21
+ export declare const ReferencesEdit: React.FC<{
22
+ quoteTeachModelList: IQuoteTeachModel[];
23
+ quoteProductList: IQuoteProduct[];
24
+ }>;
25
+ export declare const References: React.FC<{
26
+ quoteTeachModelList: IQuoteTeachModel[];
27
+ quoteProductList: IQuoteProduct[];
28
+ }>;
@@ -0,0 +1,125 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ import React from 'react';
8
+ import { knowledgeConstants } from "../../constants";
9
+ import { Tooltip } from '@douyinfe/semi-ui';
10
+ import styles from "./index.module.css";
11
+ import { CloseCircleFilled } from '@ant-design/icons';
12
+ import { useAppSelector, useAppDispatch } from "../../store/hooks";
13
+ import { setQuoteTeachModelList, setQuoteProductList } from "../../store/slices/gimiMenuSlice";
14
+ import { formatSecondsToChinese } from "../../utils/tools";
15
+ import classNames from 'classnames';
16
+ export var TeachModelReferenceContent = function TeachModelReferenceContent(_ref) {
17
+ var item = _ref.item,
18
+ showDuration = _ref.showDuration;
19
+ var quoteTeachModelList = useAppSelector(function (state) {
20
+ return state.gimiMenu.quoteTeachModelList;
21
+ });
22
+ var dispatch = useAppDispatch();
23
+ var onCancel = function onCancel() {
24
+ dispatch(setQuoteTeachModelList({
25
+ quoteTeachModelList: quoteTeachModelList.filter(function (model) {
26
+ return model.teachModelId !== item.teachModelId;
27
+ })
28
+ }));
29
+ };
30
+ return /*#__PURE__*/React.createElement("div", {
31
+ className: styles.main
32
+ }, item.canCancel && /*#__PURE__*/React.createElement(CloseCircleFilled, {
33
+ className: styles.closeIcon,
34
+ onClick: onCancel
35
+ }), /*#__PURE__*/React.createElement("img", {
36
+ alt: "\u8D44\u6599\u5F15\u7528\u56FE\u7247",
37
+ className: styles.img,
38
+ src: knowledgeConstants.VIDEO_ICON_ADDRESS
39
+ }), /*#__PURE__*/React.createElement("div", {
40
+ className: styles.description
41
+ }, /*#__PURE__*/React.createElement(Tooltip, {
42
+ content: item.teachModelName
43
+ }, /*#__PURE__*/React.createElement("div", {
44
+ className: classNames(item.canCancel ? styles.text_oneline : styles.text_twoline)
45
+ }, item.teachModelName)), item.duration > 0 && showDuration && /*#__PURE__*/React.createElement("div", {
46
+ className: styles.duration
47
+ }, "\u65F6\u957F".concat(formatSecondsToChinese(item.duration), "\u5206\u949F"))));
48
+ };
49
+ export var ProductReferenceContent = function ProductReferenceContent(_ref2) {
50
+ var item = _ref2.item;
51
+ var quoteProductList = useAppSelector(function (state) {
52
+ return state.gimiMenu.quoteProductList;
53
+ });
54
+ var dispatch = useAppDispatch();
55
+ var onCancel = function onCancel() {
56
+ dispatch(setQuoteProductList({
57
+ quoteProductList: quoteProductList.filter(function (model) {
58
+ return model.productId !== item.productId;
59
+ })
60
+ }));
61
+ };
62
+ return /*#__PURE__*/React.createElement("div", {
63
+ className: styles.main
64
+ }, item.canCancel && /*#__PURE__*/React.createElement(CloseCircleFilled, {
65
+ className: styles.closeIcon,
66
+ onClick: onCancel
67
+ }), /*#__PURE__*/React.createElement("img", {
68
+ alt: "\u8D44\u6599\u5F15\u7528\u56FE\u7247",
69
+ className: styles.img,
70
+ src: knowledgeConstants.CLASS_ICON_BIG_ADDRESS
71
+ }), /*#__PURE__*/React.createElement("div", {
72
+ className: styles.description
73
+ }, /*#__PURE__*/React.createElement(Tooltip, {
74
+ content: item.productName
75
+ }, /*#__PURE__*/React.createElement("div", {
76
+ className: styles.product_text
77
+ }, item.productName))));
78
+ };
79
+ export var ReferencesEdit = function ReferencesEdit(_ref3) {
80
+ var quoteTeachModelList = _ref3.quoteTeachModelList,
81
+ quoteProductList = _ref3.quoteProductList;
82
+ //处理数据 为每项元素增加 canCancel: true
83
+ var newQuoteTeachModelList = quoteTeachModelList.map(function (item) {
84
+ return _objectSpread(_objectSpread({}, item), {}, {
85
+ canCancel: true
86
+ });
87
+ });
88
+ var newQuoteProductList = quoteProductList.map(function (item) {
89
+ return _objectSpread(_objectSpread({}, item), {}, {
90
+ canCancel: true
91
+ });
92
+ });
93
+ return /*#__PURE__*/React.createElement("div", {
94
+ className: styles.list
95
+ }, newQuoteTeachModelList.map(function (item) {
96
+ return /*#__PURE__*/React.createElement(TeachModelReferenceContent, {
97
+ item: item,
98
+ key: item.teachModelId,
99
+ showDuration: true
100
+ });
101
+ }), newQuoteProductList.map(function (item) {
102
+ return /*#__PURE__*/React.createElement(ProductReferenceContent, {
103
+ item: item,
104
+ key: item.productId
105
+ });
106
+ }));
107
+ };
108
+ export var References = function References(_ref4) {
109
+ var quoteTeachModelList = _ref4.quoteTeachModelList,
110
+ quoteProductList = _ref4.quoteProductList;
111
+ return /*#__PURE__*/React.createElement("div", {
112
+ className: styles.list
113
+ }, quoteTeachModelList === null || quoteTeachModelList === void 0 ? void 0 : quoteTeachModelList.filter(Boolean).map(function (item) {
114
+ return /*#__PURE__*/React.createElement(TeachModelReferenceContent, {
115
+ item: item,
116
+ key: item.teachModelId,
117
+ showDuration: false
118
+ });
119
+ }), quoteProductList === null || quoteProductList === void 0 ? void 0 : quoteProductList.filter(Boolean).map(function (item) {
120
+ return /*#__PURE__*/React.createElement(ProductReferenceContent, {
121
+ item: item,
122
+ key: item.productId
123
+ });
124
+ }));
125
+ };
@@ -0,0 +1,84 @@
1
+ .list {
2
+ display: flex;
3
+ flex-direction: column;
4
+ align-items: end;
5
+ gap: 10px;
6
+ margin-bottom: 10px;
7
+ }
8
+
9
+ .main {
10
+ background-color: #f7f8fa;
11
+ border-radius: 12px;
12
+ display: flex;
13
+ align-items: center;
14
+ gap: 10px;
15
+ padding: 10px;
16
+ position: relative;
17
+ min-height: 60px;
18
+ }
19
+ .main .img {
20
+ height: 28px;
21
+ width: 28px;
22
+ }
23
+ .main .description {
24
+ display: flex;
25
+ flex-direction: column;
26
+ gap: 5px;
27
+ }
28
+ .main .description .text_oneline {
29
+ text-overflow: ellipsis;
30
+ display: -webkit-box;
31
+ -webkit-line-clamp: 1;
32
+ -webkit-box-orient: vertical;
33
+ overflow: hidden;
34
+ width: 200px;
35
+ font-family: "PingFang SC";
36
+ font-weight: 500;
37
+ font-size: 14px;
38
+ line-height: 150%;
39
+ letter-spacing: 0px;
40
+ color: #2e394c;
41
+ }
42
+ .main .description .text_twoline {
43
+ text-overflow: ellipsis;
44
+ display: -webkit-box;
45
+ -webkit-line-clamp: 2;
46
+ -webkit-box-orient: vertical;
47
+ overflow: hidden;
48
+ width: 200px;
49
+ font-family: "PingFang SC";
50
+ font-weight: 500;
51
+ font-size: 14px;
52
+ line-height: 150%;
53
+ letter-spacing: 0px;
54
+ color: #2e394c;
55
+ }
56
+ .main .description .product_text {
57
+ text-overflow: ellipsis;
58
+ display: -webkit-box;
59
+ -webkit-line-clamp: 2;
60
+ -webkit-box-orient: vertical;
61
+ overflow: hidden;
62
+ width: 200px;
63
+ font-family: "PingFang SC";
64
+ font-weight: 500;
65
+ font-size: 14px;
66
+ line-height: 150%;
67
+ letter-spacing: 0px;
68
+ color: #2e394c;
69
+ }
70
+ .main .description .duration {
71
+ color: #717f94;
72
+ font-family: "PingFang SC";
73
+ font-weight: 400;
74
+ font-style: Regular;
75
+ font-size: 12px;
76
+ line-height: 150%;
77
+ letter-spacing: 0px;
78
+ }
79
+ .main .closeIcon {
80
+ position: absolute;
81
+ top: 0;
82
+ right: 0;
83
+ transform: translate(5px, -5px);
84
+ }
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { CommonChatProps } from '../../types/chat';
3
+ import { CommonChatRef } from '../../types/chat';
4
+ declare const CommonChat: React.ForwardRefExoticComponent<CommonChatProps & React.RefAttributes<CommonChatRef>>;
5
+ export default CommonChat;
@@ -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.css";
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;