@fv-ui/ai-chat 1.2.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/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"
@@ -33296,6 +33298,8 @@
33296
33298
  querying: "\u6B63\u5728\u67E5\u8BE2",
33297
33299
  queried: "\u5DF2\u67E5\u8BE2",
33298
33300
  generateFailed: "\u751F\u6210\u5931\u8D25",
33301
+ /** 追问建议 chips 区 aria 标签 */
33302
+ followups: "\u8FFD\u95EE\u5EFA\u8BAE",
33299
33303
  loadingPhrases: ["\u6B63\u5728\u601D\u8003\u2026", "\u6B63\u5728\u6574\u7406\u601D\u8DEF\u2026", "\u6B63\u5728\u751F\u6210\u56DE\u7B54\u2026"]
33300
33304
  },
33301
33305
  aiArtifacts: {
@@ -33376,7 +33380,9 @@
33376
33380
  },
33377
33381
  attachments: {
33378
33382
  add: "Add attachment",
33379
- retry: "Retry"
33383
+ retry: "Retry",
33384
+ /** 上传中状态角标文案(loading 态 files 卡片辅助提示) */
33385
+ uploading: "Uploading\u2026"
33380
33386
  },
33381
33387
  filesCard: {
33382
33388
  remove: "Remove"
@@ -33411,6 +33417,7 @@
33411
33417
  querying: "Querying",
33412
33418
  queried: "Queried",
33413
33419
  generateFailed: "Generation failed",
33420
+ followups: "Follow-up suggestions",
33414
33421
  loadingPhrases: ["Thinking...", "Organizing thoughts...", "Generating your answer..."]
33415
33422
  },
33416
33423
  aiArtifacts: {
@@ -34316,7 +34323,7 @@
34316
34323
  class: "fv-sender-recording-wave",
34317
34324
  "aria-hidden": "true"
34318
34325
  };
34319
- const _hoisted_7$6 = { class: "fv-sender-recording-duration" };
34326
+ const _hoisted_7$7 = { class: "fv-sender-recording-duration" };
34320
34327
  const _hoisted_8$4 = ["value", "placeholder", "disabled", "readonly"];
34321
34328
  const _hoisted_9$3 = {
34322
34329
  key: 3,
@@ -34747,7 +34754,7 @@
34747
34754
  ]),
34748
34755
  vue.createElementVNode(
34749
34756
  "span",
34750
- _hoisted_7$6,
34757
+ _hoisted_7$7,
34751
34758
  vue.toDisplayString(recordDuration.value),
34752
34759
  1
34753
34760
  /* TEXT */
@@ -34963,7 +34970,7 @@
34963
34970
  const _hoisted_4$a = ["onMouseenter", "onClick"];
34964
34971
  const _hoisted_5$8 = { class: "fv-mention-avatar" };
34965
34972
  const _hoisted_6$7 = ["src", "alt"];
34966
- const _hoisted_7$5 = { class: "fv-mention-name" };
34973
+ const _hoisted_7$6 = { class: "fv-mention-name" };
34967
34974
  const CHAR_WIDTH$1 = 8;
34968
34975
  var _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
34969
34976
  ...{ name: "FvMentionSender", inheritAttrs: false },
@@ -35363,7 +35370,7 @@
35363
35370
  ]),
35364
35371
  vue.createElementVNode(
35365
35372
  "span",
35366
- _hoisted_7$5,
35373
+ _hoisted_7$6,
35367
35374
  vue.toDisplayString(item.name),
35368
35375
  1
35369
35376
  /* TEXT */
@@ -35398,7 +35405,7 @@
35398
35405
  const _hoisted_4$9 = { class: "fv-editor-input" };
35399
35406
  const _hoisted_5$7 = ["contenteditable", "data-placeholder"];
35400
35407
  const _hoisted_6$6 = { class: "fv-editor-mention-panel" };
35401
- const _hoisted_7$4 = {
35408
+ const _hoisted_7$5 = {
35402
35409
  key: 0,
35403
35410
  class: "fv-editor-mention-title"
35404
35411
  };
@@ -35425,9 +35432,9 @@
35425
35432
  };
35426
35433
  const _hoisted_17$1 = { class: "fv-editor-select-dialog" };
35427
35434
  const _hoisted_18$1 = { class: "fv-editor-select-title" };
35428
- const _hoisted_19 = { class: "fv-editor-select-grid" };
35429
- const _hoisted_20 = ["onClick"];
35430
- const _hoisted_21 = ["src", "alt"];
35435
+ const _hoisted_19$1 = { class: "fv-editor-select-grid" };
35436
+ const _hoisted_20$1 = ["onClick"];
35437
+ const _hoisted_21$1 = ["src", "alt"];
35431
35438
  const _hoisted_22 = { class: "fv-editor-select-name" };
35432
35439
  const CHAR_WIDTH = 8;
35433
35440
  var _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
@@ -36218,7 +36225,7 @@
36218
36225
  vue.createElementVNode("div", _hoisted_6$6, [
36219
36226
  panelTitle.value ? (vue.openBlock(), vue.createElementBlock(
36220
36227
  "div",
36221
- _hoisted_7$4,
36228
+ _hoisted_7$5,
36222
36229
  vue.toDisplayString(panelTitle.value),
36223
36230
  1
36224
36231
  /* TEXT */
@@ -36410,7 +36417,7 @@
36410
36417
  1
36411
36418
  /* TEXT */
36412
36419
  ),
36413
- vue.createElementVNode("div", _hoisted_19, [
36420
+ vue.createElementVNode("div", _hoisted_19$1, [
36414
36421
  (vue.openBlock(true), vue.createElementBlock(
36415
36422
  vue.Fragment,
36416
36423
  null,
@@ -36425,7 +36432,7 @@
36425
36432
  class: "fv-editor-select-preview",
36426
36433
  src: option.preview,
36427
36434
  alt: option.name
36428
- }, null, 8, _hoisted_21)) : vue.createCommentVNode("v-if", true),
36435
+ }, null, 8, _hoisted_21$1)) : vue.createCommentVNode("v-if", true),
36429
36436
  vue.createElementVNode(
36430
36437
  "span",
36431
36438
  _hoisted_22,
@@ -36433,7 +36440,7 @@
36433
36440
  1
36434
36441
  /* TEXT */
36435
36442
  )
36436
- ], 8, _hoisted_20);
36443
+ ], 8, _hoisted_20$1);
36437
36444
  }),
