@fv-ui/ai-chat 1.4.2 → 1.5.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/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, ElImageViewer, ElTooltip, ElSelect, ElOption } from 'element-plus';
2
+ import { ElMessage, ElAvatar, ElButton, ElIcon, ElPopover, ElDialog, ElScrollbar, ElDropdown, ElDropdownMenu, ElDropdownItem, ElMessageBox, ElImageViewer, ElTooltip, ElInput, 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
 
@@ -33280,7 +33280,24 @@ const zhCN = {
33280
33280
  generateFailed: "\u751F\u6210\u5931\u8D25",
33281
33281
  /** 追问建议 chips 区 aria 标签 */
33282
33282
  followups: "\u8FFD\u95EE\u5EFA\u8BAE",
33283
- loadingPhrases: ["\u6B63\u5728\u601D\u8003\u2026", "\u6B63\u5728\u6574\u7406\u601D\u8DEF\u2026", "\u6B63\u5728\u751F\u6210\u56DE\u7B54\u2026"]
33283
+ loadingPhrases: ["\u6B63\u5728\u601D\u8003\u2026", "\u6B63\u5728\u6574\u7406\u601D\u8DEF\u2026", "\u6B63\u5728\u751F\u6210\u56DE\u7B54\u2026"],
33284
+ /** 消息评价(点赞/点踩) */
33285
+ feedback: {
33286
+ like: "\u70B9\u8D5E",
33287
+ dislike: "\u70B9\u8E29",
33288
+ /** 点踩弹层标题 */
33289
+ dislikeTitle: "\u544A\u8BC9 AI \u54EA\u91CC\u4E0D\u597D",
33290
+ /** 点踩附言输入占位(选填 ≤500 字) */
33291
+ dislikePlaceholder: "\u8865\u5145\u5177\u4F53\u539F\u56E0,\u5E2E\u52A9 AI \u6539\u8FDB(\u9009\u586B)",
33292
+ /** 附言提交按钮(不带原因直接点踩) */
33293
+ submit: "\u63D0\u4EA4",
33294
+ /** 附言跳过按钮 */
33295
+ skip: "\u8DF3\u8FC7",
33296
+ /** 评价提交失败(钩子 reject/返回错误文案时 toast) */
33297
+ failed: "\u8BC4\u4EF7\u63D0\u4EA4\u5931\u8D25",
33298
+ /** 已取消评价 toast(CLEAR 成功后提示) */
33299
+ cleared: "\u5DF2\u53D6\u6D88\u8BC4\u4EF7"
33300
+ }
33284
33301
  },
33285
33302
  aiArtifacts: {
33286
33303
  copy: "\u590D\u5236",
@@ -33398,7 +33415,17 @@ const enUS = {
33398
33415
  queried: "Queried",
33399
33416
  generateFailed: "Generation failed",
33400
33417
  followups: "Follow-up suggestions",
33401
- loadingPhrases: ["Thinking...", "Organizing thoughts...", "Generating your answer..."]
33418
+ loadingPhrases: ["Thinking...", "Organizing thoughts...", "Generating your answer..."],
33419
+ feedback: {
33420
+ like: "Like",
33421
+ dislike: "Dislike",
33422
+ dislikeTitle: "Tell the AI what went wrong",
33423
+ dislikePlaceholder: "Add details to help the AI improve (optional)",
33424
+ submit: "Submit",
33425
+ skip: "Skip",
33426
+ failed: "Failed to submit feedback",
33427
+ cleared: "Feedback removed"
33428
+ }
33402
33429
  },
33403
33430
  aiArtifacts: {
33404
33431
  copy: "Copy",
@@ -35415,7 +35442,7 @@ const _hoisted_18$1 = { class: "fv-editor-select-title" };
35415
35442
  const _hoisted_19$1 = { class: "fv-editor-select-grid" };
35416
35443
  const _hoisted_20$1 = ["onClick"];
35417
35444
  const _hoisted_21$1 = ["src", "alt"];
35418
- const _hoisted_22 = { class: "fv-editor-select-name" };
35445
+ const _hoisted_22$1 = { class: "fv-editor-select-name" };
35419
35446
  const CHAR_WIDTH = 8;
35420
35447
  var _sfc_main$b = /* @__PURE__ */ defineComponent({
35421
35448
  ...{ name: "FvEditorSender" },
@@ -36415,7 +36442,7 @@ var _sfc_main$b = /* @__PURE__ */ defineComponent({
36415
36442
  }, null, 8, _hoisted_21$1)) : createCommentVNode("v-if", true),
36416
36443
  createElementVNode(
36417
36444
  "span",
36418
- _hoisted_22,
36445
+ _hoisted_22$1,
36419
36446
  toDisplayString(option.name),
36420
36447
  1
36421
36448
  /* TEXT */
@@ -38767,6 +38794,36 @@ const BulbIcon = defineComponent({
38767
38794
  }
38768
38795
  });
38769
38796
 
38797
+ const LIKE_PATH = "M507.94496 118.70208L512 118.784c41.7792 0 88.92416 30.76096 114.36032 80.81408 25.23136 44.2368 25.64096 100.352 12.6976 159.04768h123.78112c95.4368 0 177.43872 82.98496 148.02944 178.33984l-76.96384 249.6512c-19.37408 62.79168-81.75616 102.1952-148.02944 102.1952h-298.1888a116.57216 116.57216 0 0 1-116.5312-116.57216V422.2976c0-35.2256 23.38816-61.27616 47.75936-73.85088a115.9168 115.9168 0 0 0 56.19712-62.464c7.5776-20.0704 10.60864-37.76512 13.80352-56.40192l1.35168-7.61856c3.44064-19.6608 8.35584-45.99808 26.624-67.74784 16.71168-19.94752 35.84-29.73696 55.17312-33.5872 13.27104-2.62144 27.97568-2.21184 35.88096-1.96608z m-21.54496 74.30144c-3.44064 0.69632-7.49568 2.048-13.06624 8.64256-4.01408 4.79232-6.79936 12.288-10.48576 33.1776l-1.2288 6.9632c-3.11296 18.51392-7.33184 43.13088-17.53088 70.20544a189.6448 189.6448 0 0 1-91.38176 102.03136 18.6368 18.6368 0 0 0-6.63552 5.44768c-1.14688 1.6384-1.2288 2.58048-1.2288 2.8672v349.92128c0 23.67488 19.2512 42.84416 42.88512 42.84416h298.14784c39.15776 0 69.2224-23.01952 77.57824-50.21696l76.96384-249.61024c11.18208-36.20864-18.80064-82.90304-77.57824-82.90304h-172.07296a36.864 36.864 0 0 1-35.06176-48.29184c23.3472-71.68 22.44608-120.832 6.3488-148.48a38.0928 38.0928 0 0 1-1.10592-2.048C545.30048 202.30144 520.31488 192.512 512 192.512c-2.90816 0-5.81632-0.08192-8.27392-0.12288h-0.45056a264.6016 264.6016 0 0 0-7.12704-0.12288c-4.34176 0-7.3728 0.24576-9.74848 0.73728zM184.32 385.024a36.864 36.864 0 0 1 36.864 36.864v409.6a36.864 36.864 0 1 1-73.728 0v-409.6a36.864 36.864 0 0 1 36.864-36.864z";
38798
+ const LIKE_FILLED_PATH = "M614.4 183.62368c26.2144 46.94016 22.40512 116.85888-3.39968 199.31136h184.89344c82.86208 0 142.99136 72.45824 121.2416 145.94048l-82.7392 278.9376c-14.90944 50.25792-64.55296 85.11488-121.20064 85.11488H386.90816A79.70816 79.70816 0 0 1 307.2 813.21984V409.10848c0-17.6128 11.79648-32.768 27.4432-40.79616a168.46848 168.46848 0 0 0 81.7152-93.184c21.66784-59.76064 14.21312-105.55392 38.13376-135.24992 23.9616-29.65504 49.88928-24.90368 71.8848-24.90368 27.0336 0 66.02752 22.89664 88.02304 68.64896zM204.8 380.928A61.44 61.44 0 0 1 266.24 442.368v389.12a61.44 61.44 0 1 1-122.88 0v-389.12a61.44 61.44 0 0 1 61.44-61.44z";
38799
+ const DISLIKE_PATH = "M516.096 905.216l4.05504 0.08192c7.90528 0.24576 22.60992 0.65536 35.88096-1.96608 19.33312-3.85024 38.5024-13.63968 55.21408-33.5872 18.2272-21.74976 23.1424-48.08704 26.624-67.74784l1.31072-7.61856c3.19488-18.6368 6.22592-36.29056 13.80352-56.40192a115.9168 115.9168 0 0 1 56.19712-62.464c24.3712-12.57472 47.75936-38.58432 47.75936-73.85088V251.74016A116.57216 116.57216 0 0 0 640.36864 135.168h-298.1888c-66.23232 0-128.6144 39.40352-147.98848 102.1952l-77.0048 249.6512c-29.36832 95.35488 52.67456 178.33984 148.0704 178.33984h123.74016c-12.9024 58.65472-12.4928 114.85184 12.6976 159.08864 25.47712 49.9712 72.66304 80.77312 114.40128 80.77312z m38.66624-82.86208c-5.57056 6.59456-9.6256 7.94624-13.06624 8.64256-2.41664 0.49152-5.40672 0.73728-9.74848 0.73728-2.17088 0-4.42368 0-7.12704-0.12288h-0.45056c-2.4576-0.04096-5.36576-0.12288-8.27392-0.12288-8.31488 0-33.30048-9.74848-48.9472-41.04192a37.6832 37.6832 0 0 0-1.10592-2.048c-16.09728-27.68896-16.9984-76.8 6.3488-148.48a36.864 36.864 0 0 0-35.0208-48.29184H265.25696c-58.7776 0-88.76032-46.6944-77.57824-82.90304l77.0048-249.61024c8.35584-27.19744 38.37952-50.21696 77.53728-50.21696h298.1888c23.63392 0 42.8032 19.16928 42.8032 42.84416v349.92128c0 0.28672-0.04096 1.2288-1.2288 2.8672a18.59584 18.59584 0 0 1-6.5536 5.44768 189.6448 189.6448 0 0 0-91.42272 101.9904c-10.24 27.11552-14.41792 51.73248-17.57184 70.20544l-1.2288 7.04512c-3.6864 20.8896-6.43072 28.34432-10.4448 33.1776zM806.912 602.112a36.864 36.864 0 0 0 73.728 0v-409.6a36.864 36.864 0 1 0-73.728 0v409.6z";
38800
+ const DISLIKE_FILLED_PATH = "M778.24 585.728a61.44 61.44 0 1 0 122.88 0V196.608a61.44 61.44 0 0 0-122.88 0v389.12z m-344.76032 59.392c-25.8048 82.49344-29.65504 152.41216-3.39968 199.35232 21.99552 45.79328 60.98944 68.64896 88.02304 68.64896 2.62144 0 5.3248 0.08192 8.02816 0.16384 20.15232 0.49152 42.76224 1.06496 63.85664-25.06752 13.39392-16.62976 16.95744-38.25664 21.2992-64.59392 3.39968-20.72576 7.29088-44.31872 16.83456-70.656a168.50944 168.50944 0 0 1 81.7152-93.184c15.64672-8.06912 27.4432-23.18336 27.4432-40.79616V214.87616A79.70816 79.70816 0 0 0 657.57184 135.168H331.28448c-56.64768 0-106.2912 34.85696-121.2416 85.15584L127.3856 499.22048c-21.79072 73.48224 38.33856 145.94048 121.20064 145.94048h184.89344z";
38801
+ const PATHS = {
38802
+ like: { outline: LIKE_PATH, filled: LIKE_FILLED_PATH },
38803
+ dislike: { outline: DISLIKE_PATH, filled: DISLIKE_FILLED_PATH }
38804
+ };
38805
+ const FeedbackThumbIcon = defineComponent({
38806
+ name: "FvFeedbackThumbIcon",
38807
+ props: {
38808
+ /** 朝向:like 点赞 / dislike 点踩(设计稿独立 path,非翻转) */
38809
+ kind: { type: String, default: "like" },
38810
+ /** 实底态(当前评价高亮);缺省线性 */
38811
+ filled: { type: Boolean, default: false }
38812
+ },
38813
+ setup(props) {
38814
+ return () => h("svg", {
38815
+ xmlns: "http://www.w3.org/2000/svg",
38816
+ viewBox: "0 0 1024 1024",
38817
+ "aria-hidden": "true"
38818
+ }, [
38819
+ h("path", {
38820
+ d: props.filled ? PATHS[props.kind].filled : PATHS[props.kind].outline,
38821
+ fill: "currentColor"
38822
+ })
38823
+ ]);
38824
+ }
38825
+ });
38826
+
38770
38827
  var thinkingAssistantGif = new URL('assets/fvai-thinking-C5DWvBNz.gif', import.meta.url).href;
38771
38828
 
38772
38829
  var idleAssistantGif = new URL('assets/fvai-idle-BhBsbPV4.gif', import.meta.url).href;
@@ -38818,11 +38875,18 @@ const _hoisted_18 = {
38818
38875
  class: "fv-msg-actions"
38819
38876
  };
38820
38877
  const _hoisted_19 = {
38878
+ key: 3,
38879
+ class: "fv-msg-feedback"
38880
+ };
38881
+ const _hoisted_20 = ["aria-label"];
38882
+ const _hoisted_21 = { class: "fv-msg-feedback-pop-title" };
38883
+ const _hoisted_22 = { class: "fv-msg-feedback-pop-actions" };
38884
+ const _hoisted_23 = {
38821
38885
  key: 0,
38822
38886
  class: "fv-msg-branch"
38823
38887
  };
38824
- const _hoisted_20 = { class: "fv-msg-branch-label" };
38825
- const _hoisted_21 = {
38888
+ const _hoisted_24 = { class: "fv-msg-branch-label" };
38889
+ const _hoisted_25 = {
38826
38890
  key: 1,
38827
38891
  class: "fv-msg-time"
38828
38892
  };
@@ -38854,9 +38918,10 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
38854
38918
  showTime: { type: Boolean, required: false, default: true },
38855
38919
  timeFormat: { type: Function, required: false, default: void 0 },
38856
38920
  resolveFileUrl: { type: Function, required: false, default: void 0 },
38921
+ feedbackHandler: { type: Function, required: false, default: void 0 },
38857
38922
  locale: { type: null, required: false }
38858
38923
  },
38859
- emits: ["copy", "regenerate", "branch-change", "typing", "followup-select", "file-click"],
38924
+ emits: ["copy", "regenerate", "branch-change", "typing", "followup-select", "file-click", "feedback-change", "feedback-error"],
38860
38925
  setup(__props, { expose: __expose, emit: __emit }) {
38861
38926
  const props = __props;
38862
38927
  const dict = useLocaleDict(() => props.locale);
@@ -39058,6 +39123,70 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
39058
39123
  if (!followupsEnabled.value) return;
39059
39124
  emit("followup-select", item, props.message);
39060
39125
  }
39126
+ const feedbackVisible = computed(
39127
+ () => !isUser.value && props.message.status === "done" && !!props.feedbackHandler
39128
+ );
39129
+ const feedbackAction = computed(
39130
+ () => props.message.feedback?.action ?? null
39131
+ );
39132
+ const isToolOnlyRow = computed(
39133
+ () => !isUser.value && !props.message.content && hasToolSteps.value
39134
+ );
39135
+ const dislikePopVisible = ref(false);
39136
+ const dislikeComment = ref("");
39137
+ const feedbackPending = ref(false);
39138
+ const feedbackPopRef = ref(null);
39139
+ function onDocMousedown(e) {
39140
+ if (!dislikePopVisible.value) return;
39141
+ const target = e.target;
39142
+ if (!target) return;
39143
+ if (feedbackPopRef.value?.contains(target)) return;
39144
+ if (target instanceof Element && target.closest(".fv-msg-feedback-btn")) return;
39145
+ dislikePopVisible.value = false;
39146
+ }
39147
+ watch(dislikePopVisible, (on) => {
39148
+ if (on) document.addEventListener("mousedown", onDocMousedown, true);
39149
+ else document.removeEventListener("mousedown", onDocMousedown, true);
39150
+ });
39151
+ onBeforeUnmount(() => document.removeEventListener("mousedown", onDocMousedown, true));
39152
+ async function submitFeedback(next, comment) {
39153
+ const handler = props.feedbackHandler;
39154
+ if (!handler || feedbackPending.value) return;
39155
+ const prev = props.message.feedback ? { ...props.message.feedback } : void 0;
39156
+ feedbackPending.value = true;
39157
+ try {
39158
+ props.message.feedback = next === "CLEAR" ? { action: null } : { action: next, ...comment ? { comment } : {} };
39159
+ const r = await handler(props.message, next, comment);
39160
+ if (typeof r === "string" && r) throw new Error(r);
39161
+ emit("feedback-change", props.message, next);
39162
+ } catch (e) {
39163
+ props.message.feedback = prev;
39164
+ emit("feedback-error", e instanceof Error ? e.message : String(e));
39165
+ } finally {
39166
+ feedbackPending.value = false;
39167
+ }
39168
+ }
39169
+ function onFeedbackClick(kind) {
39170
+ if (feedbackPending.value) return;
39171
+ if (feedbackAction.value === kind) {
39172
+ void submitFeedback("CLEAR");
39173
+ return;
39174
+ }
39175
+ if (kind === "LIKE") {
39176
+ dislikePopVisible.value = false;
39177
+ void submitFeedback("LIKE");
39178
+ return;
39179
+ }
39180
+ dislikePopVisible.value = !dislikePopVisible.value;
39181
+ }
39182
+ function onDislikeSubmit() {
39183
+ dislikePopVisible.value = false;
39184
+ void submitFeedback("DISLIKE", dislikeComment.value.trim() || void 0);
39185
+ }
39186
+ function onDislikeSkip() {
39187
+ dislikePopVisible.value = false;
39188
+ void submitFeedback("DISLIKE");
39189
+ }
39061
39190
  const resolvedUrls = ref({});
39062
39191
  const resolvingUrls = /* @__PURE__ */ new Set();
39063
39192
  function displayUrl(f) {
@@ -39080,7 +39209,7 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
39080
39209
  function onFileClick(f, index) {
39081
39210
  emit("file-click", f, props.message);
39082
39211
  if (f.type === "image" && displayUrl(f)) {
39083
- previewIndex.value = Math.max(0, index);
39212
+ previewIndex.value = Math.max(0, previewList.value.findIndex((x) => x.id === f.id));
39084
39213
  previewVisible.value = true;
39085
39214
  }
39086
39215
  }
@@ -39180,7 +39309,7 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
39180
39309
  type: "button",
39181
39310
  class: normalizeClass(["fv-msg-file", `is-${f.type ?? "file"}`]),
39182
39311
  title: f.name,
39183
- onClick: ($event) => onFileClick(f, i)
39312
+ onClick: ($event) => onFileClick(f)
39184
39313
  }, [
39185
39314
  f.type === "image" && displayUrl(f) ? (openBlock(), createElementBlock("img", {
39186
39315
  key: 0,
@@ -39288,7 +39417,7 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
39288
39417
  [
39289
39418
  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) "),
39290
39419
  createElementVNode("span", _hoisted_13, [
39291
- _cache[7] || (_cache[7] = createElementVNode(
39420
+ _cache[10] || (_cache[10] = createElementVNode(
39292
39421
  "span",
39293
39422
  {
39294
39423
  class: "fv-msg-spinner",
@@ -39342,8 +39471,8 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
39342
39471
  /* KEYED_FRAGMENT */
39343
39472
  ))
39344
39473
  ], 8, _hoisted_16)) : createCommentVNode("v-if", true),
39345
- 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) "),
39346
- __props.showActions || __props.showBranchSwitch && __props.branch && __props.branch.count > 1 ? (openBlock(), createElementBlock("div", _hoisted_18, [
39474
+ createCommentVNode(" \u64CD\u4F5C\u533A:assistant \u590D\u5236/\u91CD\u751F\u6210 + \u6D88\u606F\u8BC4\u4EF7 + \u5206\u652F\u5207\u6362;user \u4EC5\u590D\u5236(hover \u6D88\u606F\u65F6\u6D6E\u73B0,\u89C1 scss)\u3002\r\n feedbackVisible \u72EC\u7ACB\u4E8E showActions:\u5173\u95ED\u64CD\u4F5C\u6309\u94AE\u4E0D\u541E\u8BC4\u4EF7\u5165\u53E3 "),
39475
+ feedbackVisible.value || __props.showActions || __props.showBranchSwitch && __props.branch && __props.branch.count > 1 ? (openBlock(), createElementBlock("div", _hoisted_18, [
39347
39476
  renderSlot(_ctx.$slots, "message-actions", { message: __props.message }, () => [
39348
39477
  __props.showActions && isUser.value ? (openBlock(), createBlock(unref(ElTooltip), {
39349
39478
  key: 0,
@@ -39431,17 +39560,145 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
39431
39560
  ]),
39432
39561
  _: 1
39433
39562
  /* STABLE */
39434
- }, 8, ["content"])) : createCommentVNode("v-if", true)
39563
+ }, 8, ["content"])) : createCommentVNode("v-if", true),
39564
+ createCommentVNode(" \u6D88\u606F\u8BC4\u4EF7 \u{1F44D}/\u{1F44E}(assistant \u6700\u7EC8\u56DE\u7B54\u884C;\u518D\u6B21\u70B9\u51FB\u5F53\u524D\u6001\u53D6\u6D88):\r\n \u70B9\u8E29\u5E26\u9644\u8A00\u5F39\u5C42(popover \u5185 textarea \u2264500 \u53EF\u8DF3\u8FC7),\u4E50\u89C2\u66F4\u65B0\u5931\u8D25\u56DE\u6EDA "),
39565
+ feedbackVisible.value && !isToolOnlyRow.value ? (openBlock(), createElementBlock("span", _hoisted_19, [
39566
+ createVNode(unref(ElTooltip), {
39567
+ content: unref(dict).aiMessage.feedback.like,
39568
+ placement: "top"
39569
+ }, {
39570
+ default: withCtx(() => [
39571
+ createVNode(unref(ElButton), {
39572
+ text: "",
39573
+ size: "small",
39574
+ class: normalizeClass(["fv-msg-action fv-msg-feedback-btn", { "is-active": feedbackAction.value === "LIKE" }]),
39575
+ disabled: feedbackPending.value,
39576
+ "aria-label": feedbackAction.value === "LIKE" ? unref(dict).aiMessage.feedback.cleared : unref(dict).aiMessage.feedback.like,
39577
+ "aria-pressed": feedbackAction.value === "LIKE",
39578
+ onClick: _cache[5] || (_cache[5] = ($event) => onFeedbackClick("LIKE"))
39579
+ }, {
39580
+ default: withCtx(() => [
39581
+ createVNode(unref(ElIcon), null, {
39582
+ default: withCtx(() => [
39583
+ createVNode(unref(FeedbackThumbIcon), {
39584
+ kind: "like",
39585
+ filled: feedbackAction.value === "LIKE"
39586
+ }, null, 8, ["filled"])
39587
+ ]),
39588
+ _: 1
39589
+ /* STABLE */
39590
+ })
39591
+ ]),
39592
+ _: 1
39593
+ /* STABLE */
39594
+ }, 8, ["class", "disabled", "aria-label", "aria-pressed"])
39595
+ ]),
39596
+ _: 1
39597
+ /* STABLE */
39598
+ }, 8, ["content"]),
39599
+ createVNode(unref(ElTooltip), {
39600
+ content: unref(dict).aiMessage.feedback.dislike,
39601
+ placement: "top"
39602
+ }, {
39603
+ default: withCtx(() => [
39604
+ createVNode(unref(ElButton), {
39605
+ text: "",
39606
+ size: "small",
39607
+ class: normalizeClass(["fv-msg-action fv-msg-feedback-btn", { "is-active": feedbackAction.value === "DISLIKE" }]),
39608
+ disabled: feedbackPending.value,
39609
+ "aria-label": feedbackAction.value === "DISLIKE" ? unref(dict).aiMessage.feedback.cleared : unref(dict).aiMessage.feedback.dislike,
39610
+ "aria-pressed": feedbackAction.value === "DISLIKE",
39611
+ onClick: _cache[6] || (_cache[6] = ($event) => onFeedbackClick("DISLIKE"))
39612
+ }, {
39613
+ default: withCtx(() => [
39614
+ createVNode(unref(ElIcon), null, {
39615
+ default: withCtx(() => [
39616
+ createVNode(unref(FeedbackThumbIcon), {
39617
+ kind: "dislike",
39618
+ filled: feedbackAction.value === "DISLIKE"
39619
+ }, null, 8, ["filled"])
39620
+ ]),
39621
+ _: 1
39622
+ /* STABLE */
39623
+ })
39624
+ ]),
39625
+ _: 1
39626
+ /* STABLE */
39627
+ }, 8, ["class", "disabled", "aria-label", "aria-pressed"])
39628
+ ]),
39629
+ _: 1
39630
+ /* STABLE */
39631
+ }, 8, ["content"]),
39632
+ createCommentVNode(" \u70B9\u8E29\u9644\u8A00\u5F39\u5C42:\u70B9\u51FB \u{1F44E} \u5C55\u5F00\u5728\u6309\u94AE\u4E0B\u65B9(\u975E teleported,\u968F\u64CD\u4F5C\u533A\u5B9A\u4F4D);\r\n \u70B9\u5916\u6536\u5C42(\u8349\u7A3F\u4FDD\u7559);textarea \u2264500 \u9009\u586B,\u63D0\u4EA4\u5E26\u539F\u56E0/\u8DF3\u8FC7\u4E0D\u5E26 "),
39633
+ dislikePopVisible.value ? (openBlock(), createElementBlock("div", {
39634
+ key: 0,
39635
+ ref_key: "feedbackPopRef",
39636
+ ref: feedbackPopRef,
39637
+ class: "fv-msg-feedback-pop",
39638
+ role: "dialog",
39639
+ "aria-label": unref(dict).aiMessage.feedback.dislikeTitle
39640
+ }, [
39641
+ createElementVNode(
39642
+ "div",
39643
+ _hoisted_21,
39644
+ toDisplayString(unref(dict).aiMessage.feedback.dislikeTitle),
39645
+ 1
39646
+ /* TEXT */
39647
+ ),
39648
+ createVNode(unref(ElInput), {
39649
+ modelValue: dislikeComment.value,
39650
+ "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => dislikeComment.value = $event),
39651
+ type: "textarea",
39652
+ rows: 3,
39653
+ maxlength: "500",
39654
+ "show-word-limit": "",
39655
+ placeholder: unref(dict).aiMessage.feedback.dislikePlaceholder
39656
+ }, null, 8, ["modelValue", "placeholder"]),
39657
+ createElementVNode("div", _hoisted_22, [
39658
+ createVNode(unref(ElButton), {
39659
+ size: "small",
39660
+ text: "",
39661
+ onClick: onDislikeSkip
39662
+ }, {
39663
+ default: withCtx(() => [
39664
+ createTextVNode(
39665
+ toDisplayString(unref(dict).aiMessage.feedback.skip),
39666
+ 1
39667
+ /* TEXT */
39668
+ )
39669
+ ]),
39670
+ _: 1
39671
+ /* STABLE */
39672
+ }),
39673
+ createVNode(unref(ElButton), {
39674
+ size: "small",
39675
+ type: "primary",
39676
+ loading: feedbackPending.value,
39677
+ onClick: onDislikeSubmit
39678
+ }, {
39679
+ default: withCtx(() => [
39680
+ createTextVNode(
39681
+ toDisplayString(unref(dict).aiMessage.feedback.submit),
39682
+ 1
39683
+ /* TEXT */
39684
+ )
39685
+ ]),
39686
+ _: 1
39687
+ /* STABLE */
39688
+ }, 8, ["loading"])
39689
+ ])
39690
+ ], 8, _hoisted_20)) : createCommentVNode("v-if", true)
39691
+ ])) : createCommentVNode("v-if", true)
39435
39692
  ]),
39436
39693
  createCommentVNode(" \u5206\u652F\u5207\u6362:\u5144\u5F1F\u5206\u652F > 1 \u65F6 "),
39437
- __props.showBranchSwitch && __props.branch && __props.branch.count > 1 ? (openBlock(), createElementBlock("span", _hoisted_19, [
39694
+ __props.showBranchSwitch && __props.branch && __props.branch.count > 1 ? (openBlock(), createElementBlock("span", _hoisted_23, [
39438
39695
  createVNode(unref(ElButton), {
39439
39696
  text: "",
39440
39697
  size: "small",
39441
39698
  class: "fv-msg-action",
39442
39699
  disabled: __props.branch.index <= 1,
39443
39700
  "aria-label": unref(dict).aiMessage.prevBranch,
39444
- onClick: _cache[5] || (_cache[5] = ($event) => onBranch("prev"))
39701
+ onClick: _cache[8] || (_cache[8] = ($event) => onBranch("prev"))
39445
39702
  }, {
39446
39703
  default: withCtx(() => [
39447
39704
  createVNode(unref(ElIcon), null, {
@@ -39457,7 +39714,7 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
39457
39714
  }, 8, ["disabled", "aria-label"]),
39458
39715
  createElementVNode(
39459
39716
  "span",
39460
- _hoisted_20,
39717
+ _hoisted_24,
39461
39718
  toDisplayString(__props.branch.index) + " / " + toDisplayString(__props.branch.count),
39462
39719
  1
39463
39720
  /* TEXT */
@@ -39468,7 +39725,7 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
39468
39725
  class: "fv-msg-action",
39469
39726
  disabled: __props.branch.index >= __props.branch.count,
39470
39727
  "aria-label": unref(dict).aiMessage.nextBranch,
39471
- onClick: _cache[6] || (_cache[6] = ($event) => onBranch("next"))
39728
+ onClick: _cache[9] || (_cache[9] = ($event) => onBranch("next"))
39472
39729
  }, {
39473
39730
  default: withCtx(() => [
39474
39731
  createVNode(unref(ElIcon), null, {
@@ -39486,7 +39743,7 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
39486
39743
  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 "),
39487
39744
  messageTimeText.value && timeVisible.value ? (openBlock(), createElementBlock(
39488
39745
  "span",
39489
- _hoisted_21,
39746
+ _hoisted_25,
39490
39747
  toDisplayString(messageTimeText.value),
39491
39748
  1
39492
39749
  /* TEXT */
@@ -39539,9 +39796,10 @@ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
39539
39796
  showTime: { type: Boolean, required: false, default: true },
39540
39797
  timeFormat: { type: Function, required: false, default: void 0 },
39541
39798
  resolveFileUrl: { type: Function, required: false, default: void 0 },
39799
+ feedbackHandler: { type: Function, required: false, default: void 0 },
39542
39800
  locale: { type: null, required: false }
39543
39801
  },
39544
- emits: ["select", "copy", "regenerate", "branch-change", "scroll", "followup-select", "message-file-click"],
39802
+ emits: ["select", "copy", "regenerate", "branch-change", "scroll", "followup-select", "message-file-click", "feedback-change", "feedback-error"],
39545
39803
  setup(__props, { expose: __expose, emit: __emit }) {
39546
39804
  const props = __props;
39547
39805
  const dict = useLocaleDict(() => props.locale);
@@ -39655,6 +39913,12 @@ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
39655
39913
  function onFileClick(file, m) {
39656
39914
  emit("message-file-click", file, m);
39657
39915
  }
39916
+ function onFeedbackChange(m, action) {
39917
+ emit("feedback-change", m, action);
39918
+ }
39919
+ function onFeedbackError(message) {
39920
+ emit("feedback-error", message);
39921
+ }
39658
39922
  const lastMessageId = computed(() => props.messages.length ? props.messages[props.messages.length - 1].id : "");
39659
39923
  function scrollToTop() {
39660
39924
  const el = scrollRef.value;
@@ -39795,12 +40059,15 @@ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
39795
40059
  "time-format": __props.timeFormat,
39796
40060
  "code-trigger-langs": __props.codeTriggerLangs,
39797
40061
  "resolve-file-url": __props.resolveFileUrl,
40062
+ "feedback-handler": __props.feedbackHandler,
39798
40063
  onTyping: onChildTyping,
39799
40064
  onCopy,
39800
40065
  onRegenerate,
39801
40066
  onBranchChange: onBranch,
39802
40067
  onFollowupSelect: onFollowup,
39803
- onFileClick
40068
+ onFileClick,
40069
+ onFeedbackChange,
40070
+ onFeedbackError
39804
40071
  }, createSlots({
39805
40072
  _: 2
39806
40073
  /* DYNAMIC */
@@ -39847,7 +40114,7 @@ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
39847
40114
  ]),
39848
40115
  key: "5"
39849
40116
  } : void 0
39850
- ]), 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"]);
40117
+ ]), 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", "feedback-handler"]);
39851
40118
  }),
39852
40119
  128
39853
40120
  /* KEYED_FRAGMENT */
@@ -40219,10 +40486,11 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
40219
40486
  attachmentLimit: { type: Number, required: false, default: 0 },
40220
40487
  uploadAttachment: { type: Function, required: false, default: void 0 },
40221
40488
  resolveFileUrl: { type: Function, required: false, default: void 0 },
40489
+ feedbackHandler: { type: Function, required: false, default: void 0 },
40222
40490
  theme: { type: String, required: false, default: "light" },
40223
40491
  locale: { type: null, required: false }
40224
40492
  },
40225
- emits: ["update:messages", "send", "suggestion-select", "followup-select", "message-complete", "error", "branch-change", "attachment-exceed", "attachment-uploaded", "message-file-click", "scroll", "tool-event"],
40493
+ emits: ["update:messages", "send", "suggestion-select", "followup-select", "message-complete", "error", "branch-change", "attachment-exceed", "attachment-uploaded", "message-file-click", "feedback-change", "feedback-error", "scroll", "tool-event"],
40226
40494
  setup(__props, { expose: __expose, emit: __emit }) {
40227
40495
  const props = __props;
40228
40496
  const dict = useLocaleDict(() => props.locale);
@@ -40516,6 +40784,12 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
40516
40784
  function onMessageFileClick(file, message) {
40517
40785
  emit("message-file-click", file, message);
40518
40786
  }
40787
+ function onFeedbackChange(message, action) {
40788
+ emit("feedback-change", message, action);
40789
+ }
40790
+ function onFeedbackError(message) {
40791
+ emit("feedback-error", message);
40792
+ }
40519
40793
  __expose({ sendMessage, stop, regenerate, appendToMessage, clearMessages, exportTxt, openArtifact, expandThoughtChains, collapseThoughtChains, scrollTo });
40520
40794
  return (_ctx, _cache) => {
40521
40795
  return openBlock(), createElementBlock(
@@ -40595,13 +40869,16 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
40595
40869
  "time-format": __props.timeFormat,
40596
40870
  "code-trigger-langs": artifactsOn.value && artifactsCodeTrigger.value ? ["html", "svg"] : void 0,
40597
40871
  "resolve-file-url": __props.resolveFileUrl,
40872
+ "feedback-handler": __props.feedbackHandler,
40598
40873
  onSelect: onSelectSuggestion,
40599
40874
  onFollowupSelect,
40600
40875
  onCopy,
40601
40876
  onRegenerate,
40602
40877
  onBranchChange,
40603
40878
  onScroll: onMessagesScroll,
40604
- onMessageFileClick
40879
+ onMessageFileClick,
40880
+ onFeedbackChange,
40881
+ onFeedbackError
40605
40882
  }, createSlots({
40606
40883
  _: 2
40607
40884
  /* DYNAMIC */
@@ -40697,7 +40974,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
40697
40974
  ]),
40698
40975
  key: "12"
40699
40976
  } : void 0
40700
- ]), 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"]),
40977
+ ]), 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", "feedback-handler"]),
40701
40978
  artifactsOn.value && artifacts.value.length ? (openBlock(), createBlock(_sfc_main$1, {
40702
40979
  key: 0,
40703
40980
  artifacts: artifacts.value,