@fv-ui/ai-chat 1.4.1 → 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 +326 -240
- package/dist/style.css +1 -1
- package/es/index.mjs +290 -28
- package/lib/index.js +289 -27
- 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 */
|
|
@@ -37678,6 +37705,7 @@ var _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
37678
37705
|
count: { type: Number, required: false, default: 0 },
|
|
37679
37706
|
beforeUpload: { type: Function, required: false, default: void 0 },
|
|
37680
37707
|
upload: { type: Function, required: false, default: void 0 },
|
|
37708
|
+
disabled: { type: Boolean, required: false, default: false },
|
|
37681
37709
|
layout: { type: String, required: false, default: "inline" },
|
|
37682
37710
|
locale: { type: null, required: false, default: void 0 }
|
|
37683
37711
|
},
|
|
@@ -37821,12 +37849,12 @@ var _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
37821
37849
|
multiple: "",
|
|
37822
37850
|
onChange
|
|
37823
37851
|
}, null, 40, _hoisted_2$5),
|
|
37824
|
-
createCommentVNode(" \u89E6\u53D1\u6309\u94AE:\u56DE\u5F62\u9488;count \u6EE1\u65F6\u7981\u7528(listOnly \u5E03\u5C40\u4E0D\u6E32\u67D3) "),
|
|
37852
|
+
createCommentVNode(" \u89E6\u53D1\u6309\u94AE:\u56DE\u5F62\u9488;count \u6EE1\u6216\u6574\u4F53\u7981\u7528\u65F6\u7981\u7528(listOnly \u5E03\u5C40\u4E0D\u6E32\u67D3) "),
|
|
37825
37853
|
__props.layout !== "listOnly" ? (openBlock(), createElementBlock("button", {
|
|
37826
37854
|
key: 0,
|
|
37827
37855
|
type: "button",
|
|
37828
|
-
class: normalizeClass(["fv-attachments-trigger", { "is-full": full.value }]),
|
|
37829
|
-
disabled: full.value,
|
|
37856
|
+
class: normalizeClass(["fv-attachments-trigger", { "is-full": full.value || __props.disabled }]),
|
|
37857
|
+
disabled: full.value || __props.disabled,
|
|
37830
37858
|
"aria-label": unref(dict).attachments.add,
|
|
37831
37859
|
onClick: openSelect
|
|
37832
37860
|
}, [
|
|
@@ -38766,6 +38794,36 @@ const BulbIcon = defineComponent({
|
|
|
38766
38794
|
}
|
|
38767
38795
|
});
|
|
38768
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
|
+
|
|
38769
38827
|
var thinkingAssistantGif = new URL('assets/fvai-thinking-C5DWvBNz.gif', import.meta.url).href;
|
|
38770
38828
|
|
|
38771
38829
|
var idleAssistantGif = new URL('assets/fvai-idle-BhBsbPV4.gif', import.meta.url).href;
|
|
@@ -38817,11 +38875,18 @@ const _hoisted_18 = {
|
|
|
38817
38875
|
class: "fv-msg-actions"
|
|
38818
38876
|
};
|
|
38819
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 = {
|
|
38820
38885
|
key: 0,
|
|
38821
38886
|
class: "fv-msg-branch"
|
|
38822
38887
|
};
|
|
38823
|
-
const
|
|
38824
|
-
const
|
|
38888
|
+
const _hoisted_24 = { class: "fv-msg-branch-label" };
|
|
38889
|
+
const _hoisted_25 = {
|
|
38825
38890
|
key: 1,
|
|
38826
38891
|
class: "fv-msg-time"
|
|
38827
38892
|
};
|
|
@@ -38853,9 +38918,10 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
38853
38918
|
showTime: { type: Boolean, required: false, default: true },
|
|
38854
38919
|
timeFormat: { type: Function, required: false, default: void 0 },
|
|
38855
38920
|
resolveFileUrl: { type: Function, required: false, default: void 0 },
|
|
38921
|
+
feedbackHandler: { type: Function, required: false, default: void 0 },
|
|
38856
38922
|
locale: { type: null, required: false }
|
|
38857
38923
|
},
|
|
38858
|
-
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"],
|
|
38859
38925
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
38860
38926
|
const props = __props;
|
|
38861
38927
|
const dict = useLocaleDict(() => props.locale);
|
|
@@ -39057,6 +39123,55 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
39057
39123
|
if (!followupsEnabled.value) return;
|
|
39058
39124
|
emit("followup-select", item, props.message);
|
|
39059
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
|
+
}
|
|
39060
39175
|
const resolvedUrls = ref({});
|
|
39061
39176
|
const resolvingUrls = /* @__PURE__ */ new Set();
|
|
39062
39177
|
function displayUrl(f) {
|
|
@@ -39287,7 +39402,7 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
39287
39402
|
[
|
|
39288
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) "),
|
|
39289
39404
|
createElementVNode("span", _hoisted_13, [
|
|
39290
|
-
_cache[
|
|
39405
|
+
_cache[10] || (_cache[10] = createElementVNode(
|
|
39291
39406
|
"span",
|
|
39292
39407
|
{
|
|
39293
39408
|
class: "fv-msg-spinner",
|
|
@@ -39341,8 +39456,8 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
39341
39456
|
/* KEYED_FRAGMENT */
|
|
39342
39457
|
))
|
|
39343
39458
|
], 8, _hoisted_16)) : createCommentVNode("v-if", true),
|
|
39344
|
-
createCommentVNode(" \u64CD\u4F5C\u533A:assistant \u590D\u5236/\u91CD\u751F\u6210 + \u5206\u652F\u5207\u6362;user \u4EC5\u590D\u5236(hover \u6D88\u606F\u65F6\u6D6E\u73B0,\u89C1 scss) "),
|
|
39345
|
-
__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, [
|
|
39346
39461
|
renderSlot(_ctx.$slots, "message-actions", { message: __props.message }, () => [
|
|
39347
39462
|
__props.showActions && isUser.value ? (openBlock(), createBlock(unref(ElTooltip), {
|
|
39348
39463
|
key: 0,
|
|
@@ -39430,17 +39545,142 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
39430
39545
|
]),
|
|
39431
39546
|
_: 1
|
|
39432
39547
|
/* STABLE */
|
|
39433
|
-
}, 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)
|
|
39434
39674
|
]),
|
|
39435
39675
|
createCommentVNode(" \u5206\u652F\u5207\u6362:\u5144\u5F1F\u5206\u652F > 1 \u65F6 "),
|
|
39436
|
-
__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, [
|
|
39437
39677
|
createVNode(unref(ElButton), {
|
|
39438
39678
|
text: "",
|
|
39439
39679
|
size: "small",
|
|
39440
39680
|
class: "fv-msg-action",
|
|
39441
39681
|
disabled: __props.branch.index <= 1,
|
|
39442
39682
|
"aria-label": unref(dict).aiMessage.prevBranch,
|
|
39443
|
-
onClick: _cache[
|
|
39683
|
+
onClick: _cache[8] || (_cache[8] = ($event) => onBranch("prev"))
|
|
39444
39684
|
}, {
|
|
39445
39685
|
default: withCtx(() => [
|
|
39446
39686
|
createVNode(unref(ElIcon), null, {
|
|
@@ -39456,7 +39696,7 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
39456
39696
|
}, 8, ["disabled", "aria-label"]),
|
|
39457
39697
|
createElementVNode(
|
|
39458
39698
|
"span",
|
|
39459
|
-
|
|
39699
|
+
_hoisted_24,
|
|
39460
39700
|
toDisplayString(__props.branch.index) + " / " + toDisplayString(__props.branch.count),
|
|
39461
39701
|
1
|
|
39462
39702
|
/* TEXT */
|
|
@@ -39467,7 +39707,7 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
39467
39707
|
class: "fv-msg-action",
|
|
39468
39708
|
disabled: __props.branch.index >= __props.branch.count,
|
|
39469
39709
|
"aria-label": unref(dict).aiMessage.nextBranch,
|
|
39470
|
-
onClick: _cache[
|
|
39710
|
+
onClick: _cache[9] || (_cache[9] = ($event) => onBranch("next"))
|
|
39471
39711
|
}, {
|
|
39472
39712
|
default: withCtx(() => [
|
|
39473
39713
|
createVNode(unref(ElIcon), null, {
|
|
@@ -39485,7 +39725,7 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
39485
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 "),
|
|
39486
39726
|
messageTimeText.value && timeVisible.value ? (openBlock(), createElementBlock(
|
|
39487
39727
|
"span",
|
|
39488
|
-
|
|
39728
|
+
_hoisted_25,
|
|
39489
39729
|
toDisplayString(messageTimeText.value),
|
|
39490
39730
|
1
|
|
39491
39731
|
/* TEXT */
|
|
@@ -39538,9 +39778,10 @@ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
39538
39778
|
showTime: { type: Boolean, required: false, default: true },
|
|
39539
39779
|
timeFormat: { type: Function, required: false, default: void 0 },
|
|
39540
39780
|
resolveFileUrl: { type: Function, required: false, default: void 0 },
|
|
39781
|
+
feedbackHandler: { type: Function, required: false, default: void 0 },
|
|
39541
39782
|
locale: { type: null, required: false }
|
|
39542
39783
|
},
|
|
39543
|
-
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"],
|
|
39544
39785
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
39545
39786
|
const props = __props;
|
|
39546
39787
|
const dict = useLocaleDict(() => props.locale);
|
|
@@ -39654,6 +39895,12 @@ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
39654
39895
|
function onFileClick(file, m) {
|
|
39655
39896
|
emit("message-file-click", file, m);
|
|
39656
39897
|
}
|
|
39898
|
+
function onFeedbackChange(m, action) {
|
|
39899
|
+
emit("feedback-change", m, action);
|
|
39900
|
+
}
|
|
39901
|
+
function onFeedbackError(message) {
|
|
39902
|
+
emit("feedback-error", message);
|
|
39903
|
+
}
|
|
39657
39904
|
const lastMessageId = computed(() => props.messages.length ? props.messages[props.messages.length - 1].id : "");
|
|
39658
39905
|
function scrollToTop() {
|
|
39659
39906
|
const el = scrollRef.value;
|
|
@@ -39794,12 +40041,15 @@ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
39794
40041
|
"time-format": __props.timeFormat,
|
|
39795
40042
|
"code-trigger-langs": __props.codeTriggerLangs,
|
|
39796
40043
|
"resolve-file-url": __props.resolveFileUrl,
|
|
40044
|
+
"feedback-handler": __props.feedbackHandler,
|
|
39797
40045
|
onTyping: onChildTyping,
|
|
39798
40046
|
onCopy,
|
|
39799
40047
|
onRegenerate,
|
|
39800
40048
|
onBranchChange: onBranch,
|
|
39801
40049
|
onFollowupSelect: onFollowup,
|
|
39802
|
-
onFileClick
|
|
40050
|
+
onFileClick,
|
|
40051
|
+
onFeedbackChange,
|
|
40052
|
+
onFeedbackError
|
|
39803
40053
|
}, createSlots({
|
|
39804
40054
|
_: 2
|
|
39805
40055
|
/* DYNAMIC */
|
|
@@ -39846,7 +40096,7 @@ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
39846
40096
|
]),
|
|
39847
40097
|
key: "5"
|
|
39848
40098
|
} : void 0
|
|
39849
|
-
]), 1032, ["message", "branch", "is-last", "show-actions", "show-branch-switch", "show-user-avatar", "show-user-name", "show-assistant-avatar", "show-assistant-name", "user-avatar", "assistant-avatar", "assistant-avatar-scale", "avatar-circle", "user-name", "assistant-name", "typing", "auto-collapse", "collapsible", "show-duration", "show-time", "time-format", "code-trigger-langs", "resolve-file-url"]);
|
|
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"]);
|
|
39850
40100
|
}),
|
|
39851
40101
|
128
|
|
39852
40102
|
/* KEYED_FRAGMENT */
|
|
@@ -40218,10 +40468,11 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
40218
40468
|
attachmentLimit: { type: Number, required: false, default: 0 },
|
|
40219
40469
|
uploadAttachment: { type: Function, required: false, default: void 0 },
|
|
40220
40470
|
resolveFileUrl: { type: Function, required: false, default: void 0 },
|
|
40471
|
+
feedbackHandler: { type: Function, required: false, default: void 0 },
|
|
40221
40472
|
theme: { type: String, required: false, default: "light" },
|
|
40222
40473
|
locale: { type: null, required: false }
|
|
40223
40474
|
},
|
|
40224
|
-
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"],
|
|
40225
40476
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
40226
40477
|
const props = __props;
|
|
40227
40478
|
const dict = useLocaleDict(() => props.locale);
|
|
@@ -40515,6 +40766,12 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
40515
40766
|
function onMessageFileClick(file, message) {
|
|
40516
40767
|
emit("message-file-click", file, message);
|
|
40517
40768
|
}
|
|
40769
|
+
function onFeedbackChange(message, action) {
|
|
40770
|
+
emit("feedback-change", message, action);
|
|
40771
|
+
}
|
|
40772
|
+
function onFeedbackError(message) {
|
|
40773
|
+
emit("feedback-error", message);
|
|
40774
|
+
}
|
|
40518
40775
|
__expose({ sendMessage, stop, regenerate, appendToMessage, clearMessages, exportTxt, openArtifact, expandThoughtChains, collapseThoughtChains, scrollTo });
|
|
40519
40776
|
return (_ctx, _cache) => {
|
|
40520
40777
|
return openBlock(), createElementBlock(
|
|
@@ -40594,13 +40851,16 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
40594
40851
|
"time-format": __props.timeFormat,
|
|
40595
40852
|
"code-trigger-langs": artifactsOn.value && artifactsCodeTrigger.value ? ["html", "svg"] : void 0,
|
|
40596
40853
|
"resolve-file-url": __props.resolveFileUrl,
|
|
40854
|
+
"feedback-handler": __props.feedbackHandler,
|
|
40597
40855
|
onSelect: onSelectSuggestion,
|
|
40598
40856
|
onFollowupSelect,
|
|
40599
40857
|
onCopy,
|
|
40600
40858
|
onRegenerate,
|
|
40601
40859
|
onBranchChange,
|
|
40602
40860
|
onScroll: onMessagesScroll,
|
|
40603
|
-
onMessageFileClick
|
|
40861
|
+
onMessageFileClick,
|
|
40862
|
+
onFeedbackChange,
|
|
40863
|
+
onFeedbackError
|
|
40604
40864
|
}, createSlots({
|
|
40605
40865
|
_: 2
|
|
40606
40866
|
/* DYNAMIC */
|
|
@@ -40696,7 +40956,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
40696
40956
|
]),
|
|
40697
40957
|
key: "12"
|
|
40698
40958
|
} : void 0
|
|
40699
|
-
]), 1032, ["messages", "nodes", "name", "suggestions", "suggestions-wrap", "show-scroll-button", "scroll-button-threshold", "scroll-threshold", "show-user-avatar", "show-user-name", "show-assistant-avatar", "show-assistant-name", "user-avatar", "assistant-avatar", "assistant-avatar-scale", "avatar-circle", "user-name", "assistant-name", "typing", "auto-collapse", "collapsible", "show-duration", "show-time", "time-format", "code-trigger-langs", "resolve-file-url"]),
|
|
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"]),
|
|
40700
40960
|
artifactsOn.value && artifacts.value.length ? (openBlock(), createBlock(_sfc_main$1, {
|
|
40701
40961
|
key: 0,
|
|
40702
40962
|
artifacts: artifacts.value,
|
|
@@ -40734,9 +40994,10 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
40734
40994
|
accept: __props.accept,
|
|
40735
40995
|
count: __props.attachmentLimit,
|
|
40736
40996
|
upload: attachmentsUploadHook.value,
|
|
40997
|
+
disabled: unref(isLoading),
|
|
40737
40998
|
onExceed: onAttachmentExceed,
|
|
40738
40999
|
onUploaded: onAttachmentUploaded
|
|
40739
|
-
}, null, 8, ["modelValue", "accept", "count", "upload"])
|
|
41000
|
+
}, null, 8, ["modelValue", "accept", "count", "upload", "disabled"])
|
|
40740
41001
|
]),
|
|
40741
41002
|
key: "0"
|
|
40742
41003
|
} : void 0,
|
|
@@ -40750,9 +41011,10 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
40750
41011
|
accept: __props.accept,
|
|
40751
41012
|
count: __props.attachmentLimit,
|
|
40752
41013
|
upload: attachmentsUploadHook.value,
|
|
41014
|
+
disabled: unref(isLoading),
|
|
40753
41015
|
onExceed: onAttachmentExceed,
|
|
40754
41016
|
onUploaded: onAttachmentUploaded
|
|
40755
|
-
}, null, 8, ["modelValue", "accept", "count", "upload"])
|
|
41017
|
+
}, null, 8, ["modelValue", "accept", "count", "upload", "disabled"])
|
|
40756
41018
|
]),
|
|
40757
41019
|
key: "1"
|
|
40758
41020
|
} : void 0,
|