@fv-ui/ai-chat 2.0.1 → 2.0.2

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/README.md CHANGED
@@ -890,6 +890,7 @@ const sidebarRef = ref()
890
890
  | searchHistoryEnabled | boolean | true | 是否启用搜索历史功能(点击选中搜索结果时才记录;localStorage 持久化,最多 10 条,去重) |
891
891
  | searchHistoryKey | string | 'fv-ai-search-history' | 搜索历史 localStorage 存储 key(多实例/多业务场景可自定义隔离) |
892
892
  | searchHistoryPinned | boolean | false | 搜索历史是否常驻弹窗底部(true 常驻;false 仅输入为空时展示在结果区上方) |
893
+ | showOperationError | boolean | false | 操作失败时是否弹出「操作失败」toast(默认 false:宿主经 axios 统一拦截并弹后端 message 时无需重复提示;无统一拦截时可设 true 兜底) |
893
894
 
894
895
  | Event | 说明 |
895
896
  | --- | --- |
@@ -1102,6 +1103,7 @@ const open = ref(false) // 两个 v-model 接同一 ref
1102
1103
  | title | string | '' | 头部标题(空时回落 locale AI 名称) |
1103
1104
  | avatar | string | 内置品牌头像 | 头部头像图片 URL |
1104
1105
  | service | FvAiSessionService | (必填) | 会话数据服务(透传 Panel 与 Sidebar) |
1106
+ | showOperationError | boolean | false | 操作失败时是否弹出「操作失败」toast(默认 false:宿主经 axios 统一拦截并弹后端 message 时无需重复提示;无统一拦截时可设 true 兜底;透传 Sidebar) |
1105
1107
  | adapter | ChatAdapter | (必填) | 聊天适配器(透传 Panel) |
1106
1108
  | sessionId | string | '' | 当前会话 id(缺省内部 DRAFT 编排;传入则受控优先) |
1107
1109
  | placeholder / suggestions / suggestionsTitle / suggestionsWrap / showRefreshSuggestions / refreshSuggestionsText / typing / collapsible / showTime / theme / locale / toolStepLabel | | | FvAiChatPanel 同名 props 透传 |
package/dist/index.d.ts CHANGED
@@ -2668,6 +2668,8 @@ type __VLS_Props$5 = {
2668
2668
  searchHistoryKey?: string;
2669
2669
  /** 搜索历史是否常驻弹窗底部(默认 false;true 时输入也展示在底部, false 时仅输入为空才展示) */
2670
2670
  searchHistoryPinned?: boolean;
2671
+ /** 是否显示操作失败错误提示(默认 false):axios 统一拦截已弹后端 message 的场景保持 false;无统一拦截时可设 true 兜底提示 */
2672
+ showOperationError?: boolean;
2671
2673
  };
2672
2674
 
2673
2675
  declare var __VLS_brand: {};
@@ -2721,6 +2723,7 @@ declare const __VLS_base$3: vue.DefineComponent<__VLS_Props$5, {
2721
2723
  searchHistoryEnabled: boolean;
2722
2724
  searchHistoryKey: string;
2723
2725
  searchHistoryPinned: boolean;
2726
+ showOperationError: boolean;
2724
2727
  }, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
2725
2728
 
2726
2729
  declare const __VLS_export$5: __VLS_WithSlots$3<typeof __VLS_base$3, __VLS_Slots$3>;
