bhd-components 0.10.11 → 0.10.12

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 (116) hide show
  1. package/README.md +1 -1
  2. package/dist/index.esm.es5.development.css +0 -766
  3. package/dist/index.esm.es5.development.js +162 -3085
  4. package/dist/index.esm.es5.production.css +1 -1
  5. package/dist/index.esm.es5.production.js +1 -1
  6. package/dist/vendor.esm.es5.development.js +1100 -2515
  7. package/dist/vendor.esm.es5.production.js +136 -136
  8. package/es2017/customerService/index.js +3 -1
  9. package/es2017/index.d.ts +0 -1
  10. package/es2017/index.js +0 -1
  11. package/es2017/utils/Date.d.ts +1 -2
  12. package/es2017/utils/Date.js +1 -2
  13. package/es2017/utils/dom.d.ts +1 -4
  14. package/es2017/utils/dom.js +1 -44
  15. package/esm/customerService/index.js +3 -1
  16. package/esm/index.d.ts +0 -1
  17. package/esm/index.js +0 -1
  18. package/esm/utils/Date.d.ts +1 -2
  19. package/esm/utils/Date.js +1 -2
  20. package/esm/utils/dom.d.ts +1 -4
  21. package/esm/utils/dom.js +1 -45
  22. package/package.json +1 -2
  23. package/es2017/AIMessageList/components/content/index.d.ts +0 -4
  24. package/es2017/AIMessageList/components/content/index.js +0 -29
  25. package/es2017/AIMessageList/components/content/index.module.less +0 -8
  26. package/es2017/AIMessageList/components/copyIcon/index.d.ts +0 -7
  27. package/es2017/AIMessageList/components/copyIcon/index.js +0 -73
  28. package/es2017/AIMessageList/components/copyIcon/index.module.less +0 -22
  29. package/es2017/AIMessageList/components/errorCallback/index.d.ts +0 -3
  30. package/es2017/AIMessageList/components/errorCallback/index.js +0 -6
  31. package/es2017/AIMessageList/components/fileList/fileIcon.d.ts +0 -3
  32. package/es2017/AIMessageList/components/fileList/fileIcon.js +0 -970
  33. package/es2017/AIMessageList/components/fileList/index.d.ts +0 -4
  34. package/es2017/AIMessageList/components/fileList/index.js +0 -315
  35. package/es2017/AIMessageList/components/fileList/index.module.less +0 -95
  36. package/es2017/AIMessageList/components/footer/index.d.ts +0 -10
  37. package/es2017/AIMessageList/components/footer/index.js +0 -360
  38. package/es2017/AIMessageList/components/footer/index.module.less +0 -51
  39. package/es2017/AIMessageList/components/header/index.d.ts +0 -9
  40. package/es2017/AIMessageList/components/header/index.js +0 -94
  41. package/es2017/AIMessageList/components/header/index.module.less +0 -31
  42. package/es2017/AIMessageList/components/referencesIcon/index.d.ts +0 -9
  43. package/es2017/AIMessageList/components/referencesIcon/index.js +0 -63
  44. package/es2017/AIMessageList/components/referencesIcon/index.module.less +0 -13
  45. package/es2017/AIMessageList/components/refreshBtn/index.d.ts +0 -4
  46. package/es2017/AIMessageList/components/refreshBtn/index.js +0 -29
  47. package/es2017/AIMessageList/components/refreshBtn/index.module.less +0 -12
  48. package/es2017/AIMessageList/components/remarkBtn/index.d.ts +0 -4
  49. package/es2017/AIMessageList/components/remarkBtn/index.js +0 -51
  50. package/es2017/AIMessageList/components/remarkBtn/index.module.less +0 -13
  51. package/es2017/AIMessageList/components/renderReferrnce/index.d.ts +0 -10
  52. package/es2017/AIMessageList/components/renderReferrnce/index.js +0 -68
  53. package/es2017/AIMessageList/components/renderReferrnce/index.module.less +0 -64
  54. package/es2017/AIMessageList/components/sendBtn/index.d.ts +0 -4
  55. package/es2017/AIMessageList/components/sendBtn/index.js +0 -51
  56. package/es2017/AIMessageList/components/sendBtn/index.module.less +0 -25
  57. package/es2017/AIMessageList/components/uplodaFileBtn/index.d.ts +0 -4
  58. package/es2017/AIMessageList/components/uplodaFileBtn/index.js +0 -33
  59. package/es2017/AIMessageList/components/uplodaFileBtn/index.module.less +0 -5
  60. package/es2017/AIMessageList/components/virtuosoList/index.d.ts +0 -5
  61. package/es2017/AIMessageList/components/virtuosoList/index.js +0 -689
  62. package/es2017/AIMessageList/components/virtuosoList/index.module.less +0 -467
  63. package/es2017/AIMessageList/index.d.ts +0 -4
  64. package/es2017/AIMessageList/index.js +0 -58
  65. package/es2017/AIMessageList/index.module.less +0 -20
  66. package/es2017/AIMessageList/type.d.ts +0 -306
  67. package/es2017/images/loading2.js +0 -2
  68. package/es2017/utils/number.d.ts +0 -1
  69. package/es2017/utils/number.js +0 -9
  70. package/esm/AIMessageList/components/content/index.d.ts +0 -4
  71. package/esm/AIMessageList/components/content/index.js +0 -29
  72. package/esm/AIMessageList/components/content/index.module.less +0 -8
  73. package/esm/AIMessageList/components/copyIcon/index.d.ts +0 -7
  74. package/esm/AIMessageList/components/copyIcon/index.js +0 -76
  75. package/esm/AIMessageList/components/copyIcon/index.module.less +0 -22
  76. package/esm/AIMessageList/components/errorCallback/index.d.ts +0 -3
  77. package/esm/AIMessageList/components/errorCallback/index.js +0 -6
  78. package/esm/AIMessageList/components/fileList/fileIcon.d.ts +0 -3
  79. package/esm/AIMessageList/components/fileList/fileIcon.js +0 -970
  80. package/esm/AIMessageList/components/fileList/index.d.ts +0 -4
  81. package/esm/AIMessageList/components/fileList/index.js +0 -337
  82. package/esm/AIMessageList/components/fileList/index.module.less +0 -95
  83. package/esm/AIMessageList/components/footer/index.d.ts +0 -10
  84. package/esm/AIMessageList/components/footer/index.js +0 -376
  85. package/esm/AIMessageList/components/footer/index.module.less +0 -51
  86. package/esm/AIMessageList/components/header/index.d.ts +0 -9
  87. package/esm/AIMessageList/components/header/index.js +0 -96
  88. package/esm/AIMessageList/components/header/index.module.less +0 -31
  89. package/esm/AIMessageList/components/referencesIcon/index.d.ts +0 -9
  90. package/esm/AIMessageList/components/referencesIcon/index.js +0 -65
  91. package/esm/AIMessageList/components/referencesIcon/index.module.less +0 -13
  92. package/esm/AIMessageList/components/refreshBtn/index.d.ts +0 -4
  93. package/esm/AIMessageList/components/refreshBtn/index.js +0 -31
  94. package/esm/AIMessageList/components/refreshBtn/index.module.less +0 -12
  95. package/esm/AIMessageList/components/remarkBtn/index.d.ts +0 -4
  96. package/esm/AIMessageList/components/remarkBtn/index.js +0 -51
  97. package/esm/AIMessageList/components/remarkBtn/index.module.less +0 -13
  98. package/esm/AIMessageList/components/renderReferrnce/index.d.ts +0 -10
  99. package/esm/AIMessageList/components/renderReferrnce/index.js +0 -72
  100. package/esm/AIMessageList/components/renderReferrnce/index.module.less +0 -64
  101. package/esm/AIMessageList/components/sendBtn/index.d.ts +0 -4
  102. package/esm/AIMessageList/components/sendBtn/index.js +0 -53
  103. package/esm/AIMessageList/components/sendBtn/index.module.less +0 -25
  104. package/esm/AIMessageList/components/uplodaFileBtn/index.d.ts +0 -4
  105. package/esm/AIMessageList/components/uplodaFileBtn/index.js +0 -33
  106. package/esm/AIMessageList/components/uplodaFileBtn/index.module.less +0 -5
  107. package/esm/AIMessageList/components/virtuosoList/index.d.ts +0 -5
  108. package/esm/AIMessageList/components/virtuosoList/index.js +0 -666
  109. package/esm/AIMessageList/components/virtuosoList/index.module.less +0 -467
  110. package/esm/AIMessageList/index.d.ts +0 -4
  111. package/esm/AIMessageList/index.js +0 -58
  112. package/esm/AIMessageList/index.module.less +0 -20
  113. package/esm/AIMessageList/type.d.ts +0 -306
  114. package/esm/images/loading2.js +0 -2
  115. package/esm/utils/number.d.ts +0 -1
  116. package/esm/utils/number.js +0 -9
