@fv-ui/ai-chat 1.3.0 → 1.4.1
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 +157 -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/lib/index.js
CHANGED
|
@@ -33261,7 +33261,9 @@
|
|
|
33261
33261
|
},
|
|
33262
33262
|
attachments: {
|
|
33263
33263
|
add: "\u6DFB\u52A0\u9644\u4EF6",
|
|
33264
|
-
retry: "\u91CD\u4F20"
|
|
33264
|
+
retry: "\u91CD\u4F20",
|
|
33265
|
+
/** 上传中状态角标文案(loading 态 files 卡片辅助提示) */
|
|
33266
|
+
uploading: "\u4E0A\u4F20\u4E2D\u2026"
|
|
33265
33267
|
},
|
|
33266
33268
|
filesCard: {
|
|
33267
33269
|
remove: "\u5220\u9664"
|
|
@@ -33378,7 +33380,9 @@
|
|
|
33378
33380
|
},
|
|
33379
33381
|
attachments: {
|
|
33380
33382
|
add: "Add attachment",
|
|
33381
|
-
retry: "Retry"
|
|
33383
|
+
retry: "Retry",
|
|
33384
|
+
/** 上传中状态角标文案(loading 态 files 卡片辅助提示) */
|
|
33385
|
+
uploading: "Uploading\u2026"
|
|
33382
33386
|
},
|
|
33383
33387
|
filesCard: {
|
|
33384
33388
|
remove: "Remove"
|
|
@@ -34319,7 +34323,7 @@
|
|
|
34319
34323
|
class: "fv-sender-recording-wave",
|
|
34320
34324
|
"aria-hidden": "true"
|
|
34321
34325
|
};
|
|
34322
|
-
const _hoisted_7$
|
|
34326
|
+
const _hoisted_7$7 = { class: "fv-sender-recording-duration" };
|
|
34323
34327
|
const _hoisted_8$4 = ["value", "placeholder", "disabled", "readonly"];
|
|
34324
34328
|
const _hoisted_9$3 = {
|
|
34325
34329
|
key: 3,
|
|
@@ -34750,7 +34754,7 @@
|
|
|
34750
34754
|
]),
|
|
34751
34755
|
vue.createElementVNode(
|
|
34752
34756
|
"span",
|
|
34753
|
-
_hoisted_7$
|
|
34757
|
+
_hoisted_7$7,
|
|
34754
34758
|
vue.toDisplayString(recordDuration.value),
|
|
34755
34759
|
1
|
|
34756
34760
|
/* TEXT */
|
|
@@ -34966,7 +34970,7 @@
|
|
|
34966
34970
|
const _hoisted_4$a = ["onMouseenter", "onClick"];
|
|
34967
34971
|
const _hoisted_5$8 = { class: "fv-mention-avatar" };
|
|
34968
34972
|
const _hoisted_6$7 = ["src", "alt"];
|
|
34969
|
-
const _hoisted_7$
|
|
34973
|
+
const _hoisted_7$6 = { class: "fv-mention-name" };
|
|
34970
34974
|
const CHAR_WIDTH$1 = 8;
|
|
34971
34975
|
var _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
|
|
34972
34976
|
...{ name: "FvMentionSender", inheritAttrs: false },
|
|
@@ -35366,7 +35370,7 @@
|
|
|
35366
35370
|
]),
|
|
35367
35371
|
vue.createElementVNode(
|
|
35368
35372
|
"span",
|
|
35369
|
-
_hoisted_7$
|
|
35373
|
+
_hoisted_7$6,
|
|
35370
35374
|
vue.toDisplayString(item.name),
|
|
35371
35375
|
1
|
|
35372
35376
|
/* TEXT */
|
|
@@ -35401,7 +35405,7 @@
|
|
|
35401
35405
|
const _hoisted_4$9 = { class: "fv-editor-input" };
|
|
35402
35406
|
const _hoisted_5$7 = ["contenteditable", "data-placeholder"];
|
|
35403
35407
|
const _hoisted_6$6 = { class: "fv-editor-mention-panel" };
|
|
35404
|
-
const _hoisted_7$
|
|
35408
|
+
const _hoisted_7$5 = {
|
|
35405
35409
|
key: 0,
|
|
35406
35410
|
class: "fv-editor-mention-title"
|
|
35407
35411
|
};
|
|
@@ -35430,7 +35434,7 @@
|
|
|
35430
35434
|
const _hoisted_18$1 = { class: "fv-editor-select-title" };
|
|
35431
35435
|
const _hoisted_19$1 = { class: "fv-editor-select-grid" };
|
|
35432
35436
|
const _hoisted_20$1 = ["onClick"];
|
|
35433
|
-
const _hoisted_21 = ["src", "alt"];
|
|
35437
|
+
const _hoisted_21$1 = ["src", "alt"];
|
|
35434
35438
|
const _hoisted_22 = { class: "fv-editor-select-name" };
|
|
35435
35439
|
const CHAR_WIDTH = 8;
|
|
35436
35440
|
var _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
|
|
@@ -36221,7 +36225,7 @@
|
|
|
36221
36225
|
vue.createElementVNode("div", _hoisted_6$6, [
|
|
36222
36226
|
panelTitle.value ? (vue.openBlock(), vue.createElementBlock(
|
|
36223
36227
|
"div",
|
|
36224
|
-
_hoisted_7$
|
|
36228
|
+
_hoisted_7$5,
|
|
36225
36229
|
vue.toDisplayString(panelTitle.value),
|
|
36226
36230
|
1
|
|
36227
36231
|
/* TEXT */
|
|
@@ -36428,7 +36432,7 @@
|
|
|
36428
36432
|
class: "fv-editor-select-preview",
|
|
36429
36433
|
src: option.preview,
|
|
36430
36434
|
alt: option.name
|
|
36431
|
-
}, null, 8, _hoisted_21)) : vue.createCommentVNode("v-if", true),
|
|
36435
|
+
}, null, 8, _hoisted_21$1)) : vue.createCommentVNode("v-if", true),
|
|
36432
36436
|
vue.createElementVNode(
|
|
36433
36437
|
"span",
|
|
36434
36438
|
_hoisted_22,
|
|
@@ -36634,7 +36638,7 @@
|
|
|
36634
36638
|
key: 0,
|
|
36635
36639
|
class: "fv-chain-head-preview"
|
|
36636
36640
|
};
|
|
36637
|
-
const _hoisted_7$
|
|
36641
|
+
const _hoisted_7$4 = {
|
|
36638
36642
|
key: 0,
|
|
36639
36643
|
class: "fv-chain-body"
|
|
36640
36644
|
};
|
|
@@ -37113,7 +37117,7 @@
|
|
|
37113
37117
|
/* DYNAMIC_SLOTS */
|
|
37114
37118
|
)
|
|
37115
37119
|
], 10, _hoisted_4$7),
|
|
37116
|
-
isTextExpanded(item.key) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7$
|
|
37120
|
+
isTextExpanded(item.key) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7$4, [
|
|
37117
37121
|
vue.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 "),
|
|
37118
37122
|
edgeFade(item.key).top ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_8$2)) : vue.createCommentVNode("v-if", true),
|
|
37119
37123
|
edgeFade(item.key).bottom ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_9$1)) : vue.createCommentVNode("v-if", true),
|
|
@@ -37241,7 +37245,7 @@
|
|
|
37241
37245
|
const _hoisted_4$6 = { class: "fv-welcome-text" };
|
|
37242
37246
|
const _hoisted_5$5 = { class: "fv-welcome-name" };
|
|
37243
37247
|
const _hoisted_6$4 = { class: "fv-welcome-name-accent" };
|
|
37244
|
-
const _hoisted_7$
|
|
37248
|
+
const _hoisted_7$3 = { class: "fv-welcome-description" };
|
|
37245
37249
|
const _hoisted_8$1 = {
|
|
37246
37250
|
key: 0,
|
|
37247
37251
|
class: "fv-welcome-suggestions"
|
|
@@ -37334,7 +37338,7 @@
|
|
|
37334
37338
|
])
|
|
37335
37339
|
]),
|
|
37336
37340
|
vue.createCommentVNode(" #description \u63D2\u69FD\u8986\u76D6\u63CF\u8FF0;\u672A\u4F20 description \u65F6\u56DE\u843D\u5185\u7F6E\u9ED8\u8BA4\u63CF\u8FF0 "),
|
|
37337
|
-
vue.createElementVNode("p", _hoisted_7$
|
|
37341
|
+
vue.createElementVNode("p", _hoisted_7$3, [
|
|
37338
37342
|
vue.renderSlot(_ctx.$slots, "description", {}, () => [
|
|
37339
37343
|
vue.createTextVNode(
|
|
37340
37344
|
vue.toDisplayString(__props.description || vue.unref(dict).welcome.description),
|
|
@@ -37369,7 +37373,7 @@
|
|
|
37369
37373
|
key: 0,
|
|
37370
37374
|
class: "fv-prompt-item-label"
|
|
37371
37375
|
};
|
|
37372
|
-
const _hoisted_7$
|
|
37376
|
+
const _hoisted_7$2 = {
|
|
37373
37377
|
key: 1,
|
|
37374
37378
|
class: "fv-prompt-item-description"
|
|
37375
37379
|
};
|
|
@@ -37454,7 +37458,7 @@
|
|
|
37454
37458
|
)) : vue.createCommentVNode("v-if", true),
|
|
37455
37459
|
item.description ? (vue.openBlock(), vue.createElementBlock(
|
|
37456
37460
|
"div",
|
|
37457
|
-
_hoisted_7$
|
|
37461
|
+
_hoisted_7$2,
|
|
37458
37462
|
vue.toDisplayString(item.description),
|
|
37459
37463
|
1
|
|
37460
37464
|
/* TEXT */
|
|
@@ -37479,15 +37483,16 @@
|
|
|
37479
37483
|
const _hoisted_1$6 = ["src", "alt"];
|
|
37480
37484
|
const _hoisted_2$6 = { class: "fv-files-card-info" };
|
|
37481
37485
|
const _hoisted_3$6 = ["title"];
|
|
37482
|
-
const _hoisted_4$4 =
|
|
37483
|
-
|
|
37486
|
+
const _hoisted_4$4 = ["title"];
|
|
37487
|
+
const _hoisted_5$3 = {
|
|
37488
|
+
key: 1,
|
|
37484
37489
|
class: "fv-files-card-size"
|
|
37485
37490
|
};
|
|
37486
|
-
const
|
|
37491
|
+
const _hoisted_6$2 = {
|
|
37487
37492
|
key: 2,
|
|
37488
37493
|
class: "fv-files-card-status"
|
|
37489
37494
|
};
|
|
37490
|
-
const
|
|
37495
|
+
const _hoisted_7$1 = ["aria-label"];
|
|
37491
37496
|
const KB = 1024;
|
|
37492
37497
|
const MB = 1024 * 1024;
|
|
37493
37498
|
var _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
@@ -37500,6 +37505,7 @@
|
|
|
37500
37505
|
url: { type: String, required: false, default: "" },
|
|
37501
37506
|
status: { type: String, required: false, default: "success" },
|
|
37502
37507
|
imageSize: { type: String, required: false, default: "" },
|
|
37508
|
+
errorText: { type: String, required: false, default: "" },
|
|
37503
37509
|
onDelete: { type: Function, required: false, default: void 0 },
|
|
37504
37510
|
locale: { type: null, required: false, default: void 0 }
|
|
37505
37511
|
},
|
|
@@ -37624,16 +37630,21 @@
|
|
|
37624
37630
|
class: "fv-files-card-name",
|
|
37625
37631
|
title: __props.name
|
|
37626
37632
|
}, vue.toDisplayString(__props.name), 9, _hoisted_3$6),
|
|
37627
|
-
|
|
37633
|
+
vue.createCommentVNode(" error \u5E26\u6587\u6848\u65F6\u66FF\u4EE3\u5927\u5C0F\u884C(\u4E0A\u4F20\u5931\u8D25\u539F\u56E0);\u5426\u5219\u56DE\u843D\u5927\u5C0F "),
|
|
37634
|
+
__props.status === "error" && __props.errorText ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
37635
|
+
key: 0,
|
|
37636
|
+
class: "fv-files-card-error",
|
|
37637
|
+
title: __props.errorText
|
|
37638
|
+
}, vue.toDisplayString(__props.errorText), 9, _hoisted_4$4)) : sizeText.value ? (vue.openBlock(), vue.createElementBlock(
|
|
37628
37639
|
"div",
|
|
37629
|
-
|
|
37640
|
+
_hoisted_5$3,
|
|
37630
37641
|
vue.toDisplayString(sizeText.value),
|
|
37631
37642
|
1
|
|
37632
37643
|
/* TEXT */
|
|
37633
37644
|
)) : vue.createCommentVNode("v-if", true)
|
|
37634
37645
|
]),
|
|
37635
37646
|
vue.createCommentVNode(" \u72B6\u6001\u89D2\u6807:loading spinner;error \u65E0\u89D2\u6807(\u7EA2\u8FB9\u6837\u5F0F) "),
|
|
37636
|
-
__props.status === "loading" ? (vue.openBlock(), vue.createElementBlock("div",
|
|
37647
|
+
__props.status === "loading" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6$2, [
|
|
37637
37648
|
vue.createVNode(vue.unref(elementPlus.ElIcon), { class: "fv-files-card-loading" }, {
|
|
37638
37649
|
default: vue.withCtx(() => [
|
|
37639
37650
|
vue.createVNode(vue.unref(ElementPlusIconsVue.Loading))
|
|
@@ -37656,7 +37667,7 @@
|
|
|
37656
37667
|
_: 1
|
|
37657
37668
|
/* STABLE */
|
|
37658
37669
|
})
|
|
37659
|
-
], 8,
|
|
37670
|
+
], 8, _hoisted_7$1)
|
|
37660
37671
|
],
|
|
37661
37672
|
2
|
|
37662
37673
|
/* CLASS */
|
|
@@ -37686,10 +37697,11 @@
|
|
|
37686
37697
|
tip: { type: String, required: false, default: "" },
|
|
37687
37698
|
count: { type: Number, required: false, default: 0 },
|
|
37688
37699
|
beforeUpload: { type: Function, required: false, default: void 0 },
|
|
37700
|
+
upload: { type: Function, required: false, default: void 0 },
|
|
37689
37701
|
layout: { type: String, required: false, default: "inline" },
|
|
37690
37702
|
locale: { type: null, required: false, default: void 0 }
|
|
37691
37703
|
},
|
|
37692
|
-
emits: ["update:modelValue", "change", "exceed", "delete"],
|
|
37704
|
+
emits: ["update:modelValue", "change", "exceed", "delete", "uploaded"],
|
|
37693
37705
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
37694
37706
|
const props = __props;
|
|
37695
37707
|
const dict = useLocaleDict(() => props.locale);
|
|
@@ -37732,6 +37744,38 @@
|
|
|
37732
37744
|
if (item.status !== "error") return;
|
|
37733
37745
|
item.status = "loading";
|
|
37734
37746
|
sync();
|
|
37747
|
+
void runUpload(item);
|
|
37748
|
+
}
|
|
37749
|
+
async function runUpload(item) {
|
|
37750
|
+
if (!props.upload) {
|
|
37751
|
+
item.status = "success";
|
|
37752
|
+
sync();
|
|
37753
|
+
return;
|
|
37754
|
+
}
|
|
37755
|
+
try {
|
|
37756
|
+
const r = await props.upload(item.raw, item);
|
|
37757
|
+
if (typeof r === "string" && r) {
|
|
37758
|
+
applyResult(item, { status: "error", errMessage: r });
|
|
37759
|
+
emit("uploaded", item, void 0);
|
|
37760
|
+
} else {
|
|
37761
|
+
applyResult(item, r && typeof r === "object" ? { ...r, status: "success", errMessage: void 0 } : { status: "success", errMessage: void 0 });
|
|
37762
|
+
emit("uploaded", item, r && typeof r === "object" ? r : void 0);
|
|
37763
|
+
}
|
|
37764
|
+
} catch (e) {
|
|
37765
|
+
applyResult(item, { status: "error", errMessage: e instanceof Error ? e.message : String(e) });
|
|
37766
|
+
emit("uploaded", item, void 0);
|
|
37767
|
+
}
|
|
37768
|
+
sync();
|
|
37769
|
+
}
|
|
37770
|
+
function applyResult(item, patch) {
|
|
37771
|
+
const i = innerList.value.indexOf(item);
|
|
37772
|
+
const next = { ...item, ...patch };
|
|
37773
|
+
if (i >= 0) {
|
|
37774
|
+
innerList.value.splice(i, 1, next);
|
|
37775
|
+
Object.assign(item, next);
|
|
37776
|
+
} else {
|
|
37777
|
+
Object.assign(item, next);
|
|
37778
|
+
}
|
|
37735
37779
|
}
|
|
37736
37780
|
async function onChange(e) {
|
|
37737
37781
|
const target = e.target;
|
|
@@ -37756,12 +37800,14 @@
|
|
|
37756
37800
|
size: file.size,
|
|
37757
37801
|
url: isImageFile(file) ? createUrl(file) : "",
|
|
37758
37802
|
fileType: isImageFile(file) ? "image" : "file",
|
|
37759
|
-
|
|
37803
|
+
// 有 upload 钩子:入列即 loading(上传结果落定翻转);无钩子直接 success
|
|
37804
|
+
status: props.upload ? "loading" : "success",
|
|
37760
37805
|
raw: file
|
|
37761
37806
|
};
|
|
37762
37807
|
innerList.value.push(item);
|
|
37808
|
+
sync();
|
|
37809
|
+
if (props.upload) void runUpload(item);
|
|
37763
37810
|
}
|
|
37764
|
-
sync();
|
|
37765
37811
|
}
|
|
37766
37812
|
function openSelect() {
|
|
37767
37813
|
inputRef.value?.click();
|
|
@@ -37832,6 +37878,7 @@
|
|
|
37832
37878
|
url: item.url,
|
|
37833
37879
|
"file-type": item.fileType ?? "file",
|
|
37834
37880
|
status: item.status ?? "success",
|
|
37881
|
+
"error-text": item.errMessage ?? "",
|
|
37835
37882
|
"on-delete": () => removeItem(item, index)
|
|
37836
37883
|
}, vue.createSlots({
|
|
37837
37884
|
_: 2
|
|
@@ -37847,7 +37894,7 @@
|
|
|
37847
37894
|
]),
|
|
37848
37895
|
key: "0"
|
|
37849
37896
|
} : void 0
|
|
37850
|
-
]), 1032, ["name", "size", "url", "file-type", "status", "on-delete"]),
|
|
37897
|
+
]), 1032, ["name", "size", "url", "file-type", "status", "error-text", "on-delete"]),
|
|
37851
37898
|
vue.createCommentVNode(" error \u9879:\u91CD\u4F20\u6309\u94AE(\u5220\u9664\u5165\u53E3\u7531 FilesCard \u53F3\u4E0A\u6309\u94AE\u627F\u62C5,onDelete prop \u5DF2\u6CE8\u5165) "),
|
|
37852
37899
|
item.status === "error" ? (vue.openBlock(), vue.createElementBlock("button", {
|
|
37853
37900
|
key: 0,
|
|
@@ -38537,7 +38584,7 @@
|
|
|
38537
38584
|
if (extraSystem) out.push({ role: "system", content: extraSystem });
|
|
38538
38585
|
for (const m of chain) {
|
|
38539
38586
|
if (m.role === "assistant" && !m.content) continue;
|
|
38540
|
-
out.push({ role: m.role, content: m.content });
|
|
38587
|
+
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 });
|
|
38541
38588
|
}
|
|
38542
38589
|
return out;
|
|
38543
38590
|
}
|
|
@@ -38759,41 +38806,42 @@
|
|
|
38759
38806
|
key: 1,
|
|
38760
38807
|
class: "fv-msg-files"
|
|
38761
38808
|
};
|
|
38762
|
-
const _hoisted_8 = ["
|
|
38763
|
-
const _hoisted_9 =
|
|
38809
|
+
const _hoisted_8 = ["title", "onClick"];
|
|
38810
|
+
const _hoisted_9 = ["src", "alt"];
|
|
38811
|
+
const _hoisted_10 = {
|
|
38764
38812
|
key: 1,
|
|
38765
38813
|
class: "fv-msg-file-name"
|
|
38766
38814
|
};
|
|
38767
|
-
const
|
|
38768
|
-
key:
|
|
38815
|
+
const _hoisted_11 = {
|
|
38816
|
+
key: 4,
|
|
38769
38817
|
class: "fv-msg-content"
|
|
38770
38818
|
};
|
|
38771
|
-
const
|
|
38819
|
+
const _hoisted_12 = {
|
|
38772
38820
|
key: 0,
|
|
38773
38821
|
class: "fv-msg-error"
|
|
38774
38822
|
};
|
|
38775
|
-
const
|
|
38823
|
+
const _hoisted_13 = {
|
|
38776
38824
|
class: "fv-msg-pending",
|
|
38777
38825
|
role: "status",
|
|
38778
38826
|
"aria-live": "polite"
|
|
38779
38827
|
};
|
|
38780
|
-
const
|
|
38781
|
-
const
|
|
38782
|
-
key:
|
|
38828
|
+
const _hoisted_14 = { class: "fv-msg-pending-text" };
|
|
38829
|
+
const _hoisted_15 = {
|
|
38830
|
+
key: 5,
|
|
38783
38831
|
class: "fv-msg-content fv-msg-content-user"
|
|
38784
38832
|
};
|
|
38785
|
-
const
|
|
38786
|
-
const
|
|
38787
|
-
const
|
|
38788
|
-
key:
|
|
38833
|
+
const _hoisted_16 = ["aria-label"];
|
|
38834
|
+
const _hoisted_17 = ["disabled", "onClick"];
|
|
38835
|
+
const _hoisted_18 = {
|
|
38836
|
+
key: 7,
|
|
38789
38837
|
class: "fv-msg-actions"
|
|
38790
38838
|
};
|
|
38791
|
-
const
|
|
38839
|
+
const _hoisted_19 = {
|
|
38792
38840
|
key: 0,
|
|
38793
38841
|
class: "fv-msg-branch"
|
|
38794
38842
|
};
|
|
38795
|
-
const
|
|
38796
|
-
const
|
|
38843
|
+
const _hoisted_20 = { class: "fv-msg-branch-label" };
|
|
38844
|
+
const _hoisted_21 = {
|
|
38797
38845
|
key: 1,
|
|
38798
38846
|
class: "fv-msg-time"
|
|
38799
38847
|
};
|
|
@@ -38824,9 +38872,10 @@
|
|
|
38824
38872
|
codeTriggerLangs: { type: Array, required: false },
|
|
38825
38873
|
showTime: { type: Boolean, required: false, default: true },
|
|
38826
38874
|
timeFormat: { type: Function, required: false, default: void 0 },
|
|
38875
|
+
resolveFileUrl: { type: Function, required: false, default: void 0 },
|
|
38827
38876
|
locale: { type: null, required: false }
|
|
38828
38877
|
},
|
|
38829
|
-
emits: ["copy", "regenerate", "branch-change", "typing", "followup-select"],
|
|
38878
|
+
emits: ["copy", "regenerate", "branch-change", "typing", "followup-select", "file-click"],
|
|
38830
38879
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
38831
38880
|
const props = __props;
|
|
38832
38881
|
const dict = useLocaleDict(() => props.locale);
|
|
@@ -39028,6 +39077,33 @@
|
|
|
39028
39077
|
if (!followupsEnabled.value) return;
|
|
39029
39078
|
emit("followup-select", item, props.message);
|
|
39030
39079
|
}
|
|
39080
|
+
const resolvedUrls = vue.ref({});
|
|
39081
|
+
const resolvingUrls = /* @__PURE__ */ new Set();
|
|
39082
|
+
function displayUrl(f) {
|
|
39083
|
+
if (!f.url) return "";
|
|
39084
|
+
const hit = resolvedUrls.value[f.url];
|
|
39085
|
+
if (hit !== void 0) return hit;
|
|
39086
|
+
const raw = f.url;
|
|
39087
|
+
if (props.resolveFileUrl && /^https?:\/\//i.test(raw) && !resolvingUrls.has(raw)) {
|
|
39088
|
+
resolvingUrls.add(raw);
|
|
39089
|
+
void Promise.resolve(props.resolveFileUrl(f)).then((u) => {
|
|
39090
|
+
if (u && u !== raw) resolvedUrls.value[raw] = u;
|
|
39091
|
+
}).catch(() => {
|
|
39092
|
+
}).finally(() => resolvingUrls.delete(raw));
|
|
39093
|
+
}
|
|
39094
|
+
return raw;
|
|
39095
|
+
}
|
|
39096
|
+
const previewList = vue.computed(() => (props.message.files ?? []).filter((f) => f.type === "image"));
|
|
39097
|
+
const previewVisible = vue.ref(false);
|
|
39098
|
+
const previewIndex = vue.ref(0);
|
|
39099
|
+
function onFileClick(f, index) {
|
|
39100
|
+
emit("file-click", f, props.message);
|
|
39101
|
+
if (f.type === "image" && displayUrl(f)) {
|
|
39102
|
+
previewIndex.value = Math.max(0, index);
|
|
39103
|
+
previewVisible.value = true;
|
|
39104
|
+
}
|
|
39105
|
+
}
|
|
39106
|
+
const previewSrcList = vue.computed(() => previewList.value.map((f) => displayUrl(f)));
|
|
39031
39107
|
function onCopy() {
|
|
39032
39108
|
emit("copy", props.message);
|
|
39033
39109
|
}
|
|
@@ -39108,7 +39184,7 @@
|
|
|
39108
39184
|
/* TEXT */
|
|
39109
39185
|
)) : vue.createCommentVNode("v-if", true)
|
|
39110
39186
|
])) : vue.createCommentVNode("v-if", true),
|
|
39111
|
-
vue.createCommentVNode(" \u9644\u4EF6:user \u6D88\u606F files \
|
|
39187
|
+
vue.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) "),
|
|
39112
39188
|
__props.message.files?.length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7, [
|
|
39113
39189
|
vue.renderSlot(_ctx.$slots, "message-files", {
|
|
39114
39190
|
message: __props.message,
|
|
@@ -39117,41 +39193,46 @@
|
|
|
39117
39193
|
(vue.openBlock(true), vue.createElementBlock(
|
|
39118
39194
|
vue.Fragment,
|
|
39119
39195
|
null,
|
|
39120
|
-
vue.renderList(__props.message.files, (f) => {
|
|
39121
|
-
return vue.openBlock(), vue.createElementBlock(
|
|
39122
|
-
|
|
39123
|
-
|
|
39124
|
-
|
|
39125
|
-
|
|
39126
|
-
|
|
39127
|
-
|
|
39128
|
-
|
|
39129
|
-
|
|
39130
|
-
|
|
39131
|
-
|
|
39132
|
-
|
|
39133
|
-
|
|
39134
|
-
|
|
39135
|
-
|
|
39136
|
-
|
|
39137
|
-
|
|
39138
|
-
|
|
39139
|
-
|
|
39140
|
-
|
|
39141
|
-
2
|
|
39142
|
-
/* CLASS */
|
|
39143
|
-
);
|
|
39196
|
+
vue.renderList(__props.message.files, (f, i) => {
|
|
39197
|
+
return vue.openBlock(), vue.createElementBlock("button", {
|
|
39198
|
+
key: f.id,
|
|
39199
|
+
type: "button",
|
|
39200
|
+
class: vue.normalizeClass(["fv-msg-file", `is-${f.type ?? "file"}`]),
|
|
39201
|
+
title: f.name,
|
|
39202
|
+
onClick: ($event) => onFileClick(f, i)
|
|
39203
|
+
}, [
|
|
39204
|
+
f.type === "image" && displayUrl(f) ? (vue.openBlock(), vue.createElementBlock("img", {
|
|
39205
|
+
key: 0,
|
|
39206
|
+
class: "fv-msg-file-img",
|
|
39207
|
+
src: displayUrl(f),
|
|
39208
|
+
alt: f.name
|
|
39209
|
+
}, null, 8, _hoisted_9)) : (vue.openBlock(), vue.createElementBlock(
|
|
39210
|
+
"span",
|
|
39211
|
+
_hoisted_10,
|
|
39212
|
+
vue.toDisplayString(f.name),
|
|
39213
|
+
1
|
|
39214
|
+
/* TEXT */
|
|
39215
|
+
))
|
|
39216
|
+
], 10, _hoisted_8);
|
|
39144
39217
|
}),
|
|
39145
39218
|
128
|
|
39146
39219
|
/* KEYED_FRAGMENT */
|
|
39147
39220
|
))
|
|
39148
39221
|
])
|
|
39149
39222
|
])) : vue.createCommentVNode("v-if", true),
|
|
39223
|
+
vue.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) "),
|
|
39224
|
+
previewVisible.value && previewSrcList.value.length ? (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElImageViewer), {
|
|
39225
|
+
key: 2,
|
|
39226
|
+
"url-list": previewSrcList.value,
|
|
39227
|
+
"initial-index": previewIndex.value,
|
|
39228
|
+
teleported: "",
|
|
39229
|
+
onClose: _cache[0] || (_cache[0] = ($event) => previewVisible.value = false)
|
|
39230
|
+
}, null, 8, ["url-list", "initial-index"])) : vue.createCommentVNode("v-if", true),
|
|
39150
39231
|
vue.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 "),
|
|
39151
39232
|
!isUser.value && (hasToolSteps.value || hasReasoning.value) ? (vue.openBlock(), vue.createBlock(_sfc_main$a, {
|
|
39152
|
-
key:
|
|
39233
|
+
key: 3,
|
|
39153
39234
|
modelValue: toolsExpanded.value,
|
|
39154
|
-
"onUpdate:modelValue": _cache[
|
|
39235
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => toolsExpanded.value = $event),
|
|
39155
39236
|
status: hasToolSteps.value ? toolThinkingStatus.value : thinkingStatus.value,
|
|
39156
39237
|
"auto-collapse": false,
|
|
39157
39238
|
"hide-header": !showChainHeader.value,
|
|
@@ -39163,7 +39244,7 @@
|
|
|
39163
39244
|
items: toolChainItems.value,
|
|
39164
39245
|
collapsible: __props.collapsible,
|
|
39165
39246
|
"show-duration": __props.showDuration,
|
|
39166
|
-
onTyping: _cache[
|
|
39247
|
+
onTyping: _cache[1] || (_cache[1] = ($event) => emit("typing"))
|
|
39167
39248
|
}, null, 8, ["items", "collapsible", "show-duration"])) : hasReasoning.value && useTypewriter.value && !reasoningFlushed.value ? (vue.openBlock(), vue.createElementBlock(
|
|
39168
39249
|
vue.Fragment,
|
|
39169
39250
|
{ key: 1 },
|
|
@@ -39173,7 +39254,7 @@
|
|
|
39173
39254
|
content: __props.message.reasoning ?? "",
|
|
39174
39255
|
"is-markdown": "",
|
|
39175
39256
|
typing: __props.typing,
|
|
39176
|
-
onWriting: _cache[
|
|
39257
|
+
onWriting: _cache[2] || (_cache[2] = ($event) => emit("typing"))
|
|
39177
39258
|
}, null, 8, ["content", "typing"])
|
|
39178
39259
|
],
|
|
39179
39260
|
2112
|
|
@@ -39199,10 +39280,10 @@
|
|
|
39199
39280
|
} : void 0
|
|
39200
39281
|
]), 1032, ["modelValue", "status", "hide-header", "class"])) : vue.createCommentVNode("v-if", true),
|
|
39201
39282
|
vue.createCommentVNode(" \u6B63\u6587:user \u7EAF\u6587\u672C\u6C14\u6CE1;assistant Markdown;pending \u7A7A\u5185\u5BB9\u7ED9\u52A0\u8F7D\u5360\u4F4D "),
|
|
39202
|
-
!isUser.value ? (vue.openBlock(), vue.createElementBlock("div",
|
|
39283
|
+
!isUser.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_11, [
|
|
39203
39284
|
__props.message.status === "error" ? (vue.openBlock(), vue.createElementBlock(
|
|
39204
39285
|
"span",
|
|
39205
|
-
|
|
39286
|
+
_hoisted_12,
|
|
39206
39287
|
vue.toDisplayString(__props.message.error || vue.unref(dict).aiMessage.generateFailed),
|
|
39207
39288
|
1
|
|
39208
39289
|
/* TEXT */
|
|
@@ -39214,7 +39295,7 @@
|
|
|
39214
39295
|
"is-markdown": "",
|
|
39215
39296
|
typing: __props.typing,
|
|
39216
39297
|
"code-trigger-langs": __props.codeTriggerLangs,
|
|
39217
|
-
onWriting: _cache[
|
|
39298
|
+
onWriting: _cache[4] || (_cache[4] = ($event) => emit("typing")),
|
|
39218
39299
|
onFinish: maybeCollapseOnDone
|
|
39219
39300
|
}, null, 8, ["content", "typing", "code-trigger-langs"])) : __props.message.content ? (vue.openBlock(), vue.createBlock(_sfc_main$i, {
|
|
39220
39301
|
key: 2,
|
|
@@ -39225,8 +39306,8 @@
|
|
|
39225
39306
|
{ key: 3 },
|
|
39226
39307
|
[
|
|
39227
39308
|
vue.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) "),
|
|
39228
|
-
vue.createElementVNode("span",
|
|
39229
|
-
_cache[
|
|
39309
|
+
vue.createElementVNode("span", _hoisted_13, [
|
|
39310
|
+
_cache[7] || (_cache[7] = vue.createElementVNode(
|
|
39230
39311
|
"span",
|
|
39231
39312
|
{
|
|
39232
39313
|
class: "fv-msg-spinner",
|
|
@@ -39238,7 +39319,7 @@
|
|
|
39238
39319
|
)),
|
|
39239
39320
|
vue.createElementVNode(
|
|
39240
39321
|
"span",
|
|
39241
|
-
|
|
39322
|
+
_hoisted_14,
|
|
39242
39323
|
vue.toDisplayString(pendingPhrase.value),
|
|
39243
39324
|
1
|
|
39244
39325
|
/* TEXT */
|
|
@@ -39250,14 +39331,14 @@
|
|
|
39250
39331
|
)) : vue.createCommentVNode("v-if", true)
|
|
39251
39332
|
])) : (vue.openBlock(), vue.createElementBlock(
|
|
39252
39333
|
"div",
|
|
39253
|
-
|
|
39334
|
+
_hoisted_15,
|
|
39254
39335
|
vue.toDisplayString(__props.message.content),
|
|
39255
39336
|
1
|
|
39256
39337
|
/* TEXT */
|
|
39257
39338
|
)),
|
|
39258
39339
|
vue.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 "),
|
|
39259
39340
|
followups.value.length ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
39260
|
-
key:
|
|
39341
|
+
key: 6,
|
|
39261
39342
|
class: "fv-msg-followups",
|
|
39262
39343
|
role: "listbox",
|
|
39263
39344
|
"aria-label": vue.unref(dict).aiMessage.followups
|
|
@@ -39274,14 +39355,14 @@
|
|
|
39274
39355
|
role: "option",
|
|
39275
39356
|
"aria-selected": false,
|
|
39276
39357
|
onClick: ($event) => onFollowup(item)
|
|
39277
|
-
}, vue.toDisplayString(item), 11,
|
|
39358
|
+
}, vue.toDisplayString(item), 11, _hoisted_17);
|
|
39278
39359
|
}),
|
|
39279
39360
|
128
|
|
39280
39361
|
/* KEYED_FRAGMENT */
|
|
39281
39362
|
))
|
|
39282
|
-
], 8,
|
|
39363
|
+
], 8, _hoisted_16)) : vue.createCommentVNode("v-if", true),
|
|
39283
39364
|
vue.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) "),
|
|
39284
|
-
__props.showActions || __props.showBranchSwitch && __props.branch && __props.branch.count > 1 ? (vue.openBlock(), vue.createElementBlock("div",
|
|
39365
|
+
__props.showActions || __props.showBranchSwitch && __props.branch && __props.branch.count > 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_18, [
|
|
39285
39366
|
vue.renderSlot(_ctx.$slots, "message-actions", { message: __props.message }, () => [
|
|
39286
39367
|
__props.showActions && isUser.value ? (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElTooltip), {
|
|
39287
39368
|
key: 0,
|
|
@@ -39372,14 +39453,14 @@
|
|
|
39372
39453
|
}, 8, ["content"])) : vue.createCommentVNode("v-if", true)
|
|
39373
39454
|
]),
|
|
39374
39455
|
vue.createCommentVNode(" \u5206\u652F\u5207\u6362:\u5144\u5F1F\u5206\u652F > 1 \u65F6 "),
|
|
39375
|
-
__props.showBranchSwitch && __props.branch && __props.branch.count > 1 ? (vue.openBlock(), vue.createElementBlock("span",
|
|
39456
|
+
__props.showBranchSwitch && __props.branch && __props.branch.count > 1 ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_19, [
|
|
39376
39457
|
vue.createVNode(vue.unref(elementPlus.ElButton), {
|
|
39377
39458
|
text: "",
|
|
39378
39459
|
size: "small",
|
|
39379
39460
|
class: "fv-msg-action",
|
|
39380
39461
|
disabled: __props.branch.index <= 1,
|
|
39381
39462
|
"aria-label": vue.unref(dict).aiMessage.prevBranch,
|
|
39382
|
-
onClick: _cache[
|
|
39463
|
+
onClick: _cache[5] || (_cache[5] = ($event) => onBranch("prev"))
|
|
39383
39464
|
}, {
|
|
39384
39465
|
default: vue.withCtx(() => [
|
|
39385
39466
|
vue.createVNode(vue.unref(elementPlus.ElIcon), null, {
|
|
@@ -39395,7 +39476,7 @@
|
|
|
39395
39476
|
}, 8, ["disabled", "aria-label"]),
|
|
39396
39477
|
vue.createElementVNode(
|
|
39397
39478
|
"span",
|
|
39398
|
-
|
|
39479
|
+
_hoisted_20,
|
|
39399
39480
|
vue.toDisplayString(__props.branch.index) + " / " + vue.toDisplayString(__props.branch.count),
|
|
39400
39481
|
1
|
|
39401
39482
|
/* TEXT */
|
|
@@ -39406,7 +39487,7 @@
|
|
|
39406
39487
|
class: "fv-msg-action",
|
|
39407
39488
|
disabled: __props.branch.index >= __props.branch.count,
|
|
39408
39489
|
"aria-label": vue.unref(dict).aiMessage.nextBranch,
|
|
39409
|
-
onClick: _cache[
|
|
39490
|
+
onClick: _cache[6] || (_cache[6] = ($event) => onBranch("next"))
|
|
39410
39491
|
}, {
|
|
39411
39492
|
default: vue.withCtx(() => [
|
|
39412
39493
|
vue.createVNode(vue.unref(elementPlus.ElIcon), null, {
|
|
@@ -39424,7 +39505,7 @@
|
|
|
39424
39505
|
vue.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 "),
|
|
39425
39506
|
messageTimeText.value && timeVisible.value ? (vue.openBlock(), vue.createElementBlock(
|
|
39426
39507
|
"span",
|
|
39427
|
-
|
|
39508
|
+
_hoisted_21,
|
|
39428
39509
|
vue.toDisplayString(messageTimeText.value),
|
|
39429
39510
|
1
|
|
39430
39511
|
/* TEXT */
|
|
@@ -39476,9 +39557,10 @@
|
|
|
39476
39557
|
codeTriggerLangs: { type: Array, required: false },
|
|
39477
39558
|
showTime: { type: Boolean, required: false, default: true },
|
|
39478
39559
|
timeFormat: { type: Function, required: false, default: void 0 },
|
|
39560
|
+
resolveFileUrl: { type: Function, required: false, default: void 0 },
|
|
39479
39561
|
locale: { type: null, required: false }
|
|
39480
39562
|
},
|
|
39481
|
-
emits: ["select", "copy", "regenerate", "branch-change", "scroll", "followup-select"],
|
|
39563
|
+
emits: ["select", "copy", "regenerate", "branch-change", "scroll", "followup-select", "message-file-click"],
|
|
39482
39564
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
39483
39565
|
const props = __props;
|
|
39484
39566
|
const dict = useLocaleDict(() => props.locale);
|
|
@@ -39589,6 +39671,9 @@
|
|
|
39589
39671
|
function onFollowup(item, m) {
|
|
39590
39672
|
emit("followup-select", item, m);
|
|
39591
39673
|
}
|
|
39674
|
+
function onFileClick(file, m) {
|
|
39675
|
+
emit("message-file-click", file, m);
|
|
39676
|
+
}
|
|
39592
39677
|
const lastMessageId = vue.computed(() => props.messages.length ? props.messages[props.messages.length - 1].id : "");
|
|
39593
39678
|
function scrollToTop() {
|
|
39594
39679
|
const el = scrollRef.value;
|
|
@@ -39728,11 +39813,13 @@
|
|
|
39728
39813
|
"show-time": __props.showTime,
|
|
39729
39814
|
"time-format": __props.timeFormat,
|
|
39730
39815
|
"code-trigger-langs": __props.codeTriggerLangs,
|
|
39816
|
+
"resolve-file-url": __props.resolveFileUrl,
|
|
39731
39817
|
onTyping: onChildTyping,
|
|
39732
39818
|
onCopy,
|
|
39733
39819
|
onRegenerate,
|
|
39734
39820
|
onBranchChange: onBranch,
|
|
39735
|
-
onFollowupSelect: onFollowup
|
|
39821
|
+
onFollowupSelect: onFollowup,
|
|
39822
|
+
onFileClick
|
|
39736
39823
|
}, vue.createSlots({
|
|
39737
39824
|
_: 2
|
|
39738
39825
|
/* DYNAMIC */
|
|
@@ -39779,7 +39866,7 @@
|
|
|
39779
39866
|
]),
|
|
39780
39867
|
key: "5"
|
|
39781
39868
|
} : void 0
|
|
39782
|
-
]), 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"]);
|
|
39869
|
+
]), 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"]);
|
|
39783
39870
|
}),
|
|
39784
39871
|
128
|
|
39785
39872
|
/* KEYED_FRAGMENT */
|
|
@@ -40149,10 +40236,12 @@
|
|
|
40149
40236
|
allowAttachments: { type: Boolean, required: false, default: false },
|
|
40150
40237
|
accept: { type: String, required: false, default: "" },
|
|
40151
40238
|
attachmentLimit: { type: Number, required: false, default: 0 },
|
|
40239
|
+
uploadAttachment: { type: Function, required: false, default: void 0 },
|
|
40240
|
+
resolveFileUrl: { type: Function, required: false, default: void 0 },
|
|
40152
40241
|
theme: { type: String, required: false, default: "light" },
|
|
40153
40242
|
locale: { type: null, required: false }
|
|
40154
40243
|
},
|
|
40155
|
-
emits: ["update:messages", "send", "suggestion-select", "followup-select", "message-complete", "error", "branch-change", "attachment-exceed", "scroll", "tool-event"],
|
|
40244
|
+
emits: ["update:messages", "send", "suggestion-select", "followup-select", "message-complete", "error", "branch-change", "attachment-exceed", "attachment-uploaded", "message-file-click", "scroll", "tool-event"],
|
|
40156
40245
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
40157
40246
|
const props = __props;
|
|
40158
40247
|
const dict = useLocaleDict(() => props.locale);
|
|
@@ -40242,6 +40331,7 @@
|
|
|
40242
40331
|
void regenerateChat(messageId).finally(finishRun);
|
|
40243
40332
|
}
|
|
40244
40333
|
const pendingFiles = vue.ref([]);
|
|
40334
|
+
const uploadingCount = vue.computed(() => pendingFiles.value.filter((f) => f.status === "loading").length);
|
|
40245
40335
|
function toChatFiles(items) {
|
|
40246
40336
|
return items.map((it) => ({
|
|
40247
40337
|
id: String(it.uid),
|
|
@@ -40254,14 +40344,33 @@
|
|
|
40254
40344
|
function onAttachmentExceed(file) {
|
|
40255
40345
|
emit("attachment-exceed", file);
|
|
40256
40346
|
}
|
|
40347
|
+
function onAttachmentUploaded(item, _result) {
|
|
40348
|
+
const err = item.errMessage;
|
|
40349
|
+
emit("attachment-uploaded", item, { ok: item.status === "success", message: item.status === "success" ? void 0 : err });
|
|
40350
|
+
}
|
|
40351
|
+
const attachmentsUploadHook = vue.computed(() => {
|
|
40352
|
+
const hook = props.uploadAttachment;
|
|
40353
|
+
if (!hook) return void 0;
|
|
40354
|
+
return (file, item) => {
|
|
40355
|
+
return Promise.resolve(hook(file, item)).then((r) => {
|
|
40356
|
+
if (typeof r === "string") {
|
|
40357
|
+
if (r) throw new Error(r);
|
|
40358
|
+
return void 0;
|
|
40359
|
+
}
|
|
40360
|
+
return r;
|
|
40361
|
+
});
|
|
40362
|
+
};
|
|
40363
|
+
});
|
|
40257
40364
|
function drainFiles() {
|
|
40258
40365
|
if (!props.allowAttachments || !pendingFiles.value.length) return void 0;
|
|
40259
|
-
const
|
|
40366
|
+
const ready = pendingFiles.value.filter((f) => f.status !== "error");
|
|
40367
|
+
const files = toChatFiles(ready);
|
|
40260
40368
|
pendingFiles.value = [];
|
|
40261
|
-
return files;
|
|
40369
|
+
return files.length ? files : void 0;
|
|
40262
40370
|
}
|
|
40263
40371
|
function onSubmit(text) {
|
|
40264
40372
|
if (!text.trim() && !pendingFiles.value.length) return;
|
|
40373
|
+
if (uploadingCount.value) return;
|
|
40265
40374
|
resetArtifactUserClosed();
|
|
40266
40375
|
const files = drainFiles();
|
|
40267
40376
|
emit("send", text, files);
|
|
@@ -40296,6 +40405,7 @@
|
|
|
40296
40405
|
emit("branch-change", dir, m);
|
|
40297
40406
|
}
|
|
40298
40407
|
function sendMessage(text, files) {
|
|
40408
|
+
if (uploadingCount.value) return;
|
|
40299
40409
|
if (!text.trim() && !files?.length && !pendingFiles.value.length) return;
|
|
40300
40410
|
resetArtifactUserClosed();
|
|
40301
40411
|
const payload = files ?? drainFiles();
|
|
@@ -40422,6 +40532,9 @@
|
|
|
40422
40532
|
function onMessagesScroll(event) {
|
|
40423
40533
|
emit("scroll", event);
|
|
40424
40534
|
}
|
|
40535
|
+
function onMessageFileClick(file, message) {
|
|
40536
|
+
emit("message-file-click", file, message);
|
|
40537
|
+
}
|
|
40425
40538
|
__expose({ sendMessage, stop, regenerate, appendToMessage, clearMessages, exportTxt, openArtifact, expandThoughtChains, collapseThoughtChains, scrollTo });
|
|
40426
40539
|
return (_ctx, _cache) => {
|
|
40427
40540
|
return vue.openBlock(), vue.createElementBlock(
|
|
@@ -40500,12 +40613,14 @@
|
|
|
40500
40613
|
"show-time": __props.showTime,
|
|
40501
40614
|
"time-format": __props.timeFormat,
|
|
40502
40615
|
"code-trigger-langs": artifactsOn.value && artifactsCodeTrigger.value ? ["html", "svg"] : void 0,
|
|
40616
|
+
"resolve-file-url": __props.resolveFileUrl,
|
|
40503
40617
|
onSelect: onSelectSuggestion,
|
|
40504
40618
|
onFollowupSelect,
|
|
40505
40619
|
onCopy,
|
|
40506
40620
|
onRegenerate,
|
|
40507
40621
|
onBranchChange,
|
|
40508
|
-
onScroll: onMessagesScroll
|
|
40622
|
+
onScroll: onMessagesScroll,
|
|
40623
|
+
onMessageFileClick
|
|
40509
40624
|
}, vue.createSlots({
|
|
40510
40625
|
_: 2
|
|
40511
40626
|
/* DYNAMIC */
|
|
@@ -40601,7 +40716,7 @@
|
|
|
40601
40716
|
]),
|
|
40602
40717
|
key: "12"
|
|
40603
40718
|
} : void 0
|
|
40604
|
-
]), 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"]),
|
|
40719
|
+
]), 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"]),
|
|
40605
40720
|
artifactsOn.value && artifacts.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$1, {
|
|
40606
40721
|
key: 0,
|
|
40607
40722
|
artifacts: artifacts.value,
|
|
@@ -40613,7 +40728,7 @@
|
|
|
40613
40728
|
onChange: onArtifactChange
|
|
40614
40729
|
}, null, 8, ["artifacts", "active-key", "width", "min-width", "max-width"])) : vue.createCommentVNode("v-if", true)
|
|
40615
40730
|
]),
|
|
40616
|
-
vue.createCommentVNode(" \u8F93\u5165\u533A:Sender(\u4E0D\u4F20 allowSpeech,Task 15 \u6869\u4E0D\u63A5\u7EBF);\
|
|
40731
|
+
vue.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) "),
|
|
40617
40732
|
vue.createElementVNode("div", _hoisted_4, [
|
|
40618
40733
|
vue.createVNode(_sfc_main$d, {
|
|
40619
40734
|
placeholder: __props.placeholder,
|
|
@@ -40622,7 +40737,7 @@
|
|
|
40622
40737
|
shadow: __props.senderShadow,
|
|
40623
40738
|
variant: "updown",
|
|
40624
40739
|
maxlength: 8e3,
|
|
40625
|
-
"allow-empty-submit": __props.allowAttachments && !!pendingFiles.value.length,
|
|
40740
|
+
"allow-empty-submit": __props.allowAttachments && !!pendingFiles.value.length && !uploadingCount.value,
|
|
40626
40741
|
onSubmit,
|
|
40627
40742
|
onCancel: stop
|
|
40628
40743
|
}, vue.createSlots({
|
|
@@ -40638,8 +40753,10 @@
|
|
|
40638
40753
|
layout: "listOnly",
|
|
40639
40754
|
accept: __props.accept,
|
|
40640
40755
|
count: __props.attachmentLimit,
|
|
40641
|
-
|
|
40642
|
-
|
|
40756
|
+
upload: attachmentsUploadHook.value,
|
|
40757
|
+
onExceed: onAttachmentExceed,
|
|
40758
|
+
onUploaded: onAttachmentUploaded
|
|
40759
|
+
}, null, 8, ["modelValue", "accept", "count", "upload"])
|
|
40643
40760
|
]),
|
|
40644
40761
|
key: "0"
|
|
40645
40762
|
} : void 0,
|
|
@@ -40652,8 +40769,10 @@
|
|
|
40652
40769
|
layout: "triggerOnly",
|
|
40653
40770
|
accept: __props.accept,
|
|
40654
40771
|
count: __props.attachmentLimit,
|
|
40655
|
-
|
|
40656
|
-
|
|
40772
|
+
upload: attachmentsUploadHook.value,
|
|
40773
|
+
onExceed: onAttachmentExceed,
|
|
40774
|
+
onUploaded: onAttachmentUploaded
|
|
40775
|
+
}, null, 8, ["modelValue", "accept", "count", "upload"])
|
|
40657
40776
|
]),
|
|
40658
40777
|
key: "1"
|
|
40659
40778
|
} : void 0,
|