@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.
@@ -27488,46 +27488,60 @@ var uR = ["src"], dR = /* @__PURE__ */ H({
27488
27488
  isScrollBottom: n,
27489
27489
  scrollBottomHeight: i,
27490
27490
  debouncedShowScrollBottomBtn: o,
27491
- toScrollBottom: s,
27492
- toScrollTop: c
27491
+ jumpToBottom: c,
27492
+ toScrollBottom: l,
27493
+ toScrollTop: u
27493
27494
  })));
27494
27495
  let s = () => {
27495
- a.value = !0, en(t)?.scrollIntoView({
27496
- behavior: "smooth",
27496
+ let t = en(e);
27497
+ return t ? Math.max(0, t.scrollHeight - t.scrollTop - t.clientHeight) : 0;
27498
+ }, c = () => {
27499
+ let t = en(e);
27500
+ t && (a.value = !0, t.scrollTop = t.scrollHeight);
27501
+ }, l = (e) => {
27502
+ a.value = !0;
27503
+ let n = e ?? (s() > 600 ? "auto" : "smooth");
27504
+ if (n === "auto") {
27505
+ c();
27506
+ return;
27507
+ }
27508
+ en(t)?.scrollIntoView({
27509
+ behavior: n,
27497
27510
  block: "end"
27498
27511
  });
27499
- }, c = () => {
27512
+ }, u = () => {
27500
27513
  en(e)?.scrollTo({
27501
27514
  top: 0,
27502
27515
  behavior: "smooth"
27503
27516
  });
27504
- }, l = () => {
27517
+ }, d = () => {
27505
27518
  let t = en(e);
27506
27519
  if (!t) return;
27507
27520
  let { scrollHeight: r, scrollTop: a, clientHeight: s } = t, c = r - a - s;
27508
27521
  i.value = Math.max(0, c), o.value = !n.value && i.value > 100;
27509
- }, u = (e) => {
27522
+ }, f = (e) => {
27510
27523
  e.deltaY < 0 && (a.value = !1);
27511
27524
  };
27512
27525
  return Gr(() => {
27513
27526
  Jn(() => {
27514
27527
  let s = en(e), c = en(t);
27515
- !s || !c || (r?.disconnect(), s.removeEventListener("scroll", l), s.removeEventListener("wheel", u), l(), r = new IntersectionObserver((e) => {
27528
+ !s || !c || (r?.disconnect(), s.removeEventListener("scroll", d), s.removeEventListener("wheel", f), d(), r = new IntersectionObserver((e) => {
27516
27529
  e.forEach((e) => {
27517
- e.isIntersecting ? (n.value = !0, i.value = 0, a.value = !0, o.value = !1) : (n.value = !1, l());
27530
+ e.isIntersecting ? (n.value = !0, i.value = 0, a.value = !0, o.value = !1) : (n.value = !1, d());
27518
27531
  });
27519
- }), r.observe(c), s.addEventListener("scroll", l, { passive: !0 }), s.addEventListener("wheel", u, { passive: !0 }));
27532
+ }), r.observe(c), s.addEventListener("scroll", d, { passive: !0 }), s.addEventListener("wheel", f, { passive: !0 }));
27520
27533
  });
27521
27534
  }), De(() => {
27522
27535
  r?.disconnect();
27523
27536
  let t = en(e);
27524
- t && (t.removeEventListener("scroll", l), t.removeEventListener("wheel", u));
27537
+ t && (t.removeEventListener("scroll", d), t.removeEventListener("wheel", f));
27525
27538
  }), {
27526
27539
  autoScrollEnabled: a,
27527
27540
  isScrollBottom: n,
27528
27541
  scrollBottomHeight: i,
27529
- toScrollBottom: s,
27530
- toScrollTop: c,
27542
+ jumpToBottom: c,
27543
+ toScrollBottom: l,
27544
+ toScrollTop: u,
27531
27545
  debouncedShowScrollBottomBtn: o
27532
27546
  };
27533
27547
  }, RR = () => Gn(IR, void 0), zR = Symbol("CUSTOM_TAB_TOKEN"), BR = "execution";
@@ -55280,7 +55294,11 @@ var zZ = ["src"], BZ = {
55280
55294
  }),
55281
55295
  emits: /* @__PURE__ */ bi(["stopStreaming"], ["update:selectedUserMessages"]),
