bhd-components 0.9.29 → 0.10.2
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.
- package/dist/index.esm.es5.development.css +662 -0
- package/dist/index.esm.es5.development.js +2694 -159
- package/dist/index.esm.es5.production.css +1 -1
- package/dist/index.esm.es5.production.js +1 -1
- package/dist/vendor.esm.es5.development.js +2515 -1100
- package/dist/vendor.esm.es5.production.js +136 -136
- package/es2017/AIMessageList/components/content/index.d.ts +4 -0
- package/es2017/AIMessageList/components/content/index.js +29 -0
- package/es2017/AIMessageList/components/content/index.module.less +8 -0
- package/es2017/AIMessageList/components/copyIcon/index.d.ts +7 -0
- package/es2017/AIMessageList/components/copyIcon/index.js +58 -0
- package/es2017/AIMessageList/components/copyIcon/index.module.less +22 -0
- package/es2017/AIMessageList/components/errorCallback/index.d.ts +3 -0
- package/es2017/AIMessageList/components/errorCallback/index.js +6 -0
- package/es2017/AIMessageList/components/fileList/fileIcon.d.ts +3 -0
- package/es2017/AIMessageList/components/fileList/fileIcon.js +970 -0
- package/es2017/AIMessageList/components/fileList/index.d.ts +4 -0
- package/es2017/AIMessageList/components/fileList/index.js +299 -0
- package/es2017/AIMessageList/components/fileList/index.module.less +95 -0
- package/es2017/AIMessageList/components/footer/index.d.ts +10 -0
- package/es2017/AIMessageList/components/footer/index.js +296 -0
- package/es2017/AIMessageList/components/footer/index.module.less +51 -0
- package/es2017/AIMessageList/components/header/index.d.ts +9 -0
- package/es2017/AIMessageList/components/header/index.js +94 -0
- package/es2017/AIMessageList/components/header/index.module.less +31 -0
- package/es2017/AIMessageList/components/referencesIcon/index.d.ts +9 -0
- package/es2017/AIMessageList/components/referencesIcon/index.js +37 -0
- package/es2017/AIMessageList/components/referencesIcon/index.module.less +13 -0
- package/es2017/AIMessageList/components/renderReferrnce/index.d.ts +10 -0
- package/es2017/AIMessageList/components/renderReferrnce/index.js +68 -0
- package/es2017/AIMessageList/components/renderReferrnce/index.module.less +64 -0
- package/es2017/AIMessageList/components/sendBtn/index.d.ts +4 -0
- package/es2017/AIMessageList/components/sendBtn/index.js +46 -0
- package/es2017/AIMessageList/components/sendBtn/index.module.less +25 -0
- package/es2017/AIMessageList/components/uplodaFileBtn/index.d.ts +4 -0
- package/es2017/AIMessageList/components/uplodaFileBtn/index.js +33 -0
- package/es2017/AIMessageList/components/uplodaFileBtn/index.module.less +5 -0
- package/es2017/AIMessageList/components/virtuosoList/index.d.ts +5 -0
- package/es2017/AIMessageList/components/virtuosoList/index.js +507 -0
- package/es2017/AIMessageList/components/virtuosoList/index.module.less +381 -0
- package/es2017/AIMessageList/index.d.ts +4 -0
- package/es2017/AIMessageList/index.js +58 -0
- package/es2017/AIMessageList/index.module.less +20 -0
- package/es2017/AIMessageList/type.d.ts +242 -0
- package/es2017/customerService/index.js +1 -0
- package/es2017/images/loading2.js +2 -0
- package/es2017/index.d.ts +1 -0
- package/es2017/index.js +1 -0
- package/es2017/utils/Date.d.ts +2 -1
- package/es2017/utils/Date.js +2 -1
- package/es2017/utils/dom.d.ts +4 -1
- package/es2017/utils/dom.js +44 -1
- package/es2017/utils/number.d.ts +1 -0
- package/es2017/utils/number.js +9 -0
- package/esm/AIMessageList/components/content/index.d.ts +4 -0
- package/esm/AIMessageList/components/content/index.js +29 -0
- package/esm/AIMessageList/components/content/index.module.less +8 -0
- package/esm/AIMessageList/components/copyIcon/index.d.ts +7 -0
- package/esm/AIMessageList/components/copyIcon/index.js +61 -0
- package/esm/AIMessageList/components/copyIcon/index.module.less +22 -0
- package/esm/AIMessageList/components/errorCallback/index.d.ts +3 -0
- package/esm/AIMessageList/components/errorCallback/index.js +6 -0
- package/esm/AIMessageList/components/fileList/fileIcon.d.ts +3 -0
- package/esm/AIMessageList/components/fileList/fileIcon.js +970 -0
- package/esm/AIMessageList/components/fileList/index.d.ts +4 -0
- package/esm/AIMessageList/components/fileList/index.js +325 -0
- package/esm/AIMessageList/components/fileList/index.module.less +95 -0
- package/esm/AIMessageList/components/footer/index.d.ts +10 -0
- package/esm/AIMessageList/components/footer/index.js +304 -0
- package/esm/AIMessageList/components/footer/index.module.less +51 -0
- package/esm/AIMessageList/components/header/index.d.ts +9 -0
- package/esm/AIMessageList/components/header/index.js +96 -0
- package/esm/AIMessageList/components/header/index.module.less +31 -0
- package/esm/AIMessageList/components/referencesIcon/index.d.ts +9 -0
- package/esm/AIMessageList/components/referencesIcon/index.js +39 -0
- package/esm/AIMessageList/components/referencesIcon/index.module.less +13 -0
- package/esm/AIMessageList/components/renderReferrnce/index.d.ts +10 -0
- package/esm/AIMessageList/components/renderReferrnce/index.js +72 -0
- package/esm/AIMessageList/components/renderReferrnce/index.module.less +64 -0
- package/esm/AIMessageList/components/sendBtn/index.d.ts +4 -0
- package/esm/AIMessageList/components/sendBtn/index.js +48 -0
- package/esm/AIMessageList/components/sendBtn/index.module.less +25 -0
- package/esm/AIMessageList/components/uplodaFileBtn/index.d.ts +4 -0
- package/esm/AIMessageList/components/uplodaFileBtn/index.js +33 -0
- package/esm/AIMessageList/components/uplodaFileBtn/index.module.less +5 -0
- package/esm/AIMessageList/components/virtuosoList/index.d.ts +5 -0
- package/esm/AIMessageList/components/virtuosoList/index.js +484 -0
- package/esm/AIMessageList/components/virtuosoList/index.module.less +381 -0
- package/esm/AIMessageList/index.d.ts +4 -0
- package/esm/AIMessageList/index.js +58 -0
- package/esm/AIMessageList/index.module.less +20 -0
- package/esm/AIMessageList/type.d.ts +242 -0
- package/esm/customerService/index.js +1 -0
- package/esm/images/loading2.js +2 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/utils/Date.d.ts +2 -1
- package/esm/utils/Date.js +2 -1
- package/esm/utils/dom.d.ts +4 -1
- package/esm/utils/dom.js +45 -1
- package/esm/utils/number.d.ts +1 -0
- package/esm/utils/number.js +9 -0
- package/package.json +2 -1
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
|
+
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
3
|
+
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@ice/jsx-runtime/jsx-runtime";
|
|
5
|
+
import React, { useState, useEffect, useImperativeHandle, forwardRef, useRef, useMemo } from "react";
|
|
6
|
+
import styles from "./index.module.less";
|
|
7
|
+
import { fetchEventSource } from "@microsoft/fetch-event-source";
|
|
8
|
+
import BhdEnterInput from "../../../bhdEnterInput";
|
|
9
|
+
import { Divider } from "antd";
|
|
10
|
+
import SendBtn from "../sendBtn";
|
|
11
|
+
import UploadFileBtn from "../uplodaFileBtn";
|
|
12
|
+
import FileList from "../fileList";
|
|
13
|
+
import References from "../renderReferrnce";
|
|
14
|
+
import { guidGenerator } from "../../../utils/number";
|
|
15
|
+
var TextArea = BhdEnterInput.TextArea;
|
|
16
|
+
var defaultProps = {
|
|
17
|
+
placeholder: "请输入内容\n按Enter发送,Shift+Enter换行",
|
|
18
|
+
className: "",
|
|
19
|
+
maxLength: 500,
|
|
20
|
+
fileUpload: false
|
|
21
|
+
};
|
|
22
|
+
var defaultFileUploadProps = {
|
|
23
|
+
accept: ".pdf,.ppt,.pptx,.doc,.docx,.xls,.xlsx,.txt,.text,.png,.jpg,.jpeg,.gif,.webp",
|
|
24
|
+
maxCount: 10,
|
|
25
|
+
maxSize: 50 * 1024 * 1024,
|
|
26
|
+
mapUploadCount: 1,
|
|
27
|
+
multiple: true
|
|
28
|
+
};
|
|
29
|
+
var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
30
|
+
var footerConfig = props.footerConfig, prefix = props.prefix, errorCallback = props.errorCallback, apiRef = props.apiRef;
|
|
31
|
+
var _footerConfig_placeholder = footerConfig.placeholder, placeholder = _footerConfig_placeholder === void 0 ? defaultProps.placeholder : _footerConfig_placeholder, _footerConfig_className = footerConfig.className, className = _footerConfig_className === void 0 ? defaultProps.className : _footerConfig_className, _footerConfig_maxLength = footerConfig.maxLength, maxLength = _footerConfig_maxLength === void 0 ? defaultProps.maxLength : _footerConfig_maxLength, renderAction = footerConfig.renderAction, fileUpload = footerConfig.fileUpload, sendMsgAjaxParams = footerConfig.sendMsgAjaxParams;
|
|
32
|
+
if (fileUpload) {
|
|
33
|
+
fileUpload = _object_spread({}, defaultFileUploadProps, fileUpload);
|
|
34
|
+
}
|
|
35
|
+
var fileListRef = useRef(null);
|
|
36
|
+
var ctrl = useRef(); //停止生成ai回答时使用
|
|
37
|
+
var _useState = _sliced_to_array(useState(""), 2), textValue = _useState[0], setTextValue = _useState[1];
|
|
38
|
+
var _useState1 = _sliced_to_array(useState(false), 2), sending = _useState1[0], setSending = _useState1[1];
|
|
39
|
+
var _useState2 = _sliced_to_array(useState(true), 2), fileCanSending = _useState2[0], setFileCanSending = _useState2[1]; // 是否允许发送 关联文件
|
|
40
|
+
// const [referencesSource, setReferencesSource] = useState<referenceType>({
|
|
41
|
+
// type: "file",
|
|
42
|
+
// value: {
|
|
43
|
+
// name: "文件名字.doc",
|
|
44
|
+
// suffix: "doc",
|
|
45
|
+
// fileId: "",
|
|
46
|
+
// url: "",
|
|
47
|
+
// status: undefined,
|
|
48
|
+
// source: undefined,
|
|
49
|
+
// },
|
|
50
|
+
// });
|
|
51
|
+
var _useState3 = _sliced_to_array(useState(null), 2), referencesSource = _useState3[0], setReferencesSource = _useState3[1];
|
|
52
|
+
var recordRef = useRef({
|
|
53
|
+
value: textValue,
|
|
54
|
+
referencesSource: referencesSource,
|
|
55
|
+
sending: sending
|
|
56
|
+
});
|
|
57
|
+
useImperativeHandle(ref, function() {
|
|
58
|
+
return _object_spread({
|
|
59
|
+
setTextValue: setTextValue,
|
|
60
|
+
sendMsg: sendMsg,
|
|
61
|
+
clearText: function() {
|
|
62
|
+
setTextValue("");
|
|
63
|
+
},
|
|
64
|
+
getCanSendMsg: function() {
|
|
65
|
+
return canSendMsg;
|
|
66
|
+
},
|
|
67
|
+
stopMessage: function() {
|
|
68
|
+
stopMessage();
|
|
69
|
+
},
|
|
70
|
+
setReferences: function(reference) {
|
|
71
|
+
setReferencesSource(reference);
|
|
72
|
+
}
|
|
73
|
+
}, fileListRef.current);
|
|
74
|
+
});
|
|
75
|
+
useEffect(function() {
|
|
76
|
+
recordRef.current.value = textValue;
|
|
77
|
+
recordRef.current.referencesSource = referencesSource;
|
|
78
|
+
recordRef.current.sending = sending;
|
|
79
|
+
}, [
|
|
80
|
+
textValue,
|
|
81
|
+
referencesSource,
|
|
82
|
+
sending
|
|
83
|
+
]);
|
|
84
|
+
// 是否允许发送消息
|
|
85
|
+
var canSendMsg = useMemo(function() {
|
|
86
|
+
if (textValue.trim().length === 0) return false;
|
|
87
|
+
if (typeof maxLength === "function") {
|
|
88
|
+
if (maxLength(textValue)) return false;
|
|
89
|
+
}
|
|
90
|
+
if (textValue.trim().length > maxLength) return false;
|
|
91
|
+
if (sending) return false;
|
|
92
|
+
if (!fileCanSending) return false;
|
|
93
|
+
return true;
|
|
94
|
+
}, [
|
|
95
|
+
textValue,
|
|
96
|
+
maxLength,
|
|
97
|
+
sending,
|
|
98
|
+
fileCanSending
|
|
99
|
+
]);
|
|
100
|
+
var stopMessage = function() {
|
|
101
|
+
ctrl.current && ctrl.current.abort();
|
|
102
|
+
apiRef.contentApi.clearInputing();
|
|
103
|
+
setSending(false);
|
|
104
|
+
};
|
|
105
|
+
var getCls = function(clsName) {
|
|
106
|
+
return styles[clsName] + " " + prefix + "-" + clsName;
|
|
107
|
+
};
|
|
108
|
+
var renderBtn = function() {
|
|
109
|
+
var sendNode = /*#__PURE__*/ _jsx(SendBtn, {
|
|
110
|
+
prefix: prefix,
|
|
111
|
+
canSendMsg: canSendMsg,
|
|
112
|
+
sending: sending,
|
|
113
|
+
stopMessage: stopMessage
|
|
114
|
+
});
|
|
115
|
+
if (fileUpload) {
|
|
116
|
+
var fileNode = /*#__PURE__*/ _jsx(UploadFileBtn, {
|
|
117
|
+
prefix: prefix,
|
|
118
|
+
fileUpload: fileUpload,
|
|
119
|
+
customRequest: function(options) {
|
|
120
|
+
var _fileListRef_current;
|
|
121
|
+
console.log("customRequestcustomRequest", options);
|
|
122
|
+
(_fileListRef_current = fileListRef.current) === null || _fileListRef_current === void 0 ? void 0 : _fileListRef_current.addFile(options.file);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
if (renderAction) {
|
|
126
|
+
return renderAction(sendNode, fileNode);
|
|
127
|
+
} else {
|
|
128
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
129
|
+
className: "".concat(getCls("footerActionBtn")),
|
|
130
|
+
children: [
|
|
131
|
+
fileNode,
|
|
132
|
+
/*#__PURE__*/ _jsx(Divider, {
|
|
133
|
+
type: "vertical"
|
|
134
|
+
}),
|
|
135
|
+
sendNode
|
|
136
|
+
]
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
} else {
|
|
140
|
+
var fileNode1 = null;
|
|
141
|
+
if (renderAction) {
|
|
142
|
+
return renderAction(sendNode, fileNode1);
|
|
143
|
+
} else {
|
|
144
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
145
|
+
className: "".concat(getCls("footerActionBtn")),
|
|
146
|
+
children: sendNode
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
var onPressEnter = function(e) {
|
|
152
|
+
// 判断是否按下了 Shift 键
|
|
153
|
+
if (e.shiftKey) {
|
|
154
|
+
// 如果按下了 Shift + Enter,则允许换行(默认行为)
|
|
155
|
+
return;
|
|
156
|
+
} else {
|
|
157
|
+
if (textValue.length === 0) {
|
|
158
|
+
// 内容为空时 执行换行操作
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
// 如果只按了 Enter,则阻止默认行为并发送消息
|
|
162
|
+
e.preventDefault();
|
|
163
|
+
// 在这里添加发送消息的逻辑
|
|
164
|
+
sendMsg(textValue);
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
// 发现消息
|
|
168
|
+
var sendMsg = function(value) {
|
|
169
|
+
if (value.trim().length === 0) return;
|
|
170
|
+
if (!canSendMsg) return;
|
|
171
|
+
console.log("发送消息:", value);
|
|
172
|
+
apiRef.contentApi.addMsg({
|
|
173
|
+
id: guidGenerator(),
|
|
174
|
+
createTime: new Date().getTime(),
|
|
175
|
+
content: value,
|
|
176
|
+
location: "right",
|
|
177
|
+
reference: recordRef.current.referencesSource,
|
|
178
|
+
source: null
|
|
179
|
+
});
|
|
180
|
+
sendMsgAjax();
|
|
181
|
+
};
|
|
182
|
+
var sendMsgAjax = function() {
|
|
183
|
+
var url = sendMsgAjaxParams.url, _sendMsgAjaxParams_method = sendMsgAjaxParams.method, method = _sendMsgAjaxParams_method === void 0 ? "POST" : _sendMsgAjaxParams_method, _sendMsgAjaxParams_headers = sendMsgAjaxParams.headers, headers = _sendMsgAjaxParams_headers === void 0 ? {} : _sendMsgAjaxParams_headers, _sendMsgAjaxParams_params = sendMsgAjaxParams.params, params = _sendMsgAjaxParams_params === void 0 ? function() {
|
|
184
|
+
return "";
|
|
185
|
+
} : _sendMsgAjaxParams_params, _sendMsgAjaxParams_onOpen = sendMsgAjaxParams.onOpen, onOpen = _sendMsgAjaxParams_onOpen === void 0 ? function() {} : _sendMsgAjaxParams_onOpen, _sendMsgAjaxParams_onMessage = sendMsgAjaxParams.onMessage, onMessage = _sendMsgAjaxParams_onMessage === void 0 ? function(ev) {
|
|
186
|
+
return ev;
|
|
187
|
+
} : _sendMsgAjaxParams_onMessage, _sendMsgAjaxParams_onClose = sendMsgAjaxParams.onClose, onClose = _sendMsgAjaxParams_onClose === void 0 ? function() {} : _sendMsgAjaxParams_onClose, _sendMsgAjaxParams_onError = sendMsgAjaxParams.onError, onError = _sendMsgAjaxParams_onError === void 0 ? function() {} : _sendMsgAjaxParams_onError, _sendMsgAjaxParams_coverProps = sendMsgAjaxParams.coverProps, coverProps = _sendMsgAjaxParams_coverProps === void 0 ? {} : _sendMsgAjaxParams_coverProps;
|
|
188
|
+
ctrl.current = new AbortController();
|
|
189
|
+
// apiRef
|
|
190
|
+
console.log("apiRef", apiRef);
|
|
191
|
+
var msgId = "inputing";
|
|
192
|
+
var createTime = new Date().getTime();
|
|
193
|
+
apiRef.contentApi.addMsg({
|
|
194
|
+
id: msgId,
|
|
195
|
+
createTime: createTime,
|
|
196
|
+
content: "正在输入...",
|
|
197
|
+
location: "left",
|
|
198
|
+
reference: null,
|
|
199
|
+
source: null
|
|
200
|
+
});
|
|
201
|
+
var msgContent = "";
|
|
202
|
+
setSending(true);
|
|
203
|
+
setTextValue("");
|
|
204
|
+
setReferencesSource(null);
|
|
205
|
+
var arg = [
|
|
206
|
+
recordRef.current.value,
|
|
207
|
+
recordRef.current.referencesSource,
|
|
208
|
+
fileListRef.current ? fileListRef.current.getFileList() : []
|
|
209
|
+
];
|
|
210
|
+
fetchEventSource(url, _object_spread({
|
|
211
|
+
method: method,
|
|
212
|
+
headers: _object_spread({
|
|
213
|
+
"Content-Type": "application/json",
|
|
214
|
+
Accept: "text/event-stream,application/json"
|
|
215
|
+
}, headers),
|
|
216
|
+
body: params.apply(void 0, _to_consumable_array(arg)),
|
|
217
|
+
openWhenHidden: true,
|
|
218
|
+
signal: ctrl.current.signal,
|
|
219
|
+
onopen: function(res) {
|
|
220
|
+
onOpen(res);
|
|
221
|
+
if (res.status === 200) {}
|
|
222
|
+
return null;
|
|
223
|
+
},
|
|
224
|
+
onmessage: function(ev) {
|
|
225
|
+
var data = onMessage(ev);
|
|
226
|
+
msgContent += data.content;
|
|
227
|
+
delete data.content;
|
|
228
|
+
apiRef.contentApi.updateMsg(msgId, _object_spread({
|
|
229
|
+
createTime: createTime,
|
|
230
|
+
content: msgContent,
|
|
231
|
+
location: "left",
|
|
232
|
+
reference: null,
|
|
233
|
+
source: null
|
|
234
|
+
}, data));
|
|
235
|
+
msgId = data.id;
|
|
236
|
+
},
|
|
237
|
+
onclose: function() {
|
|
238
|
+
onClose();
|
|
239
|
+
setSending(false);
|
|
240
|
+
console.log("onclose: ", event);
|
|
241
|
+
},
|
|
242
|
+
onerror: function(err) {
|
|
243
|
+
onError(err);
|
|
244
|
+
console.log("onerror: ", err);
|
|
245
|
+
}
|
|
246
|
+
}, coverProps));
|
|
247
|
+
};
|
|
248
|
+
// 判断是否超出最大字数
|
|
249
|
+
var judegTextLengthWarn = function() {
|
|
250
|
+
if (typeof maxLength === "function") {
|
|
251
|
+
return maxLength(textValue);
|
|
252
|
+
} else {
|
|
253
|
+
return textValue.length > maxLength;
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
257
|
+
className: "".concat(getCls("footer"), " ").concat(className),
|
|
258
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
259
|
+
className: "".concat(getCls("footerBody"), " ").concat(judegTextLengthWarn() ? getCls("footerBodyWarn") : ""),
|
|
260
|
+
children: [
|
|
261
|
+
fileUpload && /*#__PURE__*/ _jsx("div", {
|
|
262
|
+
className: getCls("footerFile"),
|
|
263
|
+
children: /*#__PURE__*/ _jsx(FileList, {
|
|
264
|
+
prefix: prefix,
|
|
265
|
+
fileUpload: fileUpload,
|
|
266
|
+
ref: fileListRef,
|
|
267
|
+
errorCallback: errorCallback,
|
|
268
|
+
changeFileCanSending: setFileCanSending
|
|
269
|
+
})
|
|
270
|
+
}),
|
|
271
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
272
|
+
className: getCls("footerInput"),
|
|
273
|
+
children: [
|
|
274
|
+
/*#__PURE__*/ _jsx(TextArea, {
|
|
275
|
+
value: textValue,
|
|
276
|
+
onChange: function(e) {
|
|
277
|
+
setTextValue(e.target.value);
|
|
278
|
+
},
|
|
279
|
+
placeholder: placeholder,
|
|
280
|
+
autoSize: {
|
|
281
|
+
minRows: 2,
|
|
282
|
+
maxRows: 6
|
|
283
|
+
},
|
|
284
|
+
onPressEnter: onPressEnter
|
|
285
|
+
}),
|
|
286
|
+
/*#__PURE__*/ _jsx(References, {
|
|
287
|
+
prefix: prefix,
|
|
288
|
+
referencesSource: referencesSource,
|
|
289
|
+
fileUpload: fileUpload,
|
|
290
|
+
deleteReferences: function() {
|
|
291
|
+
return setReferencesSource(null);
|
|
292
|
+
}
|
|
293
|
+
})
|
|
294
|
+
]
|
|
295
|
+
}),
|
|
296
|
+
/*#__PURE__*/ _jsx("div", {
|
|
297
|
+
className: getCls("footerAction"),
|
|
298
|
+
children: renderBtn()
|
|
299
|
+
})
|
|
300
|
+
]
|
|
301
|
+
})
|
|
302
|
+
});
|
|
303
|
+
});
|
|
304
|
+
export default Footer;
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
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;
|
|
@@ -0,0 +1,96 @@
|
|
|
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
|
+
var 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
|
+
"stop-color": "#F87AFD"
|
|
33
|
+
}),
|
|
34
|
+
/*#__PURE__*/ _jsx("stop", {
|
|
35
|
+
offset: "1",
|
|
36
|
+
"stop-color": "#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
|
+
"stop-color": "#F87AFD"
|
|
50
|
+
}),
|
|
51
|
+
/*#__PURE__*/ _jsx("stop", {
|
|
52
|
+
offset: "1",
|
|
53
|
+
"stop-color": "#41DAF8"
|
|
54
|
+
})
|
|
55
|
+
]
|
|
56
|
+
})
|
|
57
|
+
]
|
|
58
|
+
})
|
|
59
|
+
]
|
|
60
|
+
})
|
|
61
|
+
}),
|
|
62
|
+
className: "",
|
|
63
|
+
renderRightHead: function() {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
var Header = function(props) {
|
|
68
|
+
var headerConfig = props.headerConfig, prefix = props.prefix;
|
|
69
|
+
var _headerConfig_icon = headerConfig.icon, icon = _headerConfig_icon === void 0 ? defaultProps.icon : _headerConfig_icon, title = headerConfig.title, _headerConfig_className = headerConfig.className, className = _headerConfig_className === void 0 ? defaultProps.className : _headerConfig_className, _headerConfig_renderRightHead = headerConfig.renderRightHead, renderRightHead = _headerConfig_renderRightHead === void 0 ? defaultProps.renderRightHead : _headerConfig_renderRightHead;
|
|
70
|
+
var getCls = function(clsName) {
|
|
71
|
+
return styles[clsName] + " " + prefix + "-" + clsName;
|
|
72
|
+
};
|
|
73
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
74
|
+
className: "".concat(getCls("header"), " ").concat(className),
|
|
75
|
+
children: [
|
|
76
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
77
|
+
className: getCls("headerLeft"),
|
|
78
|
+
children: [
|
|
79
|
+
/*#__PURE__*/ _jsx("div", {
|
|
80
|
+
className: getCls("headerIcon"),
|
|
81
|
+
children: icon
|
|
82
|
+
}),
|
|
83
|
+
/*#__PURE__*/ _jsx("div", {
|
|
84
|
+
className: getCls("headerTitle"),
|
|
85
|
+
children: title
|
|
86
|
+
})
|
|
87
|
+
]
|
|
88
|
+
}),
|
|
89
|
+
/*#__PURE__*/ _jsx("div", {
|
|
90
|
+
className: getCls("headerRight"),
|
|
91
|
+
children: renderRightHead()
|
|
92
|
+
})
|
|
93
|
+
]
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
export default Header;
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
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;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@ice/jsx-runtime/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import styles from "./index.module.less";
|
|
4
|
+
var referencesIcon = /*#__PURE__*/ _jsx("i", {
|
|
5
|
+
children: /*#__PURE__*/ _jsx("svg", {
|
|
6
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
7
|
+
width: "1em",
|
|
8
|
+
height: "1em",
|
|
9
|
+
viewBox: "0 0 20 20",
|
|
10
|
+
fill: "currentColor",
|
|
11
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
12
|
+
d: "M8.28467 5.03809C8.4743 4.91639 8.61455 4.90994 8.76123 5.10059C8.92876 5.31834 9.04161 5.46433 9.09912 5.53906C9.18641 5.65254 9.15264 5.80277 9.06201 5.87988C7.69541 6.75725 6.13959 8.64084 6.02295 9.32031C5.90632 9.99981 6.57509 9.82255 7.66846 10.3311C8.76173 10.8396 9.66644 12.6996 8.15674 14.165C6.64677 15.6306 3.66696 13.9994 4.10107 10.667C4.38007 8.52662 5.77465 6.65005 8.28467 5.03809ZM14.8931 5.03809C15.0828 4.91629 15.2239 4.90989 15.3706 5.10059C15.5383 5.31849 15.6511 5.46448 15.7085 5.53906C15.7958 5.65256 15.7611 5.80278 15.6704 5.87988C14.3038 6.75727 12.748 8.64086 12.6313 9.32031C12.5147 9.99975 13.1836 9.82261 14.2769 10.3311C15.3702 10.8395 16.2751 12.6995 14.7651 14.165C13.2552 15.6306 10.2754 13.9994 10.7095 10.667C10.9885 8.52661 12.3831 6.65005 14.8931 5.03809Z"
|
|
13
|
+
})
|
|
14
|
+
})
|
|
15
|
+
});
|
|
16
|
+
var ReferencesIcon = function(props) {
|
|
17
|
+
var prefix = props.prefix, apiRef = props.apiRef, item = props.item;
|
|
18
|
+
var getCls = function(clsName) {
|
|
19
|
+
return styles[clsName] + " " + prefix + "-" + clsName;
|
|
20
|
+
};
|
|
21
|
+
var clickFn = function() {
|
|
22
|
+
console.log("apiRef", apiRef);
|
|
23
|
+
if (apiRef && apiRef.footerApi) {
|
|
24
|
+
console.log("itemitem", item);
|
|
25
|
+
apiRef.footerApi.setReferences({
|
|
26
|
+
type: "text",
|
|
27
|
+
value: item.content
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
32
|
+
className: "".concat(getCls("msgItem-action-references")),
|
|
33
|
+
onClick: function() {
|
|
34
|
+
return clickFn();
|
|
35
|
+
},
|
|
36
|
+
children: referencesIcon
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
export default ReferencesIcon;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { referenceType, fileUploadProps } from "../../type";
|
|
3
|
+
interface IProps {
|
|
4
|
+
prefix: string;
|
|
5
|
+
referencesSource: referenceType;
|
|
6
|
+
fileUpload: boolean | fileUploadProps;
|
|
7
|
+
deleteReferences: () => void;
|
|
8
|
+
}
|
|
9
|
+
declare const References: (props: IProps) => React.JSX.Element;
|
|
10
|
+
export default References;
|
|
@@ -0,0 +1,72 @@
|
|
|
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
|
+
import { CloseCircleFilled } from "../../../icons";
|
|
5
|
+
import { fileIconRender } from "../fileList/fileIcon";
|
|
6
|
+
var References = function(props) {
|
|
7
|
+
var prefix = props.prefix, referencesSource = props.referencesSource, fileUpload = props.fileUpload, deleteReferences = props.deleteReferences;
|
|
8
|
+
var getCls = function(clsName) {
|
|
9
|
+
return styles[clsName] + " " + prefix + "-" + clsName;
|
|
10
|
+
};
|
|
11
|
+
if (!referencesSource) return null;
|
|
12
|
+
if (referencesSource.type === "text") {
|
|
13
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
14
|
+
className: "".concat(getCls("footerReferences")),
|
|
15
|
+
children: [
|
|
16
|
+
/*#__PURE__*/ _jsx("div", {
|
|
17
|
+
className: "".concat(getCls("footerReferences_left")),
|
|
18
|
+
children: /*#__PURE__*/ _jsx("div", {
|
|
19
|
+
className: "".concat(getCls("footerReferences_left_text")),
|
|
20
|
+
children: referencesSource.value
|
|
21
|
+
})
|
|
22
|
+
}),
|
|
23
|
+
/*#__PURE__*/ _jsx("div", {
|
|
24
|
+
className: "".concat(getCls("footerReferences_right")),
|
|
25
|
+
children: /*#__PURE__*/ _jsx(CloseCircleFilled, {
|
|
26
|
+
onPointerEnterCapture: undefined,
|
|
27
|
+
onPointerLeaveCapture: undefined,
|
|
28
|
+
onClick: function() {
|
|
29
|
+
return deleteReferences();
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
})
|
|
33
|
+
]
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
if (referencesSource.type === "file" && fileUpload) {
|
|
37
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
38
|
+
className: "".concat(getCls("footerReferences")),
|
|
39
|
+
children: [
|
|
40
|
+
/*#__PURE__*/ _jsx("div", {
|
|
41
|
+
className: "".concat(getCls("footerReferences_left")),
|
|
42
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
43
|
+
className: "".concat(getCls("footerReferences_left_file")),
|
|
44
|
+
children: [
|
|
45
|
+
/*#__PURE__*/ _jsx("div", {
|
|
46
|
+
className: "".concat(getCls("footerReferences_left_file_icon")),
|
|
47
|
+
children: fileIconRender(referencesSource.value.suffix, fileUpload.iconFileRender)
|
|
48
|
+
}),
|
|
49
|
+
/*#__PURE__*/ _jsx("div", {
|
|
50
|
+
className: "".concat(getCls("footerReferences_left_file_title")),
|
|
51
|
+
title: referencesSource.value.name,
|
|
52
|
+
children: referencesSource.value.name
|
|
53
|
+
})
|
|
54
|
+
]
|
|
55
|
+
})
|
|
56
|
+
}),
|
|
57
|
+
/*#__PURE__*/ _jsx("div", {
|
|
58
|
+
className: "".concat(getCls("footerReferences_right")),
|
|
59
|
+
children: /*#__PURE__*/ _jsx(CloseCircleFilled, {
|
|
60
|
+
onPointerEnterCapture: undefined,
|
|
61
|
+
onPointerLeaveCapture: undefined,
|
|
62
|
+
onClick: function() {
|
|
63
|
+
return deleteReferences();
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
})
|
|
67
|
+
]
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
};
|
|
72
|
+
export default References;
|