@fv-ui/ai-chat 1.4.2 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +323 -240
- package/dist/style.css +1 -1
- package/es/index.mjs +282 -23
- package/lib/index.js +281 -22
- package/package.json +1 -1
package/es/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { shallowRef, inject, computed, provide, defineComponent, ref, onBeforeUnmount, openBlock, createElementBlock, Fragment, createElementVNode, createCommentVNode, createBlock, Teleport, watch, normalizeClass, createTextVNode, toDisplayString, normalizeStyle, renderSlot, unref, renderList, createVNode, isRef, nextTick, onMounted, mergeProps, createSlots, withCtx, Transition, getCurrentInstance, useSlots, normalizeProps, guardReactiveProps, reactive, resolveDynamicComponent, markRaw, withModifiers, h, onActivated } from 'vue';
|
|
2
|
-
import { ElMessage, ElAvatar, ElButton, ElIcon, ElPopover, ElDialog, ElScrollbar, ElDropdown, ElDropdownMenu, ElDropdownItem, ElMessageBox, 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 THUMB_PATH = "M960 432c0-26.4-21.6-48-48-48H667.2l45.6-208.8c1.6-6.4 1.6-13.6-0.8-20.8-8-25.6-34.4-39.2-60-31.2-12.8 4-24.8 12-34.4 21.6L460 344.8c-10.4 10.4-24 16-38.4 16H160c-35.2 0-64 28.8-64 64v384c0 35.2 28.8 64 64 64h601.6c44.8 0 83.2-31.2 92.8-75.2l66.4-331.2c1.6-6.4 1.6-13.6 1.6-20.8V432z m-704 384c0 8.8-7.2 16-16 16h-48c-8.8 0-16-7.2-16-16V456c0-8.8 7.2-16 16-16h48c8.8 0 16 7.2 16 16v360z";
|
|
38798
|
+
const FeedbackThumbIcon = defineComponent({
|
|
38799
|
+
name: "FvFeedbackThumbIcon",
|
|
38800
|
+
props: {
|
|
38801
|
+
/** 朝向:up 点赞 / down 点踩(翻转) */
|
|
38802
|
+
flip: { type: Boolean, default: false },
|
|
38803
|
+
/** 实底态(当前评价高亮);缺省线性 */
|
|
38804
|
+
filled: { type: Boolean, default: false }
|
|
38805
|
+
},
|
|
38806
|
+
setup(props) {
|
|
38807
|
+
return () => h("svg", {
|
|
38808
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
38809
|
+
viewBox: "0 0 1024 1024",
|
|
38810
|
+
"aria-hidden": "true",
|
|
38811
|
+
...props.flip ? { style: "transform: scaleY(-1)" } : {}
|
|
38812
|
+
}, [
|
|
38813
|
+
h("path", {
|
|
38814
|
+
d: THUMB_PATH,
|
|
38815
|
+
...props.filled ? { fill: "currentColor" } : {
|
|
38816
|
+
fill: "none",
|
|
38817
|
+
stroke: "currentColor",
|
|
38818
|
+
"stroke-width": 64,
|
|
38819
|
+
"stroke-linejoin": "round",
|
|
38820
|
+
"stroke-linecap": "round"
|
|
38821
|
+
}
|
|
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
|
|
38825
|
-
const
|
|
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,55 @@ 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
|
+
async function submitFeedback(next, comment) {
|
|
39139
|
+
const handler = props.feedbackHandler;
|
|
39140
|
+
if (!handler || feedbackPending.value) return;
|
|
39141
|
+
const prev = props.message.feedback ? { ...props.message.feedback } : void 0;
|
|
39142
|
+
feedbackPending.value = true;
|
|
39143
|
+
try {
|
|
39144
|
+
props.message.feedback = next === "CLEAR" ? { action: null } : { action: next, ...comment ? { comment } : {} };
|
|
39145
|
+
await handler(props.message, next, comment);
|
|
39146
|
+
emit("feedback-change", props.message, next);
|
|
39147
|
+
} catch (e) {
|
|
39148
|
+
props.message.feedback = prev;
|
|
39149
|
+
emit("feedback-error", e instanceof Error ? e.message : String(e));
|
|
39150
|
+
} finally {
|
|
39151
|
+
feedbackPending.value = false;
|
|
39152
|
+
}
|
|
39153
|
+
}
|
|
39154
|
+
function onFeedbackClick(kind) {
|
|
39155
|
+
if (feedbackPending.value) return;
|
|
39156
|
+
if (feedbackAction.value === kind) {
|
|
39157
|
+
void submitFeedback("CLEAR");
|
|
39158
|
+
return;
|
|
39159
|
+
}
|
|
39160
|
+
if (kind === "LIKE") {
|
|
39161
|
+
dislikePopVisible.value = false;
|
|
39162
|
+
void submitFeedback("LIKE");
|
|
39163
|
+
return;
|
|
39164
|
+
}
|
|
39165
|
+
dislikePopVisible.value = !dislikePopVisible.value;
|
|
39166
|
+
}
|
|
39167
|
+
function onDislikeSubmit() {
|
|
39168
|
+
dislikePopVisible.value = false;
|
|
39169
|
+
void submitFeedback("DISLIKE", dislikeComment.value.trim() || void 0);
|
|
39170
|
+
}
|
|
39171
|
+
function onDislikeSkip() {
|
|
39172
|
+
dislikePopVisible.value = false;
|
|
39173
|
+
void submitFeedback("DISLIKE");
|
|
39174
|
+
}
|
|
39061
39175
|
const resolvedUrls = ref({});
|
|
39062
39176
|
const resolvingUrls = /* @__PURE__ */ new Set();
|
|
39063
39177
|
function displayUrl(f) {
|
|
@@ -39288,7 +39402,7 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
39288
39402
|
[
|
|
39289
39403
|
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
39404
|
createElementVNode("span", _hoisted_13, [
|
|
39291
|
-
_cache[
|
|
39405
|
+
_cache[10] || (_cache[10] = createElementVNode(
|
|
39292
39406
|
"span",
|
|
39293
39407
|
{
|
|
39294
39408
|
class: "fv-msg-spinner",
|
|
@@ -39342,8 +39456,8 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
39342
39456
|
/* KEYED_FRAGMENT */
|
|
39343
39457
|
))
|
|
39344
39458
|
], 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, [
|
|
39459
|
+
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 "),
|
|
39460
|
+
feedbackVisible.value || __props.showActions || __props.showBranchSwitch && __props.branch && __props.branch.count > 1 ? (openBlock(), createElementBlock("div", _hoisted_18, [
|
|
39347
39461
|
renderSlot(_ctx.$slots, "message-actions", { message: __props.message }, () => [
|
|
39348
39462
|
__props.showActions && isUser.value ? (openBlock(), createBlock(unref(ElTooltip), {
|
|
39349
39463
|
key: 0,
|
|
@@ -39431,17 +39545,142 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
39431
39545
|
]),
|
|
39432
39546
|
_: 1
|
|
39433
39547
|
/* STABLE */
|
|
39434
|
-
}, 8, ["content"])) : createCommentVNode("v-if", true)
|
|
39548
|
+
}, 8, ["content"])) : createCommentVNode("v-if", true),
|
|
39549
|
+
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 "),
|
|
39550
|
+
feedbackVisible.value && !isToolOnlyRow.value ? (openBlock(), createElementBlock("span", _hoisted_19, [
|
|
39551
|
+
createVNode(unref(ElTooltip), {
|
|
39552
|
+
content: unref(dict).aiMessage.feedback.like,
|
|
39553
|
+
placement: "top"
|
|
39554
|
+
}, {
|
|
39555
|
+
default: withCtx(() => [
|
|
39556
|
+
createVNode(unref(ElButton), {
|
|
39557
|
+
text: "",
|
|
39558
|
+
size: "small",
|
|
39559
|
+
class: normalizeClass(["fv-msg-action fv-msg-feedback-btn", { "is-active": feedbackAction.value === "LIKE" }]),
|
|
39560
|
+
disabled: feedbackPending.value,
|
|
39561
|
+
"aria-label": feedbackAction.value === "LIKE" ? unref(dict).aiMessage.feedback.cleared : unref(dict).aiMessage.feedback.like,
|
|
39562
|
+
"aria-pressed": feedbackAction.value === "LIKE",
|
|
39563
|
+
onClick: _cache[5] || (_cache[5] = ($event) => onFeedbackClick("LIKE"))
|
|
39564
|
+
}, {
|
|
39565
|
+
default: withCtx(() => [
|
|
39566
|
+
createVNode(unref(ElIcon), null, {
|
|
39567
|
+
default: withCtx(() => [
|
|
39568
|
+
createVNode(unref(FeedbackThumbIcon), {
|
|
39569
|
+
filled: feedbackAction.value === "LIKE"
|
|
39570
|
+
}, null, 8, ["filled"])
|
|
39571
|
+
]),
|
|
39572
|
+
_: 1
|
|
39573
|
+
/* STABLE */
|
|
39574
|
+
})
|
|
39575
|
+
]),
|
|
39576
|
+
_: 1
|
|
39577
|
+
/* STABLE */
|
|
39578
|
+
}, 8, ["class", "disabled", "aria-label", "aria-pressed"])
|
|
39579
|
+
]),
|
|
39580
|
+
_: 1
|
|
39581
|
+
/* STABLE */
|
|
39582
|
+
}, 8, ["content"]),
|
|
39583
|
+
createVNode(unref(ElTooltip), {
|
|
39584
|
+
content: unref(dict).aiMessage.feedback.dislike,
|
|
39585
|
+
placement: "top"
|
|
39586
|
+
}, {
|
|
39587
|
+
default: withCtx(() => [
|
|
39588
|
+
createVNode(unref(ElButton), {
|
|
39589
|
+
text: "",
|
|
39590
|
+
size: "small",
|
|
39591
|
+
class: normalizeClass(["fv-msg-action fv-msg-feedback-btn", { "is-active": feedbackAction.value === "DISLIKE" }]),
|
|
39592
|
+
disabled: feedbackPending.value,
|
|
39593
|
+
"aria-label": feedbackAction.value === "DISLIKE" ? unref(dict).aiMessage.feedback.cleared : unref(dict).aiMessage.feedback.dislike,
|
|
39594
|
+
"aria-pressed": feedbackAction.value === "DISLIKE",
|
|
39595
|
+
onClick: _cache[6] || (_cache[6] = ($event) => onFeedbackClick("DISLIKE"))
|
|
39596
|
+
}, {
|
|
39597
|
+
default: withCtx(() => [
|
|
39598
|
+
createVNode(unref(ElIcon), null, {
|
|
39599
|
+
default: withCtx(() => [
|
|
39600
|
+
createVNode(unref(FeedbackThumbIcon), {
|
|
39601
|
+
flip: "",
|
|
39602
|
+
filled: feedbackAction.value === "DISLIKE"
|
|
39603
|
+
}, null, 8, ["filled"])
|
|
39604
|
+
]),
|
|
39605
|
+
_: 1
|
|
39606
|
+
/* STABLE */
|
|
39607
|
+
})
|
|
39608
|
+
]),
|
|
39609
|
+
_: 1
|
|
39610
|
+
/* STABLE */
|
|
39611
|
+
}, 8, ["class", "disabled", "aria-label", "aria-pressed"])
|
|
39612
|
+
]),
|
|
39613
|
+
_: 1
|
|
39614
|
+
/* STABLE */
|
|
39615
|
+
}, 8, ["content"]),
|
|
39616
|
+
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 textarea \u2264500 \u9009\u586B,\u63D0\u4EA4\u5E26\u539F\u56E0/\u8DF3\u8FC7\u4E0D\u5E26 "),
|
|
39617
|
+
dislikePopVisible.value ? (openBlock(), createElementBlock("div", {
|
|
39618
|
+
key: 0,
|
|
39619
|
+
class: "fv-msg-feedback-pop",
|
|
39620
|
+
role: "dialog",
|
|
39621
|
+
"aria-label": unref(dict).aiMessage.feedback.dislikeTitle
|
|
39622
|
+
}, [
|
|
39623
|
+
createElementVNode(
|
|
39624
|
+
"div",
|
|
39625
|
+
_hoisted_21,
|
|
39626
|
+
toDisplayString(unref(dict).aiMessage.feedback.dislikeTitle),
|
|
39627
|
+
1
|
|
39628
|
+
/* TEXT */
|
|
39629
|
+
),
|
|
39630
|
+
createVNode(unref(ElInput), {
|
|
39631
|
+
modelValue: dislikeComment.value,
|
|
39632
|
+
"onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => dislikeComment.value = $event),
|
|
39633
|
+
type: "textarea",
|
|
39634
|
+
rows: 3,
|
|
39635
|
+
maxlength: "500",
|
|
39636
|
+
"show-word-limit": "",
|
|
39637
|
+
placeholder: unref(dict).aiMessage.feedback.dislikePlaceholder
|
|
39638
|
+
}, null, 8, ["modelValue", "placeholder"]),
|
|
39639
|
+
createElementVNode("div", _hoisted_22, [
|
|
39640
|
+
createVNode(unref(ElButton), {
|
|
39641
|
+
size: "small",
|
|
39642
|
+
text: "",
|
|
39643
|
+
onClick: onDislikeSkip
|
|
39644
|
+
}, {
|
|
39645
|
+
default: withCtx(() => [
|
|
39646
|
+
createTextVNode(
|
|
39647
|
+
toDisplayString(unref(dict).aiMessage.feedback.skip),
|
|
39648
|
+
1
|
|
39649
|
+
/* TEXT */
|
|
39650
|
+
)
|
|
39651
|
+
]),
|
|
39652
|
+
_: 1
|
|
39653
|
+
/* STABLE */
|
|
39654
|
+
}),
|
|
39655
|
+
createVNode(unref(ElButton), {
|
|
39656
|
+
size: "small",
|
|
39657
|
+
type: "primary",
|
|
39658
|
+
loading: feedbackPending.value,
|
|
39659
|
+
onClick: onDislikeSubmit
|
|
39660
|
+
}, {
|
|
39661
|
+
default: withCtx(() => [
|
|
39662
|
+
createTextVNode(
|
|
39663
|
+
toDisplayString(unref(dict).aiMessage.feedback.submit),
|
|
39664
|
+
1
|
|
39665
|
+
/* TEXT */
|
|
39666
|
+
)
|
|
39667
|
+
]),
|
|
39668
|
+
_: 1
|
|
39669
|
+
/* STABLE */
|
|
39670
|
+
}, 8, ["loading"])
|
|
39671
|
+
])
|
|
39672
|
+
], 8, _hoisted_20)) : createCommentVNode("v-if", true)
|
|
39673
|
+
])) : createCommentVNode("v-if", true)
|
|
39435
39674
|
]),
|
|
39436
39675
|
createCommentVNode(" \u5206\u652F\u5207\u6362:\u5144\u5F1F\u5206\u652F > 1 \u65F6 "),
|
|
39437
|
-
__props.showBranchSwitch && __props.branch && __props.branch.count > 1 ? (openBlock(), createElementBlock("span",
|
|
39676
|
+
__props.showBranchSwitch && __props.branch && __props.branch.count > 1 ? (openBlock(), createElementBlock("span", _hoisted_23, [
|
|
39438
39677
|
createVNode(unref(ElButton), {
|
|
39439
39678
|
text: "",
|
|
39440
39679
|
size: "small",
|
|
39441
39680
|
class: "fv-msg-action",
|
|
39442
39681
|
disabled: __props.branch.index <= 1,
|
|
39443
39682
|
"aria-label": unref(dict).aiMessage.prevBranch,
|
|
39444
|
-
onClick: _cache[
|
|
39683
|
+
onClick: _cache[8] || (_cache[8] = ($event) => onBranch("prev"))
|
|
39445
39684
|
}, {
|
|
39446
39685
|
default: withCtx(() => [
|
|
39447
39686
|
createVNode(unref(ElIcon), null, {
|
|
@@ -39457,7 +39696,7 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
39457
39696
|
}, 8, ["disabled", "aria-label"]),
|
|
39458
39697
|
createElementVNode(
|
|
39459
39698
|
"span",
|
|
39460
|
-
|
|
39699
|
+
_hoisted_24,
|
|
39461
39700
|
toDisplayString(__props.branch.index) + " / " + toDisplayString(__props.branch.count),
|
|
39462
39701
|
1
|
|
39463
39702
|
/* TEXT */
|
|
@@ -39468,7 +39707,7 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
39468
39707
|
class: "fv-msg-action",
|
|
39469
39708
|
disabled: __props.branch.index >= __props.branch.count,
|
|
39470
39709
|
"aria-label": unref(dict).aiMessage.nextBranch,
|
|
39471
|
-
onClick: _cache[
|
|
39710
|
+
onClick: _cache[9] || (_cache[9] = ($event) => onBranch("next"))
|
|
39472
39711
|
}, {
|
|
39473
39712
|
default: withCtx(() => [
|
|
39474
39713
|
createVNode(unref(ElIcon), null, {
|
|
@@ -39486,7 +39725,7 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
39486
39725
|
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
39726
|
messageTimeText.value && timeVisible.value ? (openBlock(), createElementBlock(
|
|
39488
39727
|
"span",
|
|
39489
|
-
|
|
39728
|
+
_hoisted_25,
|
|
39490
39729
|
toDisplayString(messageTimeText.value),
|
|
39491
39730
|
1
|
|
39492
39731
|
/* TEXT */
|
|
@@ -39539,9 +39778,10 @@ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
39539
39778
|
showTime: { type: Boolean, required: false, default: true },
|
|
39540
39779
|
timeFormat: { type: Function, required: false, default: void 0 },
|
|
39541
39780
|
resolveFileUrl: { type: Function, required: false, default: void 0 },
|
|
39781
|
+
feedbackHandler: { type: Function, required: false, default: void 0 },
|
|
39542
39782
|
locale: { type: null, required: false }
|
|
39543
39783
|
},
|
|
39544
|
-
emits: ["select", "copy", "regenerate", "branch-change", "scroll", "followup-select", "message-file-click"],
|
|
39784
|
+
emits: ["select", "copy", "regenerate", "branch-change", "scroll", "followup-select", "message-file-click", "feedback-change", "feedback-error"],
|
|
39545
39785
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
39546
39786
|
const props = __props;
|
|
39547
39787
|
const dict = useLocaleDict(() => props.locale);
|
|
@@ -39655,6 +39895,12 @@ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
39655
39895
|
function onFileClick(file, m) {
|
|
39656
39896
|
emit("message-file-click", file, m);
|
|
39657
39897
|
}
|
|
39898
|
+
function onFeedbackChange(m, action) {
|
|
39899
|
+
emit("feedback-change", m, action);
|
|
39900
|
+
}
|
|
39901
|
+
function onFeedbackError(message) {
|
|
39902
|
+
emit("feedback-error", message);
|
|
39903
|
+
}
|
|
39658
39904
|
const lastMessageId = computed(() => props.messages.length ? props.messages[props.messages.length - 1].id : "");
|
|
39659
39905
|
function scrollToTop() {
|
|
39660
39906
|
const el = scrollRef.value;
|
|
@@ -39795,12 +40041,15 @@ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
39795
40041
|
"time-format": __props.timeFormat,
|
|
39796
40042
|
"code-trigger-langs": __props.codeTriggerLangs,
|
|
39797
40043
|
"resolve-file-url": __props.resolveFileUrl,
|
|
40044
|
+
"feedback-handler": __props.feedbackHandler,
|
|
39798
40045
|
onTyping: onChildTyping,
|
|
39799
40046
|
onCopy,
|
|
39800
40047
|
onRegenerate,
|
|
39801
40048
|
onBranchChange: onBranch,
|
|
39802
40049
|
onFollowupSelect: onFollowup,
|
|
39803
|
-
onFileClick
|
|
40050
|
+
onFileClick,
|
|
40051
|
+
onFeedbackChange,
|
|
40052
|
+
onFeedbackError
|
|
39804
40053
|
}, createSlots({
|
|
39805
40054
|
_: 2
|
|
39806
40055
|
/* DYNAMIC */
|
|
@@ -39847,7 +40096,7 @@ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
39847
40096
|
]),
|
|
39848
40097
|
key: "5"
|
|
39849
40098
|
} : 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"]);
|
|
40099
|
+
]), 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
40100
|
}),
|
|
39852
40101
|
128
|
|
39853
40102
|
/* KEYED_FRAGMENT */
|
|
@@ -40219,10 +40468,11 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
40219
40468
|
attachmentLimit: { type: Number, required: false, default: 0 },
|
|
40220
40469
|
uploadAttachment: { type: Function, required: false, default: void 0 },
|
|
40221
40470
|
resolveFileUrl: { type: Function, required: false, default: void 0 },
|
|
40471
|
+
feedbackHandler: { type: Function, required: false, default: void 0 },
|
|
40222
40472
|
theme: { type: String, required: false, default: "light" },
|
|
40223
40473
|
locale: { type: null, required: false }
|
|
40224
40474
|
},
|
|
40225
|
-
emits: ["update:messages", "send", "suggestion-select", "followup-select", "message-complete", "error", "branch-change", "attachment-exceed", "attachment-uploaded", "message-file-click", "scroll", "tool-event"],
|
|
40475
|
+
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
40476
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
40227
40477
|
const props = __props;
|
|
40228
40478
|
const dict = useLocaleDict(() => props.locale);
|
|
@@ -40516,6 +40766,12 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
40516
40766
|
function onMessageFileClick(file, message) {
|
|
40517
40767
|
emit("message-file-click", file, message);
|
|
40518
40768
|
}
|
|
40769
|
+
function onFeedbackChange(message, action) {
|
|
40770
|
+
emit("feedback-change", message, action);
|
|
40771
|
+
}
|
|
40772
|
+
function onFeedbackError(message) {
|
|
40773
|
+
emit("feedback-error", message);
|
|
40774
|
+
}
|
|
40519
40775
|
__expose({ sendMessage, stop, regenerate, appendToMessage, clearMessages, exportTxt, openArtifact, expandThoughtChains, collapseThoughtChains, scrollTo });
|
|
40520
40776
|
return (_ctx, _cache) => {
|
|
40521
40777
|
return openBlock(), createElementBlock(
|
|
@@ -40595,13 +40851,16 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
40595
40851
|
"time-format": __props.timeFormat,
|
|
40596
40852
|
"code-trigger-langs": artifactsOn.value && artifactsCodeTrigger.value ? ["html", "svg"] : void 0,
|
|
40597
40853
|
"resolve-file-url": __props.resolveFileUrl,
|
|
40854
|
+
"feedback-handler": __props.feedbackHandler,
|
|
40598
40855
|
onSelect: onSelectSuggestion,
|
|
40599
40856
|
onFollowupSelect,
|
|
40600
40857
|
onCopy,
|
|
40601
40858
|
onRegenerate,
|
|
40602
40859
|
onBranchChange,
|
|
40603
40860
|
onScroll: onMessagesScroll,
|
|
40604
|
-
onMessageFileClick
|
|
40861
|
+
onMessageFileClick,
|
|
40862
|
+
onFeedbackChange,
|
|
40863
|
+
onFeedbackError
|
|
40605
40864
|
}, createSlots({
|
|
40606
40865
|
_: 2
|
|
40607
40866
|
/* DYNAMIC */
|
|
@@ -40697,7 +40956,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
40697
40956
|
]),
|
|
40698
40957
|
key: "12"
|
|
40699
40958
|
} : 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"]),
|
|
40959
|
+
]), 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
40960
|
artifactsOn.value && artifacts.value.length ? (openBlock(), createBlock(_sfc_main$1, {
|
|
40702
40961
|
key: 0,
|
|
40703
40962
|
artifacts: artifacts.value,
|