@@ -3070,6 +3073,8 @@ type __VLS_Props$2 = {
3070
3073
  avatar?: string;
3071
3074
  /** 会话数据服务(透传 Panel 与 Sidebar) */
3072
3075
  service: FvAiSessionService;
3076
+ /** 是否显示操作失败错误提示(默认 false):axios 统一拦截已弹后端 message 的场景保持 false;无统一拦截时可设 true 兜底提示 */
3077
+ showOperationError?: boolean;
3073
3078
  /** 聊天适配器(透传 Panel) */
3074
3079
  adapter: ChatAdapter;
3075
3080
  /** 当前会话 id(缺省内部 DRAFT 编排;传入则受控优先) */
@@ -3271,6 +3276,7 @@ declare const __VLS_base$1: vue.DefineComponent<__VLS_Props$2, {
3271
3276
  searchContent: boolean;
3272
3277
  searchPlaceholder: string;
3273
3278
  searchContentPlaceholder: string;
3279
+ showOperationError: boolean;
3274
3280
  detailLimit: number;
3275
3281
  historyLimit: number;
3276
3282
  offsetBottom: number;
package/es/index.mjs CHANGED
@@ -45557,7 +45557,8 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
45557
45557
  searchContentPlaceholder: { type: String, required: false, default: "" },
45558
45558
  searchHistoryEnabled: { type: Boolean, required: false, default: true },
45559
45559
  searchHistoryKey: { type: String, required: false, default: "fv-ai-search-history" },
45560
- searchHistoryPinned: { type: Boolean, required: false, default: false }
45560
+ searchHistoryPinned: { type: Boolean, required: false, default: false },
45561
+ showOperationError: { type: Boolean, required: false, default: false }
45561
45562
  }, {
45562
45563
  "collapsed": { type: Boolean, ...{ default: false } },
45563
45564
  "collapsedModifiers": {}
@@ -45886,7 +45887,9 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
45886
45887
  openMoveSingle(sessionId);
45887
45888
  }
45888
45889
  } catch {
45889
- ElMessage.error(dict.value.sessionSidebar.operationFailed);
45890
+ if (props.showOperationError) {
45891
+ ElMessage.error(dict.value.sessionSidebar.operationFailed);
45892
+ }
45890
45893
  }
45891
45894
  }
45892
45895
  async function promptRenameSession(sessionId) {
@@ -45984,7 +45987,9 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
45984
45987
  delete folderPages[String(folderId)];
45985
45988
  await refreshQuietly();
45986
45989
  } catch {
45987
- ElMessage.error(dict.value.sessionSidebar.operationFailed);
45990
+ if (props.showOperationError) {
45991
+ ElMessage.error(dict.value.sessionSidebar.operationFailed);
45992
+ }
45988
45993
  }
45989
45994
  }
45990
45995
  function openMoveSingle(sessionId) {
@@ -46029,7 +46034,9 @@ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
46029
46034
  }
46030
46035
  await refreshQuietly();
46031
46036
  } catch {
46032
- ElMessage.error(dict.value.sessionSidebar.operationFailed);
46037
+ if (props.showOperationError) {
46038
+ ElMessage.error(dict.value.sessionSidebar.operationFailed);
46039
+ }
46033
46040
  }
46034
46041
  }