36438
36445
  128
36439
36446
  /* KEYED_FRAGMENT */
@@ -36631,7 +36638,7 @@
36631
36638
  key: 0,
36632
36639
  class: "fv-chain-head-preview"
36633
36640
  };
36634
- const _hoisted_7$3 = {
36641
+ const _hoisted_7$4 = {
36635
36642
  key: 0,
36636
36643
  class: "fv-chain-body"
36637
36644
  };
@@ -37110,7 +37117,7 @@
37110
37117
  /* DYNAMIC_SLOTS */
37111
37118
  )
37112
37119
  ], 10, _hoisted_4$7),
37113
- isTextExpanded(item.key) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7$3, [
37120
+ isTextExpanded(item.key) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7$4, [
37114
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 "),
37115
37122
  edgeFade(item.key).top ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_8$2)) : vue.createCommentVNode("v-if", true),
37116
37123
  edgeFade(item.key).bottom ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_9$1)) : vue.createCommentVNode("v-if", true),
@@ -37238,7 +37245,7 @@
37238
37245
  const _hoisted_4$6 = { class: "fv-welcome-text" };
37239
37246
  const _hoisted_5$5 = { class: "fv-welcome-name" };
37240
37247
  const _hoisted_6$4 = { class: "fv-welcome-name-accent" };
37241
- const _hoisted_7$2 = { class: "fv-welcome-description" };
37248
+ const _hoisted_7$3 = { class: "fv-welcome-description" };
37242
37249
  const _hoisted_8$1 = {
37243
37250
  key: 0,
37244
37251
  class: "fv-welcome-suggestions"
@@ -37331,7 +37338,7 @@
37331
37338
  ])
37332
37339
  ]),
37333
37340
  vue.createCommentVNode(" #description \u63D2\u69FD\u8986\u76D6\u63CF\u8FF0;\u672A\u4F20 description \u65F6\u56DE\u843D\u5185\u7F6E\u9ED8\u8BA4\u63CF\u8FF0 "),
