@fv-ui/ai-chat 1.3.0 → 1.4.0
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.d.ts +141 -70
- package/dist/style.css +1 -1
- package/es/index.mjs +225 -106
- package/lib/index.js +224 -105
- package/package.json +1 -1
package/es/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { shallowRef, inject, computed, provide, defineComponent, ref, onBeforeUnmount, openBlock, createElementBlock, Fragment, createElementVNode, createCommentVNode, createBlock, Teleport, watch, normalizeClass, createTextVNode, toDisplayString, normalizeStyle, renderSlot, unref, renderList, createVNode, isRef, nextTick, onMounted, mergeProps, createSlots, withCtx, Transition, getCurrentInstance, useSlots, normalizeProps, guardReactiveProps, reactive, resolveDynamicComponent, markRaw, withModifiers, h, onActivated } from 'vue';
|
|
2
|
-
import { ElMessage, ElAvatar, ElButton, ElIcon, ElPopover, ElDialog, ElScrollbar, ElDropdown, ElDropdownMenu, ElDropdownItem, ElMessageBox, ElTooltip, ElSelect, ElOption } from 'element-plus';
|
|
2
|
+
import { ElMessage, ElAvatar, ElButton, ElIcon, ElPopover, ElDialog, ElScrollbar, ElDropdown, ElDropdownMenu, ElDropdownItem, ElMessageBox, ElImageViewer, ElTooltip, ElSelect, ElOption } from 'element-plus';
|
|
3
3
|
import * as ElementPlusIconsVue from '@element-plus/icons-vue';
|
|
4
4
|
import { ArrowDown, Close, Check, Delete, Microphone, Promotion, VideoPause, Loading, SuccessFilled, CircleCloseFilled, ArrowUp, Cpu, Cellphone, Link, Folder, Headset, Film, Monitor, DataAnalysis, Document, Notebook, Picture, Paperclip, RefreshRight, MoreFilled, Search, User, DocumentCopy, Bottom, CopyDocument, Download, FullScreen } from '@element-plus/icons-vue';
|
|
5
5
|
|
|
@@ -33241,7 +33241,9 @@ const zhCN = {
|
|
|
33241
33241
|
},
|
|
33242
33242
|
attachments: {
|
|
33243
33243
|
add: "\u6DFB\u52A0\u9644\u4EF6",
|
|
33244
|
-
retry: "\u91CD\u4F20"
|
|
33244
|
+
retry: "\u91CD\u4F20",
|
|
33245
|
+
/** 上传中状态角标文案(loading 态 files 卡片辅助提示) */
|
|
33246
|
+
uploading: "\u4E0A\u4F20\u4E2D\u2026"
|
|
33245
33247
|
},
|
|
33246
33248
|
filesCard: {
|
|
33247
33249
|
remove: "\u5220\u9664"
|
|
@@ -33358,7 +33360,9 @@ const enUS = {
|
|
|
33358
33360
|
},
|
|
33359
33361
|
attachments: {
|
|
33360
33362
|
add: "Add attachment",
|
|
33361
|
-
retry: "Retry"
|
|
33363
|
+
retry: "Retry",
|
|
33364
|
+
/** 上传中状态角标文案(loading 态 files 卡片辅助提示) */
|
|
33365
|
+
uploading: "Uploading\u2026"
|
|
33362
33366
|
},
|
|
33363
33367
|
filesCard: {
|
|
33364
33368
|
remove: "Remove"
|
|
@@ -34299,7 +34303,7 @@ const _hoisted_6$8 = {
|
|
|
34299
34303
|
class: "fv-sender-recording-wave",
|
|
34300
34304
|
"aria-hidden": "true"
|
|
34301
34305
|
};
|
|
34302
|
-
const _hoisted_7$
|
|
34306
|
+
const _hoisted_7$7 = { class: "fv-sender-recording-duration" };
|
|
34303
34307
|
const _hoisted_8$4 = ["value", "placeholder", "disabled", "readonly"];
|
|
34304
34308
|
const _hoisted_9$3 = {
|
|
34305
34309
|
key: 3,
|
|
@@ -34730,7 +34734,7 @@ var _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
34730
34734
|
]),
|
|
34731
34735
|
createElementVNode(
|
|
34732
34736
|
"span",
|
|
34733
|
-
_hoisted_7$
|
|
34737
|
+
_hoisted_7$7,
|
|
34734
34738
|
toDisplayString(recordDuration.value),
|
|
34735
34739
|
1
|
|
34736
34740
|
/* TEXT */
|
|
@@ -34946,7 +34950,7 @@ const _hoisted_3$c = {
|
|
|
34946
34950
|
const _hoisted_4$a = ["onMouseenter", "onClick"];
|
|
34947
34951
|
const _hoisted_5$8 = { class: "fv-mention-avatar" };
|
|
34948
34952
|
const _hoisted_6$7 = ["src", "alt"];
|
|
34949
|
-
const _hoisted_7$
|
|
34953
|
+
const _hoisted_7$6 = { class: "fv-mention-name" };
|
|
34950
34954
|
const CHAR_WIDTH$1 = 8;
|
|
34951
34955
|
var _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
34952
34956
|
...{ name: "FvMentionSender", inheritAttrs: false },
|
|
@@ -35346,7 +35350,7 @@ var _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
35346
35350
|
]),
|
|
35347
35351
|
createElementVNode(
|
|
35348
35352
|
"span",
|
|
35349
|
-
_hoisted_7$
|
|
35353
|
+
_hoisted_7$6,
|
|
35350
35354
|
toDisplayString(item.name),
|
|
35351
35355
|
1
|
|
35352
35356
|
/* TEXT */
|
|
@@ -35381,7 +35385,7 @@ const _hoisted_3$b = {
|
|
|
35381
35385
|
const _hoisted_4$9 = { class: "fv-editor-input" };
|
|
35382
35386
|
const _hoisted_5$7 = ["contenteditable", "data-placeholder"];
|
|
35383
35387
|
const _hoisted_6$6 = { class: "fv-editor-mention-panel" };
|
|
35384
|
-
const _hoisted_7$
|
|
35388
|
+
const _hoisted_7$5 = {
|
|
35385
35389
|
key: 0,
|
|
35386
35390
|
class: "fv-editor-mention-title"
|
|
35387
35391
|
};
|
|
@@ -35410,7 +35414,7 @@ const _hoisted_17$1 = { class: "fv-editor-select-dialog" };
|
|
|
35410
35414
|
const _hoisted_18$1 = { class: "fv-editor-select-title" };
|
|
35411
35415
|
const _hoisted_19$1 = { class: "fv-editor-select-grid" };
|
|
35412
35416
|
const _hoisted_20$1 = ["onClick"];
|
|
35413
|
-
const _hoisted_21 = ["src", "alt"];
|
|
35417
|
+
const _hoisted_21$1 = ["src", "alt"];
|
|
35414
35418
|
const _hoisted_22 = { class: "fv-editor-select-name" };
|
|
35415
35419
|
const CHAR_WIDTH = 8;
|
|
35416
35420
|
var _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
@@ -36201,7 +36205,7 @@ var _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
36201
36205
|
createElementVNode("div", _hoisted_6$6, [
|
|
36202
36206
|
panelTitle.value ? (openBlock(), createElementBlock(
|
|
36203
36207
|
"div",
|
|
36204
|
-
_hoisted_7$
|
|
36208
|
+
_hoisted_7$5,
|
|
36205
36209
|
toDisplayString(panelTitle.value),
|
|
36206
36210
|
1
|
|
36207
36211
|
/* TEXT */
|
|
@@ -36408,7 +36412,7 @@ var _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
36408
36412
|
class: "fv-editor-select-preview",
|
|
36409
36413
|
src: option.preview,
|
|
36410
36414
|
alt: option.name
|
|
36411
|
-
}, null, 8, _hoisted_21)) : createCommentVNode("v-if", true),
|
|
36415
|
+
}, null, 8, _hoisted_21$1)) : createCommentVNode("v-if", true),
|
|
36412
36416
|
createElementVNode(
|
|
36413
36417
|
"span",
|
|
36414
36418
|
_hoisted_22,
|
|
@@ -36614,7 +36618,7 @@ const _hoisted_6$5 = {
|
|
|
36614
36618
|
key: 0,
|
|
36615
36619
|
class: "fv-chain-head-preview"
|
|
36616
36620
|
};
|
|
36617
|
-
const _hoisted_7$
|
|
36621
|
+
const _hoisted_7$4 = {
|
|
36618
36622
|
key: 0,
|
|
36619
36623
|
class: "fv-chain-body"
|
|
36620
36624
|
};
|
|
@@ -37093,7 +37097,7 @@ var _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
37093
37097
|
/* DYNAMIC_SLOTS */
|
|
37094
37098
|
)
|
|
37095
37099
|
], 10, _hoisted_4$7),
|
|
37096
|
-
isTextExpanded(item.key) ? (openBlock(), createElementBlock("div", _hoisted_7$
|
|
37100
|
+
isTextExpanded(item.key) ? (openBlock(), createElementBlock("div", _hoisted_7$4, [
|
|
37097
37101
|
createCommentVNode(" \u4E0A/\u4E0B\u7F18\u6E10\u9690\u6761:\u5185\u5BB9\u88AB\u6EDA\u52A8\u88C1\u6389\u7684\u65B9\u5411\u624D\u6E32\u67D3(\u72B6\u6001\u89C1 edgeFade),\r\n \u906E\u7F69\u76D6\u5728\u6EDA\u52A8\u533A\u4E4B\u4E0A\u3001\u4E0D\u62E6\u6307\u9488;\u6837\u5F0F\u7ECF .scroll-edge-fade-top/-bottom "),
|
|
37098
37102
|
edgeFade(item.key).top ? (openBlock(), createElementBlock("span", _hoisted_8$2)) : createCommentVNode("v-if", true),
|
|
37099
37103
|
edgeFade(item.key).bottom ? (openBlock(), createElementBlock("span", _hoisted_9$1)) : createCommentVNode("v-if", true),
|
|
@@ -37221,7 +37225,7 @@ const _hoisted_3$8 = { class: "fv-welcome-main" };
|
|
|
37221
37225
|
const _hoisted_4$6 = { class: "fv-welcome-text" };
|
|
37222
37226
|
const _hoisted_5$5 = { class: "fv-welcome-name" };
|
|
37223
37227
|
const _hoisted_6$4 = { class: "fv-welcome-name-accent" };
|
|
37224
|
-
const _hoisted_7$
|
|
37228
|
+
const _hoisted_7$3 = { class: "fv-welcome-description" };
|
|
37225
37229
|
const _hoisted_8$1 = {
|
|
37226
37230
|
key: 0,
|
|
37227
37231
|
class: "fv-welcome-suggestions"
|
|
@@ -37314,7 +37318,7 @@ var _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
37314
37318
|
])
|
|
37315
37319
|
]),
|
|
37316
37320
|
createCommentVNode(" #description \u63D2\u69FD\u8986\u76D6\u63CF\u8FF0;\u672A\u4F20 description \u65F6\u56DE\u843D\u5185\u7F6E\u9ED8\u8BA4\u63CF\u8FF0 "),
|
|
37317
|
-
createElementVNode("p", _hoisted_7$
|
|
37321
|
+
createElementVNode("p", _hoisted_7$3, [
|
|
37318
37322
|
renderSlot(_ctx.$slots, "description", {}, () => [
|
|
37319
37323
|
createTextVNode(
|
|
37320
37324
|
toDisplayString(__props.description || unref(dict).welcome.description),
|
|
@@ -37349,7 +37353,7 @@ const _hoisted_6$3 = {
|
|
|
37349
37353
|
key: 0,
|
|
37350
37354
|
class: "fv-prompt-item-label"
|
|
37351
37355
|
};
|
|
37352
|
-
const _hoisted_7$
|
|
37356
|
+
const _hoisted_7$2 = {
|
|
37353
37357
|
key: 1,
|
|
37354
37358
|
class: "fv-prompt-item-description"
|
|
37355
37359
|
};
|
|
@@ -37434,7 +37438,7 @@ var _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
37434
37438
|
)) : createCommentVNode("v-if", true),
|
|
37435
37439
|
item.description ? (openBlock(), createElementBlock(
|
|
37436
37440
|
"div",
|
|
37437
|
-
_hoisted_7$
|
|
37441
|
+
_hoisted_7$2,
|
|
37438
37442
|
toDisplayString(item.description),
|
|
37439
37443
|
1
|
|
37440
37444
|
/* TEXT */
|
|
@@ -37459,15 +37463,16 @@ var _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
37459
37463
|
const _hoisted_1$6 = ["src", "alt"];
|
|
37460
37464
|
const _hoisted_2$6 = { class: "fv-files-card-info" };
|
|
37461
37465
|
const _hoisted_3$6 = ["title"];
|
|
37462
|
-
const _hoisted_4$4 =
|
|
37463
|
-
|
|
37466
|
+
const _hoisted_4$4 = ["title"];
|
|
37467
|
+
const _hoisted_5$3 = {
|
|
37468
|
+
key: 1,
|
|
37464
37469
|
class: "fv-files-card-size"
|
|
37465
37470
|
};
|
|
37466
|
-
const
|
|
37471
|
+
const _hoisted_6$2 = {
|
|
37467
37472
|
key: 2,
|
|
37468
37473
|
class: "fv-files-card-status"
|
|
37469
37474
|
};
|
|
37470
|
-
const
|
|
37475
|
+
const _hoisted_7$1 = ["aria-label"];
|
|
37471
37476
|
const KB = 1024;
|
|
37472
37477
|
const MB = 1024 * 1024;
|
|
37473
37478
|
var _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
@@ -37480,6 +37485,7 @@ var _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
37480
37485
|
url: { type: String, required: false, default: "" },
|
|
37481
37486
|
status: { type: String, required: false, default: "success" },
|
|
37482
37487
|
imageSize: { type: String, required: false, default: "" },
|
|
37488
|
+
errorText: { type: String, required: false, default: "" },
|
|
37483
37489
|
onDelete: { type: Function, required: false, default: void 0 },
|
|
37484
37490
|
locale: { type: null, required: false, default: void 0 }
|
|
37485
37491
|
},
|
|
@@ -37604,16 +37610,21 @@ var _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
37604
37610
|
class: "fv-files-card-name",
|
|
37605
37611
|
title: __props.name
|
|
37606
37612
|
}, toDisplayString(__props.name), 9, _hoisted_3$6),
|
|
37607
|
-
|
|
37613
|
+
createCommentVNode(" error \u5E26\u6587\u6848\u65F6\u66FF\u4EE3\u5927\u5C0F\u884C(\u4E0A\u4F20\u5931\u8D25\u539F\u56E0);\u5426\u5219\u56DE\u843D\u5927\u5C0F "),
|
|
37614
|
+
__props.status === "error" && __props.errorText ? (openBlock(), createElementBlock("div", {
|
|
37615
|
+
key: 0,
|
|
37616
|
+
class: "fv-files-card-error",
|
|
37617
|
+
title: __props.errorText
|
|
37618
|
+
}, toDisplayString(__props.errorText), 9, _hoisted_4$4)) : sizeText.value ? (openBlock(), createElementBlock(
|
|
37608
37619
|
"div",
|
|
37609
|
-
|
|
37620
|
+
_hoisted_5$3,
|
|
37610
37621
|
toDisplayString(sizeText.value),
|
|
37611
37622
|
1
|
|
37612
37623
|
/* TEXT */
|
|
37613
37624
|
)) : createCommentVNode("v-if", true)
|
|
37614
37625
|
]),
|
|
37615
37626
|
createCommentVNode(" \u72B6\u6001\u89D2\u6807:loading spinner;error \u65E0\u89D2\u6807(\u7EA2\u8FB9\u6837\u5F0F) "),
|
|
37616
|
-
__props.status === "loading" ? (openBlock(), createElementBlock("div",
|
|
37627
|
+
__props.status === "loading" ? (openBlock(), createElementBlock("div", _hoisted_6$2, [
|
|
37617
37628
|
createVNode(unref(ElIcon), { class: "fv-files-card-loading" }, {
|
|
37618
37629
|
default: withCtx(() => [
|
|
37619
37630
|
createVNode(unref(Loading))
|
|
@@ -37636,7 +37647,7 @@ var _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
37636
37647
|
_: 1
|
|
37637
37648
|
/* STABLE */
|
|
37638
37649
|
})
|
|
37639
|
-
], 8,
|
|
37650
|
+
], 8, _hoisted_7$1)
|
|
37640
37651
|
],
|
|
37641
37652
|
2
|
|
37642
37653
|
/* CLASS */
|
|
@@ -37666,10 +37677,11 @@ var _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
37666
37677
|
tip: { type: String, required: false, default: "" },
|
|
37667
37678
|
count: { type: Number, required: false, default: 0 },
|
|
37668
37679
|
beforeUpload: { type: Function, required: false, default: void 0 },
|
|
37680
|
+
upload: { type: Function, required: false, default: void 0 },
|
|
37669
37681
|
layout: { type: String, required: false, default: "inline" },
|
|
37670
37682
|
locale: { type: null, required: false, default: void 0 }
|
|
37671
37683
|
},
|
|
37672
|
-
emits: ["update:modelValue", "change", "exceed", "delete"],
|
|
37684
|
+
emits: ["update:modelValue", "change", "exceed", "delete", "uploaded"],
|
|
37673
37685
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
37674
37686
|
const props = __props;
|
|
37675
37687
|
const dict = useLocaleDict(() => props.locale);
|
|
@@ -37712,6 +37724,38 @@ var _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
37712
37724
|
if (item.status !== "error") return;
|
|
37713
37725
|
item.status = "loading";
|
|
37714
37726
|
sync();
|
|
37727
|
+
void runUpload(item);
|
|
37728
|
+
}
|
|
37729
|
+
async function runUpload(item) {
|
|
37730
|
+
if (!props.upload) {
|
|
37731
|
+
item.status = "success";
|
|
37732
|
+
sync();
|
|
37733
|
+
return;
|
|
37734
|
+
}
|
|
37735
|
+
try {
|
|
37736
|
+
const r = await props.upload(item.raw, item);
|
|
37737
|
+
if (typeof r === "string" && r) {
|
|
37738
|
+
applyResult(item, { status: "error", errMessage: r });
|
|
37739
|
+
emit("uploaded", item, void 0);
|
|
37740
|
+
} else {
|
|
37741
|
+
applyResult(item, r && typeof r === "object" ? { ...r, status: "success", errMessage: void 0 } : { status: "success", errMessage: void 0 });
|
|
37742
|
+
emit("uploaded", item, r && typeof r === "object" ? r : void 0);
|
|
37743
|
+
}
|
|
37744
|
+
} catch (e) {
|
|
37745
|
+
applyResult(item, { status: "error", errMessage: e instanceof Error ? e.message : String(e) });
|
|
37746
|
+
emit("uploaded", item, void 0);
|
|
37747
|
+
}
|
|
37748
|
+
sync();
|
|
37749
|
+
}
|
|
37750
|
+
function applyResult(item, patch) {
|
|
37751
|
+
const i = innerList.value.indexOf(item);
|
|
37752
|
+
const next = { ...item, ...patch };
|
|
37753
|
+
if (i >= 0) {
|
|
37754
|
+
innerList.value.splice(i, 1, next);
|
|
37755
|
+
Object.assign(item, next);
|
|
37756
|
+
} else {
|
|
37757
|
+
Object.assign(item, next);
|
|
37758
|
+
}
|
|
37715
37759
|
}
|
|
37716
37760
|
async function onChange(e) {
|
|
37717
37761
|
const target = e.target;
|
|
@@ -37736,12 +37780,14 @@ var _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
37736
37780
|
size: file.size,
|
|
37737
37781
|
url: isImageFile(file) ? createUrl(file) : "",
|
|
37738
37782
|
fileType: isImageFile(file) ? "image" : "file",
|
|
37739
|
-
|
|
37783
|
+
// 有 upload 钩子:入列即 loading(上传结果落定翻转);无钩子直接 success
|
|
37784
|
+
status: props.upload ? "loading" : "success",
|
|
37740
37785
|
raw: file
|
|
37741
37786
|
};
|
|
37742
37787
|
innerList.value.push(item);
|
|
37788
|
+
sync();
|
|
37789
|
+
if (props.upload) void runUpload(item);
|
|
37743
37790
|
}
|
|
37744
|
-
sync();
|
|
37745
37791
|
}
|
|
37746
37792
|
function openSelect() {
|
|
37747
37793
|
inputRef.value?.click();
|
|
@@ -37812,6 +37858,7 @@ var _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
37812
37858
|
url: item.url,
|
|
37813
37859
|
"file-type": item.fileType ?? "file",
|
|
37814
37860
|
status: item.status ?? "success",
|
|
37861
|
+
"error-text": item.errMessage ?? "",
|
|
37815
37862
|
"on-delete": () => removeItem(item, index)
|
|
37816
37863
|
}, createSlots({
|
|
37817
37864
|
_: 2
|
|
@@ -37827,7 +37874,7 @@ var _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
37827
37874
|
]),
|
|
37828
37875
|
key: "0"
|
|
37829
37876
|
} : void 0
|
|
37830
|
-
]), 1032, ["name", "size", "url", "file-type", "status", "on-delete"]),
|
|
37877
|
+
]), 1032, ["name", "size", "url", "file-type", "status", "error-text", "on-delete"]),
|
|
37831
37878
|
createCommentVNode(" error \u9879:\u91CD\u4F20\u6309\u94AE(\u5220\u9664\u5165\u53E3\u7531 FilesCard \u53F3\u4E0A\u6309\u94AE\u627F\u62C5,onDelete prop \u5DF2\u6CE8\u5165) "),
|
|
37832
37879
|
item.status === "error" ? (openBlock(), createElementBlock("button", {
|
|
37833
37880
|
key: 0,
|
|
@@ -38517,7 +38564,7 @@ function useChat(options) {
|
|
|
38517
38564
|
if (extraSystem) out.push({ role: "system", content: extraSystem });
|
|
38518
38565
|
for (const m of chain) {
|
|
38519
38566
|
if (m.role === "assistant" && !m.content) continue;
|
|
38520
|
-
out.push({ role: m.role, content: m.content });
|
|
38567
|
+
out.push(m.role === "user" && m.files?.length ? { role: m.role, content: m.content, files: m.files.map((f) => ({ id: f.id, name: f.name, url: f.url, type: f.type, size: f.size })) } : { role: m.role, content: m.content });
|
|
38521
38568
|
}
|
|
38522
38569
|
return out;
|
|
38523
38570
|
}
|
|
@@ -38739,41 +38786,42 @@ const _hoisted_7 = {
|
|
|
38739
38786
|
key: 1,
|
|
38740
38787
|
class: "fv-msg-files"
|
|
38741
38788
|
};
|
|
38742
|
-
const _hoisted_8 = ["
|
|
38743
|
-
const _hoisted_9 =
|
|
38789
|
+
const _hoisted_8 = ["title", "onClick"];
|
|
38790
|
+
const _hoisted_9 = ["src", "alt"];
|
|
38791
|
+
const _hoisted_10 = {
|
|
38744
38792
|
key: 1,
|
|
38745
38793
|
class: "fv-msg-file-name"
|
|
38746
38794
|
};
|
|
38747
|
-
const
|
|
38748
|
-
key:
|
|
38795
|
+
const _hoisted_11 = {
|
|
38796
|
+
key: 4,
|
|
38749
38797
|
class: "fv-msg-content"
|
|
38750
38798
|
};
|
|
38751
|
-
const
|
|
38799
|
+
const _hoisted_12 = {
|
|
38752
38800
|
key: 0,
|
|
38753
38801
|
class: "fv-msg-error"
|
|
38754
38802
|
};
|
|
38755
|
-
const
|
|
38803
|
+
const _hoisted_13 = {
|
|
38756
38804
|
class: "fv-msg-pending",
|
|
38757
38805
|
role: "status",
|
|
38758
38806
|
"aria-live": "polite"
|
|
38759
38807
|
};
|
|
38760
|
-
const
|
|
38761
|
-
const
|
|
38762
|
-
key:
|
|
38808
|
+
const _hoisted_14 = { class: "fv-msg-pending-text" };
|
|
38809
|
+
const _hoisted_15 = {
|
|
38810
|
+
key: 5,
|
|
38763
38811
|
class: "fv-msg-content fv-msg-content-user"
|
|
38764
38812
|
};
|
|
38765
|
-
const
|
|
38766
|
-
const
|
|
38767
|
-
const
|
|
38768
|
-
key:
|
|
38813
|
+
const _hoisted_16 = ["aria-label"];
|
|
38814
|
+
const _hoisted_17 = ["disabled", "onClick"];
|
|
38815
|
+
const _hoisted_18 = {
|
|
38816
|
+
key: 7,
|
|
38769
38817
|
class: "fv-msg-actions"
|
|
38770
38818
|
};
|
|
38771
|
-
const
|
|
38819
|
+
const _hoisted_19 = {
|
|
38772
38820
|
key: 0,
|
|
38773
38821
|
class: "fv-msg-branch"
|
|
38774
38822
|
};
|
|
38775
|
-
const
|
|
38776
|
-
const
|
|
38823
|
+
const _hoisted_20 = { class: "fv-msg-branch-label" };
|
|
38824
|
+
const _hoisted_21 = {
|
|
38777
38825
|
key: 1,
|
|
38778
38826
|
class: "fv-msg-time"
|
|
38779
38827
|
};
|
|
@@ -38804,9 +38852,10 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
38804
38852
|
codeTriggerLangs: { type: Array, required: false },
|
|
38805
38853
|
showTime: { type: Boolean, required: false, default: true },
|
|
38806
38854
|
timeFormat: { type: Function, required: false, default: void 0 },
|
|
38855
|
+
resolveFileUrl: { type: Function, required: false, default: void 0 },
|
|
38807
38856
|
locale: { type: null, required: false }
|
|
38808
38857
|
},
|
|
38809
|
-
emits: ["copy", "regenerate", "branch-change", "typing", "followup-select"],
|
|
38858
|
+
emits: ["copy", "regenerate", "branch-change", "typing", "followup-select", "file-click"],
|
|
38810
38859
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
38811
38860
|
const props = __props;
|
|
38812
38861
|
const dict = useLocaleDict(() => props.locale);
|
|
@@ -39008,6 +39057,33 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
39008
39057
|
if (!followupsEnabled.value) return;
|
|
39009
39058
|
emit("followup-select", item, props.message);
|
|
39010
39059
|
}
|
|
39060
|
+
const resolvedUrls = ref({});
|
|
39061
|
+
const resolvingUrls = /* @__PURE__ */ new Set();
|
|
39062
|
+
function displayUrl(f) {
|
|
39063
|
+
if (!f.url) return "";
|
|
39064
|
+
const hit = resolvedUrls.value[f.url];
|
|
39065
|
+
if (hit !== void 0) return hit;
|
|
39066
|
+
const raw = f.url;
|
|
39067
|
+
if (props.resolveFileUrl && /^https?:\/\//i.test(raw) && !resolvingUrls.has(raw)) {
|
|
39068
|
+
resolvingUrls.add(raw);
|
|
39069
|
+
void Promise.resolve(props.resolveFileUrl(f)).then((u) => {
|
|
39070
|
+
if (u && u !== raw) resolvedUrls.value[raw] = u;
|
|
39071
|
+
}).catch(() => {
|
|
39072
|
+
}).finally(() => resolvingUrls.delete(raw));
|
|
39073
|
+
}
|
|
39074
|
+
return raw;
|
|
39075
|
+
}
|
|
39076
|
+
const previewList = computed(() => (props.message.files ?? []).filter((f) => f.type === "image"));
|
|
39077
|
+
const previewVisible = ref(false);
|
|
39078
|
+
const previewIndex = ref(0);
|
|
39079
|
+
function onFileClick(f, index) {
|
|
39080
|
+
emit("file-click", f, props.message);
|
|
39081
|
+
if (f.type === "image" && displayUrl(f)) {
|
|
39082
|
+
previewIndex.value = Math.max(0, index);
|
|
39083
|
+
previewVisible.value = true;
|
|
39084
|
+
}
|
|
39085
|
+
}
|
|
39086
|
+
const previewSrcList = computed(() => previewList.value.map((f) => displayUrl(f)));
|
|
39011
39087
|
function onCopy() {
|
|
39012
39088
|
emit("copy", props.message);
|
|
39013
39089
|
}
|
|
@@ -39088,7 +39164,7 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
39088
39164
|
/* TEXT */
|
|
39089
39165
|
)) : createCommentVNode("v-if", true)
|
|
39090
39166
|
])) : createCommentVNode("v-if", true),
|
|
39091
|
-
createCommentVNode(" \u9644\u4EF6:user \u6D88\u606F files \
|
|
39167
|
+
createCommentVNode(" \u9644\u4EF6:user \u6D88\u606F files \u5E73\u94FA;\u56FE\u7247\u7F29\u7565\u53EF\u70B9(\u5185\u7F6E\u653E\u5927\u9884\u89C8),\u6587\u6863\u540D\u53EF\u70B9(\u5BBF\u4E3B\u4E0B\u8F7D) "),
|
|
39092
39168
|
__props.message.files?.length ? (openBlock(), createElementBlock("div", _hoisted_7, [
|
|
39093
39169
|
renderSlot(_ctx.$slots, "message-files", {
|
|
39094
39170
|
message: __props.message,
|
|
@@ -39097,41 +39173,46 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
39097
39173
|
(openBlock(true), createElementBlock(
|
|
39098
39174
|
Fragment,
|
|
39099
39175
|
null,
|
|
39100
|
-
renderList(__props.message.files, (f) => {
|
|
39101
|
-
return openBlock(), createElementBlock(
|
|
39102
|
-
|
|
39103
|
-
|
|
39104
|
-
|
|
39105
|
-
|
|
39106
|
-
|
|
39107
|
-
|
|
39108
|
-
|
|
39109
|
-
|
|
39110
|
-
|
|
39111
|
-
|
|
39112
|
-
|
|
39113
|
-
|
|
39114
|
-
|
|
39115
|
-
|
|
39116
|
-
|
|
39117
|
-
|
|
39118
|
-
|
|
39119
|
-
|
|
39120
|
-
|
|
39121
|
-
2
|
|
39122
|
-
/* CLASS */
|
|
39123
|
-
);
|
|
39176
|
+
renderList(__props.message.files, (f, i) => {
|
|
39177
|
+
return openBlock(), createElementBlock("button", {
|
|
39178
|
+
key: f.id,
|
|
39179
|
+
type: "button",
|
|
39180
|
+
class: normalizeClass(["fv-msg-file", `is-${f.type ?? "file"}`]),
|
|
39181
|
+
title: f.name,
|
|
39182
|
+
onClick: ($event) => onFileClick(f, i)
|
|
39183
|
+
}, [
|
|
39184
|
+
f.type === "image" && displayUrl(f) ? (openBlock(), createElementBlock("img", {
|
|
39185
|
+
key: 0,
|
|
39186
|
+
class: "fv-msg-file-img",
|
|
39187
|
+
src: displayUrl(f),
|
|
39188
|
+
alt: f.name
|
|
39189
|
+
}, null, 8, _hoisted_9)) : (openBlock(), createElementBlock(
|
|
39190
|
+
"span",
|
|
39191
|
+
_hoisted_10,
|
|
39192
|
+
toDisplayString(f.name),
|
|
39193
|
+
1
|
|
39194
|
+
/* TEXT */
|
|
39195
|
+
))
|
|
39196
|
+
], 10, _hoisted_8);
|
|
39124
39197
|
}),
|
|
39125
39198
|
128
|
|
39126
39199
|
/* KEYED_FRAGMENT */
|
|
39127
39200
|
))
|
|
39128
39201
|
])
|
|
39129
39202
|
])) : createCommentVNode("v-if", true),
|
|
39203
|
+
createCommentVNode(" \u56FE\u7247\u653E\u5927\u9884\u89C8(\u672C\u6D88\u606F\u9644\u4EF6\u5185\u8F6E\u64AD;teleported \u6302 body \u9632\u88AB\u6D88\u606F\u533A\u88C1\u526A) "),
|
|
39204
|
+
previewVisible.value && previewSrcList.value.length ? (openBlock(), createBlock(unref(ElImageViewer), {
|
|
39205
|
+
key: 2,
|
|
39206
|
+
"url-list": previewSrcList.value,
|
|
39207
|
+
"initial-index": previewIndex.value,
|
|
39208
|
+
teleported: "",
|
|
39209
|
+
onClose: _cache[0] || (_cache[0] = ($event) => previewVisible.value = false)
|
|
39210
|
+
}, null, 8, ["url-list", "initial-index"])) : createCommentVNode("v-if", true),
|
|
39130
39211
|
createCommentVNode(" \u601D\u8003\u94FE(assistant \u542B toolSteps/reasoning \u65F6):\u591A item \u7531 Thinking \u6298\u53E0\u5934\u627F\u8F7D\u72B6\u6001\r\n \u6C47\u603B\u6587\u6848(\u843D\u5B9A\u5E26\u5DE5\u5177\u6B21\u6570)\u4E0E\u6536\u8D77/\u5C55\u5F00;\u5355 item \u65E0\u6C47\u603B\u5FC5\u8981,\u9690\u85CF\u6298\u53E0\u5934\r\n (hideHeader,\u94FE\u5E73\u94FA\u4E14\u5E38\u9A7B\u5C55\u5F00,\u5355\u6B65\u81EA\u5E26\u72B6\u6001\u56FE\u6807\u4E0E per-item \u6298\u53E0);\r\n \u4EC5 reasoning \u65E0 toolSteps \u65F6(\u7EAF\u601D\u8003\u6D88\u606F)\u56DE\u843D\u94FE\u4E0B Markdown \u6E32\u67D3 "),
|
|
39131
39212
|
!isUser.value && (hasToolSteps.value || hasReasoning.value) ? (openBlock(), createBlock(_sfc_main$a, {
|
|
39132
|
-
key:
|
|
39213
|
+
key: 3,
|
|
39133
39214
|
modelValue: toolsExpanded.value,
|
|
39134
|
-
"onUpdate:modelValue": _cache[
|
|
39215
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => toolsExpanded.value = $event),
|
|
39135
39216
|
status: hasToolSteps.value ? toolThinkingStatus.value : thinkingStatus.value,
|
|
39136
39217
|
"auto-collapse": false,
|
|
39137
39218
|
"hide-header": !showChainHeader.value,
|
|
@@ -39143,7 +39224,7 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
39143
39224
|
items: toolChainItems.value,
|
|
39144
39225
|
collapsible: __props.collapsible,
|
|
39145
39226
|
"show-duration": __props.showDuration,
|
|
39146
|
-
onTyping: _cache[
|
|
39227
|
+
onTyping: _cache[1] || (_cache[1] = ($event) => emit("typing"))
|
|
39147
39228
|
}, null, 8, ["items", "collapsible", "show-duration"])) : hasReasoning.value && useTypewriter.value && !reasoningFlushed.value ? (openBlock(), createElementBlock(
|
|
39148
39229
|
Fragment,
|
|
39149
39230
|
{ key: 1 },
|
|
@@ -39153,7 +39234,7 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
39153
39234
|
content: __props.message.reasoning ?? "",
|
|
39154
39235
|
"is-markdown": "",
|
|
39155
39236
|
typing: __props.typing,
|
|
39156
|
-
onWriting: _cache[
|
|
39237
|
+
onWriting: _cache[2] || (_cache[2] = ($event) => emit("typing"))
|
|
39157
39238
|
}, null, 8, ["content", "typing"])
|
|
39158
39239
|
],
|
|
39159
39240
|
2112
|
|
@@ -39179,10 +39260,10 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
39179
39260
|
} : void 0
|
|
39180
39261
|
]), 1032, ["modelValue", "status", "hide-header", "class"])) : createCommentVNode("v-if", true),
|
|
39181
39262
|
createCommentVNode(" \u6B63\u6587:user \u7EAF\u6587\u672C\u6C14\u6CE1;assistant Markdown;pending \u7A7A\u5185\u5BB9\u7ED9\u52A0\u8F7D\u5360\u4F4D "),
|
|
39182
|
-
!isUser.value ? (openBlock(), createElementBlock("div",
|
|
39263
|
+
!isUser.value ? (openBlock(), createElementBlock("div", _hoisted_11, [
|
|
39183
39264
|
__props.message.status === "error" ? (openBlock(), createElementBlock(
|
|
39184
39265
|
"span",
|
|
39185
|
-
|
|
39266
|
+
_hoisted_12,
|
|
39186
39267
|
toDisplayString(__props.message.error || unref(dict).aiMessage.generateFailed),
|
|
39187
39268
|
1
|
|
39188
39269
|
/* TEXT */
|
|
@@ -39194,7 +39275,7 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
39194
39275
|
"is-markdown": "",
|
|
39195
39276
|
typing: __props.typing,
|
|
39196
39277
|
"code-trigger-langs": __props.codeTriggerLangs,
|
|
39197
|
-
onWriting: _cache[
|
|
39278
|
+
onWriting: _cache[4] || (_cache[4] = ($event) => emit("typing")),
|
|
39198
39279
|
onFinish: maybeCollapseOnDone
|
|
39199
39280
|
}, null, 8, ["content", "typing", "code-trigger-langs"])) : __props.message.content ? (openBlock(), createBlock(_sfc_main$i, {
|
|
39200
39281
|
key: 2,
|
|
@@ -39205,8 +39286,8 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
39205
39286
|
{ key: 3 },
|
|
39206
39287
|
[
|
|
39207
39288
|
createCommentVNode(" \u751F\u6210\u4E2D\u5360\u4F4D:\u4E3B\u9898\u8272\u5708\u5708 spinner + \u8F6E\u6362\u6587\u6848(loadingPhrases,3s \u8F6E\u6362);\r\n \u6709\u5DE5\u5177\u8F68\u8FF9\u65F6\u4E0D\u91CD\u590D\u5360\u4F4D(Thinking \u5934\u5DF2\u662F\u300C\u601D\u8003\u4E2D...\u300D) "),
|
|
39208
|
-
createElementVNode("span",
|
|
39209
|
-
_cache[
|
|
39289
|
+
createElementVNode("span", _hoisted_13, [
|
|
39290
|
+
_cache[7] || (_cache[7] = createElementVNode(
|
|
39210
39291
|
"span",
|
|
39211
39292
|
{
|
|
39212
39293
|
class: "fv-msg-spinner",
|
|
@@ -39218,7 +39299,7 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
39218
39299
|
)),
|
|
39219
39300
|
createElementVNode(
|
|
39220
39301
|
"span",
|
|
39221
|
-
|
|
39302
|
+
_hoisted_14,
|
|
39222
39303
|
toDisplayString(pendingPhrase.value),
|
|
39223
39304
|
1
|
|
39224
39305
|
/* TEXT */
|
|
@@ -39230,14 +39311,14 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
39230
39311
|
)) : createCommentVNode("v-if", true)
|
|
39231
39312
|
])) : (openBlock(), createElementBlock(
|
|
39232
39313
|
"div",
|
|
39233
|
-
|
|
39314
|
+
_hoisted_15,
|
|
39234
39315
|
toDisplayString(__props.message.content),
|
|
39235
39316
|
1
|
|
39236
39317
|
/* TEXT */
|
|
39237
39318
|
)),
|
|
39238
39319
|
createCommentVNode(" \u8FFD\u95EE\u5EFA\u8BAE chips:\u4EC5\u94FE\u5C3E assistant \u6D88\u606F\u6E32\u67D3(isLast \u7531 AiMessages \u6CE8\u5165);\r\n \u6D41\u5F0F(message_end \u524D)\u7981\u7528\u9632\u8BEF\u70B9,\u843D\u5B9A\u540E\u53EF\u70B9\u51FB,\u70B9\u51FB\u7ECF followup-select \u4E0A\u629B "),
|
|
39239
39320
|
followups.value.length ? (openBlock(), createElementBlock("div", {
|
|
39240
|
-
key:
|
|
39321
|
+
key: 6,
|
|
39241
39322
|
class: "fv-msg-followups",
|
|
39242
39323
|
role: "listbox",
|
|
39243
39324
|
"aria-label": unref(dict).aiMessage.followups
|
|
@@ -39254,14 +39335,14 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
39254
39335
|
role: "option",
|
|
39255
39336
|
"aria-selected": false,
|
|
39256
39337
|
onClick: ($event) => onFollowup(item)
|
|
39257
|
-
}, toDisplayString(item), 11,
|
|
39338
|
+
}, toDisplayString(item), 11, _hoisted_17);
|
|
39258
39339
|
}),
|
|
39259
39340
|
128
|
|
39260
39341
|
/* KEYED_FRAGMENT */
|
|
39261
39342
|
))
|
|
39262
|
-
], 8,
|
|
39343
|
+
], 8, _hoisted_16)) : createCommentVNode("v-if", true),
|
|
39263
39344
|
createCommentVNode(" \u64CD\u4F5C\u533A:assistant \u590D\u5236/\u91CD\u751F\u6210 + \u5206\u652F\u5207\u6362;user \u4EC5\u590D\u5236(hover \u6D88\u606F\u65F6\u6D6E\u73B0,\u89C1 scss) "),
|
|
39264
|
-
__props.showActions || __props.showBranchSwitch && __props.branch && __props.branch.count > 1 ? (openBlock(), createElementBlock("div",
|
|
39345
|
+
__props.showActions || __props.showBranchSwitch && __props.branch && __props.branch.count > 1 ? (openBlock(), createElementBlock("div", _hoisted_18, [
|
|
39265
39346
|
renderSlot(_ctx.$slots, "message-actions", { message: __props.message }, () => [
|
|
39266
39347
|
__props.showActions && isUser.value ? (openBlock(), createBlock(unref(ElTooltip), {
|
|
39267
39348
|
key: 0,
|
|
@@ -39352,14 +39433,14 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
39352
39433
|
}, 8, ["content"])) : createCommentVNode("v-if", true)
|
|
39353
39434
|
]),
|
|
39354
39435
|
createCommentVNode(" \u5206\u652F\u5207\u6362:\u5144\u5F1F\u5206\u652F > 1 \u65F6 "),
|
|
39355
|
-
__props.showBranchSwitch && __props.branch && __props.branch.count > 1 ? (openBlock(), createElementBlock("span",
|
|
39436
|
+
__props.showBranchSwitch && __props.branch && __props.branch.count > 1 ? (openBlock(), createElementBlock("span", _hoisted_19, [
|
|
39356
39437
|
createVNode(unref(ElButton), {
|
|
39357
39438
|
text: "",
|
|
39358
39439
|
size: "small",
|
|
39359
39440
|
class: "fv-msg-action",
|
|
39360
39441
|
disabled: __props.branch.index <= 1,
|
|
39361
39442
|
"aria-label": unref(dict).aiMessage.prevBranch,
|
|
39362
|
-
onClick: _cache[
|
|
39443
|
+
onClick: _cache[5] || (_cache[5] = ($event) => onBranch("prev"))
|
|
39363
39444
|
}, {
|
|
39364
39445
|
default: withCtx(() => [
|
|
39365
39446
|
createVNode(unref(ElIcon), null, {
|
|
@@ -39375,7 +39456,7 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
39375
39456
|
}, 8, ["disabled", "aria-label"]),
|
|
39376
39457
|
createElementVNode(
|
|
39377
39458
|
"span",
|
|
39378
|
-
|
|
39459
|
+
_hoisted_20,
|
|
39379
39460
|
toDisplayString(__props.branch.index) + " / " + toDisplayString(__props.branch.count),
|
|
39380
39461
|
1
|
|
39381
39462
|
/* TEXT */
|
|
@@ -39386,7 +39467,7 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
39386
39467
|
class: "fv-msg-action",
|
|
39387
39468
|
disabled: __props.branch.index >= __props.branch.count,
|
|
39388
39469
|
"aria-label": unref(dict).aiMessage.nextBranch,
|
|
39389
|
-
onClick: _cache[
|
|
39470
|
+
onClick: _cache[6] || (_cache[6] = ($event) => onBranch("next"))
|
|
39390
39471
|
}, {
|
|
39391
39472
|
default: withCtx(() => [
|
|
39392
39473
|
createVNode(unref(ElIcon), null, {
|
|
@@ -39404,7 +39485,7 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
39404
39485
|
createCommentVNode(" \u6D88\u606F\u65F6\u95F4:\u8DDF\u5728\u64CD\u4F5C\u6309\u94AE\u4E0E\u5206\u652F\u5207\u6362\u4E4B\u540E;user \u6D88\u606F hover \u9690\u85CF\u6309\u94AE\u4E0D\u5F71\u54CD\u65F6\u95F4\u5E38\u9A7B;\r\n assistant \u751F\u6210\u4E2D\u4E0D\u663E,\u6B63\u6587\u6253\u5B8C\u5B57(\u6216 error)\u540E\u624D\u6D6E\u73B0 "),
|
|
39405
39486
|
messageTimeText.value && timeVisible.value ? (openBlock(), createElementBlock(
|
|
39406
39487
|
"span",
|
|
39407
|
-
|
|
39488
|
+
_hoisted_21,
|
|
39408
39489
|
toDisplayString(messageTimeText.value),
|
|
39409
39490
|
1
|
|
39410
39491
|
/* TEXT */
|
|
@@ -39456,9 +39537,10 @@ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
39456
39537
|
codeTriggerLangs: { type: Array, required: false },
|
|
39457
39538
|
showTime: { type: Boolean, required: false, default: true },
|
|
39458
39539
|
timeFormat: { type: Function, required: false, default: void 0 },
|
|
39540
|
+
resolveFileUrl: { type: Function, required: false, default: void 0 },
|
|
39459
39541
|
locale: { type: null, required: false }
|
|
39460
39542
|
},
|
|
39461
|
-
emits: ["select", "copy", "regenerate", "branch-change", "scroll", "followup-select"],
|
|
39543
|
+
emits: ["select", "copy", "regenerate", "branch-change", "scroll", "followup-select", "message-file-click"],
|
|
39462
39544
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
39463
39545
|
const props = __props;
|
|
39464
39546
|
const dict = useLocaleDict(() => props.locale);
|
|
@@ -39569,6 +39651,9 @@ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
39569
39651
|
function onFollowup(item, m) {
|
|
39570
39652
|
emit("followup-select", item, m);
|
|
39571
39653
|
}
|
|
39654
|
+
function onFileClick(file, m) {
|
|
39655
|
+
emit("message-file-click", file, m);
|
|
39656
|
+
}
|
|
39572
39657
|
const lastMessageId = computed(() => props.messages.length ? props.messages[props.messages.length - 1].id : "");
|
|
39573
39658
|
function scrollToTop() {
|
|
39574
39659
|
const el = scrollRef.value;
|
|
@@ -39708,11 +39793,13 @@ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
39708
39793
|
"show-time": __props.showTime,
|
|
39709
39794
|
"time-format": __props.timeFormat,
|
|
39710
39795
|
"code-trigger-langs": __props.codeTriggerLangs,
|
|
39796
|
+
"resolve-file-url": __props.resolveFileUrl,
|
|
39711
39797
|
onTyping: onChildTyping,
|
|
39712
39798
|
onCopy,
|
|
39713
39799
|
onRegenerate,
|
|
39714
39800
|
onBranchChange: onBranch,
|
|
39715
|
-
onFollowupSelect: onFollowup
|
|
39801
|
+
onFollowupSelect: onFollowup,
|
|
39802
|
+
onFileClick
|
|
39716
39803
|
}, createSlots({
|
|
39717
39804
|
_: 2
|
|
39718
39805
|
/* DYNAMIC */
|
|
@@ -39759,7 +39846,7 @@ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
39759
39846
|
]),
|
|
39760
39847
|
key: "5"
|
|
39761
39848
|
} : void 0
|
|
39762
|
-
]), 1032, ["message", "branch", "is-last", "show-actions", "show-branch-switch", "show-user-avatar", "show-user-name", "show-assistant-avatar", "show-assistant-name", "user-avatar", "assistant-avatar", "assistant-avatar-scale", "avatar-circle", "user-name", "assistant-name", "typing", "auto-collapse", "collapsible", "show-duration", "show-time", "time-format", "code-trigger-langs"]);
|
|
39849
|
+
]), 1032, ["message", "branch", "is-last", "show-actions", "show-branch-switch", "show-user-avatar", "show-user-name", "show-assistant-avatar", "show-assistant-name", "user-avatar", "assistant-avatar", "assistant-avatar-scale", "avatar-circle", "user-name", "assistant-name", "typing", "auto-collapse", "collapsible", "show-duration", "show-time", "time-format", "code-trigger-langs", "resolve-file-url"]);
|
|
39763
39850
|
}),
|
|
39764
39851
|
128
|
|
39765
39852
|
/* KEYED_FRAGMENT */
|
|
@@ -40129,10 +40216,12 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
40129
40216
|
allowAttachments: { type: Boolean, required: false, default: false },
|
|
40130
40217
|
accept: { type: String, required: false, default: "" },
|
|
40131
40218
|
attachmentLimit: { type: Number, required: false, default: 0 },
|
|
40219
|
+
uploadAttachment: { type: Function, required: false, default: void 0 },
|
|
40220
|
+
resolveFileUrl: { type: Function, required: false, default: void 0 },
|
|
40132
40221
|
theme: { type: String, required: false, default: "light" },
|
|
40133
40222
|
locale: { type: null, required: false }
|
|
40134
40223
|
},
|
|
40135
|
-
emits: ["update:messages", "send", "suggestion-select", "followup-select", "message-complete", "error", "branch-change", "attachment-exceed", "scroll", "tool-event"],
|
|
40224
|
+
emits: ["update:messages", "send", "suggestion-select", "followup-select", "message-complete", "error", "branch-change", "attachment-exceed", "attachment-uploaded", "message-file-click", "scroll", "tool-event"],
|
|
40136
40225
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
40137
40226
|
const props = __props;
|
|
40138
40227
|
const dict = useLocaleDict(() => props.locale);
|
|
@@ -40222,6 +40311,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
40222
40311
|
void regenerateChat(messageId).finally(finishRun);
|
|
40223
40312
|
}
|
|
40224
40313
|
const pendingFiles = ref([]);
|
|
40314
|
+
const uploadingCount = computed(() => pendingFiles.value.filter((f) => f.status === "loading").length);
|
|
40225
40315
|
function toChatFiles(items) {
|
|
40226
40316
|
return items.map((it) => ({
|
|
40227
40317
|
id: String(it.uid),
|
|
@@ -40234,14 +40324,33 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
40234
40324
|
function onAttachmentExceed(file) {
|
|
40235
40325
|
emit("attachment-exceed", file);
|
|
40236
40326
|
}
|
|
40327
|
+
function onAttachmentUploaded(item, _result) {
|
|
40328
|
+
const err = item.errMessage;
|
|
40329
|
+
emit("attachment-uploaded", item, { ok: item.status === "success", message: item.status === "success" ? void 0 : err });
|
|
40330
|
+
}
|
|
40331
|
+
const attachmentsUploadHook = computed(() => {
|
|
40332
|
+
const hook = props.uploadAttachment;
|
|
40333
|
+
if (!hook) return void 0;
|
|
40334
|
+
return (file, item) => {
|
|
40335
|
+
return Promise.resolve(hook(file, item)).then((r) => {
|
|
40336
|
+
if (typeof r === "string") {
|
|
40337
|
+
if (r) throw new Error(r);
|
|
40338
|
+
return void 0;
|
|
40339
|
+
}
|
|
40340
|
+
return r;
|
|
40341
|
+
});
|
|
40342
|
+
};
|
|
40343
|
+
});
|
|
40237
40344
|
function drainFiles() {
|
|
40238
40345
|
if (!props.allowAttachments || !pendingFiles.value.length) return void 0;
|
|
40239
|
-
const
|
|
40346
|
+
const ready = pendingFiles.value.filter((f) => f.status !== "error");
|
|
40347
|
+
const files = toChatFiles(ready);
|
|
40240
40348
|
pendingFiles.value = [];
|
|
40241
|
-
return files;
|
|
40349
|
+
return files.length ? files : void 0;
|
|
40242
40350
|
}
|
|
40243
40351
|
function onSubmit(text) {
|
|
40244
40352
|
if (!text.trim() && !pendingFiles.value.length) return;
|
|
40353
|
+
if (uploadingCount.value) return;
|
|
40245
40354
|
resetArtifactUserClosed();
|
|
40246
40355
|
const files = drainFiles();
|
|
40247
40356
|
emit("send", text, files);
|
|
@@ -40276,6 +40385,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
40276
40385
|
emit("branch-change", dir, m);
|
|
40277
40386
|
}
|
|
40278
40387
|
function sendMessage(text, files) {
|
|
40388
|
+
if (uploadingCount.value) return;
|
|
40279
40389
|
if (!text.trim() && !files?.length && !pendingFiles.value.length) return;
|
|
40280
40390
|
resetArtifactUserClosed();
|
|
40281
40391
|
const payload = files ?? drainFiles();
|
|
@@ -40402,6 +40512,9 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
40402
40512
|
function onMessagesScroll(event) {
|
|
40403
40513
|
emit("scroll", event);
|
|
40404
40514
|
}
|
|
40515
|
+
function onMessageFileClick(file, message) {
|
|
40516
|
+
emit("message-file-click", file, message);
|
|
40517
|
+
}
|
|
40405
40518
|
__expose({ sendMessage, stop, regenerate, appendToMessage, clearMessages, exportTxt, openArtifact, expandThoughtChains, collapseThoughtChains, scrollTo });
|
|
40406
40519
|
return (_ctx, _cache) => {
|
|
40407
40520
|
return openBlock(), createElementBlock(
|
|
@@ -40480,12 +40593,14 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
40480
40593
|
"show-time": __props.showTime,
|
|
40481
40594
|
"time-format": __props.timeFormat,
|
|
40482
40595
|
"code-trigger-langs": artifactsOn.value && artifactsCodeTrigger.value ? ["html", "svg"] : void 0,
|
|
40596
|
+
"resolve-file-url": __props.resolveFileUrl,
|
|
40483
40597
|
onSelect: onSelectSuggestion,
|
|
40484
40598
|
onFollowupSelect,
|
|
40485
40599
|
onCopy,
|
|
40486
40600
|
onRegenerate,
|
|
40487
40601
|
onBranchChange,
|
|
40488
|
-
onScroll: onMessagesScroll
|
|
40602
|
+
onScroll: onMessagesScroll,
|
|
40603
|
+
onMessageFileClick
|
|
40489
40604
|
}, createSlots({
|
|
40490
40605
|
_: 2
|
|
40491
40606
|
/* DYNAMIC */
|
|
@@ -40581,7 +40696,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
40581
40696
|
]),
|
|
40582
40697
|
key: "12"
|
|
40583
40698
|
} : void 0
|
|
40584
|
-
]), 1032, ["messages", "nodes", "name", "suggestions", "suggestions-wrap", "show-scroll-button", "scroll-button-threshold", "scroll-threshold", "show-user-avatar", "show-user-name", "show-assistant-avatar", "show-assistant-name", "user-avatar", "assistant-avatar", "assistant-avatar-scale", "avatar-circle", "user-name", "assistant-name", "typing", "auto-collapse", "collapsible", "show-duration", "show-time", "time-format", "code-trigger-langs"]),
|
|
40699
|
+
]), 1032, ["messages", "nodes", "name", "suggestions", "suggestions-wrap", "show-scroll-button", "scroll-button-threshold", "scroll-threshold", "show-user-avatar", "show-user-name", "show-assistant-avatar", "show-assistant-name", "user-avatar", "assistant-avatar", "assistant-avatar-scale", "avatar-circle", "user-name", "assistant-name", "typing", "auto-collapse", "collapsible", "show-duration", "show-time", "time-format", "code-trigger-langs", "resolve-file-url"]),
|
|
40585
40700
|
artifactsOn.value && artifacts.value.length ? (openBlock(), createBlock(_sfc_main$1, {
|
|
40586
40701
|
key: 0,
|
|
40587
40702
|
artifacts: artifacts.value,
|
|
@@ -40593,7 +40708,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
40593
40708
|
onChange: onArtifactChange
|
|
40594
40709
|
}, null, 8, ["artifacts", "active-key", "width", "min-width", "max-width"])) : createCommentVNode("v-if", true)
|
|
40595
40710
|
]),
|
|
40596
|
-
createCommentVNode(" \u8F93\u5165\u533A:Sender(\u4E0D\u4F20 allowSpeech,Task 15 \u6869\u4E0D\u63A5\u7EBF);\
|
|
40711
|
+
createCommentVNode(" \u8F93\u5165\u533A:Sender(\u4E0D\u4F20 allowSpeech,Task 15 \u6869\u4E0D\u63A5\u7EBF);\n allowAttachments \u5F00\u542F\u65F6:\u56DE\u5F62\u9488\u5728\u64CD\u4F5C\u680F\u5DE6\u4FA7(#action-left,\u4E0E\u63D0\u4EA4\u6309\u94AE\u540C\u884C),\n \u5DF2\u9009\u9644\u4EF6\u5217\u8868\u5728 fv-sender-body \u5185\u8F93\u5165\u884C\u4E0A\u65B9(#body-top,body-top:empty \u81EA\u52A8\u9690\u85CF);\n \u751F\u6210\u4E2D(loading)\u65F6\u9644\u4EF6\u5165\u53E3\u6574\u4F53\u7981\u7528(\u5355\u98DE\u884C\u95F8\u8BED\u4E49:\u53D1\u9001\u671F\u95F4\u9501\u5B9A\u8F93\u5165) "),
|
|
40597
40712
|
createElementVNode("div", _hoisted_4, [
|
|
40598
40713
|
createVNode(_sfc_main$d, {
|
|
40599
40714
|
placeholder: __props.placeholder,
|
|
@@ -40602,7 +40717,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
40602
40717
|
shadow: __props.senderShadow,
|
|
40603
40718
|
variant: "updown",
|
|
40604
40719
|
maxlength: 8e3,
|
|
40605
|
-
"allow-empty-submit": __props.allowAttachments && !!pendingFiles.value.length,
|
|
40720
|
+
"allow-empty-submit": __props.allowAttachments && !!pendingFiles.value.length && !uploadingCount.value,
|
|
40606
40721
|
onSubmit,
|
|
40607
40722
|
onCancel: stop
|
|
40608
40723
|
}, createSlots({
|
|
@@ -40618,8 +40733,10 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
40618
40733
|
layout: "listOnly",
|
|
40619
40734
|
accept: __props.accept,
|
|
40620
40735
|
count: __props.attachmentLimit,
|
|
40621
|
-
|
|
40622
|
-
|
|
40736
|
+
upload: attachmentsUploadHook.value,
|
|
40737
|
+
onExceed: onAttachmentExceed,
|
|
40738
|
+
onUploaded: onAttachmentUploaded
|
|
40739
|
+
}, null, 8, ["modelValue", "accept", "count", "upload"])
|
|
40623
40740
|
]),
|
|
40624
40741
|
key: "0"
|
|
40625
40742
|
} : void 0,
|
|
@@ -40632,8 +40749,10 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
40632
40749
|
layout: "triggerOnly",
|
|
40633
40750
|
accept: __props.accept,
|
|
40634
40751
|
count: __props.attachmentLimit,
|
|
40635
|
-
|
|
40636
|
-
|
|
40752
|
+
upload: attachmentsUploadHook.value,
|
|
40753
|
+
onExceed: onAttachmentExceed,
|
|
40754
|
+
onUploaded: onAttachmentUploaded
|
|
40755
|
+
}, null, 8, ["modelValue", "accept", "count", "upload"])
|
|
40637
40756
|
]),
|
|
40638
40757
|
key: "1"
|
|
40639
40758
|
} : void 0,
|