@fv-ui/ai-chat 0.4.0 → 0.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/es/index.mjs CHANGED
@@ -3343,7 +3343,7 @@ const _hoisted_16$1 = {
3343
3343
  key: 1,
3344
3344
  class: "fv-editor-footer"
3345
3345
  };
3346
- const _hoisted_17 = { class: "fv-editor-select-dialog" };
3346
+ const _hoisted_17$1 = { class: "fv-editor-select-dialog" };
3347
3347
  const _hoisted_18 = { class: "fv-editor-select-title" };
3348
3348
  const _hoisted_19 = { class: "fv-editor-select-grid" };
3349
3349
  const _hoisted_20 = ["onClick"];
@@ -4306,7 +4306,7 @@ var _sfc_main$b = /* @__PURE__ */ defineComponent({
4306
4306
  onClose: closeSelectDialog
4307
4307
  }, {
4308
4308
  default: withCtx(() => [
4309
- createElementVNode("div", _hoisted_17, [
4309
+ createElementVNode("div", _hoisted_17$1, [
4310
4310
  (openBlock(true), createElementBlock(
4311
4311
  Fragment,
4312
4312
  null,
@@ -6008,50 +6008,51 @@ const _hoisted_2$3 = {
6008
6008
  key: 0,
6009
6009
  class: "fv-msg-avatar"
6010
6010
  };
6011
- const _hoisted_3$3 = { class: "fv-msg-main" };
6012
- const _hoisted_4$2 = {
6011
+ const _hoisted_3$3 = ["src"];
6012
+ const _hoisted_4$2 = ["src"];
6013
+ const _hoisted_5 = { class: "fv-msg-main" };
6014
+ const _hoisted_6 = {
6013
6015
  key: 0,
6014
6016
  class: "fv-msg-header"
6015
6017
  };
6016
- const _hoisted_5 = { class: "fv-msg-role" };
6017
- const _hoisted_6 = {
6018
- key: 0,
6018
+ const _hoisted_7 = {
6019
+ key: 2,
6019
6020
  class: "fv-msg-model"
6020
6021
  };
6021
- const _hoisted_7 = {
6022
+ const _hoisted_8 = {
6022
6023
  key: 1,
6023
6024
  class: "fv-msg-files"
6024
6025
  };
6025
- const _hoisted_8 = ["src", "alt"];
6026
- const _hoisted_9 = {
6026
+ const _hoisted_9 = ["src", "alt"];
6027
+ const _hoisted_10 = {
6027
6028
  key: 1,
6028
6029
  class: "fv-msg-file-name"
6029
6030
  };
6030
- const _hoisted_10 = {
6031
+ const _hoisted_11 = {
6031
6032
  key: 3,
6032
6033
  class: "fv-msg-content"
6033
6034
  };
6034
- const _hoisted_11 = {
6035
+ const _hoisted_12 = {
6035
6036
  key: 0,
6036
6037
  class: "fv-msg-error"
6037
6038
  };
6038
- const _hoisted_12 = {
6039
+ const _hoisted_13 = {
6039
6040
  key: 2,
6040
6041
  class: "fv-msg-pending"
6041
6042
  };
6042
- const _hoisted_13 = {
6043
+ const _hoisted_14 = {
6043
6044
  key: 4,
6044
6045
  class: "fv-msg-content fv-msg-content-user"
6045
6046
  };
6046
- const _hoisted_14 = {
6047
+ const _hoisted_15 = {
6047
6048
  key: 5,
6048
6049
  class: "fv-msg-actions"
6049
6050
  };
6050
- const _hoisted_15 = {
6051
+ const _hoisted_16 = {
6051
6052
  key: 0,
6052
6053
  class: "fv-msg-branch"
6053
6054
  };
6054
- const _hoisted_16 = { class: "fv-msg-branch-label" };
6055
+ const _hoisted_17 = { class: "fv-msg-branch-label" };
6055
6056
  var _sfc_main$3 = /* @__PURE__ */ defineComponent({
6056
6057
  ...{ name: "FvAiMessage" },
6057
6058
  __name: "index",
@@ -6062,6 +6063,12 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
6062
6063
  showBranchSwitch: { type: Boolean, required: false, default: true },
6063
6064
  showUserAvatar: { type: Boolean, required: false, default: true },
6064
6065
  showUserName: { type: Boolean, required: false, default: true },
6066
+ showAssistantAvatar: { type: Boolean, required: false, default: true },
6067
+ showAssistantName: { type: Boolean, required: false, default: true },
6068
+ userAvatar: { type: String, required: false, default: "" },
6069
+ assistantAvatar: { type: String, required: false, default: "" },
6070
+ userName: { type: String, required: false, default: "" },
6071
+ assistantName: { type: String, required: false, default: "" },
6065
6072
  autoCollapse: { type: Boolean, required: false, default: true }
6066
6073
  },
6067
6074
  emits: ["copy", "regenerate", "branch-change"],
@@ -6092,50 +6099,70 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
6092
6099
  class: normalizeClass(["fv-msg", [`is-${__props.message.role}`, { "is-error": __props.message.status === "error", "is-user": isUser.value }]]),
6093
6100
  "data-message-id": __props.message.id
6094
6101
  }, [
6095
- createCommentVNode(" \u5934\u50CF:user \u53F3\u4FA7(\u81EA\u8EAB),assistant \u5DE6\u4FA7;showUserAvatar=false \u65F6\u7528\u6237\u6D88\u606F\u4E0D\u6E32\u67D3 "),
6096
- !isUser.value || __props.showUserAvatar ? (openBlock(), createElementBlock("div", _hoisted_2$3, [
6102
+ createCommentVNode(" \u5934\u50CF:user \u53F3\u4FA7(\u81EA\u8EAB),assistant \u5DE6\u4FA7;\u663E\u9690\u5F00\u5173\u5173\u95ED\u65F6\u4E0D\u6E32\u67D3;\r\n \u4F18\u5148\u7EA7:message-avatar \u6574\u4F53\u63D2\u69FD > user-avatar/assistant-avatar \u7EC6\u5206\u63D2\u69FD > props \u56FE\u7247 > \u5185\u7F6E\u56FE\u6807 "),
6103
+ (isUser.value ? __props.showUserAvatar : __props.showAssistantAvatar) ? (openBlock(), createElementBlock("div", _hoisted_2$3, [
6097
6104
  renderSlot(_ctx.$slots, "message-avatar", { message: __props.message }, () => [
6098
- isUser.value ? (openBlock(), createBlock(unref(ElIcon), {
6099
- key: 0,
6100
- class: "fv-msg-avatar-user"
6101
- }, {
6102
- default: withCtx(() => [
6103
- createVNode(unref(User))
6104
- ]),
6105
- _: 1
6106
- /* STABLE */
6107
- })) : (openBlock(), createBlock(unref(ElIcon), {
6108
- key: 1,
6109
- class: "fv-msg-avatar-bot"
6110
- }, {
6111
- default: withCtx(() => [
6112
- createVNode(unref(ChatDotRound))
6113
- ]),
6114
- _: 1
6115
- /* STABLE */
6116
- }))
6105
+ isUser.value ? renderSlot(_ctx.$slots, "user-avatar", {}, () => [
6106
+ __props.userAvatar ? (openBlock(), createElementBlock("img", {
6107
+ key: 0,
6108
+ class: "fv-msg-avatar-img",
6109
+ src: __props.userAvatar,
6110
+ alt: ""
6111
+ }, null, 8, _hoisted_3$3)) : (openBlock(), createBlock(unref(ElIcon), {
6112
+ key: 1,
6113
+ class: "fv-msg-avatar-user"
6114
+ }, {
6115
+ default: withCtx(() => [
6116
+ createVNode(unref(User))
6117
+ ]),
6118
+ _: 1
6119
+ /* STABLE */
6120
+ }))
6121
+ ], void 0, 0) : renderSlot(_ctx.$slots, "assistant-avatar", {}, () => [
6122
+ __props.assistantAvatar ? (openBlock(), createElementBlock("img", {
6123
+ key: 0,
6124
+ class: "fv-msg-avatar-img",
6125
+ src: __props.assistantAvatar,
6126
+ alt: ""
6127
+ }, null, 8, _hoisted_4$2)) : (openBlock(), createBlock(unref(ElIcon), {
6128
+ key: 1,
6129
+ class: "fv-msg-avatar-bot"
6130
+ }, {
6131
+ default: withCtx(() => [
6132
+ createVNode(unref(ChatDotRound))
6133
+ ]),
6134
+ _: 1
6135
+ /* STABLE */
6136
+ }))
6137
+ ], void 0, 1)
6117
6138
  ])
6118
6139
  ])) : createCommentVNode("v-if", true),
6119
- createElementVNode("div", _hoisted_3$3, [
6120
- createCommentVNode(" \u5934\u90E8:\u89D2\u8272\u540D + \u6A21\u578B\u6807\u8BB0;showUserName=false \u65F6\u7528\u6237\u6D88\u606F\u4E0D\u6E32\u67D3 "),
6121
- !isUser.value || __props.showUserName ? (openBlock(), createElementBlock("div", _hoisted_4$2, [
6122
- createElementVNode(
6123
- "span",
6124
- _hoisted_5,
6125
- toDisplayString(isUser.value ? "\u4F60" : "\u52A9\u624B"),
6126
- 1
6127
- /* TEXT */
6128
- ),
6140
+ createElementVNode("div", _hoisted_5, [
6141
+ createCommentVNode(" \u5934\u90E8:\u89D2\u8272\u540D + \u6A21\u578B\u6807\u8BB0;\u663E\u9690\u5F00\u5173\u5173\u95ED\u65F6\u4E0D\u6E32\u67D3;\u7EC6\u5206\u63D2\u69FD > props > \u9ED8\u8BA4\u6587\u6848 "),
6142
+ (isUser.value ? __props.showUserName : __props.showAssistantName) ? (openBlock(), createElementBlock("div", _hoisted_6, [
6143
+ isUser.value ? renderSlot(_ctx.$slots, "user-name", { message: __props.message }, () => [
6144
+ createTextVNode(
6145
+ toDisplayString(__props.userName || "\u4F60"),
6146
+ 1
6147
+ /* TEXT */
6148
+ )
6149
+ ], void 0, 0) : renderSlot(_ctx.$slots, "assistant-name", { message: __props.message }, () => [
6150
+ createTextVNode(
6151
+ toDisplayString(__props.assistantName || "\u52A9\u624B"),
6152
+ 1
6153
+ /* TEXT */
6154
+ )
6155
+ ], void 0, 1),
6129
6156
  !isUser.value && modelLabel.value ? (openBlock(), createElementBlock(
6130
6157
  "span",
6131
- _hoisted_6,
6158
+ _hoisted_7,
6132
6159
  toDisplayString(modelLabel.value),
6133
6160
  1
6134
6161
  /* TEXT */
6135
6162
  )) : createCommentVNode("v-if", true)
6136
6163
  ])) : createCommentVNode("v-if", true),
6137
6164
  createCommentVNode(" \u9644\u4EF6:user \u6D88\u606F files \u4EE5 FilesCard \u5E73\u94FA "),
6138
- __props.message.files?.length ? (openBlock(), createElementBlock("div", _hoisted_7, [
6165
+ __props.message.files?.length ? (openBlock(), createElementBlock("div", _hoisted_8, [
6139
6166
  renderSlot(_ctx.$slots, "message-files", {
6140
6167
  message: __props.message,
6141
6168
  files: __props.message.files
@@ -6156,9 +6183,9 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
6156
6183
  class: "fv-msg-file-img",
6157
6184
  src: f.url,
6158
6185
  alt: f.name
6159
- }, null, 8, _hoisted_8)) : (openBlock(), createElementBlock(
6186
+ }, null, 8, _hoisted_9)) : (openBlock(), createElementBlock(
6160
6187
  "span",
6161
- _hoisted_9,
6188
+ _hoisted_10,
6162
6189
  toDisplayString(f.name),
6163
6190
  1
6164
6191
  /* TEXT */
@@ -6189,17 +6216,17 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
6189
6216
  /* STABLE */
6190
6217
  }, 8, ["content", "status", "auto-collapse"])) : createCommentVNode("v-if", true),
6191
6218
  createCommentVNode(" \u6B63\u6587:user \u7EAF\u6587\u672C\u6C14\u6CE1;assistant Markdown;pending \u7A7A\u5185\u5BB9\u7ED9\u52A0\u8F7D\u5360\u4F4D "),
6192
- !isUser.value ? (openBlock(), createElementBlock("div", _hoisted_10, [
6219
+ !isUser.value ? (openBlock(), createElementBlock("div", _hoisted_11, [
6193
6220
  __props.message.status === "error" ? (openBlock(), createElementBlock(
6194
6221
  "span",
6195
- _hoisted_11,
6222
+ _hoisted_12,
6196
6223
  toDisplayString(__props.message.error || "\u751F\u6210\u5931\u8D25"),
6197
6224
  1
6198
6225
  /* TEXT */
6199
6226
  )) : __props.message.content ? (openBlock(), createBlock(_sfc_main$i, {
6200
6227
  key: 1,
6201
6228
  content: __props.message.content
6202
- }, null, 8, ["content"])) : __props.message.status === "pending" || __props.message.status === "streaming" ? (openBlock(), createElementBlock("span", _hoisted_12, [
6229
+ }, null, 8, ["content"])) : __props.message.status === "pending" || __props.message.status === "streaming" ? (openBlock(), createElementBlock("span", _hoisted_13, [
6203
6230
  (openBlock(), createElementBlock(
6204
6231
  Fragment,
6205
6232
  null,
@@ -6222,13 +6249,13 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
6222
6249
  ])) : createCommentVNode("v-if", true)
6223
6250
  ])) : (openBlock(), createElementBlock(
6224
6251
  "div",
6225
- _hoisted_13,
6252
+ _hoisted_14,
6226
6253
  toDisplayString(__props.message.content),
6227
6254
  1
6228
6255
  /* TEXT */
6229
6256
  )),
6230
6257
  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) "),
6231
- __props.showActions || __props.showBranchSwitch && __props.branch && __props.branch.count > 1 ? (openBlock(), createElementBlock("div", _hoisted_14, [
6258
+ __props.showActions || __props.showBranchSwitch && __props.branch && __props.branch.count > 1 ? (openBlock(), createElementBlock("div", _hoisted_15, [
6232
6259
  renderSlot(_ctx.$slots, "message-actions", { message: __props.message }, () => [
6233
6260
  __props.showActions && isUser.value ? (openBlock(), createBlock(unref(ElTooltip), {
6234
6261
  key: 0,
@@ -6319,7 +6346,7 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
6319
6346
  })) : createCommentVNode("v-if", true)
6320
6347
  ]),
6321
6348
  createCommentVNode(" \u5206\u652F\u5207\u6362:\u5144\u5F1F\u5206\u652F > 1 \u65F6 "),
6322
- __props.showBranchSwitch && __props.branch && __props.branch.count > 1 ? (openBlock(), createElementBlock("span", _hoisted_15, [
6349
+ __props.showBranchSwitch && __props.branch && __props.branch.count > 1 ? (openBlock(), createElementBlock("span", _hoisted_16, [
6323
6350
  createVNode(unref(ElButton), {
6324
6351
  text: "",
6325
6352
  size: "small",
@@ -6342,7 +6369,7 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
6342
6369
  }, 8, ["disabled"]),
6343
6370
  createElementVNode(
6344
6371
  "span",
6345
- _hoisted_16,
6372
+ _hoisted_17,
6346
6373
  toDisplayString(__props.branch.index) + " / " + toDisplayString(__props.branch.count),
6347
6374
  1
6348
6375
  /* TEXT */
@@ -6396,7 +6423,13 @@ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
6396
6423
  showActions: { type: Boolean, required: false, default: true },
6397
6424
  showBranchSwitch: { type: Boolean, required: false, default: true },
6398
6425
  showUserAvatar: { type: Boolean, required: false, default: true },
6399
- showUserName: { type: Boolean, required: false, default: true }
6426
+ showUserName: { type: Boolean, required: false, default: true },
6427
+ showAssistantAvatar: { type: Boolean, required: false, default: true },
6428
+ showAssistantName: { type: Boolean, required: false, default: true },
6429
+ userAvatar: { type: String, required: false, default: "" },
6430
+ assistantAvatar: { type: String, required: false, default: "" },
6431
+ userName: { type: String, required: false, default: "" },
6432
+ assistantName: { type: String, required: false, default: "" }
6400
6433
  },
6401
6434
  emits: ["select", "copy", "regenerate", "branch-change"],
6402
6435
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -6515,6 +6548,12 @@ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
6515
6548
  "show-branch-switch": __props.showBranchSwitch,
6516
6549
  "show-user-avatar": __props.showUserAvatar,
6517
6550
  "show-user-name": __props.showUserName,
6551
+ "show-assistant-avatar": __props.showAssistantAvatar,
6552
+ "show-assistant-name": __props.showAssistantName,
6553
+ "user-avatar": __props.userAvatar,
6554
+ "assistant-avatar": __props.assistantAvatar,
6555
+ "user-name": __props.userName,
6556
+ "assistant-name": __props.assistantName,
6518
6557
  onCopy,
6519
6558
  onRegenerate,
6520
6559
  onBranchChange: onBranch
@@ -6535,8 +6574,36 @@ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
6535
6574
  renderSlot(_ctx.$slots, "message-actions", mergeProps({ ref_for: true }, scope))
6536
6575
  ]),
6537
6576
  key: "1"
6577
+ } : void 0,
6578
+ _ctx.$slots["user-avatar"] ? {
6579
+ name: "user-avatar",
6580
+ fn: withCtx(() => [
6581
+ renderSlot(_ctx.$slots, "user-avatar")
6582
+ ]),
6583
+ key: "2"
6584
+ } : void 0,
6585
+ _ctx.$slots["assistant-avatar"] ? {
6586
+ name: "assistant-avatar",
6587
+ fn: withCtx(() => [
6588
+ renderSlot(_ctx.$slots, "assistant-avatar")
6589
+ ]),
6590
+ key: "3"
6591
+ } : void 0,
6592
+ _ctx.$slots["user-name"] ? {
6593
+ name: "user-name",
6594
+ fn: withCtx((scope) => [
6595
+ renderSlot(_ctx.$slots, "user-name", mergeProps({ ref_for: true }, scope))
6596
+ ]),
6597
+ key: "4"
6598
+ } : void 0,
6599
+ _ctx.$slots["assistant-name"] ? {
6600
+ name: "assistant-name",
6601
+ fn: withCtx((scope) => [
6602
+ renderSlot(_ctx.$slots, "assistant-name", mergeProps({ ref_for: true }, scope))
6603
+ ]),
6604
+ key: "5"
6538
6605
  } : void 0
6539
- ]), 1032, ["message", "branch", "show-actions", "show-branch-switch", "show-user-avatar", "show-user-name"]);
6606
+ ]), 1032, ["message", "branch", "show-actions", "show-branch-switch", "show-user-avatar", "show-user-name", "show-assistant-avatar", "show-assistant-name", "user-avatar", "assistant-avatar", "user-name", "assistant-name"]);
6540
6607
  }),
6541
6608
  128
6542
6609
  /* KEYED_FRAGMENT */
@@ -6831,6 +6898,12 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
6831
6898
  centerWelcome: { type: Boolean, required: false, default: true },
6832
6899
  showUserAvatar: { type: Boolean, required: false, default: true },
6833
6900
  showUserName: { type: Boolean, required: false, default: true },
6901
+ showAssistantAvatar: { type: Boolean, required: false, default: true },
6902
+ showAssistantName: { type: Boolean, required: false, default: true },
6903
+ userAvatar: { type: String, required: false, default: "" },
6904
+ assistantAvatar: { type: String, required: false, default: "" },
6905
+ userName: { type: String, required: false, default: "" },
6906
+ assistantName: { type: String, required: false, default: "" },
6834
6907
  placeholder: { type: String, required: false, default: "" },
6835
6908
  senderShadow: { type: Boolean, required: false, default: true },
6836
6909
  suggestions: { type: Array, required: false, default: () => [] },
@@ -7096,6 +7169,12 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
7096
7169
  suggestions: __props.suggestions,
7097
7170
  "show-user-avatar": __props.showUserAvatar,
7098
7171
  "show-user-name": __props.showUserName,
7172
+ "show-assistant-avatar": __props.showAssistantAvatar,
7173
+ "show-assistant-name": __props.showAssistantName,
7174
+ "user-avatar": __props.userAvatar,
7175
+ "assistant-avatar": __props.assistantAvatar,
7176
+ "user-name": __props.userName,
7177
+ "assistant-name": __props.assistantName,
7099
7178
  onSelect: onSelectSuggestion,
7100
7179
  onCopy,
7101
7180
  onRegenerate,
@@ -7118,14 +7197,42 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
7118
7197
  ]),
7119
7198
  key: "1"
7120
7199
  } : void 0,
7200
+ _ctx.$slots["user-avatar"] ? {
7201
+ name: "user-avatar",
7202
+ fn: withCtx(() => [
7203
+ renderSlot(_ctx.$slots, "user-avatar")
7204
+ ]),
7205
+ key: "2"
7206
+ } : void 0,
7207
+ _ctx.$slots["assistant-avatar"] ? {
7208
+ name: "assistant-avatar",
7209
+ fn: withCtx(() => [
7210
+ renderSlot(_ctx.$slots, "assistant-avatar")
7211
+ ]),
7212
+ key: "3"
7213
+ } : void 0,
7214
+ _ctx.$slots["user-name"] ? {
7215
+ name: "user-name",
7216
+ fn: withCtx((scope) => [
7217
+ renderSlot(_ctx.$slots, "user-name", normalizeProps(guardReactiveProps(scope)))
7218
+ ]),
7219
+ key: "4"
7220
+ } : void 0,
7221
+ _ctx.$slots["assistant-name"] ? {
7222
+ name: "assistant-name",
7223
+ fn: withCtx((scope) => [
7224
+ renderSlot(_ctx.$slots, "assistant-name", normalizeProps(guardReactiveProps(scope)))
7225
+ ]),
7226
+ key: "5"
7227
+ } : void 0,
7121
7228
  _ctx.$slots.empty ? {
7122
7229
  name: "empty",
7123
7230
  fn: withCtx(() => [
7124
7231
  renderSlot(_ctx.$slots, "empty")
7125
7232
  ]),
7126
- key: "2"
7233
+ key: "6"
7127
7234
  } : void 0
7128
- ]), 1032, ["messages", "nodes", "name", "suggestions", "show-user-avatar", "show-user-name"]),
7235
+ ]), 1032, ["messages", "nodes", "name", "suggestions", "show-user-avatar", "show-user-name", "show-assistant-avatar", "show-assistant-name", "user-avatar", "assistant-avatar", "user-name", "assistant-name"]),
7129
7236
  __props.features?.artifacts && artifacts.value.length ? (openBlock(), createBlock(_sfc_main$1, {
7130
7237
  key: 0,
7131
7238
  artifacts: artifacts.value,