37334
- vue.createElementVNode("p", _hoisted_7$2, [
37341
+ vue.createElementVNode("p", _hoisted_7$3, [
37335
37342
  vue.renderSlot(_ctx.$slots, "description", {}, () => [
37336
37343
  vue.createTextVNode(
37337
37344
  vue.toDisplayString(__props.description || vue.unref(dict).welcome.description),
@@ -37366,7 +37373,7 @@
37366
37373
  key: 0,
37367
37374
  class: "fv-prompt-item-label"
37368
37375
  };
37369
- const _hoisted_7$1 = {
37376
+ const _hoisted_7$2 = {
37370
37377
  key: 1,
37371
37378
  class: "fv-prompt-item-description"
37372
37379
  };
@@ -37451,7 +37458,7 @@
37451
37458
  )) : vue.createCommentVNode("v-if", true),
37452
37459
  item.description ? (vue.openBlock(), vue.createElementBlock(
37453
37460
  "div",
37454
- _hoisted_7$1,
37461
+ _hoisted_7$2,
37455
37462
  vue.toDisplayString(item.description),
37456
37463
  1
37457
37464
  /* TEXT */
@@ -37476,15 +37483,16 @@
37476
37483
  const _hoisted_1$6 = ["src", "alt"];
37477
37484
  const _hoisted_2$6 = { class: "fv-files-card-info" };
37478
37485
  const _hoisted_3$6 = ["title"];
37479
- const _hoisted_4$4 = {
37480
- key: 0,
37486
+ const _hoisted_4$4 = ["title"];
37487
+ const _hoisted_5$3 = {
37488
+ key: 1,
37481
37489
  class: "fv-files-card-size"
37482
37490
  };
37483
- const _hoisted_5$3 = {
37491
+ const _hoisted_6$2 = {
37484
37492
  key: 2,
37485
37493
  class: "fv-files-card-status"
37486
37494
  };
37487
- const _hoisted_6$2 = ["aria-label"];
37495
+ const _hoisted_7$1 = ["aria-label"];
37488
37496
  const KB = 1024;
37489
37497
  const MB = 1024 * 1024;
37490
37498
  var _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
@@ -37497,6 +37505,7 @@
37497
37505
  url: { type: String, required: false, default: "" },
37498
37506
  status: { type: String, required: false, default: "success" },
37499
37507
  imageSize: { type: String, required: false, default: "" },
37508
+ errorText: { type: String, required: false, default: "" },
37500
37509
  onDelete: { type: Function, required: false, default: void 0 },
37501
37510
  locale: { type: null, required: false, default: void 0 }
37502
37511
  },
@@ -37621,16 +37630,21 @@
37621
37630
  class: "fv-files-card-name",
37622
37631
  title: __props.name
37623
37632
  }, vue.toDisplayString(__props.name), 9, _hoisted_3$6),
37624
- sizeText.value ? (vue.openBlock(), vue.createElementBlock(
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(
37625
37639
  "div",
37626
- _hoisted_4$4,
37640
+ _hoisted_5$3,
37627
37641
  vue.toDisplayString(sizeText.value),
37628
37642
  1
37629
37643
  /* TEXT */
37630
37644
  )) : vue.createCommentVNode("v-if", true)
37631
37645
  ]),
37632
37646
  vue.createCommentVNode(" \u72B6\u6001\u89D2\u6807:loading spinner;error \u65E0\u89D2\u6807(\u7EA2\u8FB9\u6837\u5F0F) "),
37633
- __props.status === "loading" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$3, [
37647
+ __props.status === "loading" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6$2, [
37634
37648
  vue.createVNode(vue.unref(elementPlus.ElIcon), { class: "fv-files-card-loading" }, {
37635
37649
  default: vue.withCtx(() => [
37636
37650
  vue.createVNode(vue.unref(ElementPlusIconsVue.Loading))
@@ -37653,7 +37667,7 @@
37653
37667
  _: 1
37654
37668
  /* STABLE */
37655
37669
  })
37656
- ], 8, _hoisted_6$2)
37670
+ ], 8, _hoisted_7$1)
37657
37671
  ],
37658
37672
  2
37659
37673
  /* CLASS */
@@ -37683,10 +37697,11 @@
37683
37697
  tip: { type: String, required: false, default: "" },
37684
37698
  count: { type: Number, required: false, default: 0 },
37685
37699
  beforeUpload: { type: Function, required: false, default: void 0 },
37700
+ upload: { type: Function, required: false, default: void 0 },
37686
37701
  layout: { type: String, required: false, default: "inline" },
37687
37702
  locale: { type: null, required: false, default: void 0 }
37688
37703
  },
37689
- emits: ["update:modelValue", "change", "exceed", "delete"],
37704
+ emits: ["update:modelValue", "change", "exceed", "delete", "uploaded"],
37690
37705
  setup(__props, { expose: __expose, emit: __emit }) {
37691
37706
  const props = __props;
37692
37707
  const dict = useLocaleDict(() => props.locale);
@@ -37729,6 +37744,38 @@
37729
37744
  if (item.status !== "error") return;
37730
37745
  item.status = "loading";
37731
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
+ }
37732
37779
  }
37733
37780
  async function onChange(e) {
37734
37781
  const target = e.target;
@@ -37753,12 +37800,14 @@
37753
37800
  size: file.size,
37754
37801
  url: isImageFile(file) ? createUrl(file) : "",
37755
37802
  fileType: isImageFile(file) ? "image" : "file",
37756
- status: "success",
37803
+ // 有 upload 钩子:入列即 loading(上传结果落定翻转);无钩子直接 success
37804
+ status: props.upload ? "loading" : "success",
37757
37805
  raw: file
37758
37806
  };
37759
37807
  innerList.value.push(item);
37808
+ sync();
37809
+ if (props.upload) void runUpload(item);
37760
37810
  }
37761
- sync();
37762
37811
  }
37763
37812
  function openSelect() {
37764
37813
  inputRef.value?.click();
@@ -37829,6 +37878,7 @@
37829
37878
  url: item.url,
37830
37879
  "file-type": item.fileType ?? "file",
37831
37880
  status: item.status ?? "success",
37881
+ "error-text": item.errMessage ?? "",
37832
37882
  "on-delete": () => removeItem(item, index)
37833
37883
  }, vue.createSlots({
37834
37884
  _: 2
@@ -37844,7 +37894,7 @@
37844
37894
  ]),
37845
37895
  key: "0"
37846
37896
  } : void 0
37847
- ]), 1032, ["name", "size", "url", "file-type", "status", "on-delete"]),
37897
+ ]), 1032, ["name", "size", "url", "file-type", "status", "error-text", "on-delete"]),
37848
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) "),
37849
37899
  item.status === "error" ? (vue.openBlock(), vue.createElementBlock("button", {
37850
37900
  key: 0,
@@ -38284,6 +38334,7 @@
38284
38334
  error: node.error,
38285
38335
  createdAt: typeof node.createdAt === "number" ? node.createdAt : Date.now(),
38286
38336
  createdTime: node.createdTime,
38337
+ suggestions: node.suggestions ? [...node.suggestions] : void 0,
38287
38338
  usage: node.usage ? { ...node.usage } : void 0
38288
38339
  };
38289
38340
  messages[id] = full;
@@ -38533,7 +38584,7 @@
38533
38584
  if (extraSystem) out.push({ role: "system", content: extraSystem });
38534
38585
  for (const m of chain) {
38535
38586
  if (m.role === "assistant" && !m.content) continue;
38536
- 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 });
38537
38588
  }
38538
38589
  return out;
38539
38590
  }
@@ -38580,6 +38631,9 @@
38580
38631
  onBackendMessageId: (id) => {
38581
38632
  msgs.edit(assistantId, { backendId: id });
38582
38633
  },
38634
+ onSuggestions: (items) => {
38635
+ msgs.edit(assistantId, { suggestions: items });
38636
+ },
38583
38637
  onTool: (ev) => {
38584
38638
  const label = (name) => options.toolStepLabel ? options.toolStepLabel(name) : name;
38585
38639
  const steps = [...msgs.messages.value[assistantId]?.toolSteps ?? []];
@@ -38752,39 +38806,42 @@
38752
38806
  key: 1,
38753
38807
  class: "fv-msg-files"
38754
38808
  };