@@ -1,360 +0,0 @@
1
- import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
2
- import { jsx as _jsx, jsxs as _jsxs } from "@ice/jsx-runtime/jsx-runtime";
3
- import React, { useState, useEffect, useImperativeHandle, forwardRef, useRef, useMemo } from "react";
4
- import styles from "./index.module.less";
5
- import { fetchEventSource } from "@microsoft/fetch-event-source";
6
- import BhdEnterInput from "../../../bhdEnterInput";
7
- import { Divider } from "antd";
8
- import SendBtn from "../sendBtn";
9
- import UploadFileBtn from "../uplodaFileBtn";
10
- import FileList from "../fileList";
11
- import References from "../renderReferrnce";
12
- import { guidGenerator } from "../../../utils/number";
13
- const { TextArea } = BhdEnterInput;
14
- const defaultProps = {
15
- placeholder: "请输入内容\n按Enter发送,Shift+Enter换行",
16
- className: "",
17
- maxLength: 500,
18
- fileUpload: false
19
- };
20
- const defaultFileUploadProps = {
21
- accept: ".pdf,.ppt,.pptx,.doc,.docx,.xls,.xlsx,.txt,.text,.png,.jpg,.jpeg,.gif,.webp",
22
- maxCount: 10,
23
- maxSize: 50 * 1024 * 1024,
24
- mapUploadCount: 1,
25
- multiple: true
26
- };
27
- const Footer = /*#__PURE__*/ forwardRef((props, ref)=>{
28
- let { footerConfig, prefix, errorCallback, apiRef } = props;
29
- let { placeholder = defaultProps.placeholder, className = defaultProps.className, maxLength = defaultProps.maxLength, renderAction, fileUpload, sendMsgAjaxParams, onClickStop = ()=>{}, conversionContent = (str)=>str } = footerConfig;
30
- if (fileUpload) {
31
- fileUpload = _object_spread({}, defaultFileUploadProps, fileUpload);
32
- }
33
- const footerDomRef = useRef(null);
34
- const resizeObserverRef = useRef(null);
35
- const fileListRef = useRef(null);
36
- const ctrl = useRef(); //停止生成ai回答时使用
37
- const [textValue, setTextValue] = useState("");
38
- const [sending, setSending] = useState(false);
39
- const [fileCanSending, setFileCanSending] = useState(true); // 是否允许发送 关联文件
40
- const updateMsgRef = useRef(null);
41
- // const [referencesSource, setReferencesSource] = useState<referenceType>({
42
- // type: "file",
43
- // value: {
44
- // name: "文件名字.doc",
45
- // suffix: "doc",
46
- // fileId: "",
47
- // url: "",
48
- // status: undefined,
49
- // source: undefined,
50
- // },
51
- // });
52
- const [referencesSource, setReferencesSource] = useState(null);
53
- const recordRef = useRef({
54
- value: textValue,
55
- referencesSource: referencesSource,
56
- sending: sending
57
- });
58
- useImperativeHandle(ref, ()=>{
59
- return _object_spread({
60
- setTextValue,
61
- sendMsg: sendMsg,
62
- clearText: ()=>{
63
- setTextValue("");
64
- },
65
- getCanSendMsg: ()=>{
66
- return canSendMsg;
67
- },
68
- stopMessage: ()=>{
69
- stopMessage();
70
- },
71
- setReferences: (reference)=>{
72
- setReferencesSource(reference);
73
- }
74
- }, fileListRef.current);
75
- });
76
- useEffect(()=>{
77
- listenerFooterHeight();
78
- return ()=>{
79
- resizeObserverRef.current && resizeObserverRef.current.disconnect();
80
- clearTimeout(updateMsgRef.current);
81
- };
82
- }, []);
83
- useEffect(()=>{
84
- recordRef.current.value = textValue;
85
- recordRef.current.referencesSource = referencesSource;
86
- recordRef.current.sending = sending;
87
- }, [
88
- textValue,
89
- referencesSource,
90
- sending
91
- ]);
92
- // 监听footer变化
93
- const listenerFooterHeight = ()=>{
94
- if (!footerDomRef.current) return;
95
- // 创建ResizeObserver实例
96
- resizeObserverRef.current = new ResizeObserver((entries)=>{
97
- apiRef.contentApi && apiRef.contentApi.scrollToBottom();
98
- });
99
- // 开始观察footer元素
100
- resizeObserverRef.current.observe(footerDomRef.current);
101
- };
102
- // 是否允许发送消息
103
- const canSendMsg = useMemo(()=>{
104
- if (textValue.trim().length === 0) return false;
105
- if (typeof maxLength === "function") {
106
- if (maxLength(textValue)) return false;
107
- }
108
- if (textValue.trim().length > maxLength) return false;
109
- if (sending) return false;
110
- if (!fileCanSending) return false;
111
- return true;
112
- }, [
113
- textValue,
114
- maxLength,
115
- sending,
116
- fileCanSending
117
- ]);
118
- const stopMessage = ()=>{
119
- ctrl.current && ctrl.current.abort();
120
- apiRef.contentApi.clearInputing();
121
- setSending(false);
122
- };
123
- const getCls = (clsName)=>{
124
- return styles[clsName] + " " + prefix + "-" + clsName;
125
- };
126
- const renderBtn = ()=>{
127
- let sendNode = /*#__PURE__*/ _jsx(SendBtn, {
128
- prefix: prefix,
129
- canSendMsg: canSendMsg,
130
- sending: sending,
131
- stopMessage: ()=>{
132
- onClickStop();
133
- stopMessage();
134
- },
135
- clickFn: ()=>{
136
- if (textValue.trim().length === 0) return;
137
- sendMsg(textValue);
138
- }
139
- });
140
- if (fileUpload) {
141
- let fileNode = /*#__PURE__*/ _jsx(UploadFileBtn, {
142
- prefix: prefix,
143
- fileUpload: fileUpload,
144
- customRequest: (options)=>{
145
- var _fileListRef_current;
146
- console.log("customRequestcustomRequest", options);
147
- (_fileListRef_current = fileListRef.current) === null || _fileListRef_current === void 0 ? void 0 : _fileListRef_current.addFile(options.file);
148
- }
149
- });
150
- if (renderAction) {
151
- return renderAction(sendNode, fileNode);
152
- } else {
153
- return /*#__PURE__*/ _jsxs("div", {
154
- className: `${getCls("footerActionBtn")}`,
155
- children: [
156
- fileNode,
157
- /*#__PURE__*/ _jsx(Divider, {
158
- type: "vertical"
159
- }),
160
- sendNode
161
- ]
162
- });
163
- }
164
- } else {
165
- let fileNode = null;
166
- if (renderAction) {
167
- return renderAction(sendNode, fileNode);
168
- } else {
169
- return /*#__PURE__*/ _jsx("div", {
170
- className: `${getCls("footerActionBtn")}`,
171
- children: sendNode
172
- });
173
- }
174
- }
175
- };
176
- const onPressEnter = (e)=>{
177
- // 判断是否按下了 Shift 键
178
- if (e.shiftKey) {
179
- // 如果按下了 Shift + Enter,则允许换行(默认行为)
180
- return;
181
- } else {
182
- if (textValue.length === 0) {
183
- // 内容为空时 执行换行操作
184
- return;
185
- }
186
- // 如果只按了 Enter,则阻止默认行为并发送消息
187
- e.preventDefault();
188
- // 在这里添加发送消息的逻辑
189
- sendMsg(textValue);
190
- }
191
- };
192
- // 发现消息
193
- const sendMsg = (value)=>{
194
- if (value.trim().length === 0) return;
195
- if (!canSendMsg) return;
196
- console.log("发送消息:", value);
197
- apiRef.contentApi.addMsg({
198
- id: guidGenerator(),
199
- createTime: new Date().getTime(),
200
- content: value,
201
- location: "right",
202
- reference: recordRef.current.referencesSource,
203
- source: null,
204
- fileList: fileListRef.current.getFileList()
205
- });
206
- sendMsgAjax();
207
- };
208
- const sendMsgAjax = ()=>{
209
- const { url, method = "POST", headers = ()=>({}), params = ()=>"", onOpen = ()=>{}, onMessage = (ev)=>ev, onClose = ()=>{}, onError = ()=>{}, coverProps = {}, beforeSendMsg = ()=>Promise.resolve() } = sendMsgAjaxParams;
210
- ctrl.current = new AbortController();
211
- // apiRef
212
- console.log("apiRef", apiRef);
213
- let msgId = "inputing";
214
- let createTime = new Date().getTime();
215
- apiRef.contentApi.addMsg({
216
- id: msgId,
217
- createTime: createTime,
218
- content: "正在输入...",
219
- location: "left",
220
- reference: null,
221
- source: null,
222
- fileList: fileListRef.current.getFileList()
223
- });
224
- let msgContent = "";
225
- setSending(true);
226
- setTextValue("");
227
- fileListRef.current.clearFileList();
228
- setReferencesSource(null);
229
- let recordMsgObj = {};
230
- let arg = [
231
- recordRef.current.value,
232
- recordRef.current.referencesSource,
233
- fileListRef.current ? fileListRef.current.getFileList() : []
234
- ];
235
- beforeSendMsg(...arg).then((beforeInfo)=>{
236
- const callback = ()=>{
237
- let isClose = false;
238
- const closeCallback = ()=>{
239
- if (isClose) return;
240
- isClose = true;
241
- onClose();
242
- setSending(false);
243
- if (recordMsgObj.id) {
244
- apiRef.contentApi.recordMsg(recordMsgObj);
245
- apiRef.contentApi.setSendingId(recordMsgObj.id);
246
- }
247
- console.log("onclose: ", recordMsgObj);
248
- };
249
- fetchEventSource(url, _object_spread({
250
- method,
251
- headers: _object_spread({
252
- "Content-Type": "application/json",
253
- Accept: "text/event-stream,application/json"
254
- }, headers()),
255
- body: params(...arg, beforeInfo),
256
- openWhenHidden: true,
257
- signal: ctrl.current.signal,
258
- onopen: (res)=>{
259
- const retryFetch = ()=>{
260
- callback();
261
- };
262
- onOpen(res, {
263
- retryFetch,
264
- stopMessage
265
- });
266
- return null;
267
- },
268
- onmessage: (ev)=>{
269
- let data = onMessage(ev, closeCallback);
270
- msgContent += data.content;
271
- let str = msgContent.replace(/\\n/g, "\n");
272
- str = conversionContent(str);
273
- delete data.content;
274
- recordMsgObj = _object_spread({
275
- createTime: createTime,
276
- content: str || "正在输入...",
277
- location: "left",
278
- reference: null,
279
- source: null
280
- }, data);
281
- apiRef.contentApi.setSendingId(data.id);
282
- apiRef.contentApi.updateMsg(msgId, recordMsgObj);
283
- msgId = data.id;
284
- updateMsgRef.current = setTimeout(function() {
285
- apiRef.contentApi.scrollToBottom();
286
- }, 100);
287
- },
288
- onclose: ()=>{
289
- closeCallback();
290
- },
291
- onerror: (err)=>{
292
- onError(err);
293
- if (recordMsgObj.id) {
294
- apiRef.contentApi.recordMsg(recordMsgObj);
295
- }
296
- console.log("onerror: ", err);
297
- }
298
- }, coverProps));
299
- };
300
- callback();
301
- }).catch(()=>{
302
- stopMessage();
303
- });
304
- };
305
- // 判断是否超出最大字数
306
- const judegTextLengthWarn = ()=>{
307
- if (typeof maxLength === "function") {
308
- return maxLength(textValue);
309
- } else {
310
- return textValue.length > maxLength;
311
- }
312
- };
313
- return /*#__PURE__*/ _jsx("div", {
314
- className: `${getCls("footer")} ${className}`,
315
- ref: footerDomRef,
316
- children: /*#__PURE__*/ _jsxs("div", {
317
- className: `${getCls("footerBody")} ${judegTextLengthWarn() ? getCls("footerBodyWarn") : ""}`,
318
- children: [
319
- fileUpload && /*#__PURE__*/ _jsx("div", {
320
- className: getCls("footerFile"),
321
- children: /*#__PURE__*/ _jsx(FileList, {
322
- prefix: prefix,
323
- fileUpload: fileUpload,
324
- ref: fileListRef,
325
- errorCallback: errorCallback,
326
- changeFileCanSending: setFileCanSending
327
- })
328
- }),
329
- /*#__PURE__*/ _jsxs("div", {
330
- className: getCls("footerInput"),
331
- children: [
332
- /*#__PURE__*/ _jsx(TextArea, {
333
- value: textValue,
334
- onChange: (e)=>{
335
- setTextValue(e.target.value);
336
- },
337
- placeholder: placeholder,
338
- autoSize: {
339
- minRows: 2,
340
- maxRows: 6
341
- },
342
- onPressEnter: onPressEnter
343
- }),
344
- /*#__PURE__*/ _jsx(References, {
345
- prefix: prefix,
346
- referencesSource: referencesSource,
347
- fileUpload: fileUpload,
348
- deleteReferences: ()=>setReferencesSource(null)
349
- })
350
- ]
351
- }),
352
- /*#__PURE__*/ _jsx("div", {
353
- className: getCls("footerAction"),
354
- children: renderBtn()
355
- })
356
- ]
357
- })
358
- });
359
- });
360
- export default Footer;
@@ -1,51 +0,0 @@
1
- .footer {
2
- width: 100%;
3
- padding: 16px;
4
- box-sizing: border-box;
5
- .footerBody {
6
- width: 100%;
7
- border-radius: 8px;
8
- background: #ffffff;
9
- border: 1px solid rgba(0, 0, 0, 0.06);
10
- padding-bottom: 12px;
11
- &.footerBodyWarn {
12
- border-color: #f4523b;
13
- }
14
-
15
- .footerFile {
16
- width: 100%;
17
- }
18
- .footerInput {
19
- :global {
20
- .bhd-input {
21
- border: none;
22
- box-shadow: none;
23
- background: transparent;
24
- padding: 12px 16px;
25
- }
26
- }
27
- }
28
- .footerAction {
29
- width: 100%;
30
- padding: 0 16px;
31
- box-sizing: border-box;
32
- .footerActionBtn {
33
- width: 100%;
34
- display: flex;
35
- align-items: center;
36
- justify-content: flex-end;
37
- :global {
38
- .bhd-divider {
39
- border-color: rgba(0, 0, 0, 0.06);
40
- height: 16px;
41
- top: 0;
42
- margin: 0 16px;
43
- }
44
- .bhd-upload-wrapper {
45
- display: flex;
46
- }
47
- }
48
- }
49
- }
50
- }
51
- }
@@ -1,9 +0,0 @@
1
- import React from "react";
2
- import type { headerConfigProps, errorMessageProps } from "../../type";
3
- interface IProps {
4
- headerConfig: headerConfigProps;
5
- prefix: string;
6
- errorCallback: (error: errorMessageProps) => void;
7
- }
8
- declare const Header: (props: IProps) => React.JSX.Element;
9
- export default Header;
@@ -1,94 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "@ice/jsx-runtime/jsx-runtime";
2
- import React from "react";
3
- import styles from "./index.module.less";
4
- const defaultProps = {
5
- icon: /*#__PURE__*/ _jsx("i", {
6
- children: /*#__PURE__*/ _jsxs("svg", {
7
- xmlns: "http://www.w3.org/2000/svg",
8
- width: "1em",
9
- height: "1em",
10
- viewBox: "0 0 16 16",
11
- fill: "none",
12
- children: [
13
- /*#__PURE__*/ _jsx("path", {
14
- d: "M12.6063 14C12.2547 13.9994 11.9095 13.9066 11.6051 13.7309C11.3006 13.5551 11.0476 13.3025 10.8714 12.9983L7.15187 6.55597L4.21122 11.6493H7.67426C7.98599 11.6493 8.28495 11.7731 8.50538 11.9935C8.7258 12.2139 8.84963 12.5129 8.84963 12.8246C8.84963 13.1364 8.7258 13.4353 8.50538 13.6557C8.28495 13.8762 7.98599 14 7.67426 14H2.17613C1.96974 14.0001 1.76696 13.9459 1.58818 13.8428C1.40939 13.7397 1.26091 13.5913 1.15766 13.4126C1.05441 13.2339 1.00003 13.0312 1 12.8248C0.999967 12.6184 1.05428 12.4157 1.15747 12.2369L6.13322 3.61754C6.23638 3.43887 6.38476 3.29051 6.56343 3.18736C6.7421 3.08421 6.94478 3.0299 7.15109 3.0299C7.3574 3.0299 7.56008 3.08421 7.73875 3.18736C7.91742 3.29051 8.0658 3.43887 8.16896 3.61754L12.2582 10.6998V4.20522C12.2582 3.8935 12.3821 3.59454 12.6025 3.37411C12.8229 3.15368 13.1219 3.02985 13.4336 3.02985C13.7453 3.02985 14.0443 3.15368 14.2647 3.37411C14.4851 3.59454 14.609 3.8935 14.609 4.20522V11.9966C14.609 12.5279 14.398 13.0373 14.0224 13.413C13.6469 13.7887 13.1375 13.9998 12.6063 14Z",
15
- fill: "url(#paint0_linear_34_244)"
16
- }),
17
- /*#__PURE__*/ _jsx("path", {
18
- d: "M13.4336 2.35075C14.0827 2.35075 14.609 1.82451 14.609 1.17537C14.609 0.526232 14.0827 0 13.4336 0C12.7845 0 12.2582 0.526232 12.2582 1.17537C12.2582 1.82451 12.7845 2.35075 13.4336 2.35075Z",
19
- fill: "url(#paint1_linear_34_244)"
20
- }),
21
- /*#__PURE__*/ _jsxs("defs", {
22
- children: [
23
- /*#__PURE__*/ _jsxs("linearGradient", {
24
- id: "paint0_linear_34_244",
25
- x1: "14.609",
26
- y1: "0",
27
- x2: "-0.275842",
28
- y2: "13.609",
29
- gradientUnits: "userSpaceOnUse",
30
- children: [
31
- /*#__PURE__*/ _jsx("stop", {
32
- stopColor: "#F87AFD"
33
- }),
34
- /*#__PURE__*/ _jsx("stop", {
35
- offset: "1",
36
- stopColor: "#41DAF8"
37
- })
38
- ]
39
- }),
40
- /*#__PURE__*/ _jsxs("linearGradient", {
41
- id: "paint1_linear_34_244",
42
- x1: "14.609",
43
- y1: "0",
44
- x2: "-0.275842",
45
- y2: "13.609",
46
- gradientUnits: "userSpaceOnUse",
47
- children: [
48
- /*#__PURE__*/ _jsx("stop", {
49
- stopColor: "#F87AFD"
50
- }),
51
- /*#__PURE__*/ _jsx("stop", {
52
- offset: "1",
53
- stopColor: "#41DAF8"
54
- })
55
- ]
56
- })
57
- ]
58
- })
59
- ]
60
- })
61
- }),
62
- className: "",
63
- renderRightHead: ()=>null
64
- };
65
- const Header = (props)=>{
66
- const { headerConfig, prefix } = props;
67
- const { icon = defaultProps.icon, title, className = defaultProps.className, renderRightHead = defaultProps.renderRightHead } = headerConfig;
68
- const getCls = (clsName)=>{
69
- return styles[clsName] + " " + prefix + "-" + clsName;
70
- };
71
- return /*#__PURE__*/ _jsxs("div", {
72
- className: `${getCls("header")} ${className}`,
73
- children: [
74
- /*#__PURE__*/ _jsxs("div", {
75
- className: getCls("headerLeft"),
76
- children: [
77
- /*#__PURE__*/ _jsx("div", {
78
- className: getCls("headerIcon"),
79
- children: icon
80
- }),
81
- /*#__PURE__*/ _jsx("div", {
82
- className: getCls("headerTitle"),
83
- children: title
84
- })
85
- ]
86
- }),
87
- /*#__PURE__*/ _jsx("div", {
88
- className: getCls("headerRight"),
89
- children: renderRightHead()
90
- })
91
- ]
92
- });
93
- };
94
- export default Header;
@@ -1,31 +0,0 @@
1
- .header {
2
- width: 100%;
3
- padding: 8px 16px;
4
- box-sizing: border-box;
5
- display: flex;
6
- align-items: center;
7
- gap: 8px;
8
- justify-content: space-between;
9
- border-bottom: 1px solid #ebebeb;
10
- .headerLeft {
11
- display: flex;
12
- align-items: center;
13
- gap: 8px;
14
- .headerIcon {
15
- &>i{
16
- line-height: 1;
17
- font-size: 16px;
18
- display: flex;
19
- }
20
- }
21
- .headerTitle {
22
- font-weight: 600;
23
- color: rgba(0, 0, 0, 0.65);
24
- font-size: 16px;
25
- line-height: 1.5;
26
- }
27
- }
28
- .headerRight {
29
- font-size: 16px;
30
- }
31
- }
@@ -1,9 +0,0 @@
1
- import React from "react";
2
- import type { dataItemType, AIMessageListRefProps } from "../../type";
3
- interface ReferencesIconProps {
4
- prefix: string;
5
- item: dataItemType;
6
- apiRef: AIMessageListRefProps;
7
- }
8
- declare const ReferencesIcon: (props: ReferencesIconProps) => React.JSX.Element;
9
- export default ReferencesIcon;
@@ -1,63 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "@ice/jsx-runtime/jsx-runtime";
2
- import React from "react";
3
- import styles from "./index.module.less";
4
- const referencesIcon = /*#__PURE__*/ _jsx("i", {
5
- children: /*#__PURE__*/ _jsxs("svg", {
6
- width: "1em",
7
- height: "1em",
8
- shapeRendering: "geometricPrecision",
9
- fill: "currentColor",
10
- viewBox: "0 0 14 14",
11
- xmlns: "http://www.w3.org/2000/svg",
12
- children: [
13
- /*#__PURE__*/ _jsx("path", {
14
- "fill-rule": "evenodd",
15
- "clip-rule": "evenodd",
16
- d: "M6.28443 3.03861C3.77423 4.65069 2.37971 6.52702 2.10085 8.66759C1.66674 12 4.6468 13.6311 6.15677 12.1655C7.66673 10.7 6.7616 8.83982 5.66823 8.33136C4.57487 7.82286 3.90623 7.99996 4.02287 7.32046C4.1395 6.64099 5.69503 4.75706 7.06163 3.87969C7.1523 3.80259 7.1868 3.65299 7.0995 3.53949C7.04207 3.46486 6.92943 3.31847 6.7616 3.10033C6.61483 2.90957 6.47423 2.91671 6.28443 3.03861Z"
17
- }),
18
- /*#__PURE__*/ _jsx("path", {
19
- "fill-rule": "evenodd",
20
- "clip-rule": "evenodd",
21
- d: "M12.893 3.03861C10.3828 4.65069 8.98827 6.52702 8.7094 8.66759C8.2753 12 11.2554 13.6311 12.7653 12.1655C14.2753 10.7 13.3702 8.83982 12.2768 8.33136C11.1834 7.82286 10.5148 7.99996 10.6314 7.32046C10.7481 6.64099 12.3036 4.75706 13.6702 3.87969C13.7609 3.80259 13.7954 3.65299 13.708 3.53949C13.6506 3.46486 13.538 3.31847 13.3702 3.10033C13.2234 2.90957 13.0828 2.91671 12.893 3.03861Z"
22
- })
23
- ]
24
- })
25
- });
26
- const ReferencesIcon = (props)=>{
27
- const { prefix, apiRef, item } = props;
28
- const getCls = (clsName)=>{
29
- return styles[clsName] + " " + prefix + "-" + clsName;
30
- };
31
- const clickFn = ()=>{
32
- console.log("apiRef", apiRef);
33
- if (apiRef && apiRef.footerApi) {
34
- console.log("itemitem", item);
35
- if (item.type === "file") {
36
- apiRef.footerApi.setReferences({
37
- type: "file",
38
- value: {
39
- name: item.fileTitle,
40
- suffix: item.suffix,
41
- fileId: item.id,
42
- url: "",
43
- status: "success",
44
- source: null
45
- },
46
- source: item
47
- });
48
- } else {
49
- apiRef.footerApi.setReferences({
50
- type: "text",
51
- value: item.content,
52
- source: item
53
- });
54
- }
55
- }
56
- };
57
- return /*#__PURE__*/ _jsx("div", {
58
- className: `${getCls("msgItem-action-reference")}`,
59
- onClick: ()=>clickFn(),
60
- children: referencesIcon
61
- });
62
- };
63
- export default ReferencesIcon;
@@ -1,13 +0,0 @@
1
- .msgItem-action-reference {
2
- cursor: pointer;
3
- border-radius: 2px;
4
- display: flex;
5
- line-height: 1;
6
- & > i {
7
- color: rgba(140, 140, 140, 1);
8
- font-size: 16px;
9
- }
10
- &:hover {
11
- background-color: rgba(0, 0, 0, 0.04);
12
- }
13
- }
@@ -1,4 +0,0 @@
1
- import React from "react";
2
- import type { refreshBtnProps } from "../../type";
3
- declare const RefreshBtn: (props: refreshBtnProps) => React.JSX.Element;
4
- export default RefreshBtn;
@@ -1,29 +0,0 @@
1
- import { jsx as _jsx } from "@ice/jsx-runtime/jsx-runtime";
2
- import React from "react";
3
- import styles from "./index.module.less";
4
- const refreshSvg = /*#__PURE__*/ _jsx("svg", {
5
- viewBox: "0 0 14 14",
6
- version: "1.1",
7
- xmlns: "http://www.w3.org/2000/svg",
8
- "p-id": "8340",
9
- width: "1em",
10
- height: "1em",
11
- fill: "currentColor",
12
- shapeRendering: "geometricPrecision",
13
- "aria-hidden": "true",
14
- children: /*#__PURE__*/ _jsx("path", {
15
- d: "M8 3.80001C7.27938 3.80001 6.60141 3.97512 6.00464 4.2846C5.71048 4.43715 5.34834 4.32235 5.19579 4.02818C5.04324 3.73401 5.15804 3.37187 5.4522 3.21932C6.21563 2.82342 7.0826 2.60001 8 2.60001C11.0603 2.60001 13.5412 5.08088 13.5412 8.14118C13.5412 8.40936 13.5221 8.67343 13.4851 8.93202C13.4737 9.01141 13.4607 9.09026 13.446 9.16853L13.7175 9.02364C14.0098 8.86759 14.3733 8.97808 14.5293 9.27041C14.6854 9.56274 14.5749 9.92622 14.2825 10.0823L12.6718 10.9421C12.3819 11.0968 12.0215 10.9896 11.8633 10.7016L11.0035 9.13588C10.844 8.84542 10.9501 8.48065 11.2406 8.32115C11.5311 8.16164 11.8958 8.2678 12.0553 8.55825L12.2672 8.94405C12.2784 8.88383 12.2885 8.82318 12.2972 8.76211C12.3261 8.55962 12.3412 8.35233 12.3412 8.14118C12.3412 5.74362 10.3976 3.80001 8 3.80001ZM3.32824 5.34029C3.61811 5.18556 3.97853 5.29278 4.13669 5.58079L4.99651 7.14649C5.15601 7.43694 5.04986 7.80171 4.7594 7.96122C4.46895 8.12072 4.10418 8.01457 3.94467 7.72411L3.73281 7.33832C3.72156 7.39853 3.71155 7.45919 3.70282 7.52026C3.67386 7.72275 3.65883 7.93003 3.65883 8.14118C3.65883 10.5387 5.60244 12.4824 8 12.4824C8.72063 12.4824 9.39859 12.3072 9.99536 11.9978C10.2895 11.8452 10.6517 11.96 10.8042 12.2542C10.9568 12.5484 10.842 12.9105 10.5478 13.063C9.78437 13.4589 8.9174 13.6824 8 13.6824C4.93969 13.6824 2.45883 11.2015 2.45883 8.14118C2.45883 7.87301 2.47792 7.60894 2.51491 7.35034C2.52627 7.27095 2.5393 7.19211 2.55399 7.11384L2.28254 7.25873C1.99021 7.41477 1.62673 7.30429 1.47069 7.01196C1.31465 6.71963 1.42513 6.35615 1.71746 6.20011L3.32824 5.34029Z"
16
- })
17
- });
18
- const RefreshBtn = (props)=>{
19
- const { prefix, clickFn } = props;
20
- const getCls = (clsName)=>{
21
- return styles[clsName] + " " + prefix + "-" + clsName;
22
- };
23
- return /*#__PURE__*/ _jsx("i", {
24
- className: `${getCls("refreshBtn")}`,
25
- onClick: ()=>clickFn(),
26
- children: refreshSvg
27
- });
28
- };
29
- export default RefreshBtn;