46035
46042
  function onFolderMenuCommand(cmd, folderId) {
@@ -47659,6 +47666,7 @@ var _sfc_main$1 = /* @__PURE__ */ defineComponent({
47659
47666
  title: { type: String, required: false, default: "" },
47660
47667
  avatar: { type: String, required: false, default: "" },
47661
47668
  service: { type: Object, required: true },
47669
+ showOperationError: { type: Boolean, required: false, default: false },
47662
47670
  adapter: { type: Object, required: true },
47663
47671
  sessionId: { type: String, required: false, default: "" },
47664
47672
  placeholder: { type: String, required: false, default: "" },
@@ -47850,7 +47858,9 @@ var _sfc_main$1 = /* @__PURE__ */ defineComponent({
47850
47858
  ElMessage.success(dict.value.sessionSidebar.folderRenamed);
47851
47859
  await loadHistory(true);
47852
47860
  } catch {
47853
- ElMessage.error(dict.value.sessionSidebar.operationFailed);
47861
+ if (props.showOperationError) {
47862
+ ElMessage.error(dict.value.sessionSidebar.operationFailed);
47863
+ }
47854
47864
  }
47855
47865
  } else if (cmd === "delete-folder") {
47856
47866
  if (!props.service.removeFolder) return;
@@ -47872,7 +47882,9 @@ var _sfc_main$1 = /* @__PURE__ */ defineComponent({
47872
47882
  ElMessage.success(dict.value.sessionSidebar.folderDeleted);
47873
47883
  await loadHistory(true);
47874
47884
  } catch {
47875
- ElMessage.error(dict.value.sessionSidebar.operationFailed);
47885
+ if (props.showOperationError) {
47886
+ ElMessage.error(dict.value.sessionSidebar.operationFailed);
47887
+ }
47876
47888
  }
47877
47889
  }
47878
47890
  }
@@ -47918,7 +47930,9 @@ var _sfc_main$1 = /* @__PURE__ */ defineComponent({
47918
47930
  moveDialogVisible.value = true;
47919
47931
  }
47920
47932
  } catch {
47921
- ElMessage.error(dict.value.sessionSidebar.operationFailed);
47933
+ if (props.showOperationError) {
47934
+ ElMessage.error(dict.value.sessionSidebar.operationFailed);
47935
+ }
47922
47936
  }
47923
47937
  }
47924
47938
  async function promptRenameHistorySession(sessionId) {
@@ -47992,7 +48006,9 @@ var _sfc_main$1 = /* @__PURE__ */ defineComponent({
47992
48006
  target != null && target !== "" ? String(target) : void 0
47993
48007
  );
47994
48008
  } catch {
47995
- ElMessage.error(dict.value.sessionSidebar.operationFailed);
48009
+ if (props.showOperationError) {
48010
+ ElMessage.error(dict.value.sessionSidebar.operationFailed);
48011
+ }
47996
48012
  }
47997
48013
  }
47998
48014
  function onNewChat() {
@@ -48550,11 +48566,12 @@ var _sfc_main$1 = /* @__PURE__ */ defineComponent({
48550
48566
  "search-history-enabled": __props.searchHistoryEnabled,
48551
48567
  "search-history-key": __props.searchHistoryKey,
48552
48568
  "search-history-pinned": __props.searchHistoryPinned,
48569
+ "show-operation-error": __props.showOperationError,
48553
48570
  onSelect: onSidebarSelect,
48554
48571
  onNewChat,
48555
48572
  onRemoved: onSidebarRemoved,
48556
48573
  onContentSelect
48557
- }, null, 8, ["collapsed", "service", "active-id", "brand-name", "brand-icon", "locale", "search-content", "search-placeholder", "search-content-placeholder", "search-history-enabled", "search-history-key", "search-history-pinned"])) : createCommentVNode("v-if", true),
48574
+ }, null, 8, ["collapsed", "service", "active-id", "brand-name", "brand-icon", "locale", "search-content", "search-placeholder", "search-content-placeholder", "search-history-enabled", "search-history-key", "search-history-pinned", "show-operation-error"])) : createCommentVNode("v-if", true),
48558
48575
  createElementVNode(
48559
48576
  "div",
48560
48577
  {
package/lib/index.js CHANGED
@@ -45561,7 +45561,8 @@
45561
45561
  searchContentPlaceholder: { type: String, required: false, default: "" },
45562
45562
  searchHistoryEnabled: { type: Boolean, required: false, default: true },
45563
45563
  searchHistoryKey: { type: String, required: false, default: "fv-ai-search-history" },
45564
- searchHistoryPinned: { type: Boolean, required: false, default: false }
45564
+ searchHistoryPinned: { type: Boolean, required: false, default: false },
45565
+ showOperationError: { type: Boolean, required: false, default: false }
45565
45566
  }, {
45566
45567
  "collapsed": { type: Boolean, ...{ default: false } },
45567
45568
  "collapsedModifiers": {}
@@ -45890,7 +45891,9 @@
45890
45891
  openMoveSingle(sessionId);
45891
45892
  }
45892
45893
  } catch {
45893
- elementPlus.ElMessage.error(dict.value.sessionSidebar.operationFailed);
45894
+ if (props.showOperationError) {
45895
+ elementPlus.ElMessage.error(dict.value.sessionSidebar.operationFailed);
45896
+ }
45894
45897
  }
45895
45898
  }
45896
45899
  async function promptRenameSession(sessionId) {
@@ -45988,7 +45991,9 @@
45988
45991
  delete folderPages[String(folderId)];
45989
45992
  await refreshQuietly();
45990
45993
  } catch {
45991
- elementPlus.ElMessage.error(dict.value.sessionSidebar.operationFailed);
45994
+ if (props.showOperationError) {
45995
+ elementPlus.ElMessage.error(dict.value.sessionSidebar.operationFailed);
45996
+ }
45992
45997
  }
45993
45998
  }
45994
45999
  function openMoveSingle(sessionId) {
@@ -46033,7 +46038,9 @@
46033
46038
  }
46034
46039
  await refreshQuietly();