55282
55296
  setup(e) {
55283
- let t = e, n = Bi(e, "selectedUserMessages"), r = jr("messageContainerRef"), i = jr("messageContainerBottomRef"), { toScrollBottom: a, debouncedShowScrollBottomBtn: o } = LR(r, i), { copy: s } = PR(), c = (e, t) => {
55297
+ let t = e, n = Bi(e, "selectedUserMessages"), r = jr("messageContainerRef"), i = jr("messageContainerBottomRef"), { jumpToBottom: a, toScrollBottom: o, debouncedShowScrollBottomBtn: s } = LR(r, i);
55298
+ Gr(() => {
55299
+ t.messageGroups?.length && (a(), requestAnimationFrame(() => a()));
55300
+ });
55301
+ let { copy: c } = PR(), l = (e, t) => {
55284
55302
  if (!t?.length) return e;
55285
55303
  let n = e.map((e) => {
55286
55304
  let n = t.find((t) => t.id === e.id);
@@ -55290,12 +55308,12 @@ var zZ = ["src"], BZ = {
55290
55308
  } : e;
55291
55309
  }), r = t.filter((t) => !e.some((e) => e.id === t.id));
55292
55310
  return [...n, ...r].filter((e) => !e.hidden);
55293
- }, l = X(() => c(Lc, t.messageTools).filter((e) => t.renderMode !== Hc.Test || e.id !== "share")), u = X(() => c(zc, t.updateTools)), d = X(() => t.renderMode === Hc.Share ? t.messageGroups.filter((e) => e.type !== Oc.Loading) : t.messageGroups), f = (e) => {
55311
+ }, u = X(() => l(Lc, t.messageTools).filter((e) => t.renderMode !== Hc.Test || e.id !== "share")), d = X(() => l(zc, t.updateTools)), f = X(() => t.renderMode === Hc.Share ? t.messageGroups.filter((e) => e.type !== Oc.Loading) : t.messageGroups), p = (e) => {
55294
55312
  e.messages?.at(-1)?.role !== Oc.Interrupt && (e.isHover = !0);
55295
- }, p = (e, t) => {
55313
+ }, m = (e, t) => {
55296
55314
  let n = t.toElement ?? t.relatedTarget;
55297
55315
  n instanceof Element && n.classList.contains("ai-user-feedback") || (e.isHover = !1);
55298
- }, m = (e, r) => {
55316
+ }, h = (e, r) => {
55299
55317
  let i = e.type === Oc.User;
55300
55318
  t.messageGroups?.forEach((n, a) => {
55301
55319
  if (n === e) {
@@ -55304,30 +55322,30 @@ var zZ = ["src"], BZ = {
55304
55322
  e && (e.checked = r);
55305
55323
  }
55306
55324
  }), n.value = t.messageGroups?.filter((e) => e.checked).map((e) => e.messages).flat();
55307
- }, h = async (e, n) => (e.id === "copy" && s(n.filter((e) => e.role !== Oc.Reasoning).map((e) => typeof e.content == "string" ? e.content : JSON.stringify(e.content || "")).join("\n")), t.onAgentAction?.(e, n)), g = async (e, n) => {
55325
+ }, g = async (e, n) => (e.id === "copy" && c(n.filter((e) => e.role !== Oc.Reasoning).map((e) => typeof e.content == "string" ? e.content : JSON.stringify(e.content || "")).join("\n")), t.onAgentAction?.(e, n)), _ = async (e, n) => {
55308
55326
  t.onUserAction?.(e, n);
55309
- }, _ = async (e, n, r) => {
55327
+ }, v = async (e, n, r) => {
55310
55328
  t.onUserInputConfirm?.(e, n, r);
55311
- }, v = async (e, n) => {
55329
+ }, y = async (e, n) => {
55312
55330
  t.onUserShortcutConfirm?.(e, n);
55313
55331
  };
55314
- return (n, s) => (W(), G("div", {
55332
+ return (n, a) => (W(), G("div", {
55315
55333
  ref_key: "messageContainerRef",
55316
55334
  ref: r,
55317
55335
  class: "ai-message-container"
55318
55336
  }, [
55319
- (W(!0), G(U, null, si(d.value, (r, i) => (W(), G("div", {
55337
+ (W(!0), G(U, null, si(f.value, (r, i) => (W(), G("div", {
55320
55338
  id: r.uid,
55321
55339
  key: i,
55322
55340
  class: "message-group",
55323
55341
  style: ce({ backgroundColor: r.checked ? "#f5f7fa" : "transparent" }),
55324
- onMouseenter: (e) => f(r),
55325
- onMouseleave: (e) => p(r, e)
55342
+ onMouseenter: (e) => p(r),
55343
+ onMouseleave: (e) => m(r, e)
55326
55344
  }, [li(n.$slots, "group", Xa({ ref_for: !0 }, { group: r }), () => [e.enableSelection && r.type !== B(Oc).Loading ? (W(), K(B(Wk), {
55327
55345
  key: 0,
55328
55346
  class: "message-group-checkbox",
55329
55347
  "model-value": r.checked,
55330
- "onUpdate:modelValue": (e) => m(r, e)
55348
+ "onUpdate:modelValue": (e) => h(r, e)
55331
55349
  }, null, 8, ["model-value", "onUpdate:modelValue"])) : Y("v-if", !0), q("div", {
55332
55350
  class: pe(["message-group-messages", { "message-group-enabled-selection": e.renderMode === B(Hc).Share || e.enableSelection && r.type !== B(Oc).Loading }]),
55333
55351
  style: ce({ width: e.enableSelection && r.type !== B(Oc).Loading ? "calc(100% - 16px)" : "100%" })
@@ -55342,10 +55360,10 @@ var zZ = ["src"], BZ = {
55342
55360
  key: i,
55343
55361
  message: r,
55344
55362
  "message-tools-status": e.messageToolsStatus,
55345
- "on-action": (e) => g(e, r),
55346
- "on-input-confirm": (e, t) => _(r, e, t),
55363
+ "on-action": (e) => _(e, r),
55364
+ "on-input-confirm": (e, t) => v(r, e, t),
55347
55365
  "on-interrupt-resume": t.onInterruptResume,
55348
- "on-shortcut-confirm": (e) => v(r, e),
55366
+ "on-shortcut-confirm": (e) => y(r, e),
55349
55367
  "tippy-options": e.messageToolsTippyOptions
55350
55368
  }, ci({ _: 2 }, [n.$slots.answeredQuestion ? {
55351
55369
  name: "answeredQuestion",
@@ -55361,12 +55379,12 @@ var zZ = ["src"], BZ = {
55361
55379
  "tippy-options"
55362
55380
  ]))])), 128)), e.renderMode !== B(Hc).Share && !(e.enableSelection && r.type !== B(Oc).Loading) && !r.pause && r.type === B(Oc).Assistant && e.messageToolsStatus !== B(gZ).Hidden ? (W(), K(F1, {
55363
55381
  key: 0,
55364
- "message-tools": l.value,
55382
+ "message-tools": u.value,
55365
55383
  "message-tools-status": e.messageToolsStatus,
55366
- "on-action": (e) => h(e, r.messages),
55384
+ "on-action": (e) => g(e, r.messages),
55367
55385
  style: ce({ visibility: r.isHover ? "visible" : "hidden" }),
55368
55386
  "tippy-options": t.messageToolsTippyOptions,
55369
- "update-tools": u.value,
55387
+ "update-tools": d.value,
55370
55388
  onFeedback: (e, n, i) => t.onAgentFeedback?.(e, r.messages, n, i)
55371
55389
  }, null, 8, [
55372
55390
  "message-tools",
@@ -55386,17 +55404,17 @@ var zZ = ["src"], BZ = {
55386
55404
  q("div", u4, [Hn(J(BP, {
55387
55405
  loading: e.messageStatus === B(kc).StopLoading,
55388
55406
  title: e.messageStatus === B(kc).StopLoading ? B(Q)("正在停止") : B(Q)("停止生成"),
55389
- onClick: s[0] ||= (e) => n.$emit("stopStreaming")
55407
+ onClick: a[0] ||= (e) => n.$emit("stopStreaming")
55390
55408
  }, {
55391
55409
  icon: V(() => [J(B(Dl))]),
55392
55410
  _: 1
55393
55411
  }, 8, ["loading", "title"]), [[$o, e.renderMode !== B(Hc).Share && (e.messageStatus === B(kc).Streaming || e.messageStatus === B(kc).StopLoading || e.messageStatus === B(kc).Fetching || e.messageStatus === B(kc).Pending)]]), Hn(J(BP, {
55394
55412
  title: B(Q)("返回底部"),
55395
- onClick: B(a)
55413
+ onClick: a[1] ||= () => B(o)("smooth")
55396
55414
  }, {
55397
55415
  icon: V(() => [J(B(Gl))]),
55398
55416
  _: 1
55399
- }, 8, ["title", "onClick"]), [[$o, B(o)]])])
55417
+ }, 8, ["title"]), [[$o, B(s)]])])
55400
55418
  ], 512));
55401
55419
  }
55402
55420
  }), f4 = { class: "ai-execution-summary" }, p4 = { class: "ai-execution-summary-header" }, m4 = { class: "ai-execution-summary-content" }, h4 = ["onMouseenter"], g4 = { class: "content-item-header" }, _4 = { class: "content-item-title" }, v4 = { class: "content-item-messages" }, y4 = {
@@ -59751,17 +59769,17 @@ var Q6 = class {
59751
59769
  }
59752
59770
  };
59753
59771
  function e8(e) {
59754
- let { props: t, emit: n, scrollToBottom: r, reportError: i, managerErrorBridge: a } = e, o = /* @__PURE__ */ z(null), s = /* @__PURE__ */ z(null), c = /* @__PURE__ */ z(null), l = /* @__PURE__ */ z(null), u = /* @__PURE__ */ R(!1), d = /* @__PURE__ */ R(!t.chatHelper), f = /* @__PURE__ */ R(null), p = X(() => u.value), m = () => t.chatHelper ? !t.chatHelper.agent || !t.chatHelper.session || !t.chatHelper.message ? {
59772
+ let { props: t, emit: n, reportError: r, managerErrorBridge: i } = e, a = /* @__PURE__ */ z(null), o = /* @__PURE__ */ z(null), s = /* @__PURE__ */ z(null), c = /* @__PURE__ */ z(null), l = /* @__PURE__ */ R(!1), u = /* @__PURE__ */ R(!t.chatHelper), d = /* @__PURE__ */ R(null), f = X(() => l.value), p = () => t.chatHelper ? !t.chatHelper.agent || !t.chatHelper.session || !t.chatHelper.message ? {
59755
59773
  valid: !1,
59756
59774
  error: "[ChatBot] Invalid chatHelper: missing required modules (agent, session, message)"
59757
59775
  } : { valid: !0 } : t.url ? { valid: !0 } : {
59758
59776
  valid: !1,
59759
59777
  error: "[ChatBot] Neither chatHelper nor url provided. Component requires at least one."
59760
- }, h = () => {
59761
- let e = m();
59762
- if (!e.valid) return console.error(e.error), f.value = Error(e.error), null;
59778
+ }, m = () => {
59779
+ let e = p();
59780
+ if (!e.valid) return console.error(e.error), d.value = Error(e.error), null;
59763
59781
  if (t.chatHelper) return t.chatHelper;
59764
- let a = new Y4({
59782
+ let i = new Y4({
59765
59783
  onStart: () => {
59766
59784
  n("receive-start");
59767
59785
  },
@@ -59769,76 +59787,76 @@ function e8(e) {
59769
59787
  n("receive-text");
59770
59788
  },
59771
59789
  onDone: () => {
59772
- n("receive-end"), r();
59790
+ n("receive-end");
59773
59791
  },
59774
59792
  onError: (e) => {
59775
- i(e, "Stream error");
59793
+ r(e, "Stream error");
59776
59794
  }
59777
- }), o = W3({
59795
+ }), a = W3({
59778
59796
  requestData: K3(r6(t.url), () => en(t.requestOptions)),
59779
- protocol: a
59797
+ protocol: i
59780
59798
  });
59781
- return a.injectMessageModule(o.message), o;
59782
- }, g = async (e, t) => {
59799
+ return i.injectMessageModule(a.message), a;
59800
+ }, h = async (e, t) => {
59783
59801
  if (e) try {
59784
59802
  let n = e.session.current?.value?.sessionCode ?? "";
59785
59803
  await e.agent.stopChat(n), t && e.agent.abortChat();
59786
59804
  } catch {}
59787
- }, _ = 0, v = null, y = null, b = null, x = (e) => {
59788
- b &&= (e ? b.reject(e) : b.resolve(), null), v = null;
59789
- }, S = (e) => {
59790
- if (e !== _) throw new $6();
59791
- }, C = async (e) => {
59792
- let r = o.value, p = d.value;
59793
- u.value = !1, f.value = null, d.value = !t.chatHelper, await g(r, p), S(e), o.value = null, s.value = null, c.value = null, l.value = null;
59794
- let m = h();
59795
- if (!m) throw f.value ?? /* @__PURE__ */ Error("[ChatBot] Failed to create chatHelper");
59796
- let _ = new G6(m.session, m.agent, a, {
59805
+ }, g = 0, _ = null, v = null, y = null, b = (e) => {
59806
+ y &&= (e ? y.reject(e) : y.resolve(), null), _ = null;
59807
+ }, x = (e) => {
59808
+ if (e !== g) throw new $6();
59809
+ }, S = async (e) => {
59810
+ let f = a.value, p = u.value;
59811
+ l.value = !1, d.value = null, u.value = !t.chatHelper, await h(f, p), x(e), a.value = null, o.value = null, s.value = null, c.value = null;
59812
+ let g = m();
59813
+ if (!g) throw d.value ?? /* @__PURE__ */ Error("[ChatBot] Failed to create chatHelper");
59814
+ let _ = new G6(g.session, g.agent, i, {
59797
59815
  enableChatSession: !0,
59798
59816
  autoSwitchToInitialSession: !!t.sessionCode,
59799
59817
  loadRecentSessionOnMount: t.autoLoad,
59800
59818
  initialSessionCode: t.sessionCode,
59801
59819
  alwaysCreateNewSession: t.alwaysCreateNewSession
59802
- }, m.message), v = new W6(m.agent, m.message, m.session, a, {
59820
+ }, g.message), v = new W6(g.agent, g.message, g.session, i, {
59803
59821
  openingRemark: t.helloText,
59804
59822
  predefinedQuestions: t.prompts,
59805
59823
  placeholder: t.placeholder,
59806
59824
  onSessionRenamed: (e) => n("rename", e)
59807
59825
  }), y = new q6(null, t.shortcuts || []);
59808
- o.value = m, s.value = _, c.value = v, l.value = y;
59826
+ a.value = g, o.value = _, s.value = v, c.value = y;
59809
59827
  try {
59810
- d.value && (await U6(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), u.value = !0, n("agent-info-loaded", m);
59828
+ u.value && (await U6(g, { enableModelSelect: t.enableModelSelect !== !1 && !t.models?.length }), x(e), await _.loadRecentSession({ skipLoadSessions: !0 }), x(e)), t.enableModelSelect !== !1 && (t.models?.length ? v.setModels(t.models) : await v.loadModels(), x(e)), x(e), l.value = !0, n("agent-info-loaded", g);
59811
59829
  } catch (t) {
59812
- throw S(e), f.value = i(t, "Failed to initialize ChatBot"), t;
59830
+ throw x(e), d.value = r(t, "Failed to initialize ChatBot"), t;
59813
59831
  }
59814
- }, w = () => {
59815
- x(new $6()), y = null;
59816
- let e = ++_;
59817
- v = new Promise((t, n) => {
59818
- b = {
59832
+ }, C = () => {
59833
+ b(new $6()), v = null;
59834
+ let e = ++g;
59835
+ _ = new Promise((t, n) => {
59836
+ y = {
59819
59837
  resolve: t,
59820
59838
  reject: n
59821
- }, C(e).then(() => {
59822
- b &&= (y = Promise.resolve(), b.resolve(), null);
59839
+ }, S(e).then(() => {
59840
+ y &&= (v = Promise.resolve(), y.resolve(), null);
59823
59841
  }).catch((e) => {
59824
- b &&= (b.reject(e6(e)), null);
59842
+ y &&= (y.reject(e6(e)), null);
59825
59843
  }).finally(() => {
59826
- e === _ && (v = null);
59844
+ e === g && (_ = null);
59827
59845
  });
59828
- }), v.catch(() => {});
59846
+ }), _.catch(() => {});
59829
59847
  };
59830
- return Zn([() => t.url, () => t.chatHelper], () => w(), { immediate: !0 }), Jr(() => {
59831
- x(), g(o.value, d.value);
59848
+ return Zn([() => t.url, () => t.chatHelper], () => C(), { immediate: !0 }), Jr(() => {
59849
+ b(), h(a.value, u.value);
59832
59850
  }), {
59833
- chatHelper: o,
59834
- isStandaloneMode: d,
59835
- isInitialized: u,
59836
- isReady: p,
59837
- initError: f,
59838
- whenReady: () => u.value ? (y ||= Promise.resolve(), y) : f.value ? Promise.reject(f.value) : v || Promise.resolve(),
59839
- chatBusinessManager: c,
59840
- sessionBusinessManager: s,
59841
- shortcutManager: l
59851
+ chatHelper: a,
59852
+ isStandaloneMode: u,
59853
+ isInitialized: l,
59854
+ isReady: f,
59855
+ initError: d,
59856
+ whenReady: () => l.value ? (v ||= Promise.resolve(), v) : d.value ? Promise.reject(d.value) : _ || Promise.resolve(),
59857
+ chatBusinessManager: s,
59858
+ sessionBusinessManager: o,
59859
+ shortcutManager: c
59842
59860
  };
59843
59861
  }
59844
59862
  //#endregion
@@ -60159,7 +60177,7 @@ function m8(e) {
60159
60177
  //#endregion
60160
60178
  //#region src/components/composables/use-tool-actions.ts
60161
60179
  function h8(e) {
60162
- 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) => {
60180
+ 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) => {
60163
60181
  if (!r.value || !n.value) {
60164
60182
  console.error("[ChatBot] Cannot delete messages: chatBusinessManager not initialized");
60165
60183
  return;
@@ -60173,9 +60191,9 @@ function h8(e) {
60173
60191
  let a = [i, ...e];
60174
60192
  await n.value.message.deleteMessages(a);
60175
60193
  } catch (e) {
60176
- u(e, "Failed to delete messages");
60194
+ l(e, "Failed to delete messages");
60177
60195
  }
60178
- }, p = async (e) => {
60196
+ }, f = async (e) => {
60179
60197
  if (!r.value || !n.value) {
60180
60198
  console.error("[ChatBot] Cannot regenerate: chatBusinessManager not initialized");
60181
60199
  return;
@@ -60186,11 +60204,11 @@ function h8(e) {
60186
60204
  return;
60187
60205
  }
60188
60206
  try {
60189
- await r.value.regenerateFromAIMessages(e, t), o();
60207
+ await r.value.regenerateFromAIMessages(e, t);
60190
60208
  } catch (e) {
60191
- u(e, "Failed to regenerate");
60209
+ l(e, "Failed to regenerate");
60192
60210
  }
60193
- }, m = async (e) => {
60211
+ }, p = async (e) => {
60194
60212
  if (!r.value || !n.value) {
60195
60213
  console.error("[ChatBot] Cannot delete message: chatHelper not initialized");
60196
60214
  return;
@@ -60210,7 +60228,7 @@ function h8(e) {
60210
60228
  let o = [e, ...a];
60211
60229
  await n.value.message.deleteMessages(o);
60212
60230
  } catch (e) {
60213
- u(e, "Failed to delete user message");
60231
+ l(e, "Failed to delete user message");
60214
60232
  }
60215
60233
  };
60216
60234
  return {
@@ -60220,11 +60238,11 @@ function h8(e) {
60220
60238
  return;
60221
60239
  }
60222
60240
  if (e.id === "rebuild") {
60223
- await p(r);
60241
+ await f(r);
60224
60242
  return;
60225
60243
  }
60226
60244
  if (e.id === "delete") {
60227
- await f(r);
60245
+ await d(r);
60228
60246
  return;
60229
60247
  }
60230
60248
  if (e.id === "like" || e.id === "unlike") {
@@ -60252,22 +60270,22 @@ function h8(e) {
60252
60270
  console.error("[ChatBot] Cannot submit feedback: no user message found");
60253
60271
  return;
60254
60272
  }
60255
- let l = e.id === "like" ? 5 : 0;
60273
+ let u = e.id === "like" ? 5 : 0;
60256
60274
  try {
60257
60275
  await n.value.session.postSessionFeedback({
60258
60276
  sessionCode: s,
60259
60277
  sessionContentIds: [c],
60260
- rate: l,
60278
+ rate: u,
60261
60279
  labels: a,
60262
60280
  comment: o
60263
60281
  }), t("feedback", e, i[0], a, o);
60264
60282
  } catch (e) {
60265
- u(e, "Failed to submit feedback");
60283
+ l(e, "Failed to submit feedback");
60266
60284
  }
60267
60285
  },
60268
60286
  handleUserAction: async (e, t) => {
60269
60287
  if (e.id === "delete") {
60270
- await m(t);
60288
+ await p(t);
60271
60289
  return;
60272
60290
  }
60273
60291
  if (e.id === "cite") {
@@ -60286,16 +60304,16 @@ function h8(e) {
60286
60304
  console.error("[ChatBot] Cannot edit message: no active session");
60287
60305
  return;
60288
60306
  }
60289
- let s = e.id;
60290
- if (s === void 0) {
60307
+ let o = e.id;
60308
+ if (o === void 0) {
60291
60309
  console.error("[ChatBot] Cannot edit message: message has no id");
60292
60310
  return;
60293
60311
  }
60294
60312
  try {
60295
- let n = e.property, i = J3(n, l);
60296
- await r.value?.resendMessageWithProperty(String(s), a, typeof t == "string" ? t : "", i), o();
60313
+ let n = e.property, i = J3(n, c);
60314
+ await r.value?.resendMessageWithProperty(String(o), a, typeof t == "string" ? t : "", i);
60297
60315
  } catch (e) {
60298
- u(e, "Failed to edit and resend message");
60316
+ l(e, "Failed to edit and resend message");
60299
60317
  }
60300
60318
  },
60301
60319
  handleUserShortcutConfirm: async (e, t) => {
@@ -60314,18 +60332,18 @@ function h8(e) {
60314
60332
  return;
60315
60333
  }
60316
60334
  try {
60317
- let n = s(e);
60335
+ let n = o(e);
60318
60336
  if (!n) {
60319
60337
  console.error("[ChatBot] Cannot edit shortcut message: shortcut not found");
60320
60338
  return;
60321
60339
  }
60322
- let u = J3(c(n, t), l), d = String(t.input ?? "");
60323
- await r.value.resendMessageWithProperty(String(a), i, d, u), o();
60340
+ let l = J3(s(n, t), c), u = String(t.input ?? "");
60341
+ await r.value.resendMessageWithProperty(String(a), i, u, l);
60324
60342
  } catch (e) {
60325
- u(e, "Failed to edit shortcut message");
60343
+ l(e, "Failed to edit shortcut message");
60326
60344
  }
60327
60345
  },
60328
- handleStopStreaming: d
60346
+ handleStopStreaming: u
60329
60347
  };
60330
60348
  }
60331
60349
  //#endregion
@@ -60405,194 +60423,190 @@ var g8 = /* @__PURE__ */ H({
60405
60423
  }, a = X(() => ({
60406
60424
  ...i,
60407
60425
  ...r.resizeProps
60408
- })), o = n, s = hi(), c = /* @__PURE__ */ R(), l = /* @__PURE__ */ R(), u = /* @__PURE__ */ R(), d = /* @__PURE__ */ z([]), f = /* @__PURE__ */ R(null), p = X({
60426
+ })), o = n, s = hi(), c = /* @__PURE__ */ R(), l = /* @__PURE__ */ R(), u = /* @__PURE__ */ z([]), d = /* @__PURE__ */ R(null), f = X({
60409
60427
  get: () => r.renderMode ?? Hc.Chat,
60410
60428
  set: () => {}
60411
- }), m = X(() => T.value?.selectedLlmCode.value), h = async () => {
60412
- await An(), c.value && (c.value.scrollTop = c.value.scrollHeight);
60413
- }, g = () => {
60414
- u.value?.focus?.();
60415
- }, { reportError: _, managerErrorBridge: v } = r8(o), { chatHelper: y, isStandaloneMode: b, isInitialized: x, isReady: S, initError: C, whenReady: w, chatBusinessManager: T, sessionBusinessManager: E, shortcutManager: D } = e8({
60429
+ }), p = X(() => C.value?.selectedLlmCode.value), m = () => {
60430
+ l.value?.focus?.();
60431
+ }, { reportError: h, managerErrorBridge: g } = r8(o), { chatHelper: _, isStandaloneMode: v, isInitialized: y, isReady: b, initError: x, whenReady: S, chatBusinessManager: C, sessionBusinessManager: w, shortcutManager: T } = e8({
60416
60432
  props: r,
60417
60433
  emit: o,
60418
- scrollToBottom: h,
60419
- reportError: _,
60420
- managerErrorBridge: v
60421
- }), { handleInterruptResume: O, resumeUserQuestionWithInput: k } = u8({
60422
- chatHelper: y,
60423
- reportError: _
60424
- }), { userInput: A, cite: j, handleUpdateModelValue: M, doSendMessage: N, handleSendMessage: P, handleUpload: F, handleArtifactClick: I, handleStopSending: ee, stopGeneration: te } = d8({
60434
+ reportError: h,
60435
+ managerErrorBridge: g
60436
+ }), { handleInterruptResume: E, resumeUserQuestionWithInput: D } = u8({
60437
+ chatHelper: _,
60438
+ reportError: h
60439
+ }), { userInput: O, cite: k, handleUpdateModelValue: A, doSendMessage: j, handleSendMessage: M, handleUpload: N, handleArtifactClick: P, handleStopSending: F, stopGeneration: I } = d8({
60425
60440
  emit: o,
60426
- chatHelper: y,
60427
- chatBusinessManager: T,
60441
+ chatHelper: _,
60442
+ chatBusinessManager: C,
60428
60443
  getRequestOptions: () => r.requestOptions,
60429
- reportError: _,
60430
- resumeUserQuestionWithInput: k,
60431
- selectedShortcut: f,
60432
- selectedResources: d
60433
- }), { handleSelectShortcut: ne, handleCloseShortcut: re, handleShortcutSubmit: ie, selectShortcutWithText: ae, getShortcutFromMessage: oe, buildShortcutProperty: se, sendShortcutDirectly: le } = m8({
60444
+ reportError: h,
60445
+ resumeUserQuestionWithInput: D,
60446
+ selectedShortcut: d,
60447
+ selectedResources: u
60448
+ }), { handleSelectShortcut: ee, handleCloseShortcut: te, handleShortcutSubmit: ne, selectShortcutWithText: re, getShortcutFromMessage: ie, buildShortcutProperty: ae, sendShortcutDirectly: oe } = m8({
60434
60449
  props: r,
60435
60450
  emit: o,
60436
- chatHelper: y,
60437
- shortcutManager: D,
60438
- doSendMessage: N,
60439
- reportError: _,
60440
- selectedShortcut: f
60441
- }), { messageStatus: ue, messageToolsStatus: de, messages: fe, isMessagesLoading: he, isGenerating: ge, currentSession: _e, isWelcomeState: ve, openingRemark: ye, effectiveResources: be, effectivePrompts: L, effectiveSkills: xe, effectiveSupportUpload: Se, chatbotStyle: Ce, filteredShortcuts: we } = t8({
60451
+ chatHelper: _,
60452
+ shortcutManager: T,
60453
+ doSendMessage: j,
60454
+ reportError: h,
60455
+ selectedShortcut: d
60456
+ }), { messageStatus: se, messageToolsStatus: le, messages: ue, isMessagesLoading: de, isGenerating: fe, currentSession: he, isWelcomeState: ge, openingRemark: _e, effectiveResources: ve, effectivePrompts: ye, effectiveSkills: be, effectiveSupportUpload: L, chatbotStyle: xe, filteredShortcuts: Se } = t8({
60442
60457
  props: r,
60443
- chatHelper: y,
60444
- chatBusinessManager: T,
60445
- sessionBusinessManager: E,
60446
- shortcutManager: D,
60447
- isStandaloneMode: b,
60448
- isInitialized: x,
60449
- selectedShortcut: f
60450
- }), { handleAgentAction: Te, handleAgentFeedback: Ee, handleUserAction: De, handleUserInputConfirm: Oe, handleUserShortcutConfirm: ke, handleStopStreaming: Ae } = h8({
60458
+ chatHelper: _,
60459
+ chatBusinessManager: C,
60460
+ sessionBusinessManager: w,
60461
+ shortcutManager: T,
60462
+ isStandaloneMode: v,
60463
+ isInitialized: y,
60464
+ selectedShortcut: d
60465
+ }), { handleAgentAction: Ce, handleAgentFeedback: we, handleUserAction: Te, handleUserInputConfirm: Ee, handleUserShortcutConfirm: De, handleStopStreaming: Oe } = h8({
60451
60466
  emit: o,
60452
- chatHelper: y,
60453
- chatBusinessManager: T,
60454
- cite: j,
60455
- focusInput: g,
60456
- scrollToBottom: h,
60457
- getShortcutFromMessage: oe,
60458
- buildShortcutProperty: se,
60467
+ chatHelper: _,
60468
+ chatBusinessManager: C,
60469
+ cite: k,
60470
+ focusInput: m,
60471
+ getShortcutFromMessage: ie,
60472
+ buildShortcutProperty: ae,
60459
60473
  getRequestOptions: () => r.requestOptions,
60460
- reportError: _,
60461
- stopGeneration: te
60462
- }), je = X(() => !x.value || he.value), Me = X(() => {
60463
- if (r.useAgentName) return y.value?.agent.info.value?.agentName || void 0;
60464
- }), Ne = X(() => {
60474
+ reportError: h,
60475
+ stopGeneration: I
60476
+ }), ke = X(() => !y.value || de.value), Ae = X(() => {
60477
+ if (r.useAgentName) return _.value?.agent.info.value?.agentName || void 0;
60478
+ }), je = X(() => {
60465
60479
  if (r.enableModelSelect === !1) return;
60466
- let e = T.value?.models.value ?? [];
60480
+ let e = C.value?.models.value ?? [];
60467
60481
  return e.length > 0 ? e : void 0;
60468
- }), Pe = X({
60469
- get: () => T.value?.selectedModelName.value ?? "",
60482
+ }), Me = X({
60483
+ get: () => C.value?.selectedModelName.value ?? "",
60470
60484
  set: (e) => {
60471
- T.value?.setSelectedModelByName(e);
60485
+ C.value?.setSelectedModelByName(e);
60472
60486
  }
60473
- }), Fe = (e) => {
60474
- T.value?.setSelectedModel(e);
60487
+ }), Ne = (e) => {
60488
+ C.value?.setSelectedModel(e);
60475
60489
  };
60476
60490
  Zn(() => r.models, (e) => {
60477
- r.enableModelSelect === !1 || !T.value || e?.length && T.value.setModels(e);
60491
+ r.enableModelSelect === !1 || !C.value || e?.length && C.value.setModels(e);
60478
60492
  });
60479
- let { handleConfirmShare: Ie } = p8({
60493
+ let { handleConfirmShare: Pe } = p8({
60480
60494
  emit: o,
60481
- chatHelper: y,
60482
- isStandaloneMode: b
60483
- }), Le = (e, t) => {
60495
+ chatHelper: _,
60496
+ isStandaloneMode: v
60497
+ }), Fe = (e, t) => {
60484
60498
  o("execution-panel-change", e, t);
60485
- }, Re = async (e) => {
60499
+ }, Ie = async (e) => {
60486
60500
  if (r.onCustomTabChange) return r.onCustomTabChange(e);
60487
60501
  let t = e.data?.props;
60488
- if (t?.task_id != null && t?.node_id) return y.value?.message.getFlowAgentTaskNodeInfo(t.task_id, t.node_id);
60502
+ if (t?.task_id != null && t?.node_id) return _.value?.message.getFlowAgentTaskNodeInfo(t.task_id, t.node_id);
60489
60503
  };
60490
60504
  return t({
60491
- sendMessage: (e) => P(e, [[]]),
60492
- stopGeneration: te,
60505
+ sendMessage: (e) => M(e, [[]]),
60506
+ stopGeneration: I,
60493
60507
  switchSession: async (e) => {
60494
- if (!E.value) {
60508
+ if (!w.value) {
60495
60509
  console.error("[ChatBot] Cannot switch session: sessionBusinessManager not initialized");
60496
60510
  return;
60497
60511
  }
60498
60512
  try {
60499
- await E.value.switchSession(e), o("session-switched", E.value.currentSession.value);
60513
+ await w.value.switchSession(e), o("session-switched", w.value.currentSession.value);
60500
60514
  } catch (e) {
60501
- _(e, "Failed to switch session");
60515
+ h(e, "Failed to switch session");
60502
60516
  }
60503
60517
  },
60504
- messages: fe,
60505
- currentSession: _e,
60506
- isGenerating: ge,
60518
+ messages: ue,
60519
+ currentSession: he,
60520
+ isGenerating: fe,
60507
60521
  get isReady() {
60508
- return S.value;
60522
+ return b.value;
60509
60523
  },
60510
- whenReady: w,
60511
- getChatHelper: () => y.value,
60524
+ whenReady: S,
60525
+ getChatHelper: () => _.value,
60512
60526
  setCiteText: (e) => {
60513
- j.value = e;
60527
+ k.value = e;
60514
60528
  },
60515
- focusInput: g,
60516
- enterShareMode: () => l.value?.enterShareMode(),
60517
- exitShareMode: () => l.value?.exitShareMode(),
60529
+ focusInput: m,
60530
+ enterShareMode: () => c.value?.enterShareMode(),
60531
+ exitShareMode: () => c.value?.exitShareMode(),
60518
60532
  selectShortcut: (e, t) => {
60519
- ae(e, t);
60533
+ re(e, t);
60520
60534
  },
60521
- sendShortcut: (e, t) => le(e, t),
60535
+ sendShortcut: (e, t) => oe(e, t),
60522
60536
  updateAgentInfo: async () => {
60523
- let e = y.value;
60537
+ let e = _.value;
60524
60538
  if (!e) return null;
60525
60539
  try {
60526
60540
  await e.agent.getAgentInfo();
60527
60541
  let t = e.agent.info.value ?? null;
60528
- return t?.conversationSettings?.commands && D.value?.setAgentShortcuts(t.conversationSettings.commands), t;
60542
+ return t?.conversationSettings?.commands && T.value?.setAgentShortcuts(t.conversationSettings.commands), t;
60529
60543
  } catch (e) {
60530
- return _(e, "Failed to update agentInfo"), null;
60544
+ return h(e, "Failed to update agentInfo"), null;
60531
60545
  }
60532
60546
  },
60533
- selectedLlmCode: m
60547
+ selectedLlmCode: p
60534
60548
  }), (t, n) => (W(), G("div", {
60535
60549
  class: pe([
60536
60550
  "ai-chatbot",
60537
60551
  r.extCls,
60538
- { "welcome-state": B(ve) }
60552
+ { "welcome-state": B(ge) }
60539
60553
  ]),
60540
- style: ce(B(Ce))
60554
+ style: ce(B(xe))
60541
60555
  }, [J(B(P4), {
60542
60556
  ref_key: "chatContainerRef",
60543
- ref: l,
60544
- cite: B(j),
60545
- "onUpdate:cite": n[0] ||= (e) => /* @__PURE__ */ Zt(j) ? j.value = e : null,
60546
- "selected-shortcut": f.value,
60547
- "onUpdate:selectedShortcut": n[1] ||= (e) => f.value = e,
60548
- "selected-model": Pe.value,
60549
- "onUpdate:selectedModel": n[2] ||= (e) => Pe.value = e,
60550
- "render-mode": p.value,
60551
- "onUpdate:renderMode": n[3] ||= (e) => p.value = e,
60552
- "chat-loading": je.value,
60557
+ ref: c,
60558
+ cite: B(k),
60559
+ "onUpdate:cite": n[0] ||= (e) => /* @__PURE__ */ Zt(k) ? k.value = e : null,
60560
+ "selected-shortcut": d.value,
60561
+ "onUpdate:selectedShortcut": n[1] ||= (e) => d.value = e,
60562
+ "selected-model": Me.value,
60563
+ "onUpdate:selectedModel": n[2] ||= (e) => Me.value = e,
60564
+ "render-mode": f.value,
60565
+ "onUpdate:renderMode": n[3] ||= (e) => f.value = e,
60566
+ "chat-loading": ke.value,
60553
60567
  "common-tippy-options": e.messageToolsTippyOptions,
60554
60568
  "execution-tab-visible": r.executionTabVisible,
60555
- "message-status": B(ue),
60569
+ "message-status": B(se),
60556
60570
  "message-tools": r.messageTools,
60557
- "message-tools-status": B(de),
60558
- messages: B(fe),
60559
- "model-value": B(A),
60560
- models: Ne.value,
60561
- "on-agent-action": B(Te),
60562
- "on-agent-feedback": B(Ee),
60563
- "on-interrupt-resume": B(O),
60571
+ "message-tools-status": B(le),
60572
+ messages: B(ue),
60573
+ "model-value": B(O),
60574
+ models: je.value,
60575
+ "on-agent-action": B(Ce),
60576
+ "on-agent-feedback": B(we),
60577
+ "on-interrupt-resume": B(E),
60564
60578
  "get-side-render-component": r.getSideRenderComponent,
60565
60579
  "get-side-tab-render-component": r.getSideTabRenderComponent,
60566
- "on-custom-tab-change": Re,
60567
- "on-send-message": B(P),
60568
- "on-stop-sending": B(ee),
60569
- "on-artifact-click": B(I),
60570
- "on-upload": B(F),
60571
- "on-user-action": B(De),
60572
- "on-user-input-confirm": B(Oe),
60573
- "on-user-shortcut-confirm": B(ke),
60574
- "opening-remark": B(ye),
60580
+ "on-custom-tab-change": Ie,
60581
+ "on-send-message": B(M),
60582
+ "on-stop-sending": B(F),
60583
+ "on-artifact-click": B(P),
60584
+ "on-upload": B(N),
60585
+ "on-user-action": B(Te),
60586
+ "on-user-input-confirm": B(Ee),
60587
+ "on-user-shortcut-confirm": B(De),
60588
+ "opening-remark": B(_e),
60575
60589
  placeholder: r.placeholder,
60576
60590
  placement: r.placement,
60577
- "welcome-title": Me.value,
60578
- prompts: B(L),
60591
+ "welcome-title": Ae.value,
60592
+ prompts: B(ye),
60579
60593
  "resize-props": a.value,
60580
60594
  size: r.size,
60581
- resources: B(be),
60582
- "shortcut-id": f.value?.id,
60583
- shortcuts: B(we),
60584
- skills: B(xe),
60585
- "support-upload": B(Se),
60595
+ resources: B(ve),
60596
+ "shortcut-id": d.value?.id,
60597
+ shortcuts: B(Se),
60598
+ skills: B(be),
60599
+ "support-upload": B(L),
60586
60600
  "update-tools": r.updateTools,
60587
- onCollapseChange: Le,
60588
- onConfirmShare: B(Ie),
60589
- onDeleteShortcut: B(re),
60590
- onModelChange: Fe,
60591
- onSelectShortcut: B(ne),
60592
- onShortcutClose: B(re),
60593
- onShortcutSubmit: B(ie),
60594
- onStopStreaming: B(Ae),
60595
- "onUpdate:modelValue": B(M)
60601
+ onCollapseChange: Fe,
60602
+ onConfirmShare: B(Pe),
60603
+ onDeleteShortcut: B(te),
60604
+ onModelChange: Ne,
60605
+ onSelectShortcut: B(ee),
60606
+ onShortcutClose: B(te),
60607
+ onShortcutSubmit: B(ne),
60608
+ onStopStreaming: B(Oe),
60609
+ "onUpdate:modelValue": B(A)
60596
60610
  }, ci({
60597
60611
  message: V(({ message: n, messageToolsStatus: r, onInterruptResume: i }) => [Y(" 消费方提供了 #message slot 时,优先使用消费方的渲染 "), B(s).message ? li(t.$slots, "message", {
60598
60612
  key: 0,
@@ -60602,10 +60616,10 @@ var g8 = /* @__PURE__ */ H({
60602
60616
  }) : (W(), G(U, { key: 1 }, [Y(" 否则使用默认的 MessageRender "), J(B(c4), {
60603
60617
  message: n,
60604
60618
  "message-tools-status": r,
60605
- "on-action": (e) => B(De)(e, n),
60606
- "on-input-confirm": (e, t) => B(Oe)(n, e, t),
60619
+ "on-action": (e) => B(Te)(e, n),
60620
+ "on-input-confirm": (e, t) => B(Ee)(n, e, t),
60607
60621
  "on-interrupt-resume": i,
60608
- "on-shortcut-confirm": (e) => B(ke)(n, e),
60622
+ "on-shortcut-confirm": (e) => B(De)(n, e),
60609
60623
  "tippy-options": e.messageToolsTippyOptions
60610
60624
  }, ci({ _: 2 }, [t.$slots.codeHeader ? {
60611
60625
  name: "codeHeader",