@blueking/ai-blueking 2.2.2-beta.4 → 2.2.2-beta.5

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.
@@ -26738,46 +26738,60 @@ var bM = T("svg", {
26738
26738
  isScrollBottom: n,
26739
26739
  scrollBottomHeight: i,
26740
26740
  debouncedShowScrollBottomBtn: o,
26741
- toScrollBottom: s,
26742
- toScrollTop: c
26741
+ jumpToBottom: c,
26742
+ toScrollBottom: l,
26743
+ toScrollTop: u
26743
26744
  })));
26744
26745
  let s = () => {
26745
- a.value = !0, q(t)?.scrollIntoView({
26746
- behavior: "smooth",
26746
+ let t = q(e);
26747
+ return t ? Math.max(0, t.scrollHeight - t.scrollTop - t.clientHeight) : 0;
26748
+ }, c = () => {
26749
+ let t = q(e);
26750
+ t && (a.value = !0, t.scrollTop = t.scrollHeight);
26751
+ }, l = (e) => {
26752
+ a.value = !0;
26753
+ let n = e ?? (s() > 600 ? "auto" : "smooth");
26754
+ if (n === "auto") {
26755
+ c();
26756
+ return;
26757
+ }
26758
+ q(t)?.scrollIntoView({
26759
+ behavior: n,
26747
26760
  block: "end"
26748
26761
  });
26749
- }, c = () => {
26762
+ }, u = () => {
26750
26763
  q(e)?.scrollTo({
26751
26764
  top: 0,
26752
26765
  behavior: "smooth"
26753
26766
  });
26754
- }, l = () => {
26767
+ }, f = () => {
26755
26768
  let t = q(e);
26756
26769
  if (!t) return;
26757
26770
  let { scrollHeight: r, scrollTop: a, clientHeight: s } = t, c = r - a - s;
26758
26771
  i.value = Math.max(0, c), o.value = !n.value && i.value > 100;
26759
- }, u = (e) => {
26772
+ }, p = (e) => {
26760
26773
  e.deltaY < 0 && (a.value = !1);
26761
26774
  };
26762
26775
  return R(() => {
26763
26776
  pe(() => {
26764
26777
  let s = q(e), c = q(t);
26765
- !s || !c || (r?.disconnect(), s.removeEventListener("scroll", l), s.removeEventListener("wheel", u), l(), r = new IntersectionObserver((e) => {
26778
+ !s || !c || (r?.disconnect(), s.removeEventListener("scroll", f), s.removeEventListener("wheel", p), f(), r = new IntersectionObserver((e) => {
26766
26779
  e.forEach((e) => {
26767
- e.isIntersecting ? (n.value = !0, i.value = 0, a.value = !0, o.value = !1) : (n.value = !1, l());
26780
+ e.isIntersecting ? (n.value = !0, i.value = 0, a.value = !0, o.value = !1) : (n.value = !1, f());
26768
26781
  });
26769
- }), r.observe(c), s.addEventListener("scroll", l, { passive: !0 }), s.addEventListener("wheel", u, { passive: !0 }));
26782
+ }), r.observe(c), s.addEventListener("scroll", f, { passive: !0 }), s.addEventListener("wheel", p, { passive: !0 }));
26770
26783
  });
26771
26784
  }), z(() => {
26772
26785
  r?.disconnect();
26773
26786
  let t = q(e);
26774
- t && (t.removeEventListener("scroll", l), t.removeEventListener("wheel", u));
26787
+ t && (t.removeEventListener("scroll", f), t.removeEventListener("wheel", p));
26775
26788
  }), {
26776
26789
  autoScrollEnabled: a,
26777
26790
  isScrollBottom: n,
26778
26791
  scrollBottomHeight: i,
26779
- toScrollBottom: s,
26780
- toScrollTop: c,
26792
+ jumpToBottom: c,
26793
+ toScrollBottom: l,
26794
+ toScrollTop: u,
26781
26795
  debouncedShowScrollBottomBtn: o
26782
26796
  };
26783
26797
  }, lN = () => E(sN, void 0), uN = Symbol("CUSTOM_TAB_TOKEN"), dN = "execution";
@@ -53888,7 +53902,11 @@ var uG = ["src"], dG = {
53888
53902
  }),
53889
53903
  emits: /* @__PURE__ */ j(["stopStreaming"], ["update:selectedUserMessages"]),