46035
46040
  } catch {
46036
- elementPlus.ElMessage.error(dict.value.sessionSidebar.operationFailed);
46041
+ if (props.showOperationError) {
46042
+ elementPlus.ElMessage.error(dict.value.sessionSidebar.operationFailed);
46043
+ }
46037
46044
  }
46038
46045
  }
46039
46046
  function onFolderMenuCommand(cmd, folderId) {
@@ -47663,6 +47670,7 @@
47663
47670
  title: { type: String, required: false, default: "" },
47664
47671
  avatar: { type: String, required: false, default: "" },
47665
47672
  service: { type: Object, required: true },
47673
+ showOperationError: { type: Boolean, required: false, default: false },
47666
47674
  adapter: { type: Object, required: true },
47667
47675
  sessionId: { type: String, required: false, default: "" },
47668
47676
  placeholder: { type: String, required: false, default: "" },
@@ -47854,7 +47862,9 @@
47854
47862
  elementPlus.ElMessage.success(dict.value.sessionSidebar.folderRenamed);
47855
47863
  await loadHistory(true);
47856
47864
  } catch {
47857
- elementPlus.ElMessage.error(dict.value.sessionSidebar.operationFailed);
47865
+ if (props.showOperationError) {
47866
+ elementPlus.ElMessage.error(dict.value.sessionSidebar.operationFailed);
47867
+ }
47858
47868
  }
47859
47869
  } else if (cmd === "delete-folder") {
47860
47870
  if (!props.service.removeFolder) return;
@@ -47876,7 +47886,9 @@
47876
47886
  elementPlus.ElMessage.success(dict.value.sessionSidebar.folderDeleted);
47877
47887
  await loadHistory(true);
47878
47888
  } catch {
47879
- elementPlus.ElMessage.error(dict.value.sessionSidebar.operationFailed);
47889
+ if (props.showOperationError) {
47890
+ elementPlus.ElMessage.error(dict.value.sessionSidebar.operationFailed);
47891
+ }
47880
47892
  }
47881
47893
  }
47882
47894
  }
@@ -47922,7 +47934,9 @@
47922
47934
  moveDialogVisible.value = true;
47923
47935
  }
47924
47936
  } catch {
47925
- elementPlus.ElMessage.error(dict.value.sessionSidebar.operationFailed);
47937
+ if (props.showOperationError) {
47938
+ elementPlus.ElMessage.error(dict.value.sessionSidebar.operationFailed);
47939
+ }
47926
47940
  }
47927
47941
  }
47928
47942
  async function promptRenameHistorySession(sessionId) {
@@ -47996,7 +48010,9 @@
47996
48010
  target != null && target !== "" ? String(target) : void 0
47997
48011
  );
47998
48012
  } catch {
47999
- elementPlus.ElMessage.error(dict.value.sessionSidebar.operationFailed);
48013
+ if (props.showOperationError) {
48014
+ elementPlus.ElMessage.error(dict.value.sessionSidebar.operationFailed);
48015
+ }
48000
48016
  }
48001
48017
  }
48002
48018
  function onNewChat() {
@@ -48554,11 +48570,12 @@
48554
48570
  "search-history-enabled": __props.searchHistoryEnabled,
48555
48571
  "search-history-key": __props.searchHistoryKey,
48556
48572
  "search-history-pinned": __props.searchHistoryPinned,
48573
+ "show-operation-error": __props.showOperationError,
48557
48574
  onSelect: onSidebarSelect,
48558
48575
  onNewChat,
48559
48576
  onRemoved: onSidebarRemoved,
48560
48577
  onContentSelect
48561
- }, null, 8, ["collapsed", "service", "active-id", "brand-name", "brand-icon", "locale", "search-content", "search-placeholder", "search-content-placeholder", "search-history-enabled", "search-history-key", "search-history-pinned"])) : vue.createCommentVNode("v-if", true),
48578
+ }, null, 8, ["collapsed", "service", "active-id", "brand-name", "brand-icon", "locale", "search-content", "search-placeholder", "search-content-placeholder", "search-history-enabled", "search-history-key", "search-history-pinned", "show-operation-error"])) : vue.createCommentVNode("v-if", true),
48562
48579
  vue.createElementVNode(
48563
48580
  "div",
48564
48581
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fv-ui/ai-chat",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "基于 Vue3 + Element Plus 的 AI 对话组件库",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",