38755
- const _hoisted_8 = ["src", "alt"];
38756
- const _hoisted_9 = {
38809
+ const _hoisted_8 = ["title", "onClick"];
38810
+ const _hoisted_9 = ["src", "alt"];
38811
+ const _hoisted_10 = {
38757
38812
  key: 1,
38758
38813
  class: "fv-msg-file-name"
38759
38814
  };
38760
- const _hoisted_10 = {
38761
- key: 3,
38815
+ const _hoisted_11 = {
38816
+ key: 4,
38762
38817
  class: "fv-msg-content"
38763
38818
  };
38764
- const _hoisted_11 = {
38819
+ const _hoisted_12 = {
38765
38820
  key: 0,
38766
38821
  class: "fv-msg-error"
38767
38822
  };
38768
- const _hoisted_12 = {
38823
+ const _hoisted_13 = {
38769
38824
  class: "fv-msg-pending",
38770
38825
  role: "status",
38771
38826
  "aria-live": "polite"
38772
38827
  };
38773
- const _hoisted_13 = { class: "fv-msg-pending-text" };
38774
- const _hoisted_14 = {
38775
- key: 4,
38776
- class: "fv-msg-content fv-msg-content-user"
38777
- };
38828
+ const _hoisted_14 = { class: "fv-msg-pending-text" };
38778
38829
  const _hoisted_15 = {
38779
38830
  key: 5,
38831
+ class: "fv-msg-content fv-msg-content-user"
38832
+ };
38833
+ const _hoisted_16 = ["aria-label"];
38834
+ const _hoisted_17 = ["disabled", "onClick"];
38835
+ const _hoisted_18 = {
38836
+ key: 7,
38780
38837
  class: "fv-msg-actions"
38781
38838
  };
38782
- const _hoisted_16 = {
38839
+ const _hoisted_19 = {
38783
38840
  key: 0,
38784
38841
  class: "fv-msg-branch"
38785
38842
  };
38786
- const _hoisted_17 = { class: "fv-msg-branch-label" };
38787
- const _hoisted_18 = {
38843
+ const _hoisted_20 = { class: "fv-msg-branch-label" };
38844
+ const _hoisted_21 = {
38788
38845
  key: 1,
38789
38846
  class: "fv-msg-time"
38790
38847
  };
@@ -38795,6 +38852,7 @@
38795
38852
  props: {
38796
38853
  message: { type: Object, required: true },
38797
38854
  branch: { type: Object, required: false, default: void 0 },
38855
+ isLast: { type: Boolean, required: false, default: false },
38798
38856
  showActions: { type: Boolean, required: false, default: true },
38799
38857
  showBranchSwitch: { type: Boolean, required: false, default: true },
38800
38858
  showUserAvatar: { type: Boolean, required: false, default: false },
@@ -38814,9 +38872,10 @@
38814
38872
  codeTriggerLangs: { type: Array, required: false },
38815
38873
  showTime: { type: Boolean, required: false, default: true },
38816
38874
  timeFormat: { type: Function, required: false, default: void 0 },
38875
+ resolveFileUrl: { type: Function, required: false, default: void 0 },
38817
38876
  locale: { type: null, required: false }
38818
38877
  },
38819
- emits: ["copy", "regenerate", "branch-change", "typing"],
38878
+ emits: ["copy", "regenerate", "branch-change", "typing", "followup-select", "file-click"],
38820
38879
  setup(__props, { expose: __expose, emit: __emit }) {
38821
38880
  const props = __props;
38822
38881
  const dict = useLocaleDict(() => props.locale);
@@ -39008,6 +39067,43 @@
39008
39067
  vue.onBeforeUnmount(() => {
39009
39068
  if (phraseTimer !== null) clearInterval(phraseTimer);
39010
39069
  });
39070
+ const followups = vue.computed(() => {
39071
+ if (!props.isLast || isUser.value) return [];
39072
+ const s = props.message.suggestions;
39073
+ return s && s.length ? s : [];
39074
+ });
39075
+ const followupsEnabled = vue.computed(() => props.message.status === "done");
39076
+ function onFollowup(item) {
39077
+ if (!followupsEnabled.value) return;
39078
+ emit("followup-select", item, props.message);
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)));
39011
39107
  function onCopy() {
39012
39108
  emit("copy", props.message);
39013
39109
  }
@@ -39088,7 +39184,7 @@
39088
39184
  /* TEXT */
39089
39185
  )) : vue.createCommentVNode("v-if", true)
39090
39186
  ])) : vue.createCommentVNode("v-if", true),
39091
- vue.createCommentVNode(" \u9644\u4EF6:user \u6D88\u606F files \u4EE5 FilesCard \u5E73\u94FA "),
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) "),
39092
39188
  __props.message.files?.length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7, [
39093
39189
  vue.renderSlot(_ctx.$slots, "message-files", {
39094
39190
  message: __props.message,
@@ -39097,41 +39193,46 @@
39097
39193
  (vue.openBlock(true), vue.createElementBlock(
39098
39194
  vue.Fragment,
39099
39195
  null,
39100
- vue.renderList(__props.message.files, (f) => {
39101
- return vue.openBlock(), vue.createElementBlock(
39102
- "div",
39103
- {
39104
- key: f.id,
39105
- class: vue.normalizeClass(["fv-msg-file", `is-${f.type ?? "file"}`])
39106
- },
39107
- [
39108
- f.type === "image" && f.url ? (vue.openBlock(), vue.createElementBlock("img", {
39109
- key: 0,
39110
- class: "fv-msg-file-img",
39111
- src: f.url,
39112
- alt: f.name
39113
- }, null, 8, _hoisted_8)) : (vue.openBlock(), vue.createElementBlock(
39114
- "span",
39115
- _hoisted_9,
39116
- vue.toDisplayString(f.name),
39117
- 1
39118
- /* TEXT */
39119
- ))
39120
- ],
39121
- 2
39122
- /* CLASS */
39123
- );
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);
39124
39217
  }),
39125
39218
  128
39126
39219
  /* KEYED_FRAGMENT */
39127
39220
  ))
39128
39221
  ])
