@blueking/ai-ui-sdk 0.0.7-beta.3 → 0.0.7-beta.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.
- package/dist/common/chart-helper.d.ts +1 -1
- package/dist/common/type-transform.d.ts +1 -1
- package/dist/hooks/use-chat.d.ts +6 -7
- package/dist/hooks/use-reference-doc.d.ts +1 -1
- package/dist/hooks/use-summary.d.ts +1 -1
- package/dist/main.js +248 -0
- package/dist/svg/iconcool.99d41d1a.svg +53 -0
- package/package.json +1 -1
- package/dist/css/iconcool.js +0 -10
- package/dist/css/main.css +0 -1
- package/dist/css/style.css +0 -43
- package/dist/main.es.js +0 -1089
- package/dist/main.es.js.map +0 -1
- package/dist/main.umd.js +0 -2
- package/dist/main.umd.js.map +0 -1
package/dist/main.es.js
DELETED
@@ -1,1089 +0,0 @@
|
|
1
|
-
var __defProp = Object.defineProperty;
|
2
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
3
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
4
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
6
|
-
var __spreadValues = (a, b) => {
|
7
|
-
for (var prop in b || (b = {}))
|
8
|
-
if (__hasOwnProp.call(b, prop))
|
9
|
-
__defNormalProp(a, prop, b[prop]);
|
10
|
-
if (__getOwnPropSymbols)
|
11
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
12
|
-
if (__propIsEnum.call(b, prop))
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
14
|
-
}
|
15
|
-
return a;
|
16
|
-
};
|
17
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
18
|
-
var __async = (__this, __arguments, generator) => {
|
19
|
-
return new Promise((resolve, reject) => {
|
20
|
-
var fulfilled = (value) => {
|
21
|
-
try {
|
22
|
-
step(generator.next(value));
|
23
|
-
} catch (e) {
|
24
|
-
reject(e);
|
25
|
-
}
|
26
|
-
};
|
27
|
-
var rejected = (value) => {
|
28
|
-
try {
|
29
|
-
step(generator.throw(value));
|
30
|
-
} catch (e) {
|
31
|
-
reject(e);
|
32
|
-
}
|
33
|
-
};
|
34
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
35
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
36
|
-
});
|
37
|
-
};
|
38
|
-
import { onBeforeMount, onBeforeUnmount, ref, computed } from "vue";
|
39
|
-
import { Message } from "bkui-vue";
|
40
|
-
var SessionPromptRole = /* @__PURE__ */ ((SessionPromptRole2) => {
|
41
|
-
SessionPromptRole2["System"] = "system";
|
42
|
-
SessionPromptRole2["Assistant"] = "assistant";
|
43
|
-
SessionPromptRole2["User"] = "user";
|
44
|
-
SessionPromptRole2["Guide"] = "guide";
|
45
|
-
SessionPromptRole2["Pause"] = "pause";
|
46
|
-
SessionPromptRole2["UserImage"] = "user-image";
|
47
|
-
SessionPromptRole2["Hidden"] = "hidden";
|
48
|
-
SessionPromptRole2["HiddenUser"] = "hidden-user";
|
49
|
-
SessionPromptRole2["HiddenAssistant"] = "hidden-assistant";
|
50
|
-
SessionPromptRole2["HiddenSystem"] = "hidden-system";
|
51
|
-
SessionPromptRole2["HiddenGuide"] = "hidden-guide";
|
52
|
-
SessionPromptRole2["TemplateUser"] = "template-user";
|
53
|
-
SessionPromptRole2["TemplateAssistant"] = "template-assistant";
|
54
|
-
SessionPromptRole2["TemplateSystem"] = "template-system";
|
55
|
-
SessionPromptRole2["TemplateGuide"] = "template-guide";
|
56
|
-
SessionPromptRole2["TemplateHidden"] = "template-hidden";
|
57
|
-
return SessionPromptRole2;
|
58
|
-
})(SessionPromptRole || {});
|
59
|
-
var SessionContentStatus = /* @__PURE__ */ ((SessionContentStatus2) => {
|
60
|
-
SessionContentStatus2["Fail"] = "fail";
|
61
|
-
SessionContentStatus2["Loading"] = "loading";
|
62
|
-
SessionContentStatus2["Success"] = "success";
|
63
|
-
return SessionContentStatus2;
|
64
|
-
})(SessionContentStatus || {});
|
65
|
-
var SessionContentRole = /* @__PURE__ */ ((SessionContentRole2) => {
|
66
|
-
SessionContentRole2["Ai"] = "ai";
|
67
|
-
SessionContentRole2["User"] = "user";
|
68
|
-
SessionContentRole2["Time"] = "time";
|
69
|
-
SessionContentRole2["System"] = "system";
|
70
|
-
SessionContentRole2["Role"] = "role";
|
71
|
-
SessionContentRole2["Hidden"] = "hidden";
|
72
|
-
SessionContentRole2["Guide"] = "guide";
|
73
|
-
SessionContentRole2["Pause"] = "pause";
|
74
|
-
SessionContentRole2["TokenExpired"] = "token-expired";
|
75
|
-
SessionContentRole2["UserImage"] = "user-image";
|
76
|
-
SessionContentRole2["HiddenUser"] = "hidden-user";
|
77
|
-
SessionContentRole2["HiddenAi"] = "hidden-ai";
|
78
|
-
SessionContentRole2["HiddenRole"] = "hidden-role";
|
79
|
-
SessionContentRole2["HiddenGuide"] = "hidden-guide";
|
80
|
-
SessionContentRole2["TemplateUser"] = "template-user";
|
81
|
-
SessionContentRole2["TemplateAi"] = "template-ai";
|
82
|
-
SessionContentRole2["TemplateRole"] = "template-role";
|
83
|
-
SessionContentRole2["TemplateGuide"] = "template-guide";
|
84
|
-
SessionContentRole2["TemplateHidden"] = "template-hidden";
|
85
|
-
SessionContentRole2["ImageNotSupported"] = "image-not-supported";
|
86
|
-
return SessionContentRole2;
|
87
|
-
})(SessionContentRole || {});
|
88
|
-
var HttpErrorCode = /* @__PURE__ */ ((HttpErrorCode2) => {
|
89
|
-
HttpErrorCode2["TokenExpired"] = "80003";
|
90
|
-
HttpErrorCode2["ImageNotSupported"] = "82003";
|
91
|
-
HttpErrorCode2["UnAuthorizedPreviewFile"] = "80401";
|
92
|
-
HttpErrorCode2["TagRepeat"] = "1513405";
|
93
|
-
HttpErrorCode2[HttpErrorCode2["Aborted"] = 20] = "Aborted";
|
94
|
-
HttpErrorCode2[HttpErrorCode2["UnLogin"] = 401] = "UnLogin";
|
95
|
-
HttpErrorCode2["IamNoPermission"] = "IAM_NO_PERMISSION";
|
96
|
-
return HttpErrorCode2;
|
97
|
-
})(HttpErrorCode || {});
|
98
|
-
const transferSessionContent2SessionPrompt = (sessionContent) => {
|
99
|
-
const sessionRoleMap = {
|
100
|
-
[SessionContentRole.Ai]: SessionPromptRole.Assistant,
|
101
|
-
[SessionContentRole.User]: SessionPromptRole.User,
|
102
|
-
[SessionContentRole.System]: SessionPromptRole.System,
|
103
|
-
[SessionContentRole.Hidden]: SessionPromptRole.Hidden,
|
104
|
-
[SessionContentRole.Guide]: SessionPromptRole.Guide,
|
105
|
-
[SessionContentRole.Time]: SessionPromptRole.System,
|
106
|
-
[SessionContentRole.Role]: SessionPromptRole.System,
|
107
|
-
[SessionContentRole.HiddenAi]: SessionPromptRole.HiddenAssistant,
|
108
|
-
[SessionContentRole.HiddenGuide]: SessionPromptRole.HiddenGuide,
|
109
|
-
[SessionContentRole.HiddenRole]: SessionPromptRole.HiddenSystem,
|
110
|
-
[SessionContentRole.HiddenUser]: SessionPromptRole.HiddenUser,
|
111
|
-
[SessionContentRole.TemplateAi]: SessionPromptRole.TemplateAssistant,
|
112
|
-
[SessionContentRole.TemplateGuide]: SessionPromptRole.TemplateGuide,
|
113
|
-
[SessionContentRole.TemplateRole]: SessionPromptRole.TemplateSystem,
|
114
|
-
[SessionContentRole.TemplateUser]: SessionPromptRole.TemplateUser,
|
115
|
-
[SessionContentRole.TemplateHidden]: SessionPromptRole.TemplateHidden,
|
116
|
-
[SessionContentRole.Pause]: SessionPromptRole.Pause,
|
117
|
-
[SessionContentRole.TokenExpired]: SessionPromptRole.Pause,
|
118
|
-
[SessionContentRole.ImageNotSupported]: SessionPromptRole.Pause,
|
119
|
-
[SessionContentRole.UserImage]: SessionPromptRole.UserImage
|
120
|
-
};
|
121
|
-
return {
|
122
|
-
content: sessionContent.content,
|
123
|
-
role: sessionRoleMap[sessionContent.role]
|
124
|
-
};
|
125
|
-
};
|
126
|
-
const isJSON = (str) => {
|
127
|
-
try {
|
128
|
-
JSON.parse(str);
|
129
|
-
return true;
|
130
|
-
} catch (e) {
|
131
|
-
return false;
|
132
|
-
}
|
133
|
-
};
|
134
|
-
function durationFormatter(val) {
|
135
|
-
const hours = Math.floor(val / 36e5);
|
136
|
-
const minutes = Math.floor(val % 36e5 / 6e4);
|
137
|
-
const seconds = Math.floor(val % 6e4 / 1e3);
|
138
|
-
const milliseconds = val % 1e3;
|
139
|
-
const parts = [];
|
140
|
-
if (hours > 0) {
|
141
|
-
parts.push(`${hours}h`);
|
142
|
-
}
|
143
|
-
if (minutes > 0) {
|
144
|
-
parts.push(`${minutes}min`);
|
145
|
-
}
|
146
|
-
if (seconds > 0) {
|
147
|
-
parts.push(`${seconds}s`);
|
148
|
-
}
|
149
|
-
if (milliseconds > 0) {
|
150
|
-
parts.push(`${milliseconds.toFixed(2)}ms`);
|
151
|
-
}
|
152
|
-
return parts.join(" ");
|
153
|
-
}
|
154
|
-
function handleDownLoad(source, filename = "ai.txt") {
|
155
|
-
const downloadEl = document.createElement("a");
|
156
|
-
const blob = new Blob([source]);
|
157
|
-
downloadEl.download = filename;
|
158
|
-
downloadEl.href = URL.createObjectURL(blob);
|
159
|
-
downloadEl.style.display = "none";
|
160
|
-
document.body.appendChild(downloadEl);
|
161
|
-
downloadEl.click();
|
162
|
-
document.body.removeChild(downloadEl);
|
163
|
-
}
|
164
|
-
const handleCopy = (text) => {
|
165
|
-
const textarea = document.createElement("textarea");
|
166
|
-
textarea.value = text;
|
167
|
-
document.body.appendChild(textarea);
|
168
|
-
textarea.select();
|
169
|
-
document.execCommand("copy");
|
170
|
-
Message({
|
171
|
-
theme: "success",
|
172
|
-
message: "复制成功"
|
173
|
-
});
|
174
|
-
document.body.removeChild(textarea);
|
175
|
-
};
|
176
|
-
const processPromptTemplate = (prompt, selectedText) => {
|
177
|
-
return prompt.replace(/\{\{\s*SELECTED_TEXT\s*\}\}/g, selectedText || "");
|
178
|
-
};
|
179
|
-
const useClickProxy = () => {
|
180
|
-
const clickProxy = (e) => {
|
181
|
-
var _a, _b, _c, _d;
|
182
|
-
const target = e.target;
|
183
|
-
if (target == null ? void 0 : target.classList.contains("bkaidev-angle-up")) {
|
184
|
-
const parent = target == null ? void 0 : target.parentElement;
|
185
|
-
if (parent == null ? void 0 : parent.classList.contains("closed")) {
|
186
|
-
parent == null ? void 0 : parent.classList.remove("closed");
|
187
|
-
} else {
|
188
|
-
parent == null ? void 0 : parent.classList.add("closed");
|
189
|
-
}
|
190
|
-
}
|
191
|
-
if (target == null ? void 0 : target.classList.contains("click-close")) {
|
192
|
-
if (target == null ? void 0 : target.classList.contains("closed")) {
|
193
|
-
target == null ? void 0 : target.classList.remove("closed");
|
194
|
-
} else {
|
195
|
-
target == null ? void 0 : target.classList.add("closed");
|
196
|
-
}
|
197
|
-
}
|
198
|
-
if (target == null ? void 0 : target.classList.contains("click-full-screen")) {
|
199
|
-
const fullScreenWrap = (_b = (_a = target == null ? void 0 : target.parentElement) == null ? void 0 : _a.parentElement) == null ? void 0 : _b.parentElement;
|
200
|
-
fullScreenWrap == null ? void 0 : fullScreenWrap.classList.add("full-screen");
|
201
|
-
if (!fullScreenWrap._originalParent) {
|
202
|
-
fullScreenWrap._originalParent = fullScreenWrap.parentNode;
|
203
|
-
fullScreenWrap._originalNextSibling = fullScreenWrap.nextSibling;
|
204
|
-
}
|
205
|
-
document.body.appendChild(fullScreenWrap);
|
206
|
-
}
|
207
|
-
if (target == null ? void 0 : target.classList.contains("click-un-full-screen")) {
|
208
|
-
const fullScreenWrap = (_d = (_c = target == null ? void 0 : target.parentElement) == null ? void 0 : _c.parentElement) == null ? void 0 : _d.parentElement;
|
209
|
-
fullScreenWrap == null ? void 0 : fullScreenWrap.classList.remove("full-screen");
|
210
|
-
if (fullScreenWrap._originalNextSibling) {
|
211
|
-
fullScreenWrap._originalParent.insertBefore(fullScreenWrap, fullScreenWrap._originalNextSibling);
|
212
|
-
} else {
|
213
|
-
fullScreenWrap._originalParent.appendChild(fullScreenWrap);
|
214
|
-
}
|
215
|
-
}
|
216
|
-
if (target == null ? void 0 : target.classList.contains("click-copy")) {
|
217
|
-
const text = target == null ? void 0 : target.getAttribute("data-clipboard-text");
|
218
|
-
if (text) {
|
219
|
-
handleCopy(decodeURIComponent(text));
|
220
|
-
}
|
221
|
-
}
|
222
|
-
if (target == null ? void 0 : target.classList.contains("click-download")) {
|
223
|
-
const text = target == null ? void 0 : target.getAttribute("data-clipboard-text");
|
224
|
-
const fileName = target == null ? void 0 : target.getAttribute("data-file-name");
|
225
|
-
if (text && fileName) {
|
226
|
-
handleDownLoad(decodeURIComponent(text), fileName);
|
227
|
-
}
|
228
|
-
}
|
229
|
-
};
|
230
|
-
const addClickProxy = () => {
|
231
|
-
window.addEventListener("click", clickProxy);
|
232
|
-
};
|
233
|
-
const removeClickProxy = () => {
|
234
|
-
window.removeEventListener("click", clickProxy);
|
235
|
-
};
|
236
|
-
onBeforeMount(() => {
|
237
|
-
addClickProxy();
|
238
|
-
});
|
239
|
-
onBeforeUnmount(() => {
|
240
|
-
removeClickProxy();
|
241
|
-
});
|
242
|
-
};
|
243
|
-
const getHtmlContentFromDocuments = (documents) => {
|
244
|
-
let htmlContent = `<section class="knowledge-head click-close">
|
245
|
-
<svg
|
246
|
-
class="ai-ui-sdk-wenzhang"
|
247
|
-
>
|
248
|
-
<use href="#ai-ui-sdk-wenzhang"></use>
|
249
|
-
</svg>
|
250
|
-
找到 ${documents.length} 篇资料参考
|
251
|
-
<i class="ai-ui-sdk-icon ai-ui-sdk-angle-up"></i>
|
252
|
-
</section>
|
253
|
-
<ul class="knowledge-body">`;
|
254
|
-
documents.forEach((document2) => {
|
255
|
-
const { path, file_path: filePath, display_name: displayName, preview_path: previewPath } = document2.metadata;
|
256
|
-
const title = displayName || filePath.split("/").pop();
|
257
|
-
htmlContent += `<li
|
258
|
-
class="knowledge-item"
|
259
|
-
>
|
260
|
-
<i class="ai-ui-sdk-icon ai-ui-sdk-zhishiku"></i>
|
261
|
-
<a href="${previewPath}" title="${title} (${previewPath})" target="_blank" class="knowledge-link g-flex-truncate">
|
262
|
-
${title}
|
263
|
-
</a>
|
264
|
-
<a href="${path}" title="预览原文" target="_blank" class="knowledge-link hover-show">
|
265
|
-
<i class="ai-ui-sdk-icon ai-ui-sdk-yanjing-kejian"></i>
|
266
|
-
</a>
|
267
|
-
</li>`;
|
268
|
-
});
|
269
|
-
htmlContent += "</ul>";
|
270
|
-
return htmlContent;
|
271
|
-
};
|
272
|
-
const removeReferenceDoc = (content) => {
|
273
|
-
return content.replace(/<section class="knowledge-head click-close">[\s\S]*?<\/section>/, "").replace(/<ul class="knowledge-body">[\s\S]*?<\/ul>/, "").replace(/<section class="knowledge-tips">[\s\S]*?<\/section>/, "");
|
274
|
-
};
|
275
|
-
const useReferenceDoc = () => {
|
276
|
-
let styleEle = null;
|
277
|
-
const addReferenceDocStyle = () => {
|
278
|
-
const oldStyle = `.knowledge-tips {
|
279
|
-
position: relative;
|
280
|
-
padding: 6px 8px;
|
281
|
-
margin-bottom: 14px;
|
282
|
-
line-height: 22px;
|
283
|
-
background: #f5f7fa;
|
284
|
-
border-radius: 4px;
|
285
|
-
|
286
|
-
&.closed {
|
287
|
-
.bkaidev-angle-up {
|
288
|
-
transform: rotate(180deg);
|
289
|
-
}
|
290
|
-
|
291
|
-
.knowledge-summary {
|
292
|
-
margin-bottom: 0;
|
293
|
-
}
|
294
|
-
|
295
|
-
.knowledge-link {
|
296
|
-
display: none;
|
297
|
-
}
|
298
|
-
}
|
299
|
-
|
300
|
-
.bkaidev-angle-up {
|
301
|
-
position: absolute;
|
302
|
-
top: 4px;
|
303
|
-
right: 0px;
|
304
|
-
font-size: 22px;
|
305
|
-
color: #979ba5;
|
306
|
-
cursor: pointer;
|
307
|
-
}
|
308
|
-
|
309
|
-
.bkaidev-help-document {
|
310
|
-
margin-right: 4px;
|
311
|
-
font-size: 19px;
|
312
|
-
color: #3a84ff;
|
313
|
-
}
|
314
|
-
|
315
|
-
.knowledge-summary {
|
316
|
-
display: block;
|
317
|
-
margin-bottom: 4px;
|
318
|
-
color: #313238;
|
319
|
-
}
|
320
|
-
|
321
|
-
.knowledge-link {
|
322
|
-
display: block;
|
323
|
-
color: #3a84ff;
|
324
|
-
text-decoration: none;
|
325
|
-
cursor: pointer;
|
326
|
-
|
327
|
-
.bkaidev-cc-jump-link {
|
328
|
-
font-size: 14px;
|
329
|
-
}
|
330
|
-
|
331
|
-
&:last-child {
|
332
|
-
margin-bottom: 2px;
|
333
|
-
}
|
334
|
-
}
|
335
|
-
}`;
|
336
|
-
const newStyle = `.knowledge-head {
|
337
|
-
display: flex;
|
338
|
-
align-items: center;
|
339
|
-
padding: 0 8px 0 6px;
|
340
|
-
margin-bottom: 8px;
|
341
|
-
line-height: 28px;
|
342
|
-
background: #F0F1F5;
|
343
|
-
border-radius: 4px;
|
344
|
-
font-size: 12px;
|
345
|
-
color: #313238;
|
346
|
-
cursor: pointer;
|
347
|
-
width: fit-content;
|
348
|
-
|
349
|
-
.ai-ui-sdk-wenzhang {
|
350
|
-
width: 14px;
|
351
|
-
height: 14px;
|
352
|
-
margin-right: 6px;
|
353
|
-
}
|
354
|
-
|
355
|
-
.ai-ui-sdk-angle-up {
|
356
|
-
font-size: 22px;
|
357
|
-
color: #4D4F56;
|
358
|
-
margin-left: 4px;
|
359
|
-
}
|
360
|
-
|
361
|
-
&.closed {
|
362
|
-
margin-bottom: 16px;
|
363
|
-
|
364
|
-
.ai-ui-sdk-angle-up {
|
365
|
-
transform: rotate(180deg);
|
366
|
-
}
|
367
|
-
|
368
|
-
&~ .knowledge-body {
|
369
|
-
display: none;
|
370
|
-
}
|
371
|
-
}
|
372
|
-
|
373
|
-
&:hover {
|
374
|
-
background: #EAEBF0;
|
375
|
-
}
|
376
|
-
}
|
377
|
-
.knowledge-body {
|
378
|
-
background: #F5F7FA;
|
379
|
-
padding: 16px 0 !important;
|
380
|
-
.knowledge-item {
|
381
|
-
padding-left: 10px;
|
382
|
-
display: flex;
|
383
|
-
align-items: center;
|
384
|
-
line-height: 28px;
|
385
|
-
.hover-show {
|
386
|
-
display: none;
|
387
|
-
}
|
388
|
-
a {
|
389
|
-
margin-right: 10px;
|
390
|
-
&:has(i) {
|
391
|
-
padding: 0 10px;
|
392
|
-
margin-right: 0;
|
393
|
-
text-decoration: none !important;
|
394
|
-
}
|
395
|
-
}
|
396
|
-
.ai-ui-sdk-zhishiku {
|
397
|
-
color: #D66F6B;
|
398
|
-
font-size: 14px;
|
399
|
-
margin-right: 6px;
|
400
|
-
}
|
401
|
-
&:hover {
|
402
|
-
background: #EAEBF0;
|
403
|
-
.hover-show {
|
404
|
-
display: inline;
|
405
|
-
}
|
406
|
-
}
|
407
|
-
}
|
408
|
-
}`;
|
409
|
-
styleEle = document.createElement("style");
|
410
|
-
styleEle.textContent = oldStyle + newStyle;
|
411
|
-
document.head.appendChild(styleEle);
|
412
|
-
};
|
413
|
-
const removeReferenceDocStyle = () => {
|
414
|
-
if (styleEle) {
|
415
|
-
styleEle.remove();
|
416
|
-
styleEle = null;
|
417
|
-
}
|
418
|
-
};
|
419
|
-
onBeforeMount(() => {
|
420
|
-
addReferenceDocStyle();
|
421
|
-
});
|
422
|
-
onBeforeUnmount(() => {
|
423
|
-
removeReferenceDocStyle();
|
424
|
-
});
|
425
|
-
};
|
426
|
-
const getHtmlContentFromThink = (chatContent, content, cover, elapsedTime) => {
|
427
|
-
let htmlContent = chatContent === "内容正在生成中..." || cover ? "" : chatContent;
|
428
|
-
if (!htmlContent.includes('<section class="think-head click-close">')) {
|
429
|
-
htmlContent += `<section class="think-head click-close">
|
430
|
-
<i class="ai-ui-sdk-icon ai-ui-sdk-sikao"></i>思考中...<i class="ai-ui-sdk-icon ai-ui-sdk-angle-up"></i>
|
431
|
-
</section>
|
432
|
-
<section class="think-body">
|
433
|
-
${content}
|
434
|
-
</section>`;
|
435
|
-
} else {
|
436
|
-
const thinkBodyMatch = htmlContent.match(/<section class="think-body">([\s\S]*?)<\/section>/);
|
437
|
-
if (thinkBodyMatch) {
|
438
|
-
const thinkContent = thinkBodyMatch[1];
|
439
|
-
const newThinkContent = thinkContent.replace(/\n$/g, `${content}
|
440
|
-
`);
|
441
|
-
htmlContent = htmlContent.replace(
|
442
|
-
thinkContent,
|
443
|
-
newThinkContent
|
444
|
-
);
|
445
|
-
}
|
446
|
-
}
|
447
|
-
if (elapsedTime) {
|
448
|
-
htmlContent = htmlContent.replace("思考中...", `已完成思考 (耗时:${durationFormatter(elapsedTime)})`);
|
449
|
-
}
|
450
|
-
return htmlContent;
|
451
|
-
};
|
452
|
-
const removeThink = (content) => {
|
453
|
-
const afterRemoveThinkHead = content.replace(/<section class="think-head click-close">[\s\S]*<\/section>/, "");
|
454
|
-
let afterRemoveThinkBody = afterRemoveThinkHead.replace(/<section class="think-body">[\s\S]*<\/section>/, "");
|
455
|
-
if (afterRemoveThinkBody.trim() === "") {
|
456
|
-
const thinkBodyMatch = content.match(/<section class="think-body">([\s\S]*?)<\/section>/);
|
457
|
-
if (thinkBodyMatch) {
|
458
|
-
[, afterRemoveThinkBody] = thinkBodyMatch;
|
459
|
-
}
|
460
|
-
}
|
461
|
-
return afterRemoveThinkBody;
|
462
|
-
};
|
463
|
-
const isThinking = (content) => {
|
464
|
-
const isStartThinking = content === "正在思考...";
|
465
|
-
const thinkBodyMatch = content.match(/<section class="think-body">([\s\S]*?)<\/section>$/);
|
466
|
-
const isEmptyThinking = thinkBodyMatch && thinkBodyMatch[1].trim() === "";
|
467
|
-
return isStartThinking || isEmptyThinking;
|
468
|
-
};
|
469
|
-
const useThink = () => {
|
470
|
-
let styleEle = null;
|
471
|
-
const addThinkStyle = () => {
|
472
|
-
const style = `.think-head {
|
473
|
-
display: flex;
|
474
|
-
align-items: center;
|
475
|
-
padding: 0 8px 0 6px;
|
476
|
-
margin-bottom: 8px;
|
477
|
-
line-height: 28px;
|
478
|
-
background: #F0F1F5;
|
479
|
-
border-radius: 4px;
|
480
|
-
font-size: 12px;
|
481
|
-
color: #313238;
|
482
|
-
cursor: pointer;
|
483
|
-
width: fit-content;
|
484
|
-
.ai-ui-sdk-sikao {
|
485
|
-
font-size: 14px;
|
486
|
-
color: #979ba5;
|
487
|
-
margin-right: 4px;
|
488
|
-
}
|
489
|
-
|
490
|
-
.ai-ui-sdk-angle-up {
|
491
|
-
font-size: 22px;
|
492
|
-
color: #4D4F56;
|
493
|
-
margin-left: 4px;
|
494
|
-
}
|
495
|
-
|
496
|
-
&.closed {
|
497
|
-
margin-bottom: 16px;
|
498
|
-
|
499
|
-
.ai-ui-sdk-angle-up {
|
500
|
-
transform: rotate(180deg);
|
501
|
-
}
|
502
|
-
|
503
|
-
&~ .think-body {
|
504
|
-
display: none;
|
505
|
-
}
|
506
|
-
}
|
507
|
-
|
508
|
-
&:hover {
|
509
|
-
background: #EAEBF0;
|
510
|
-
}
|
511
|
-
}
|
512
|
-
.think-body {
|
513
|
-
background: #F5F7FA;
|
514
|
-
color: #979BA5;
|
515
|
-
padding: 16px;
|
516
|
-
margin-bottom: 16px;
|
517
|
-
&~ .knowledge-head {
|
518
|
-
margin-bottom: 8px;
|
519
|
-
}
|
520
|
-
}`;
|
521
|
-
styleEle = document.createElement("style");
|
522
|
-
styleEle.textContent = style;
|
523
|
-
document.head.appendChild(styleEle);
|
524
|
-
};
|
525
|
-
const removeThinkStyle = () => {
|
526
|
-
if (styleEle) {
|
527
|
-
styleEle.remove();
|
528
|
-
styleEle = null;
|
529
|
-
}
|
530
|
-
};
|
531
|
-
onBeforeMount(() => {
|
532
|
-
addThinkStyle();
|
533
|
-
});
|
534
|
-
onBeforeUnmount(() => {
|
535
|
-
removeThinkStyle();
|
536
|
-
});
|
537
|
-
};
|
538
|
-
class ChatHelper {
|
539
|
-
constructor({
|
540
|
-
handleStart,
|
541
|
-
handleText,
|
542
|
-
handleReferenceDoc,
|
543
|
-
handleThink,
|
544
|
-
handleEnd,
|
545
|
-
handleError
|
546
|
-
}) {
|
547
|
-
__publicField(this, "handleStart");
|
548
|
-
__publicField(this, "handleText");
|
549
|
-
__publicField(this, "handleReferenceDoc");
|
550
|
-
__publicField(this, "handleThink");
|
551
|
-
__publicField(this, "handleEnd");
|
552
|
-
__publicField(this, "handleError");
|
553
|
-
__publicField(this, "controllerMap");
|
554
|
-
this.handleStart = handleStart;
|
555
|
-
this.handleText = handleText;
|
556
|
-
this.handleReferenceDoc = handleReferenceDoc;
|
557
|
-
this.handleThink = handleThink;
|
558
|
-
this.handleEnd = handleEnd;
|
559
|
-
this.handleError = handleError;
|
560
|
-
this.controllerMap = {};
|
561
|
-
}
|
562
|
-
stream(_0) {
|
563
|
-
return __async(this, arguments, function* ({
|
564
|
-
sessionCode,
|
565
|
-
url,
|
566
|
-
headers,
|
567
|
-
data
|
568
|
-
}) {
|
569
|
-
var _a;
|
570
|
-
yield (_a = this.handleStart) == null ? void 0 : _a.call(this, sessionCode);
|
571
|
-
const controller = new AbortController();
|
572
|
-
this.controllerMap[sessionCode] = controller;
|
573
|
-
fetch(url, {
|
574
|
-
method: "post",
|
575
|
-
signal: controller.signal,
|
576
|
-
headers: __spreadValues({
|
577
|
-
"Content-Type": "application/json"
|
578
|
-
}, headers),
|
579
|
-
mode: "cors",
|
580
|
-
credentials: "include",
|
581
|
-
body: JSON.stringify(data)
|
582
|
-
}).then((response) => __async(this, null, function* () {
|
583
|
-
const reader = response.body.pipeThrough(new window.TextDecoderStream()).getReader();
|
584
|
-
let temp = "";
|
585
|
-
while (true) {
|
586
|
-
try {
|
587
|
-
const { value, done } = yield reader.read();
|
588
|
-
if (!response.ok) {
|
589
|
-
this.handleError(sessionCode, value || response.statusText, response.status);
|
590
|
-
break;
|
591
|
-
}
|
592
|
-
if (done) {
|
593
|
-
this.handleEnd(sessionCode);
|
594
|
-
break;
|
595
|
-
}
|
596
|
-
const values = (temp + value.toString()).split("\n");
|
597
|
-
values.forEach((value2) => {
|
598
|
-
var _a2, _b;
|
599
|
-
const item = value2.replace("data:", "").trim();
|
600
|
-
if (isJSON(item)) {
|
601
|
-
const {
|
602
|
-
event,
|
603
|
-
content,
|
604
|
-
cover,
|
605
|
-
documents,
|
606
|
-
result,
|
607
|
-
code,
|
608
|
-
elapsed_time,
|
609
|
-
message
|
610
|
-
} = JSON.parse(item);
|
611
|
-
if (result === false || response.status !== 200) {
|
612
|
-
this.handleError(sessionCode, message || "模型调用失败", code);
|
613
|
-
return;
|
614
|
-
}
|
615
|
-
switch (event) {
|
616
|
-
case "text":
|
617
|
-
this.handleText(sessionCode, content, cover);
|
618
|
-
break;
|
619
|
-
case "reference_doc":
|
620
|
-
(_a2 = this.handleReferenceDoc) == null ? void 0 : _a2.call(this, sessionCode, documents, cover);
|
621
|
-
break;
|
622
|
-
case "think":
|
623
|
-
(_b = this.handleThink) == null ? void 0 : _b.call(this, sessionCode, content, cover, elapsed_time);
|
624
|
-
break;
|
625
|
-
case "done":
|
626
|
-
this.handleEnd(sessionCode, cover ? content : "");
|
627
|
-
break;
|
628
|
-
case "error":
|
629
|
-
this.handleError(sessionCode, message || "模型调用失败", code);
|
630
|
-
break;
|
631
|
-
}
|
632
|
-
temp = "";
|
633
|
-
} else if (item) {
|
634
|
-
temp = item;
|
635
|
-
}
|
636
|
-
});
|
637
|
-
} catch (error) {
|
638
|
-
if ((error == null ? void 0 : error.code) !== 20) {
|
639
|
-
this.handleError(sessionCode, `模型调用失败:${error.message}`, error.code);
|
640
|
-
}
|
641
|
-
break;
|
642
|
-
}
|
643
|
-
}
|
644
|
-
}));
|
645
|
-
});
|
646
|
-
}
|
647
|
-
stop(sessionCode) {
|
648
|
-
var _a, _b;
|
649
|
-
(_b = (_a = this.controllerMap[sessionCode]) == null ? void 0 : _a.abort) == null ? void 0 : _b.call(_a);
|
650
|
-
return this.handleEnd(sessionCode);
|
651
|
-
}
|
652
|
-
}
|
653
|
-
const useChat = ({
|
654
|
-
handleStart,
|
655
|
-
handleText,
|
656
|
-
handleReferenceDoc,
|
657
|
-
handleThink,
|
658
|
-
handleEnd,
|
659
|
-
handleError,
|
660
|
-
requestOptions
|
661
|
-
} = {}) => {
|
662
|
-
const startMessage = "内容正在生成中...";
|
663
|
-
const currentSession = ref();
|
664
|
-
const sessionLoadingMap = ref({});
|
665
|
-
const sessionContents = ref([]);
|
666
|
-
const sessionContentsMap = {};
|
667
|
-
const calculatedSessionContents = computed(() => {
|
668
|
-
const calculatedSessionContents2 = [];
|
669
|
-
for (let index = sessionContents.value.length - 1; index >= 0; index--) {
|
670
|
-
const sessionContent = sessionContents.value[index];
|
671
|
-
let nextAiSessionContentIndex = index + 1;
|
672
|
-
let nextAiSessionContent = sessionContents.value[nextAiSessionContentIndex];
|
673
|
-
while (nextAiSessionContent && ![
|
674
|
-
SessionContentRole.Ai,
|
675
|
-
SessionContentRole.TokenExpired,
|
676
|
-
SessionContentRole.ImageNotSupported,
|
677
|
-
SessionContentRole.Pause,
|
678
|
-
SessionContentRole.Guide
|
679
|
-
].includes(nextAiSessionContent.role)) {
|
680
|
-
nextAiSessionContentIndex += 1;
|
681
|
-
nextAiSessionContent = sessionContents.value[nextAiSessionContentIndex];
|
682
|
-
}
|
683
|
-
if (sessionContent.role === SessionContentRole.System) {
|
684
|
-
break;
|
685
|
-
}
|
686
|
-
if (sessionContent.status !== SessionContentStatus.Fail && !((nextAiSessionContent == null ? void 0 : nextAiSessionContent.status) === SessionContentStatus.Fail && [SessionContentRole.User, SessionContentRole.UserImage].includes(sessionContent.role)) && ![SessionContentRole.Time, SessionContentRole.System].includes(sessionContent.role)) {
|
687
|
-
calculatedSessionContents2.unshift(sessionContent);
|
688
|
-
}
|
689
|
-
}
|
690
|
-
return calculatedSessionContents2;
|
691
|
-
});
|
692
|
-
const currentSessionLoading = computed(() => {
|
693
|
-
var _a;
|
694
|
-
const sessionCode = (_a = currentSession.value) == null ? void 0 : _a.sessionCode;
|
695
|
-
return sessionCode ? sessionLoadingMap.value[sessionCode] : false;
|
696
|
-
});
|
697
|
-
const prompts = computed(() => {
|
698
|
-
var _a, _b, _c;
|
699
|
-
const rolePrompts = [];
|
700
|
-
const userPrompts = [];
|
701
|
-
const prompts2 = [];
|
702
|
-
const latestMatchIndex = sessionContents.value.findLastIndex((sessionContent) => sessionContent.role === SessionContentRole.System && ["已启用角色", "已启用模型"].some((key) => sessionContent.content.includes(key)));
|
703
|
-
let index = 0;
|
704
|
-
(_c = (_b = (_a = currentSession.value) == null ? void 0 : _a.roleInfo) == null ? void 0 : _b.content) == null ? void 0 : _c.forEach((roleContent) => {
|
705
|
-
const sessionContent = sessionContents.value[latestMatchIndex + 1 + index];
|
706
|
-
let nextSessionContent = sessionContents.value[latestMatchIndex + 2 + index];
|
707
|
-
if ((sessionContent == null ? void 0 : sessionContent.content) === roleContent.content && sessionContent.role !== SessionContentRole.System) {
|
708
|
-
rolePrompts.push(transferSessionContent2SessionPrompt(sessionContent));
|
709
|
-
index += 1;
|
710
|
-
if ((sessionContent == null ? void 0 : sessionContent.role) === SessionContentRole.Pause) {
|
711
|
-
while (nextSessionContent && nextSessionContent.role === SessionContentRole.System) {
|
712
|
-
index += 1;
|
713
|
-
nextSessionContent = sessionContents.value[latestMatchIndex + 1 + index];
|
714
|
-
}
|
715
|
-
while (nextSessionContent && [SessionContentRole.User, SessionContentRole.UserImage].includes(nextSessionContent.role)) {
|
716
|
-
rolePrompts.push(transferSessionContent2SessionPrompt(nextSessionContent));
|
717
|
-
index += 1;
|
718
|
-
nextSessionContent = sessionContents.value[latestMatchIndex + 1 + index];
|
719
|
-
}
|
720
|
-
}
|
721
|
-
}
|
722
|
-
});
|
723
|
-
userPrompts.push(...calculatedSessionContents.value.map(transferSessionContent2SessionPrompt));
|
724
|
-
const isSameContent = (startIndex) => {
|
725
|
-
var _a2;
|
726
|
-
let isSame = true;
|
727
|
-
for (let index2 = startIndex; index2 < rolePrompts.length; index2++) {
|
728
|
-
const rolePrompt = rolePrompts[index2];
|
729
|
-
if (rolePrompt.content !== ((_a2 = userPrompts[index2 - startIndex]) == null ? void 0 : _a2.content)) {
|
730
|
-
isSame = false;
|
731
|
-
}
|
732
|
-
}
|
733
|
-
return isSame;
|
734
|
-
};
|
735
|
-
for (let index2 = 0; index2 < rolePrompts.length; index2++) {
|
736
|
-
const rolePrompt = rolePrompts[index2];
|
737
|
-
if (isSameContent(index2)) {
|
738
|
-
break;
|
739
|
-
} else {
|
740
|
-
prompts2.push(rolePrompt);
|
741
|
-
}
|
742
|
-
}
|
743
|
-
prompts2.push(...userPrompts);
|
744
|
-
prompts2.forEach((prompt) => {
|
745
|
-
prompt.content = removeThink(prompt.content);
|
746
|
-
prompt.content = removeReferenceDoc(prompt.content);
|
747
|
-
});
|
748
|
-
return prompts2;
|
749
|
-
});
|
750
|
-
const chatHelper = new ChatHelper({
|
751
|
-
handleStart: handleStartChat,
|
752
|
-
handleText: handleTextChat,
|
753
|
-
handleReferenceDoc: handleReferenceDocChat,
|
754
|
-
handleThink: handleThinkChat,
|
755
|
-
handleEnd: handleEndChat,
|
756
|
-
handleError: handleErrorChat
|
757
|
-
});
|
758
|
-
function setCurrentSession(session) {
|
759
|
-
currentSession.value = session;
|
760
|
-
if (!(session == null ? void 0 : session.sessionCode)) return;
|
761
|
-
if (!sessionContentsMap[session.sessionCode]) {
|
762
|
-
sessionContentsMap[session.sessionCode] = [];
|
763
|
-
}
|
764
|
-
sessionContents.value = sessionContentsMap[session.sessionCode];
|
765
|
-
}
|
766
|
-
function setSessionContents(data) {
|
767
|
-
if (!currentSession.value) return;
|
768
|
-
sessionContentsMap[currentSession.value.sessionCode] = data;
|
769
|
-
sessionContents.value = data;
|
770
|
-
}
|
771
|
-
function getSessionContentById(id, sessionCode) {
|
772
|
-
const sessionContents2 = getSessionContentsBySessionCode(sessionCode);
|
773
|
-
return sessionContents2.find((item) => item.id === id);
|
774
|
-
}
|
775
|
-
function getLastSessionContentBySessionCode(sessionCode) {
|
776
|
-
var _a, _b;
|
777
|
-
if (((_a = currentSession.value) == null ? void 0 : _a.sessionCode) === sessionCode) {
|
778
|
-
return sessionContents.value.at(-1);
|
779
|
-
}
|
780
|
-
return (_b = sessionContentsMap[sessionCode]) == null ? void 0 : _b.at(-1);
|
781
|
-
}
|
782
|
-
function getSessionContentsBySessionCode(sessionCode) {
|
783
|
-
var _a;
|
784
|
-
if (((_a = currentSession.value) == null ? void 0 : _a.sessionCode) === sessionCode) {
|
785
|
-
return sessionContents.value;
|
786
|
-
}
|
787
|
-
return sessionContentsMap[sessionCode];
|
788
|
-
}
|
789
|
-
function plusSessionContent(sessionCode, sessionContent) {
|
790
|
-
const sessionContents2 = getSessionContentsBySessionCode(sessionCode);
|
791
|
-
sessionContents2.push(sessionContent);
|
792
|
-
}
|
793
|
-
function updateSessionContent(sessionContent) {
|
794
|
-
var _a;
|
795
|
-
const currentSessionContents = ((_a = currentSession.value) == null ? void 0 : _a.sessionCode) === sessionContent.sessionCode ? sessionContents.value : sessionContentsMap[sessionContent.sessionCode];
|
796
|
-
const currentSessionContent = currentSessionContents.find((item) => +(item.id || 0) === +(sessionContent.id || 0));
|
797
|
-
if (currentSessionContent) {
|
798
|
-
Object.assign(currentSessionContent, sessionContent);
|
799
|
-
}
|
800
|
-
}
|
801
|
-
function getDeleteSessionContents(sessionCode, sessionContentIds, relatedDelete) {
|
802
|
-
var _a;
|
803
|
-
const currentSessionContents = ((_a = currentSession.value) == null ? void 0 : _a.sessionCode) === sessionCode ? sessionContents.value : sessionContentsMap[sessionCode];
|
804
|
-
const deleteSessionContentIds = [];
|
805
|
-
sessionContentIds.forEach((sessionContentId) => {
|
806
|
-
const index = currentSessionContents.findIndex((sessionContent) => sessionContent.id === sessionContentId);
|
807
|
-
if (index > -1) {
|
808
|
-
const preSessionContent = currentSessionContents[index - 1];
|
809
|
-
const nextSessionContent = currentSessionContents[index + 1];
|
810
|
-
const nextNextSessionContent = currentSessionContents[index + 2];
|
811
|
-
currentSessionContents.splice(index, 1);
|
812
|
-
deleteSessionContentIds.push(sessionContentId);
|
813
|
-
if ([SessionContentRole.Hidden].includes(preSessionContent == null ? void 0 : preSessionContent.role)) {
|
814
|
-
const hiddenIndex = currentSessionContents.findIndex((sessionContent) => sessionContent.id === preSessionContent.id);
|
815
|
-
currentSessionContents.splice(hiddenIndex, 1);
|
816
|
-
deleteSessionContentIds.push(preSessionContent.id);
|
817
|
-
}
|
818
|
-
if ((nextSessionContent == null ? void 0 : nextSessionContent.role) === SessionContentRole.Ai || relatedDelete && [
|
819
|
-
SessionContentRole.Ai,
|
820
|
-
SessionContentRole.Guide,
|
821
|
-
SessionContentRole.TokenExpired,
|
822
|
-
SessionContentRole.ImageNotSupported,
|
823
|
-
SessionContentRole.Pause
|
824
|
-
].includes(nextSessionContent == null ? void 0 : nextSessionContent.role)) {
|
825
|
-
const nextIndex = currentSessionContents.findIndex((sessionContent) => sessionContent.id === nextSessionContent.id);
|
826
|
-
currentSessionContents.splice(nextIndex, 1);
|
827
|
-
deleteSessionContentIds.push(nextSessionContent.id);
|
828
|
-
}
|
829
|
-
if ([SessionContentRole.Guide].includes(nextNextSessionContent == null ? void 0 : nextNextSessionContent.role) && relatedDelete) {
|
830
|
-
const nextNextIndex = currentSessionContents.findIndex((sessionContent) => sessionContent.id === nextNextSessionContent.id);
|
831
|
-
currentSessionContents.splice(nextNextIndex, 1);
|
832
|
-
deleteSessionContentIds.push(nextNextSessionContent.id);
|
833
|
-
}
|
834
|
-
}
|
835
|
-
});
|
836
|
-
return deleteSessionContentIds;
|
837
|
-
}
|
838
|
-
function deleteSessionContent(sessionCode, contentId) {
|
839
|
-
const deleteSessionContentIds = getDeleteSessionContents(sessionCode, [contentId], true);
|
840
|
-
return deleteSessionContentIds;
|
841
|
-
}
|
842
|
-
function deleteSessionContents(sessionCode, contentIds) {
|
843
|
-
const deleteSessionContentIds = getDeleteSessionContents(sessionCode, contentIds, false);
|
844
|
-
return deleteSessionContentIds;
|
845
|
-
}
|
846
|
-
function handleStartChat(sessionCode) {
|
847
|
-
sessionLoadingMap.value[sessionCode] = true;
|
848
|
-
const sessionContent = {
|
849
|
-
sessionCode,
|
850
|
-
role: SessionContentRole.Ai,
|
851
|
-
status: SessionContentStatus.Loading,
|
852
|
-
content: startMessage
|
853
|
-
};
|
854
|
-
plusSessionContent(sessionCode, sessionContent);
|
855
|
-
return handleStart == null ? void 0 : handleStart(sessionCode, sessionContent);
|
856
|
-
}
|
857
|
-
function handleReferenceDocChat(sessionCode, documents, cover) {
|
858
|
-
const sessionContent = getLastSessionContentBySessionCode(sessionCode);
|
859
|
-
const content = getHtmlContentFromDocuments(documents);
|
860
|
-
sessionContent.content = cover ? content : sessionContent.content + content;
|
861
|
-
return handleReferenceDoc == null ? void 0 : handleReferenceDoc(sessionCode, sessionContent);
|
862
|
-
}
|
863
|
-
function handleThinkChat(sessionCode, content, cover, elapsedTime) {
|
864
|
-
const sessionContent = getLastSessionContentBySessionCode(sessionCode);
|
865
|
-
sessionContent.content = getHtmlContentFromThink(sessionContent.content, content, cover, elapsedTime);
|
866
|
-
return handleThink == null ? void 0 : handleThink(sessionCode, sessionContent);
|
867
|
-
}
|
868
|
-
function handleTextChat(sessionCode, message, cover) {
|
869
|
-
const sessionContent = getLastSessionContentBySessionCode(sessionCode);
|
870
|
-
if (sessionContent.content === startMessage) {
|
871
|
-
sessionContent.content = message;
|
872
|
-
} else if (sessionContent.status === SessionContentStatus.Loading) {
|
873
|
-
sessionContent.content = cover ? message : sessionContent.content + message;
|
874
|
-
} else {
|
875
|
-
return;
|
876
|
-
}
|
877
|
-
return handleText == null ? void 0 : handleText(sessionCode, sessionContent);
|
878
|
-
}
|
879
|
-
function handleEndChat(sessionCode, message) {
|
880
|
-
const sessionContent = getLastSessionContentBySessionCode(sessionCode);
|
881
|
-
if (sessionContent.status === SessionContentStatus.Loading) {
|
882
|
-
sessionLoadingMap.value[sessionCode] = false;
|
883
|
-
if (message) {
|
884
|
-
sessionContent.content = message;
|
885
|
-
}
|
886
|
-
sessionContent.status = SessionContentStatus.Success;
|
887
|
-
return handleEnd == null ? void 0 : handleEnd(sessionCode, sessionContent);
|
888
|
-
}
|
889
|
-
if (sessionContent.content === startMessage || isThinking(sessionContent.content)) {
|
890
|
-
handleErrorChat(sessionCode, "聊天内容已中断");
|
891
|
-
}
|
892
|
-
}
|
893
|
-
function handleErrorChat(sessionCode, message, code) {
|
894
|
-
const sessionContent = getLastSessionContentBySessionCode(sessionCode);
|
895
|
-
sessionContent.status = SessionContentStatus.Fail;
|
896
|
-
sessionContent.content = message;
|
897
|
-
sessionLoadingMap.value[sessionCode] = false;
|
898
|
-
if (code === HttpErrorCode.TokenExpired) {
|
899
|
-
sessionContent.content = "抱歉,您的剩余 Token 不足,无法返回回答内容,请先清空当前会话(上下文仍会作为历史记录保留))";
|
900
|
-
sessionContent.role = SessionContentRole.TokenExpired;
|
901
|
-
}
|
902
|
-
if (code === HttpErrorCode.ImageNotSupported) {
|
903
|
-
sessionContent.content = "抱歉,当前模型不支持图片内容解析";
|
904
|
-
sessionContent.role = SessionContentRole.ImageNotSupported;
|
905
|
-
}
|
906
|
-
return handleError == null ? void 0 : handleError(sessionCode, sessionContent, code);
|
907
|
-
}
|
908
|
-
function reGenerateChat(chatIndex) {
|
909
|
-
const chat2 = sessionContents.value[chatIndex];
|
910
|
-
if (chat2.role !== SessionContentRole.Ai) {
|
911
|
-
return;
|
912
|
-
}
|
913
|
-
const message = sessionContents.value[chatIndex - 1].content;
|
914
|
-
const cite = sessionContents.value[chatIndex - 1].cite;
|
915
|
-
sessionContents.value.splice(chatIndex - 1, 2);
|
916
|
-
sendChat({ message, cite });
|
917
|
-
}
|
918
|
-
function chat({
|
919
|
-
sessionCode,
|
920
|
-
data,
|
921
|
-
url,
|
922
|
-
headers
|
923
|
-
}) {
|
924
|
-
chatHelper.stream({
|
925
|
-
sessionCode,
|
926
|
-
url,
|
927
|
-
data,
|
928
|
-
headers: headers || (requestOptions == null ? void 0 : requestOptions.headers)
|
929
|
-
});
|
930
|
-
}
|
931
|
-
function reSendChat(index, { message, cite }, callback) {
|
932
|
-
const chat2 = sessionContents.value[index];
|
933
|
-
if (chat2.role !== SessionContentRole.User) {
|
934
|
-
return;
|
935
|
-
}
|
936
|
-
sessionContents.value.splice(index, sessionContents.value.length - index);
|
937
|
-
sendChat({ message, cite }, callback);
|
938
|
-
}
|
939
|
-
function sendChat(content, callback) {
|
940
|
-
var _a, _b, _c;
|
941
|
-
if (!((_a = currentSession.value) == null ? void 0 : _a.sessionCode) || !(requestOptions == null ? void 0 : requestOptions.url) || currentSessionLoading.value) {
|
942
|
-
return;
|
943
|
-
}
|
944
|
-
const { message, cite, shortcut } = content;
|
945
|
-
let input = "";
|
946
|
-
if (shortcut) {
|
947
|
-
input = processPromptTemplate(shortcut.prompt, cite);
|
948
|
-
} else {
|
949
|
-
input = cite ? `${message}: "${cite}"` : message;
|
950
|
-
}
|
951
|
-
sessionContents.value.push({
|
952
|
-
sessionCode: (_b = currentSession.value) == null ? void 0 : _b.sessionCode,
|
953
|
-
content: message,
|
954
|
-
role: SessionContentRole.User,
|
955
|
-
status: SessionContentStatus.Success,
|
956
|
-
cite
|
957
|
-
});
|
958
|
-
chatHelper.stream({
|
959
|
-
sessionCode: (_c = currentSession.value) == null ? void 0 : _c.sessionCode,
|
960
|
-
url: requestOptions.url,
|
961
|
-
headers: requestOptions == null ? void 0 : requestOptions.headers,
|
962
|
-
data: {
|
963
|
-
inputs: {
|
964
|
-
chat_history: prompts.value.slice(0, prompts.value.length - 1),
|
965
|
-
input
|
966
|
-
}
|
967
|
-
}
|
968
|
-
});
|
969
|
-
callback == null ? void 0 : callback();
|
970
|
-
}
|
971
|
-
function deleteChat(index) {
|
972
|
-
const chat2 = sessionContents.value[index];
|
973
|
-
if (chat2.role === SessionContentRole.User) {
|
974
|
-
sessionContents.value.splice(index, 2);
|
975
|
-
return;
|
976
|
-
}
|
977
|
-
sessionContents.value.splice(index - 1, 2);
|
978
|
-
}
|
979
|
-
function stopChat(sessionCode) {
|
980
|
-
chatHelper.stop(sessionCode);
|
981
|
-
}
|
982
|
-
return {
|
983
|
-
currentSession,
|
984
|
-
sessionContents,
|
985
|
-
sessionContentsMap,
|
986
|
-
sessionLoadingMap,
|
987
|
-
prompts,
|
988
|
-
currentSessionLoading,
|
989
|
-
chat,
|
990
|
-
sendChat,
|
991
|
-
stopChat,
|
992
|
-
plusSessionContent,
|
993
|
-
updateSessionContent,
|
994
|
-
getSessionContentById,
|
995
|
-
getLastSessionContentBySessionCode,
|
996
|
-
getSessionContentsBySessionCode,
|
997
|
-
setCurrentSession,
|
998
|
-
setSessionContents,
|
999
|
-
deleteSessionContent,
|
1000
|
-
deleteSessionContents,
|
1001
|
-
handleStartChat,
|
1002
|
-
handleErrorChat,
|
1003
|
-
reGenerateChat,
|
1004
|
-
reSendChat,
|
1005
|
-
deleteChat
|
1006
|
-
};
|
1007
|
-
};
|
1008
|
-
const useSummary = ({
|
1009
|
-
handleStart,
|
1010
|
-
handleEnd,
|
1011
|
-
handleError
|
1012
|
-
} = {}) => {
|
1013
|
-
let summaryText = "";
|
1014
|
-
const handleStartChat = () => {
|
1015
|
-
summaryText = "";
|
1016
|
-
return handleStart == null ? void 0 : handleStart();
|
1017
|
-
};
|
1018
|
-
const handleTextChat = (sessionCode, message, cover) => {
|
1019
|
-
if (cover || summaryText === "正在思考...") {
|
1020
|
-
summaryText = message;
|
1021
|
-
} else {
|
1022
|
-
summaryText += message;
|
1023
|
-
}
|
1024
|
-
};
|
1025
|
-
const handleEndChat = () => {
|
1026
|
-
if (summaryText === "无话可说") {
|
1027
|
-
summaryText = "";
|
1028
|
-
}
|
1029
|
-
return handleEnd == null ? void 0 : handleEnd(summaryText);
|
1030
|
-
};
|
1031
|
-
const handleErrorChat = (sessionCode, message, code) => {
|
1032
|
-
return handleError == null ? void 0 : handleError(message, code);
|
1033
|
-
};
|
1034
|
-
const chatHelper = new ChatHelper({
|
1035
|
-
handleStart: handleStartChat,
|
1036
|
-
handleText: handleTextChat,
|
1037
|
-
handleEnd: handleEndChat,
|
1038
|
-
handleError: handleErrorChat
|
1039
|
-
});
|
1040
|
-
const summary = ({
|
1041
|
-
content,
|
1042
|
-
url,
|
1043
|
-
headers,
|
1044
|
-
model
|
1045
|
-
}) => {
|
1046
|
-
const filterContent = removeThink(removeReferenceDoc(content));
|
1047
|
-
const prompts = [
|
1048
|
-
{
|
1049
|
-
role: SessionPromptRole.User,
|
1050
|
-
content: `你是一个总结大师,请帮助我对下面这段话进行总结。要求总结精炼,不超过 15 个字!且末尾没有标点符号!请注意:如果你无法总结,请回复“无话可说”!
|
1051
|
-
文字如下:
|
1052
|
-
${filterContent}`
|
1053
|
-
}
|
1054
|
-
];
|
1055
|
-
chatHelper.stream({
|
1056
|
-
sessionCode: "summary",
|
1057
|
-
url,
|
1058
|
-
data: {
|
1059
|
-
prompts,
|
1060
|
-
model
|
1061
|
-
},
|
1062
|
-
headers
|
1063
|
-
});
|
1064
|
-
};
|
1065
|
-
return {
|
1066
|
-
summary
|
1067
|
-
};
|
1068
|
-
};
|
1069
|
-
const useStyle = () => {
|
1070
|
-
if (typeof document !== "undefined") {
|
1071
|
-
const script = document.createElement("script");
|
1072
|
-
script.src = new URL("data:text/javascript;base64,IShmdW5jdGlvbiAoKSB7CiAgICB2YXIgc3ZnQ29kZSA9ICc8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgZGF0YS1uYW1lPSJhaS11aS1zZGsiIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBzdHlsZT0icG9zaXRpb246YWJzb2x1dGU7d2lkdGg6MDtoZWlnaHQ6MDt2aXNpYmlsaXR5OmhpZGRlbiI+PHN5bWJvbCBpZD0iYWktdWktc2RrLWFuZ2xlLXVwIiB2aWV3Qm94PSIwIDAgMzIgMzIiPjxwYXRoIGZpbGw9IiM2MzY1NmUiIGQ9Ik0xNiAxMS41bDcgNy0xLjUgMS41LTUuNS01LjUtNS41I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VkJywgZnVuY3Rpb24oKSB7CiAgICAgICAgICAgIGRvY3VtZW50LmJvZHkuaW5zZXJ0QWRqYWNlbnRIVE1MKCdhZnRlcmJlZ2luJywgc3ZnQ29kZSkKICAgICAgICB9KQogICAgfQp9KSgp", import.meta.url).href;
|
1073
|
-
document.head.appendChild(script);
|
1074
|
-
}
|
1075
|
-
useReferenceDoc();
|
1076
|
-
useThink();
|
1077
|
-
};
|
1078
|
-
export {
|
1079
|
-
HttpErrorCode,
|
1080
|
-
SessionContentRole,
|
1081
|
-
SessionContentStatus,
|
1082
|
-
SessionPromptRole,
|
1083
|
-
transferSessionContent2SessionPrompt,
|
1084
|
-
useChat,
|
1085
|
-
useClickProxy,
|
1086
|
-
useStyle,
|
1087
|
-
useSummary
|
1088
|
-
};
|
1089
|
-
//# sourceMappingURL=main.es.js.map
|