53890
53904
  setup(e) {
53891
- let t = e, n = ce(e, "selectedUserMessages"), r = ue("messageContainerRef"), i = ue("messageContainerBottomRef"), { toScrollBottom: a, debouncedShowScrollBottomBtn: s } = cN(r, i), { copy: c } = aN(), l = (e, t) => {
53905
+ let t = e, n = ce(e, "selectedUserMessages"), r = ue("messageContainerRef"), i = ue("messageContainerBottomRef"), { jumpToBottom: a, toScrollBottom: s, debouncedShowScrollBottomBtn: c } = cN(r, i);
53906
+ R(() => {
53907
+ t.messageGroups?.length && (a(), requestAnimationFrame(() => a()));
53908
+ });
53909
+ let { copy: l } = aN(), u = (e, t) => {
53892
53910
  if (!t?.length) return e;
53893
53911
  let n = e.map((e) => {
53894
53912
  let n = t.find((t) => t.id === e.id);
@@ -53898,12 +53916,12 @@ var uG = ["src"], dG = {
53898
53916
  } : e;
53899
53917
  }), r = t.filter((t) => !e.some((e) => e.id === t.id));
53900
53918
  return [...n, ...r].filter((e) => !e.hidden);
53901
- }, u = d(() => l(cj, t.messageTools).filter((e) => t.renderMode !== pj.Test || e.id !== "share")), f = d(() => l(uj, t.updateTools)), v = d(() => t.renderMode === pj.Share ? t.messageGroups.filter((e) => e.type !== $A.Loading) : t.messageGroups), b = (e) => {
53919
+ }, f = d(() => u(cj, t.messageTools).filter((e) => t.renderMode !== pj.Test || e.id !== "share")), v = d(() => u(uj, t.updateTools)), b = d(() => t.renderMode === pj.Share ? t.messageGroups.filter((e) => e.type !== $A.Loading) : t.messageGroups), x = (e) => {
53902
53920
  e.messages?.at(-1)?.role !== $A.Interrupt && (e.isHover = !0);
53903
- }, x = (e, t) => {
53921
+ }, S = (e, t) => {
53904
53922
  let n = t.toElement ?? t.relatedTarget;
53905
53923
  n instanceof Element && n.classList.contains("ai-user-feedback") || (e.isHover = !1);
53906
- }, S = (e, r) => {
53924
+ }, C = (e, r) => {
53907
53925
  let i = e.type === $A.User;
53908
53926
  t.messageGroups?.forEach((n, a) => {
53909
53927
  if (n === e) {
@@ -53912,30 +53930,30 @@ var uG = ["src"], dG = {
53912
53930
  e && (e.checked = r);
53913
53931
  }
53914
53932
  }), n.value = t.messageGroups?.filter((e) => e.checked).map((e) => e.messages).flat();
53915
- }, C = async (e, n) => (e.id === "copy" && c(n.filter((e) => e.role !== $A.Reasoning).map((e) => typeof e.content == "string" ? e.content : JSON.stringify(e.content || "")).join("\n")), t.onAgentAction?.(e, n)), w = async (e, n) => {
53933
+ }, w = async (e, n) => (e.id === "copy" && l(n.filter((e) => e.role !== $A.Reasoning).map((e) => typeof e.content == "string" ? e.content : JSON.stringify(e.content || "")).join("\n")), t.onAgentAction?.(e, n)), T = async (e, n) => {
53916
53934
  t.onUserAction?.(e, n);
53917
- }, T = async (e, n, r) => {
53935
+ }, E = async (e, n, r) => {
53918
53936
  t.onUserInputConfirm?.(e, n, r);
53919
- }, E = async (e, n) => {
53937
+ }, D = async (e, n) => {
53920
53938
  t.onUserShortcutConfirm?.(e, n);
53921
53939
  };
53922
- return (n, c) => (V(), h("div", {
53940
+ return (n, a) => (V(), h("div", {
53923
53941
  ref_key: "messageContainerRef",
53924
53942
  ref: r,
53925
53943
  class: "ai-message-container"
53926
53944
  }, [
53927
- (V(!0), h(o, null, U(v.value, (r, i) => (V(), h("div", {
53945
+ (V(!0), h(o, null, U(b.value, (r, i) => (V(), h("div", {
53928
53946
  id: r.uid,
53929
53947
  key: i,
53930
53948
  class: "message-group",
53931
53949
  style: I({ backgroundColor: r.checked ? "#f5f7fa" : "transparent" }),
53932
- onMouseenter: (e) => b(r),
53933
- onMouseleave: (e) => x(r, e)
53950
+ onMouseenter: (e) => x(r),
53951
+ onMouseleave: (e) => S(r, e)
53934
53952
  }, [W(n.$slots, "group", M({ ref_for: !0 }, { group: r }), () => [e.enableSelection && r.type !== J($A).Loading ? (V(), p(J(mb), {
53935
53953
  key: 0,
53936
53954
  class: "message-group-checkbox",
53937
53955
  "model-value": r.checked,
53938
- "onUpdate:modelValue": (e) => S(r, e)
53956
+ "onUpdate:modelValue": (e) => C(r, e)
53939
53957
  }, null, 8, ["model-value", "onUpdate:modelValue"])) : m("v-if", !0), g("div", {
53940
53958
  class: P(["message-group-messages", { "message-group-enabled-selection": e.renderMode === J(pj).Share || e.enableSelection && r.type !== J($A).Loading }]),
53941
53959
  style: I({ width: e.enableSelection && r.type !== J($A).Loading ? "calc(100% - 16px)" : "100%" })
@@ -53950,10 +53968,10 @@ var uG = ["src"], dG = {
53950
53968
  key: i,
53951
53969
  message: r,
53952
53970
  "message-tools-status": e.messageToolsStatus,
53953
- "on-action": (e) => w(e, r),
53954
- "on-input-confirm": (e, t) => T(r, e, t),
53971
+ "on-action": (e) => T(e, r),
53972
+ "on-input-confirm": (e, t) => E(r, e, t),
53955
53973
  "on-interrupt-resume": t.onInterruptResume,
53956
- "on-shortcut-confirm": (e) => E(r, e),
53974
+ "on-shortcut-confirm": (e) => D(r, e),
53957
53975
  "tippy-options": e.messageToolsTippyOptions
53958
53976
  }, _({ _: 2 }, [n.$slots.answeredQuestion ? {
53959
53977
  name: "answeredQuestion",
@@ -53969,12 +53987,12 @@ var uG = ["src"], dG = {
53969
53987
  "tippy-options"
53970
53988
  ]))])), 128)), e.renderMode !== J(pj).Share && !(e.enableSelection && r.type !== J($A).Loading) && !r.pause && r.type === J($A).Assistant && e.messageToolsStatus !== J(VW).Hidden ? (V(), p(oJ, {
53971
53989
  key: 0,
53972
- "message-tools": u.value,
53990
+ "message-tools": f.value,
53973
53991
  "message-tools-status": e.messageToolsStatus,
53974
- "on-action": (e) => C(e, r.messages),
53992
+ "on-action": (e) => w(e, r.messages),
53975
53993
  style: I({ visibility: r.isHover ? "visible" : "hidden" }),
53976
53994
  "tippy-options": t.messageToolsTippyOptions,
53977
- "update-tools": f.value,
53995
+ "update-tools": v.value,
53978
53996
  onFeedback: (e, n, i) => t.onAgentFeedback?.(e, r.messages, n, i)
53979
53997
  }, null, 8, [
53980
53998
  "message-tools",
@@ -53994,17 +54012,17 @@ var uG = ["src"], dG = {
53994
54012
  g("div", FX, [he(y(DM, {
53995
54013
  loading: e.messageStatus === J(ej).StopLoading,
53996
54014
  title: e.messageStatus === J(ej).StopLoading ? J(Q)("正在停止") : J(Q)("停止生成"),
53997
- onClick: c[0] ||= (e) => n.$emit("stopStreaming")
54015
+ onClick: a[0] ||= (e) => n.$emit("stopStreaming")
53998
54016
  }, {
53999
54017
  icon: Y(() => [y(J(Qj))]),
54000
54018
  _: 1
54001
54019
  }, 8, ["loading", "title"]), [[de, e.renderMode !== J(pj).Share && (e.messageStatus === J(ej).Streaming || e.messageStatus === J(ej).StopLoading || e.messageStatus === J(ej).Fetching || e.messageStatus === J(ej).Pending)]]), he(y(DM, {
54002
54020
  title: J(Q)("返回底部"),
54003
- onClick: J(a)
54021
+ onClick: a[1] ||= () => J(s)("smooth")
54004
54022
  }, {
54005
54023
  icon: Y(() => [y(J(gM))]),
54006
54024
  _: 1
54007
- }, 8, ["title", "onClick"]), [[de, J(s)]])])
54025
+ }, 8, ["title"]), [[de, J(c)]])])
54008
54026
  ], 512));
54009
54027
  }
54010
54028
  }), LX = { class: "ai-execution-summary" }, RX = { class: "ai-execution-summary-header" }, zX = { class: "ai-execution-summary-content" }, BX = ["onMouseenter"], VX = { class: "content-item-header" }, HX = { class: "content-item-title" }, UX = { class: "content-item-messages" }, WX = {
@@ -55731,17 +55749,17 @@ var EZ = class extends Error {
55731
55749
  }
55732
55750
  };
55733
55751
  function DZ(e) {
55734
- let { props: t, emit: n, scrollToBottom: r, reportError: i, managerErrorBridge: a } = e, o = G(null), s = G(null), c = G(null), l = G(null), u = H(!1), f = H(!t.chatHelper), p = H(null), m = d(() => u.value), h = () => t.chatHelper ? !t.chatHelper.agent || !t.chatHelper.session || !t.chatHelper.message ? {
55752
+ let { props: t, emit: n, reportError: r, managerErrorBridge: i } = e, a = G(null), o = G(null), s = G(null), c = G(null), l = H(!1), u = H(!t.chatHelper), f = H(null), p = d(() => l.value), m = () => t.chatHelper ? !t.chatHelper.agent || !t.chatHelper.session || !t.chatHelper.message ? {
55735
55753
  valid: !1,
55736
55754
  error: "[ChatBot] Invalid chatHelper: missing required modules (agent, session, message)"
55737
55755
  } : { valid: !0 } : t.url ? { valid: !0 } : {
55738
55756
  valid: !1,
55739
55757
  error: "[ChatBot] Neither chatHelper nor url provided. Component requires at least one."
55740
- }, g = () => {
55741
- let e = h();
55742
- if (!e.valid) return console.error(e.error), p.value = Error(e.error), null;
55758
+ }, h = () => {
55759
+ let e = m();
55760
+ if (!e.valid) return console.error(e.error), f.value = Error(e.error), null;
55743
55761
  if (t.chatHelper) return t.chatHelper;
55744
- let a = new ST({
55762
+ let i = new ST({
55745
55763
  onStart: () => {
55746
55764
  n("receive-start");
55747
55765
  },
@@ -55749,76 +55767,76 @@ function DZ(e) {
55749
55767
  n("receive-text");
55750
55768
  },
55751
55769
  onDone: () => {
55752
- n("receive-end"), r();
55770
+ n("receive-end");
55753
55771
  },
55754
55772
  onError: (e) => {
55755
- i(e, "Stream error");
55773
+ r(e, "Stream error");
55756
55774
  }
55757
- }), o = _E({
55775
+ }), a = _E({
55758
55776
  requestData: yE(kE(t.url), () => q(t.requestOptions)),
55759
- protocol: a
55777
+ protocol: i
55760
55778
  });
55761
- return a.injectMessageModule(o.message), o;
55762
- }, _ = async (e, t) => {
55779
+ return i.injectMessageModule(a.message), a;
55780
+ }, g = async (e, t) => {
55763
55781
  if (e) try {
55764
55782
  let n = e.session.current?.value?.sessionCode ?? "";
55765
55783
  await e.agent.stopChat(n), t && e.agent.abortChat();
55766
55784
  } catch {}
55767
- }, v = 0, y = null, b = null, x = null, S = (e) => {
55768
- x &&= (e ? x.reject(e) : x.resolve(), null), y = null;
55769
- }, C = (e) => {
55770
- if (e !== v) throw new EZ();
55771
- }, w = async (e) => {
55772
- let r = o.value, d = f.value;
55773
- u.value = !1, p.value = null, f.value = !t.chatHelper, await _(r, d), C(e), o.value = null, s.value = null, c.value = null, l.value = null;
55774
- let m = g();
55775
- if (!m) throw p.value ?? /* @__PURE__ */ Error("[ChatBot] Failed to create chatHelper");
55776
- let h = new yZ(m.session, m.agent, a, {
55785
+ }, _ = 0, v = null, y = null, b = null, x = (e) => {
55786
+ b &&= (e ? b.reject(e) : b.resolve(), null), v = null;
55787
+ }, S = (e) => {
55788
+ if (e !== _) throw new EZ();
55789
+ }, C = async (e) => {
55790
+ let d = a.value, p = u.value;
55791
+ l.value = !1, f.value = null, u.value = !t.chatHelper, await g(d, p), S(e), a.value = null, o.value = null, s.value = null, c.value = null;
55792
+ let m = h();
55793
+ if (!m) throw f.value ?? /* @__PURE__ */ Error("[ChatBot] Failed to create chatHelper");
55794
+ let _ = new yZ(m.session, m.agent, i, {
55777
55795
  enableChatSession: !0,
55778
55796
  autoSwitchToInitialSession: !!t.sessionCode,
55779
55797
  loadRecentSessionOnMount: t.autoLoad,
55780
55798
  initialSessionCode: t.sessionCode,
55781
55799
  alwaysCreateNewSession: t.alwaysCreateNewSession
55782
- }, m.message), v = new vZ(m.agent, m.message, m.session, a, {
55800
+ }, m.message), v = new vZ(m.agent, m.message, m.session, i, {
55783
55801
  openingRemark: t.helloText,
55784
55802
  predefinedQuestions: t.prompts,
55785
55803
  placeholder: t.placeholder,
55786
55804
  onSessionRenamed: (e) => n("rename", e)
55787
55805
  }), y = new xZ(null, t.shortcuts || []);
55788
- o.value = m, s.value = h, c.value = v, l.value = y;
55806
+ a.value = m, o.value = _, s.value = v, c.value = y;
55789
55807
  try {
55790
- f.value && (await _Z(m, { enableModelSelect: t.enableModelSelect !== !1 && !t.models?.length }), C(e), await h.loadRecentSession({ skipLoadSessions: !0 }), C(e)), t.enableModelSelect !== !1 && (t.models?.length ? v.setModels(t.models) : await v.loadModels(), C(e)), C(e), u.value = !0, n("agent-info-loaded", m);
55808
+ u.value && (await _Z(m, { enableModelSelect: t.enableModelSelect !== !1 && !t.models?.length }), S(e), await _.loadRecentSession({ skipLoadSessions: !0 }), S(e)), t.enableModelSelect !== !1 && (t.models?.length ? v.setModels(t.models) : await v.loadModels(), S(e)), S(e), l.value = !0, n("agent-info-loaded", m);
55791
55809
  } catch (t) {
55792
- throw C(e), p.value = i(t, "Failed to initialize ChatBot"), t;
55810
+ throw S(e), f.value = r(t, "Failed to initialize ChatBot"), t;
55793
55811
  }
55794
- }, T = () => {
55795
- S(new EZ()), b = null;
55796
- let e = ++v;
55797
- y = new Promise((t, n) => {
55798
- x = {
55812
+ }, w = () => {
55813
+ x(new EZ()), y = null;
55814
+ let e = ++_;
55815
+ v = new Promise((t, n) => {
55816
+ b = {
55799
55817
  resolve: t,
55800
55818
  reject: n
55801
- }, w(e).then(() => {
55802
- x &&= (b = Promise.resolve(), x.resolve(), null);
55819
+ }, C(e).then(() => {
55820
+ b &&= (y = Promise.resolve(), b.resolve(), null);
55803
55821
  }).catch((e) => {
55804
- x &&= (x.reject(EE(e)), null);
55822
+ b &&= (b.reject(EE(e)), null);
55805
55823
  }).finally(() => {
55806
- e === v && (y = null);
55824
+ e === _ && (v = null);
55807
55825
  });
55808
- }), y.catch(() => {});
55826
+ }), v.catch(() => {});
55809
55827
  };
55810
- return fe([() => t.url, () => t.chatHelper], () => T(), { immediate: !0 }), L(() => {
55811
- S(), _(o.value, f.value);
55828
+ return fe([() => t.url, () => t.chatHelper], () => w(), { immediate: !0 }), L(() => {
55829
+ x(), g(a.value, u.value);
55812
55830
  }), {
55813
- chatHelper: o,
55814
- isStandaloneMode: f,
55815
- isInitialized: u,
55816
- isReady: m,
55817
- initError: p,
55818
- whenReady: () => u.value ? (b ||= Promise.resolve(), b) : p.value ? Promise.reject(p.value) : y || Promise.resolve(),
55819
- chatBusinessManager: c,
55820
- sessionBusinessManager: s,
55821
- shortcutManager: l
55831
+ chatHelper: a,
55832
+ isStandaloneMode: u,
55833
+ isInitialized: l,
55834
+ isReady: p,
55835
+ initError: f,
55836
+ whenReady: () => l.value ? (y ||= Promise.resolve(), y) : f.value ? Promise.reject(f.value) : v || Promise.resolve(),
55837
+ chatBusinessManager: s,
55838
+ sessionBusinessManager: o,
55839
+ shortcutManager: c
55822
55840
  };
55823
55841
  }
55824
55842
  //#endregion
@@ -56139,7 +56157,7 @@ function VZ(e) {
56139
56157
  //#endregion
56140
56158
  //#region src/components/composables/use-tool-actions.ts
56141
56159
  function HZ(e) {
56142
- let { emit: t, chatHelper: n, chatBusinessManager: r, cite: i, focusInput: a, scrollToBottom: o, getShortcutFromMessage: s, buildShortcutProperty: c, getRequestOptions: l, reportError: u, stopGeneration: d } = e, f = async (e) => {
56160
+ let { emit: t, chatHelper: n, chatBusinessManager: r, cite: i, focusInput: a, getShortcutFromMessage: o, buildShortcutProperty: s, getRequestOptions: c, reportError: l, stopGeneration: u } = e, d = async (e) => {
56143
56161
  if (!r.value || !n.value) {
56144
56162
  console.error("[ChatBot] Cannot delete messages: chatBusinessManager not initialized");
56145
56163
  return;
@@ -56153,9 +56171,9 @@ function HZ(e) {
56153
56171
  let a = [i, ...e];
56154
56172
  await n.value.message.deleteMessages(a);
56155
56173
  } catch (e) {
56156
- u(e, "Failed to delete messages");
56174
+ l(e, "Failed to delete messages");
56157
56175
  }
56158
- }, p = async (e) => {
56176
+ }, f = async (e) => {
56159
56177
  if (!r.value || !n.value) {
56160
56178
  console.error("[ChatBot] Cannot regenerate: chatBusinessManager not initialized");
56161
56179
  return;
@@ -56166,11 +56184,11 @@ function HZ(e) {
56166
56184
  return;
56167
56185
  }
56168
56186
  try {
56169
- await r.value.regenerateFromAIMessages(e, t), o();
56187
+ await r.value.regenerateFromAIMessages(e, t);
56170
56188
  } catch (e) {
56171
- u(e, "Failed to regenerate");
56189
+ l(e, "Failed to regenerate");
56172
56190
  }
56173
- }, m = async (e) => {
56191
+ }, p = async (e) => {
56174
56192
  if (!r.value || !n.value) {
56175
56193
  console.error("[ChatBot] Cannot delete message: chatHelper not initialized");
56176
56194
  return;
@@ -56190,7 +56208,7 @@ function HZ(e) {
56190
56208
  let o = [e, ...a];
56191
56209
  await n.value.message.deleteMessages(o);
56192
56210
  } catch (e) {
56193
- u(e, "Failed to delete user message");
56211
+ l(e, "Failed to delete user message");
56194
56212
  }
56195
56213
  };
56196
56214
  return {
@@ -56200,11 +56218,11 @@ function HZ(e) {
56200
56218
  return;
56201
56219
  }
56202
56220
  if (e.id === "rebuild") {
56203
- await p(r);
56221
+ await f(r);
56204
56222
  return;
56205
56223
  }
56206
56224
  if (e.id === "delete") {
56207
- await f(r);
56225
+ await d(r);
56208
56226
  return;
56209
56227
  }
56210
56228
  if (e.id === "like" || e.id === "unlike") {
@@ -56232,22 +56250,22 @@ function HZ(e) {
56232
56250
  console.error("[ChatBot] Cannot submit feedback: no user message found");
56233
56251
  return;
56234
56252
  }
56235
- let l = e.id === "like" ? 5 : 0;
56253
+ let u = e.id === "like" ? 5 : 0;
56236
56254
  try {
56237
56255
  await n.value.session.postSessionFeedback({
56238
56256
  sessionCode: s,
56239
56257
  sessionContentIds: [c],
56240
- rate: l,
56258
+ rate: u,
56241
56259
  labels: a,
56242
56260
  comment: o
56243
56261
  }), t("feedback", e, i[0], a, o);
56244
56262
  } catch (e) {
56245
- u(e, "Failed to submit feedback");
56263
+ l(e, "Failed to submit feedback");
56246
56264
  }
56247
56265
  },
56248
56266
  handleUserAction: async (e, t) => {
56249
56267
  if (e.id === "delete") {
56250
- await m(t);
56268
+ await p(t);
56251
56269
  return;
56252
56270
  }
56253
56271
  if (e.id === "cite") {
@@ -56266,16 +56284,16 @@ function HZ(e) {
56266
56284
  console.error("[ChatBot] Cannot edit message: no active session");
56267
56285
  return;
56268
56286
  }
56269
- let s = e.id;
56270
- if (s === void 0) {
56287
+ let o = e.id;
56288
+ if (o === void 0) {
56271
56289
  console.error("[ChatBot] Cannot edit message: message has no id");
56272
56290
  return;
56273
56291
  }
56274
56292
  try {
56275
- let n = e.property, i = xE(n, l);
56276
- await r.value?.resendMessageWithProperty(String(s), a, typeof t == "string" ? t : "", i), o();
56293
+ let n = e.property, i = xE(n, c);
56294
+ await r.value?.resendMessageWithProperty(String(o), a, typeof t == "string" ? t : "", i);
56277
56295
  } catch (e) {
56278
- u(e, "Failed to edit and resend message");
56296
+ l(e, "Failed to edit and resend message");
56279
56297
  }
56280
56298
  },
56281
56299
  handleUserShortcutConfirm: async (e, t) => {
@@ -56294,18 +56312,18 @@ function HZ(e) {
56294
56312
  return;
56295
56313
  }
56296
56314
  try {
56297
- let n = s(e);
56315
+ let n = o(e);
56298
56316
  if (!n) {
56299
56317
  console.error("[ChatBot] Cannot edit shortcut message: shortcut not found");
56300
56318
  return;
56301
56319
  }
56302
- let u = xE(c(n, t), l), d = String(t.input ?? "");
56303
- await r.value.resendMessageWithProperty(String(a), i, d, u), o();
56320
+ let l = xE(s(n, t), c), u = String(t.input ?? "");
56321
+ await r.value.resendMessageWithProperty(String(a), i, u, l);
56304
56322
  } catch (e) {
56305
- u(e, "Failed to edit shortcut message");
56323
+ l(e, "Failed to edit shortcut message");
56306
56324
  }
56307
56325
  },
56308
- handleStopStreaming: d
56326
+ handleStopStreaming: u
56309
56327
  };
56310
56328
  }
56311
56329
  //#endregion
@@ -56385,194 +56403,190 @@ var UZ = /* @__PURE__ */ x({
56385
56403
  }, a = d(() => ({
56386
56404
  ...i,
56387
56405
  ...r.resizeProps
56388
- })), s = n, c = le(), l = H(), u = H(), f = H(), p = G([]), g = H(null), v = d({
56406
+ })), s = n, c = le(), l = H(), u = H(), f = G([]), p = H(null), g = d({
56389
56407
  get: () => r.renderMode ?? pj.Chat,
56390
56408
  set: () => {}
56391
- }), b = d(() => L.value?.selectedLlmCode.value), x = async () => {
56392
- await N(), l.value && (l.value.scrollTop = l.value.scrollHeight);
56393
- }, S = () => {
56394
- f.value?.focus?.();
56395
- }, { reportError: w, managerErrorBridge: T } = AZ(s), { chatHelper: E, isStandaloneMode: D, isInitialized: k, isReady: A, initError: j, whenReady: M, chatBusinessManager: L, sessionBusinessManager: R, shortcutManager: z } = DZ({
56409
+ }), v = d(() => j.value?.selectedLlmCode.value), b = () => {
56410
+ u.value?.focus?.();
56411
+ }, { reportError: x, managerErrorBridge: S } = AZ(s), { chatHelper: w, isStandaloneMode: T, isInitialized: E, isReady: D, initError: k, whenReady: A, chatBusinessManager: j, sessionBusinessManager: M, shortcutManager: N } = DZ({
56396
56412
  props: r,
56397
56413
  emit: s,
56398
- scrollToBottom: x,
56399
- reportError: w,
56400
- managerErrorBridge: T
56401
- }), { handleInterruptResume: B, resumeUserQuestionWithInput: ee } = LZ({
56402
- chatHelper: E,
56403
- reportError: w
56404
- }), { userInput: te, cite: ne, handleUpdateModelValue: re, doSendMessage: U, handleSendMessage: ie, handleUpload: K, handleArtifactClick: ae, handleStopSending: q, stopGeneration: oe } = RZ({
56414
+ reportError: x,
56415
+ managerErrorBridge: S
56416
+ }), { handleInterruptResume: L, resumeUserQuestionWithInput: R } = LZ({
56417
+ chatHelper: w,
56418
+ reportError: x
56419
+ }), { userInput: z, cite: B, handleUpdateModelValue: ee, doSendMessage: te, handleSendMessage: ne, handleUpload: re, handleArtifactClick: U, handleStopSending: ie, stopGeneration: K } = RZ({
56405
56420
  emit: s,
56406
- chatHelper: E,
56407
- chatBusinessManager: L,
56421
+ chatHelper: w,
56422
+ chatBusinessManager: j,
56408
56423
  getRequestOptions: () => r.requestOptions,
56409
- reportError: w,
56410
- resumeUserQuestionWithInput: ee,
56411
- selectedShortcut: g,
56412
- selectedResources: p
56413
- }), { handleSelectShortcut: se, handleCloseShortcut: ce, handleShortcutSubmit: ue, selectShortcutWithText: de, getShortcutFromMessage: pe, buildShortcutProperty: me, sendShortcutDirectly: he } = VZ({
56424
+ reportError: x,
56425
+ resumeUserQuestionWithInput: R,
56426
+ selectedShortcut: p,
56427
+ selectedResources: f
56428
+ }), { handleSelectShortcut: ae, handleCloseShortcut: q, handleShortcutSubmit: oe, selectShortcutWithText: se, getShortcutFromMessage: ce, buildShortcutProperty: ue, sendShortcutDirectly: de } = VZ({
56414
56429
  props: r,
56415
56430
  emit: s,
56416
- chatHelper: E,
56417
- shortcutManager: z,
56418
- doSendMessage: U,
56419
- reportError: w,
56420
- selectedShortcut: g
56421
- }), { messageStatus: ge, messageToolsStatus: _e, messages: ve, isMessagesLoading: ye, isGenerating: be, currentSession: xe, isWelcomeState: Se, openingRemark: Ce, effectiveResources: we, effectivePrompts: Te, effectiveSkills: Ee, effectiveSupportUpload: De, chatbotStyle: Oe, filteredShortcuts: ke } = OZ({
56431
+ chatHelper: w,
56432
+ shortcutManager: N,
56433
+ doSendMessage: te,
56434
+ reportError: x,
56435
+ selectedShortcut: p
56436
+ }), { messageStatus: pe, messageToolsStatus: me, messages: he, isMessagesLoading: ge, isGenerating: _e, currentSession: ve, isWelcomeState: ye, openingRemark: be, effectiveResources: xe, effectivePrompts: Se, effectiveSkills: Ce, effectiveSupportUpload: we, chatbotStyle: Te, filteredShortcuts: Ee } = OZ({
56422
56437
  props: r,
56423
- chatHelper: E,
56424
- chatBusinessManager: L,
56425
- sessionBusinessManager: R,
56426
- shortcutManager: z,
56427
- isStandaloneMode: D,
56428
- isInitialized: k,
56429
- selectedShortcut: g
56430
- }), { handleAgentAction: Ae, handleAgentFeedback: je, handleUserAction: Me, handleUserInputConfirm: Ne, handleUserShortcutConfirm: Pe, handleStopStreaming: Fe } = HZ({
56438
+ chatHelper: w,
56439
+ chatBusinessManager: j,
56440
+ sessionBusinessManager: M,
56441
+ shortcutManager: N,
56442
+ isStandaloneMode: T,
56443
+ isInitialized: E,
56444
+ selectedShortcut: p
56445
+ }), { handleAgentAction: De, handleAgentFeedback: Oe, handleUserAction: ke, handleUserInputConfirm: Ae, handleUserShortcutConfirm: je, handleStopStreaming: Me } = HZ({
56431
56446
  emit: s,
56432
- chatHelper: E,
56433
- chatBusinessManager: L,
56434
- cite: ne,
56435
- focusInput: S,
56436
- scrollToBottom: x,
56437
- getShortcutFromMessage: pe,
56438
- buildShortcutProperty: me,
56447
+ chatHelper: w,
56448
+ chatBusinessManager: j,
56449
+ cite: B,
56450
+ focusInput: b,
56451
+ getShortcutFromMessage: ce,
56452
+ buildShortcutProperty: ue,
56439
56453
  getRequestOptions: () => r.requestOptions,
56440
- reportError: w,
56441
- stopGeneration: oe
56442
- }), Ie = d(() => !k.value || ye.value), Le = d(() => {
56443
- if (r.useAgentName) return E.value?.agent.info.value?.agentName || void 0;
56444
- }), Re = d(() => {
56454
+ reportError: x,
56455
+ stopGeneration: K
56456
+ }), Ne = d(() => !E.value || ge.value), Pe = d(() => {
56457
+ if (r.useAgentName) return w.value?.agent.info.value?.agentName || void 0;
56458
+ }), Fe = d(() => {
56445
56459
  if (r.enableModelSelect === !1) return;
56446
- let e = L.value?.models.value ?? [];
56460
+ let e = j.value?.models.value ?? [];
56447
56461
  return e.length > 0 ? e : void 0;
56448
- }), ze = d({
56449
- get: () => L.value?.selectedModelName.value ?? "",
56462
+ }), Ie = d({
56463
+ get: () => j.value?.selectedModelName.value ?? "",
56450
56464
  set: (e) => {
56451
- L.value?.setSelectedModelByName(e);
56465
+ j.value?.setSelectedModelByName(e);
56452
56466
  }
56453
- }), Be = (e) => {
56454
- L.value?.setSelectedModel(e);
56467
+ }), Le = (e) => {
56468
+ j.value?.setSelectedModel(e);
56455
56469
  };
56456
56470
  fe(() => r.models, (e) => {
56457
- r.enableModelSelect === !1 || !L.value || e?.length && L.value.setModels(e);
56471
+ r.enableModelSelect === !1 || !j.value || e?.length && j.value.setModels(e);
56458
56472
  });
56459
- let { handleConfirmShare: Ve } = BZ({
56473
+ let { handleConfirmShare: Re } = BZ({
56460
56474
  emit: s,
56461
- chatHelper: E,
56462
- isStandaloneMode: D
56463
- }), He = (e, t) => {
56475
+ chatHelper: w,
56476
+ isStandaloneMode: T
56477
+ }), ze = (e, t) => {
56464
56478
  s("execution-panel-change", e, t);
56465
- }, Ue = async (e) => {
56479
+ }, Be = async (e) => {
56466
56480
  if (r.onCustomTabChange) return r.onCustomTabChange(e);
56467
56481
  let t = e.data?.props;
56468
- if (t?.task_id != null && t?.node_id) return E.value?.message.getFlowAgentTaskNodeInfo(t.task_id, t.node_id);
56482
+ if (t?.task_id != null && t?.node_id) return w.value?.message.getFlowAgentTaskNodeInfo(t.task_id, t.node_id);
56469
56483
  };
56470
56484
  return t({
56471
- sendMessage: (e) => ie(e, [[]]),
56472
- stopGeneration: oe,
56485
+ sendMessage: (e) => ne(e, [[]]),
56486
+ stopGeneration: K,
56473
56487
  switchSession: async (e) => {
56474
- if (!R.value) {
56488
+ if (!M.value) {
56475
56489
  console.error("[ChatBot] Cannot switch session: sessionBusinessManager not initialized");
56476
56490
  return;
56477
56491
  }
56478
56492
  try {
56479
- await R.value.switchSession(e), s("session-switched", R.value.currentSession.value);
56493
+ await M.value.switchSession(e), s("session-switched", M.value.currentSession.value);
56480
56494
  } catch (e) {
56481
- w(e, "Failed to switch session");
56495
+ x(e, "Failed to switch session");
56482
56496
  }
56483
56497
  },
56484
- messages: ve,
56485
- currentSession: xe,
56486
- isGenerating: be,
56498
+ messages: he,
56499
+ currentSession: ve,
56500
+ isGenerating: _e,
56487
56501
  get isReady() {
56488
- return A.value;
56502
+ return D.value;
56489
56503
  },
56490
- whenReady: M,
56491
- getChatHelper: () => E.value,
56504
+ whenReady: A,
56505
+ getChatHelper: () => w.value,
56492
56506
  setCiteText: (e) => {
56493
- ne.value = e;
56507
+ B.value = e;
56494
56508
  },
56495
- focusInput: S,
56496
- enterShareMode: () => u.value?.enterShareMode(),
56497
- exitShareMode: () => u.value?.exitShareMode(),
56509
+ focusInput: b,
56510
+ enterShareMode: () => l.value?.enterShareMode(),
56511
+ exitShareMode: () => l.value?.exitShareMode(),
56498
56512
  selectShortcut: (e, t) => {
56499
- de(e, t);
56513
+ se(e, t);
56500
56514
  },
56501
- sendShortcut: (e, t) => he(e, t),
56515
+ sendShortcut: (e, t) => de(e, t),
56502
56516
  updateAgentInfo: async () => {
56503
- let e = E.value;
56517
+ let e = w.value;
56504
56518
  if (!e) return null;
56505
56519
  try {
56506
56520
  await e.agent.getAgentInfo();
56507
56521
  let t = e.agent.info.value ?? null;
56508
- return t?.conversationSettings?.commands && z.value?.setAgentShortcuts(t.conversationSettings.commands), t;
56522
+ return t?.conversationSettings?.commands && N.value?.setAgentShortcuts(t.conversationSettings.commands), t;
56509
56523
  } catch (e) {
56510
- return w(e, "Failed to update agentInfo"), null;
56524
+ return x(e, "Failed to update agentInfo"), null;
56511
56525
  }
56512
56526
  },
56513
- selectedLlmCode: b
56527
+ selectedLlmCode: v
56514
56528
  }), (t, n) => (V(), h("div", {
56515
56529
  class: P([
56516
56530
  "ai-chatbot",
56517
56531
  r.extCls,
56518
- { "welcome-state": J(Se) }
56532
+ { "welcome-state": J(ye) }
56519
56533
  ]),
56520
- style: I(J(Oe))
56534
+ style: I(J(Te))
56521
56535
  }, [y(J(aZ), {
56522
56536
  ref_key: "chatContainerRef",
56523
- ref: u,
56524
- cite: J(ne),
56525
- "onUpdate:cite": n[0] ||= (e) => O(ne) ? ne.value = e : null,
56526
- "selected-shortcut": g.value,
56527
- "onUpdate:selectedShortcut": n[1] ||= (e) => g.value = e,
56528
- "selected-model": ze.value,
56529
- "onUpdate:selectedModel": n[2] ||= (e) => ze.value = e,
56530
- "render-mode": v.value,
56531
- "onUpdate:renderMode": n[3] ||= (e) => v.value = e,
56532
- "chat-loading": Ie.value,
56537
+ ref: l,
56538
+ cite: J(B),
56539
+ "onUpdate:cite": n[0] ||= (e) => O(B) ? B.value = e : null,
56540
+ "selected-shortcut": p.value,
56541
+ "onUpdate:selectedShortcut": n[1] ||= (e) => p.value = e,
56542
+ "selected-model": Ie.value,
56543
+ "onUpdate:selectedModel": n[2] ||= (e) => Ie.value = e,
56544
+ "render-mode": g.value,
56545
+ "onUpdate:renderMode": n[3] ||= (e) => g.value = e,
56546
+ "chat-loading": Ne.value,
56533
56547
  "common-tippy-options": e.messageToolsTippyOptions,
56534
56548
  "execution-tab-visible": r.executionTabVisible,
56535
- "message-status": J(ge),
56549
+ "message-status": J(pe),
56536
56550
  "message-tools": r.messageTools,
56537
- "message-tools-status": J(_e),
56538
- messages: J(ve),
56539
- "model-value": J(te),
56540
- models: Re.value,
56541
- "on-agent-action": J(Ae),
56542
- "on-agent-feedback": J(je),
56543
- "on-interrupt-resume": J(B),
56551
+ "message-tools-status": J(me),
56552
+ messages: J(he),
56553
+ "model-value": J(z),
56554
+ models: Fe.value,
56555
+ "on-agent-action": J(De),
56556
+ "on-agent-feedback": J(Oe),
56557
+ "on-interrupt-resume": J(L),
56544
56558
  "get-side-render-component": r.getSideRenderComponent,
56545
56559
  "get-side-tab-render-component": r.getSideTabRenderComponent,
56546
- "on-custom-tab-change": Ue,
56547
- "on-send-message": J(ie),
56548
- "on-stop-sending": J(q),
56549
- "on-artifact-click": J(ae),
56550
- "on-upload": J(K),
56551
- "on-user-action": J(Me),
56552
- "on-user-input-confirm": J(Ne),
56553
- "on-user-shortcut-confirm": J(Pe),
56554
- "opening-remark": J(Ce),
56560
+ "on-custom-tab-change": Be,
56561
+ "on-send-message": J(ne),
56562
+ "on-stop-sending": J(ie),
56563
+ "on-artifact-click": J(U),
56564
+ "on-upload": J(re),
56565
+ "on-user-action": J(ke),
56566
+ "on-user-input-confirm": J(Ae),
56567
+ "on-user-shortcut-confirm": J(je),
56568
+ "opening-remark": J(be),
56555
56569
  placeholder: r.placeholder,
56556
56570
  placement: r.placement,
56557
- "welcome-title": Le.value,
56558
- prompts: J(Te),
56571
+ "welcome-title": Pe.value,
56572
+ prompts: J(Se),
56559
56573
  "resize-props": a.value,
56560
56574
  size: r.size,
56561
- resources: J(we),
56562
- "shortcut-id": g.value?.id,
56563
- shortcuts: J(ke),
56564
- skills: J(Ee),
56565
- "support-upload": J(De),
56575
+ resources: J(xe),
56576
+ "shortcut-id": p.value?.id,
56577
+ shortcuts: J(Ee),
56578
+ skills: J(Ce),
56579
+ "support-upload": J(we),
56566
56580
  "update-tools": r.updateTools,
56567
- onCollapseChange: He,
56568
- onConfirmShare: J(Ve),
56569
- onDeleteShortcut: J(ce),
56570
- onModelChange: Be,
56571
- onSelectShortcut: J(se),
56572
- onShortcutClose: J(ce),
56573
- onShortcutSubmit: J(ue),
56574
- onStopStreaming: J(Fe),
56575
- "onUpdate:modelValue": J(re)
56581
+ onCollapseChange: ze,
56582
+ onConfirmShare: J(Re),
56583
+ onDeleteShortcut: J(q),
56584
+ onModelChange: Le,
56585
+ onSelectShortcut: J(ae),
56586
+ onShortcutClose: J(q),
56587
+ onShortcutSubmit: J(oe),
56588
+ onStopStreaming: J(Me),
56589
+ "onUpdate:modelValue": J(ee)
56576
56590
  }, _({
56577
56591
  message: Y(({ message: n, messageToolsStatus: r, onInterruptResume: i }) => [m(" 消费方提供了 #message slot 时,优先使用消费方的渲染 "), J(c).message ? W(t.$slots, "message", {
56578
56592
  key: 0,
@@ -56582,10 +56596,10 @@ var UZ = /* @__PURE__ */ x({
56582
56596
  }) : (V(), h(o, { key: 1 }, [m(" 否则使用默认的 MessageRender "), y(J(NX), {
56583
56597
  message: n,
56584
56598
  "message-tools-status": r,
56585
- "on-action": (e) => J(Me)(e, n),
56586
- "on-input-confirm": (e, t) => J(Ne)(n, e, t),
56599
+ "on-action": (e) => J(ke)(e, n),
56600
+ "on-input-confirm": (e, t) => J(Ae)(n, e, t),
56587
56601
  "on-interrupt-resume": i,
56588
- "on-shortcut-confirm": (e) => J(Pe)(n, e),
56602
+ "on-shortcut-confirm": (e) => J(je)(n, e),
56589
56603
  "tippy-options": e.messageToolsTippyOptions
56590
56604
  }, _({ _: 2 }, [t.$slots.codeHeader ? {
56591
56605
  name: "codeHeader",