39129
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),
39130
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 "),
39131
39232
  !isUser.value && (hasToolSteps.value || hasReasoning.value) ? (vue.openBlock(), vue.createBlock(_sfc_main$a, {
39132
- key: 2,
39233
+ key: 3,
39133
39234
  modelValue: toolsExpanded.value,
39134
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => toolsExpanded.value = $event),
39235
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => toolsExpanded.value = $event),
39135
39236
  status: hasToolSteps.value ? toolThinkingStatus.value : thinkingStatus.value,
39136
39237
  "auto-collapse": false,
39137
39238
  "hide-header": !showChainHeader.value,
@@ -39143,7 +39244,7 @@
39143
39244
  items: toolChainItems.value,
39144
39245
  collapsible: __props.collapsible,
39145
39246
  "show-duration": __props.showDuration,
39146
- onTyping: _cache[0] || (_cache[0] = ($event) => emit("typing"))
39247
+ onTyping: _cache[1] || (_cache[1] = ($event) => emit("typing"))
39147
39248
  }, null, 8, ["items", "collapsible", "show-duration"])) : hasReasoning.value && useTypewriter.value && !reasoningFlushed.value ? (vue.openBlock(), vue.createElementBlock(
39148
39249
  vue.Fragment,
39149
39250
  { key: 1 },
@@ -39153,7 +39254,7 @@
39153
39254
  content: __props.message.reasoning ?? "",
39154
39255
  "is-markdown": "",
39155
39256
  typing: __props.typing,
39156
- onWriting: _cache[1] || (_cache[1] = ($event) => emit("typing"))
39257
+ onWriting: _cache[2] || (_cache[2] = ($event) => emit("typing"))
39157
39258
  }, null, 8, ["content", "typing"])
39158
39259
  ],
39159
39260
  2112
@@ -39179,10 +39280,10 @@
39179
39280
  } : void 0
39180
39281
  ]), 1032, ["modelValue", "status", "hide-header", "class"])) : vue.createCommentVNode("v-if", true),
39181
39282
  vue.createCommentVNode(" \u6B63\u6587:user \u7EAF\u6587\u672C\u6C14\u6CE1;assistant Markdown;pending \u7A7A\u5185\u5BB9\u7ED9\u52A0\u8F7D\u5360\u4F4D "),
39182
- !isUser.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_10, [
39283
+ !isUser.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_11, [
39183
39284
  __props.message.status === "error" ? (vue.openBlock(), vue.createElementBlock(
39184
39285
  "span",
39185
- _hoisted_11,
39286
+ _hoisted_12,
39186
39287
  vue.toDisplayString(__props.message.error || vue.unref(dict).aiMessage.generateFailed),
39187
39288
  1
39188
39289
  /* TEXT */
@@ -39194,7 +39295,7 @@
39194
39295
  "is-markdown": "",
39195
39296
  typing: __props.typing,
39196
39297
  "code-trigger-langs": __props.codeTriggerLangs,
39197
- onWriting: _cache[3] || (_cache[3] = ($event) => emit("typing")),
39298
+ onWriting: _cache[4] || (_cache[4] = ($event) => emit("typing")),
39198
39299
  onFinish: maybeCollapseOnDone
39199
39300
  }, null, 8, ["content", "typing", "code-trigger-langs"])) : __props.message.content ? (vue.openBlock(), vue.createBlock(_sfc_main$i, {
39200
39301
  key: 2,
@@ -39205,8 +39306,8 @@
39205
39306
  { key: 3 },
39206
39307
  [
39207
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) "),
39208
- vue.createElementVNode("span", _hoisted_12, [
39209
- _cache[6] || (_cache[6] = vue.createElementVNode(
39309
+ vue.createElementVNode("span", _hoisted_13, [
39310
+ _cache[7] || (_cache[7] = vue.createElementVNode(
39210
39311
  "span",
39211
39312
  {
39212
39313
  class: "fv-msg-spinner",
@@ -39218,7 +39319,7 @@
39218
39319
  )),
39219
39320
  vue.createElementVNode(
39220
39321
  "span",
39221
- _hoisted_13,
39322
+ _hoisted_14,
39222
39323
  vue.toDisplayString(pendingPhrase.value),
39223
39324
  1
39224
39325
  /* TEXT */
@@ -39230,13 +39331,38 @@
39230
39331
  )) : vue.createCommentVNode("v-if", true)
39231
39332
  ])) : (vue.openBlock(), vue.createElementBlock(
39232
39333
  "div",
39233
- _hoisted_14,
39334
+ _hoisted_15,
39234
39335
  vue.toDisplayString(__props.message.content),
39235
39336
  1
39236
39337
  /* TEXT */
39237
39338
  )),
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 "),
39340
+ followups.value.length ? (vue.openBlock(), vue.createElementBlock("div", {
39341
+ key: 6,
39342
+ class: "fv-msg-followups",
39343
+ role: "listbox",
39344
+ "aria-label": vue.unref(dict).aiMessage.followups
39345
+ }, [
39346
+ (vue.openBlock(true), vue.createElementBlock(
39347
+ vue.Fragment,
39348
+ null,
39349
+ vue.renderList(followups.value, (item, i) => {
39350
+ return vue.openBlock(), vue.createElementBlock("button", {
39351
+ key: `${i}-${item}`,
39352
+ type: "button",
39353
+ class: vue.normalizeClass(["fv-msg-followup", { "is-disabled": !followupsEnabled.value }]),
39354
+ disabled: !followupsEnabled.value,
39355
+ role: "option",
39356
+ "aria-selected": false,
39357
+ onClick: ($event) => onFollowup(item)
39358
+ }, vue.toDisplayString(item), 11, _hoisted_17);
39359
+ }),
39360
+ 128
39361
+ /* KEYED_FRAGMENT */
39362
+ ))
39363
+ ], 8, _hoisted_16)) : vue.createCommentVNode("v-if", true),
39238
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) "),
39239
- __props.showActions || __props.showBranchSwitch && __props.branch && __props.branch.count > 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_15, [
39365
+ __props.showActions || __props.showBranchSwitch && __props.branch && __props.branch.count > 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_18, [
39240
39366
  vue.renderSlot(_ctx.$slots, "message-actions", { message: __props.message }, () => [
39241
39367
  __props.showActions && isUser.value ? (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElTooltip), {
39242
39368
  key: 0,
@@ -39327,14 +39453,14 @@
39327
39453
  }, 8, ["content"])) : vue.createCommentVNode("v-if", true)
39328
39454
  ]),
39329
39455
  vue.createCommentVNode(" \u5206\u652F\u5207\u6362:\u5144\u5F1F\u5206\u652F > 1 \u65F6 "),
39330
- __props.showBranchSwitch && __props.branch && __props.branch.count > 1 ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_16, [
39456
+ __props.showBranchSwitch && __props.branch && __props.branch.count > 1 ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_19, [
39331
39457
  vue.createVNode(vue.unref(elementPlus.ElButton), {
39332
39458
  text: "",
39333
39459
  size: "small",
39334
39460
  class: "fv-msg-action",
39335
39461
  disabled: __props.branch.index <= 1,
39336
39462
  "aria-label": vue.unref(dict).aiMessage.prevBranch,
39337
- onClick: _cache[4] || (_cache[4] = ($event) => onBranch("prev"))
39463
+ onClick: _cache[5] || (_cache[5] = ($event) => onBranch("prev"))
39338
39464
  }, {
39339
39465
  default: vue.withCtx(() => [
39340
39466
  vue.createVNode(vue.unref(elementPlus.ElIcon), null, {
@@ -39350,7 +39476,7 @@
39350
39476
  }, 8, ["disabled", "aria-label"]),
39351
39477
  vue.createElementVNode(
39352
39478
  "span",
39353
- _hoisted_17,
39479
+ _hoisted_20,
39354
39480
  vue.toDisplayString(__props.branch.index) + " / " + vue.toDisplayString(__props.branch.count),
39355
39481
  1
39356
39482
  /* TEXT */
@@ -39361,7 +39487,7 @@
39361
39487
  class: "fv-msg-action",
39362
39488
  disabled: __props.branch.index >= __props.branch.count,
39363
39489
  "aria-label": vue.unref(dict).aiMessage.nextBranch,
39364
- onClick: _cache[5] || (_cache[5] = ($event) => onBranch("next"))
39490
+ onClick: _cache[6] || (_cache[6] = ($event) => onBranch("next"))
39365
39491
  }, {
39366
39492
  default: vue.withCtx(() => [
39367
39493
  vue.createVNode(vue.unref(elementPlus.ElIcon), null, {
@@ -39379,7 +39505,7 @@
39379
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 "),
39380
39506
  messageTimeText.value && timeVisible.value ? (vue.openBlock(), vue.createElementBlock(
39381
39507
  "span",
39382
- _hoisted_18,
39508
+ _hoisted_21,
39383
39509
  vue.toDisplayString(messageTimeText.value),
39384
39510
  1
39385
39511
  /* TEXT */
@@ -39431,9 +39557,10 @@
39431
39557
  codeTriggerLangs: { type: Array, required: false },
39432
39558
  showTime: { type: Boolean, required: false, default: true },
39433
39559
  timeFormat: { type: Function, required: false, default: void 0 },
39560
+ resolveFileUrl: { type: Function, required: false, default: void 0 },
39434
39561
  locale: { type: null, required: false }
39435
39562
  },
39436
- emits: ["select", "copy", "regenerate", "branch-change", "scroll"],
39563
+ emits: ["select", "copy", "regenerate", "branch-change", "scroll", "followup-select", "message-file-click"],
39437
39564
  setup(__props, { expose: __expose, emit: __emit }) {
39438
39565
  const props = __props;
39439
39566
  const dict = useLocaleDict(() => props.locale);
@@ -39508,7 +39635,7 @@
39508
39635
  );
39509
39636
  vue.watch(
39510
39637
  () => props.messages.reduce(
39511
- (sum, m) => sum + m.content.length + (m.reasoning?.length ?? 0) + (m.toolSteps?.reduce((s, t) => s + (t.status?.length ?? 0) + (t.title?.length ?? 0), 0) ?? 0) + (m.toolSteps?.length ?? 0),
39638
+ (sum, m) => sum + m.content.length + (m.reasoning?.length ?? 0) + (m.toolSteps?.reduce((s, t) => s + (t.status?.length ?? 0) + (t.title?.length ?? 0), 0) ?? 0) + (m.toolSteps?.length ?? 0) + (m.suggestions?.length ?? 0),
39512
39639
  0
39513
39640
  ),
39514
39641
  () => followIfPinned()
@@ -39541,6 +39668,13 @@
39541
39668
  function onBranch(dir, m) {
39542
39669
  emit("branch-change", dir, m);
39543
39670
  }
39671
+ function onFollowup(item, m) {
39672
+ emit("followup-select", item, m);
39673
+ }
39674
+ function onFileClick(file, m) {
39675
+ emit("message-file-click", file, m);
39676
+ }
39677
+ const lastMessageId = vue.computed(() => props.messages.length ? props.messages[props.messages.length - 1].id : "");
39544
39678
  function scrollToTop() {
39545
39679
  const el = scrollRef.value;
39546
39680
  if (!el) return;
@@ -39659,6 +39793,7 @@
39659
39793
  ref: (el) => setMessageRef(m.id, el),
39660
39794
  message: m,
39661
39795
  branch: branchInfo(m),
39796
+ "is-last": m.id === lastMessageId.value,
39662
39797
  "show-actions": __props.showActions,
39663
39798
  "show-branch-switch": __props.showBranchSwitch,
39664
39799
  "show-user-avatar": __props.showUserAvatar,
@@ -39678,10 +39813,13 @@
39678
39813
  "show-time": __props.showTime,
39679
39814
  "time-format": __props.timeFormat,
39680
39815
  "code-trigger-langs": __props.codeTriggerLangs,
39816
+ "resolve-file-url": __props.resolveFileUrl,
39681
39817
  onTyping: onChildTyping,
39682
39818
  onCopy,
39683
39819
  onRegenerate,
39684
- onBranchChange: onBranch
39820
+ onBranchChange: onBranch,
39821
+ onFollowupSelect: onFollowup,
39822
+ onFileClick
39685
39823
  }, vue.createSlots({
39686
39824
  _: 2
39687
39825
  /* DYNAMIC */
@@ -39728,7 +39866,7 @@
39728
39866
  ]),
39729
39867
  key: "5"
39730
39868
  } : void 0
39731
- ]), 1032, ["message", "branch", "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"]);
39732
39870
  }),
39733
39871
  128
39734
39872
  /* KEYED_FRAGMENT */
@@ -40098,10 +40236,12 @@
40098
40236
  allowAttachments: { type: Boolean, required: false, default: false },
40099
40237
  accept: { type: String, required: false, default: "" },
40100
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 },
40101
40241
  theme: { type: String, required: false, default: "light" },
40102
40242
  locale: { type: null, required: false }
40103
40243
  },
40104
- emits: ["update:messages", "send", "suggestion-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"],
40105
40245
  setup(__props, { expose: __expose, emit: __emit }) {
40106
40246
  const props = __props;
40107
40247
  const dict = useLocaleDict(() => props.locale);
@@ -40191,6 +40331,7 @@
40191
40331
  void regenerateChat(messageId).finally(finishRun);
40192
40332
  }
40193
40333
  const pendingFiles = vue.ref([]);
40334
+ const uploadingCount = vue.computed(() => pendingFiles.value.filter((f) => f.status === "loading").length);
40194
40335
  function toChatFiles(items) {
40195
40336
  return items.map((it) => ({
40196
40337
  id: String(it.uid),
@@ -40203,14 +40344,33 @@
40203
40344
  function onAttachmentExceed(file) {
40204
40345
  emit("attachment-exceed", file);
40205
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
+ });
40206
40364
  function drainFiles() {
40207
40365
  if (!props.allowAttachments || !pendingFiles.value.length) return void 0;
40208
- const files = toChatFiles(pendingFiles.value);
40366
+ const ready = pendingFiles.value.filter((f) => f.status !== "error");
40367
+ const files = toChatFiles(ready);
40209
40368
  pendingFiles.value = [];
40210
- return files;
40369
+ return files.length ? files : void 0;
40211
40370
  }
40212
40371
  function onSubmit(text) {
40213
40372
  if (!text.trim() && !pendingFiles.value.length) return;
40373
+ if (uploadingCount.value) return;
40214
40374
  resetArtifactUserClosed();
40215
40375
  const files = drainFiles();
40216
40376
  emit("send", text, files);
@@ -40224,6 +40384,14 @@
40224
40384
  emit("send", text);
40225
40385
  void send(text).finally(finishRun);
40226
40386
  }
40387
+ function onFollowupSelect(item, message) {
40388
+ const text = item.trim();
40389
+ if (!text || isLoading.value) return;
40390
+ resetArtifactUserClosed();
40391
+ emit("followup-select", item, message);
40392
+ emit("send", text);
40393
+ void send(text).finally(finishRun);
40394
+ }
40227
40395
  function onCopy(m) {
40228
40396
  const text = `${m.content}`;
40229
40397
  void navigator.clipboard?.writeText(text).catch(() => {
@@ -40237,6 +40405,7 @@
40237
40405
  emit("branch-change", dir, m);
40238
40406
  }
40239
40407
  function sendMessage(text, files) {
40408
+ if (uploadingCount.value) return;
40240
40409
  if (!text.trim() && !files?.length && !pendingFiles.value.length) return;
40241
40410
  resetArtifactUserClosed();
40242
40411
  const payload = files ?? drainFiles();
@@ -40363,6 +40532,9 @@
40363
40532
  function onMessagesScroll(event) {
40364
40533
  emit("scroll", event);
40365
40534
  }
40535
+ function onMessageFileClick(file, message) {
40536
+ emit("message-file-click", file, message);
40537
+ }
40366
40538
  __expose({ sendMessage, stop, regenerate, appendToMessage, clearMessages, exportTxt, openArtifact, expandThoughtChains, collapseThoughtChains, scrollTo });
40367
40539
  return (_ctx, _cache) => {
40368
40540
  return vue.openBlock(), vue.createElementBlock(
@@ -40441,11 +40613,14 @@
40441
40613
  "show-time": __props.showTime,
40442
40614
  "time-format": __props.timeFormat,
40443
40615
  "code-trigger-langs": artifactsOn.value && artifactsCodeTrigger.value ? ["html", "svg"] : void 0,
40616
+ "resolve-file-url": __props.resolveFileUrl,
40444
40617
  onSelect: onSelectSuggestion,
40618
+ onFollowupSelect,
40445
40619
  onCopy,
40446
40620
  onRegenerate,
40447
40621
  onBranchChange,
40448
- onScroll: onMessagesScroll
40622
+ onScroll: onMessagesScroll,
40623
+ onMessageFileClick
40449
40624
  }, vue.createSlots({
40450
40625
  _: 2
40451
40626
  /* DYNAMIC */
@@ -40541,7 +40716,7 @@
40541
40716
  ]),
40542
40717
  key: "12"
40543
40718
  } : void 0
40544
- ]), 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"]),
40545
40720
  artifactsOn.value && artifacts.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$1, {
40546
40721
  key: 0,
40547
40722
  artifacts: artifacts.value,
@@ -40553,7 +40728,7 @@
40553
40728
  onChange: onArtifactChange
40554
40729
  }, null, 8, ["artifacts", "active-key", "width", "min-width", "max-width"])) : vue.createCommentVNode("v-if", true)
40555
40730
  ]),
40556
- vue.createCommentVNode(" \u8F93\u5165\u533A:Sender(\u4E0D\u4F20 allowSpeech,Task 15 \u6869\u4E0D\u63A5\u7EBF);\r\n allowAttachments \u5F00\u542F\u65F6:\u56DE\u5F62\u9488\u5728\u64CD\u4F5C\u680F\u5DE6\u4FA7(#action-left,\u4E0E\u63D0\u4EA4\u6309\u94AE\u540C\u884C),\r\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) "),
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) "),
40557
40732
  vue.createElementVNode("div", _hoisted_4, [
40558
40733
  vue.createVNode(_sfc_main$d, {
40559
40734
  placeholder: __props.placeholder,
@@ -40562,7 +40737,7 @@
40562
40737
  shadow: __props.senderShadow,
40563
40738
  variant: "updown",
40564
40739
  maxlength: 8e3,
40565
- "allow-empty-submit": __props.allowAttachments && !!pendingFiles.value.length,
40740
+ "allow-empty-submit": __props.allowAttachments && !!pendingFiles.value.length && !uploadingCount.value,
40566
40741
  onSubmit,
40567
40742
  onCancel: stop
40568
40743
  }, vue.createSlots({
@@ -40578,8 +40753,10 @@
40578
40753
  layout: "listOnly",
40579
40754
  accept: __props.accept,
40580
40755
  count: __props.attachmentLimit,
40581
- onExceed: onAttachmentExceed
40582
- }, null, 8, ["modelValue", "accept", "count"])
40756
+ upload: attachmentsUploadHook.value,
40757
+ onExceed: onAttachmentExceed,
40758
+ onUploaded: onAttachmentUploaded
40759
+ }, null, 8, ["modelValue", "accept", "count", "upload"])
40583
40760
  ]),
40584
40761
  key: "0"
40585
40762
  } : void 0,
@@ -40592,8 +40769,10 @@
40592
40769
  layout: "triggerOnly",
40593
40770
  accept: __props.accept,
40594
40771
  count: __props.attachmentLimit,
40595
- onExceed: onAttachmentExceed
40596
- }, null, 8, ["modelValue", "accept", "count"])
40772
+ upload: attachmentsUploadHook.value,
40773
+ onExceed: onAttachmentExceed,
40774
+ onUploaded: onAttachmentUploaded
40775
+ }, null, 8, ["modelValue", "accept", "count", "upload"])
40597
40776
  ]),
40598
40777
  key: "1"
40599
40778
  } : void 0,
@@ -40745,6 +40924,17 @@
40745
40924
  function resolve(v) {
40746
40925
  return typeof v === "function" ? v() : v;
40747
40926
  }
40927
+ function parseSuggestions(raw) {
40928
+ if (!raw) return void 0;
40929
+ try {
40930
+ const parsed = JSON.parse(raw);
40931
+ if (!Array.isArray(parsed)) return void 0;
40932
+ const items = parsed.filter((s) => typeof s === "string" && s.trim().length > 0);
40933
+ return items.length ? items : void 0;
40934
+ } catch {
40935
+ return void 0;
40936
+ }
40937
+ }
40748
40938
  function FvCommonAdapter(config) {
40749
40939
  const { baseURL, headers, sessionId, errorMessages } = config;
40750
40940
  const activeControllers = /* @__PURE__ */ new Set();
@@ -40820,6 +41010,13 @@
40820
41010
  case "reasoning":
40821
41011
  if (typeof j.text === "string" && j.text) handlers.onReasoning(j.text);
40822
41012
  break;
41013
+ case "suggestions": {
41014
+ if (Array.isArray(j.items)) {
41015
+ const items = j.items.filter((s) => typeof s === "string" && s.trim().length > 0);
41016
+ if (items.length) handlers.onSuggestions?.(items);
41017
+ }
41018
+ break;
41019
+ }
40823
41020
  case "message_end": {
40824
41021
  if (typeof j.messageId === "string") handlers.onBackendMessageId?.(j.messageId);
40825
41022
  const usage = {};
@@ -40961,6 +41158,7 @@
40961
41158
  exports.createMessageTree = createMessageTree;
40962
41159
  exports.createSSEParser = createSSEParser;
40963
41160
  exports.enUS = enUS;
41161
+ exports.parseSuggestions = parseSuggestions;
40964
41162
  exports.useChat = useChat;
40965
41163
  exports.useMessages = useMessages;
40966
41164
  exports.useRecord = useRecord;