@blueking/ai-blueking 2.2.5-beta.2 → 2.2.5-beta.3

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.
@@ -1962,6 +1962,7 @@ var vt = (e) => {
1962
1962
  timeout: i?.timeout ?? o
1963
1963
  });
1964
1964
  },
1965
+ deletePvFile: (t, n, r) => e.delete(`session/${t}/pv_files/`, { path: n }, r),
1965
1966
  isResumeSession: (t, n) => e.get(`session/${t}/is_resume/`, void 0, n)
1966
1967
  }), At = (e) => ({
1967
1968
  agent: yt(e),
@@ -2137,6 +2138,7 @@ var vt = (e) => {
2137
2138
  return zt(r) ? (await e.http?.session.uploadPvFiles(t, n))?.results ?? [] : (await Promise.all(n.map((n) => e.http?.session.uploadFile(t, n)))).filter((e) => !!e);
2138
2139
  },
2139
2140
  getPvFileDownloadUrl: (t, n, r) => e.http?.session.getPvFileDownloadUrl(t, n, r),
2141
+ deletePvFile: (t, n) => e.http?.session.deletePvFile(t, n),
2140
2142
  reset: () => {
2141
2143
  t.value = [], n.value = null, i.value = 0, a.value = 0, o.value = 0, s.value = !1, c.value = !1, l.value = !1, u.value = !1, d.value = !1, f.value = !1, p.value = !1, m.value = !1;
2142
2144
  }
@@ -4302,7 +4304,25 @@ function gr(e) {
4302
4304
  });
4303
4305
  let u = (e) => {
4304
4306
  c.value = e;
4305
- }, d = async (e, a = {}) => {
4307
+ }, d = /* @__PURE__ */ new Set(), f = (e) => {
4308
+ if (e) {
4309
+ if ("path" in e && e.path) return e.path;
4310
+ if ("id" in e && e.id) return e.id;
4311
+ }
4312
+ }, p = async (e, t) => {
4313
+ try {
4314
+ await n.value.session.deletePvFile(e, t);
4315
+ } catch (e) {
4316
+ a(e, "Failed to delete uploaded file");
4317
+ }
4318
+ }, m = (e, t, n) => {
4319
+ t.forEach((t, r) => {
4320
+ if (!d.has(t)) return;
4321
+ d.delete(t);
4322
+ let i = f(n[r]);
4323
+ i && p(e, i);
4324
+ });
4325
+ }, h = async (e, a = {}) => {
4306
4326
  if (!r.value || !n.value) throw Error("[ChatBot] Cannot send message: chatBusinessManager not initialized");
4307
4327
  let o = n.value.session.current?.value?.sessionCode;
4308
4328
  if (!o) throw Error("[ChatBot] Cannot send message: no active session");
@@ -4312,13 +4332,17 @@ function gr(e) {
4312
4332
  ...a,
4313
4333
  ...s ? { property: s } : {}
4314
4334
  });
4315
- }, f = async (e) => {
4335
+ }, g = async (e) => {
4316
4336
  let t = n.value?.session.current?.value?.sessionCode;
4317
4337
  if (!t) throw Error("[ChatBot] Cannot upload: no active session");
4318
- let r = await n.value.session.uploadFiles(t, e);
4319
- if (!r?.length) throw Error("[ChatBot] Upload failed: empty response");
4320
- return r;
4321
- }, p = async (e) => {
4338
+ try {
4339
+ let r = await n.value.session.uploadFiles(t, e);
4340
+ if (!r?.length) throw Error("[ChatBot] Upload failed: empty response");
4341
+ return m(t, e, r), r;
4342
+ } catch (t) {
4343
+ throw e.forEach((e) => d.delete(e)), t;
4344
+ }
4345
+ }, _ = async (e) => {
4322
4346
  let t = n.value?.session.current?.value?.sessionCode;
4323
4347
  if (!t) throw Error("[ChatBot] Cannot resolve artifact URL: no active session");
4324
4348
  let r = await n.value.session.getPvFileDownloadUrl(t, e.outputId);
@@ -4326,7 +4350,16 @@ function gr(e) {
4326
4350
  download_url: r?.download_url,
4327
4351
  preview_url: r?.preview_url
4328
4352
  };
4329
- }, m = async (e, t, n) => {
4353
+ }, v = async (e) => {
4354
+ let t = e.outputId || e.id;
4355
+ if (e.file && !t) {
4356
+ d.add(e.file);
4357
+ return;
4358
+ }
4359
+ e.file && d.delete(e.file);
4360
+ let r = n.value?.session.current?.value?.sessionCode;
4361
+ !t || !r || await p(r, t);
4362
+ }, y = async (e, t, n) => {
4330
4363
  try {
4331
4364
  if (n?.payload && o) {
4332
4365
  c.value = [[]], l.value = "", await o(e, n);
@@ -4338,13 +4371,13 @@ function gr(e) {
4338
4371
  ...Object.keys(r).length ? { extra: r } : {},
4339
4372
  ...i ? { docSchema: i } : {}
4340
4373
  };
4341
- await d(e, Object.keys(a).length ? { property: a } : {});
4374
+ await h(e, Object.keys(a).length ? { property: a } : {});
4342
4375
  } catch (e) {
4343
4376
  a(e, "Failed to send message");
4344
4377
  }
4345
- }, h = async () => {
4346
- await g();
4347
- }, g = async () => {
4378
+ }, b = async () => {
4379
+ await x();
4380
+ }, x = async () => {
4348
4381
  if (!r.value) {
4349
4382
  console.error("[ChatBot] Cannot stop generation: chatBusinessManager not initialized");
4350
4383
  return;
@@ -4359,12 +4392,13 @@ function gr(e) {
4359
4392
  userInput: c,
4360
4393
  cite: l,
4361
4394
  handleUpdateModelValue: u,
4362
- doSendMessage: d,
4363
- handleSendMessage: m,
4364
- handleArtifactClick: p,
4365
- handleUpload: f,
4366
- handleStopSending: h,
4367
- stopGeneration: g
4395
+ doSendMessage: h,
4396
+ handleSendMessage: y,
4397
+ handleArtifactClick: _,
4398
+ handleDeleteFile: v,
4399
+ handleUpload: g,
4400
+ handleStopSending: b,
4401
+ stopGeneration: x
4368
4402
  };
4369
4403
  }
4370
4404
  //#endregion
@@ -4768,7 +4802,7 @@ var xr = /* @__PURE__ */ d({
4768
4802
  }), { handleInterruptResume: ie, resumeUserQuestionWithInput: ae } = hr({
4769
4803
  chatHelper: F,
4770
4804
  reportError: N
4771
- }), { userInput: oe, cite: G, handleUpdateModelValue: ce, doSendMessage: le, handleSendMessage: ue, handleUpload: K, handleArtifactClick: de, handleStopSending: fe, stopGeneration: pe } = gr({
4805
+ }), { userInput: oe, cite: G, handleUpdateModelValue: ce, doSendMessage: le, handleSendMessage: ue, handleUpload: K, handleDeleteFile: de, handleArtifactClick: fe, handleStopSending: pe, stopGeneration: me } = gr({
4772
4806
  emit: p,
4773
4807
  chatHelper: F,
4774
4808
  chatBusinessManager: H,
@@ -4776,7 +4810,7 @@ var xr = /* @__PURE__ */ d({
4776
4810
  reportError: N,
4777
4811
  resumeUserQuestionWithInput: ae,
4778
4812
  selectedShortcut: D
4779
- }), { handleSelectShortcut: me, handleCloseShortcut: he, handleShortcutSubmit: ge, selectShortcutWithText: _e, getShortcutFromMessage: ve, buildShortcutProperty: ye, sendShortcutDirectly: be } = yr({
4813
+ }), { handleSelectShortcut: he, handleCloseShortcut: ge, handleShortcutSubmit: _e, selectShortcutWithText: ve, getShortcutFromMessage: ye, buildShortcutProperty: be, sendShortcutDirectly: xe } = yr({
4780
4814
  props: s,
4781
4815
  emit: p,
4782
4816
  chatHelper: F,
@@ -4784,7 +4818,7 @@ var xr = /* @__PURE__ */ d({
4784
4818
  doSendMessage: le,
4785
4819
  reportError: N,
4786
4820
  selectedShortcut: D
4787
- }), { messageStatus: xe, messageToolsStatus: Se, effectiveMessageTools: Ce, effectiveUpdateTools: we, effectiveUserMessageTools: Te, messages: Ee, isMessagesLoading: De, isGenerating: Oe, currentSession: q, isWelcomeState: J, openingRemark: Y, effectiveMenuSources: ke, effectiveSupportUpload: Ae, chatbotStyle: je, filteredShortcuts: Me } = or({
4821
+ }), { messageStatus: Se, messageToolsStatus: Ce, effectiveMessageTools: we, effectiveUpdateTools: Te, effectiveUserMessageTools: Ee, messages: De, isMessagesLoading: Oe, isGenerating: q, currentSession: J, isWelcomeState: Y, openingRemark: ke, effectiveMenuSources: Ae, effectiveSupportUpload: je, chatbotStyle: Me, filteredShortcuts: Ne } = or({
4788
4822
  props: s,
4789
4823
  chatHelper: F,
4790
4824
  chatBusinessManager: H,
@@ -4793,48 +4827,48 @@ var xr = /* @__PURE__ */ d({
4793
4827
  isStandaloneMode: I,
4794
4828
  isInitialized: z,
4795
4829
  selectedShortcut: D
4796
- }), { handleAgentAction: Ne, handleAgentFeedback: Pe, handleUserAction: X, handleUserInputConfirm: Z, handleUserShortcutConfirm: Fe, handleStopStreaming: Ie } = br({
4830
+ }), { handleAgentAction: Pe, handleAgentFeedback: X, handleUserAction: Z, handleUserInputConfirm: Fe, handleUserShortcutConfirm: Ie, handleStopStreaming: Le } = br({
4797
4831
  emit: p,
4798
4832
  chatHelper: F,
4799
4833
  chatBusinessManager: H,
4800
4834
  cite: G,
4801
4835
  focusInput: j,
4802
- getShortcutFromMessage: ve,
4803
- buildShortcutProperty: ye,
4836
+ getShortcutFromMessage: ye,
4837
+ buildShortcutProperty: be,
4804
4838
  getRequestOptions: () => s.requestOptions,
4805
4839
  reportError: N,
4806
- stopGeneration: pe
4807
- }), Le = r(() => !z.value || De.value), Re = r(() => {
4840
+ stopGeneration: me
4841
+ }), Re = r(() => !z.value || Oe.value), ze = r(() => {
4808
4842
  if (s.useAgentName) return F.value?.agent.info.value?.agentName || void 0;
4809
- }), ze = r(() => {
4843
+ }), Be = r(() => {
4810
4844
  if (s.enableModelSelect === !1) return;
4811
4845
  let e = H.value?.models.value ?? [];
4812
4846
  return e.length > 0 ? e : void 0;
4813
- }), Be = r({
4847
+ }), Ve = r({
4814
4848
  get: () => H.value?.selectedModelName.value ?? "",
4815
4849
  set: (e) => {
4816
4850
  H.value?.setSelectedModelByName(e);
4817
4851
  }
4818
- }), Ve = (e) => {
4852
+ }), He = (e) => {
4819
4853
  H.value?.setSelectedModel(e);
4820
4854
  };
4821
4855
  L(() => s.models, (e) => {
4822
4856
  s.enableModelSelect === !1 || !H.value || e?.length && H.value.setModels(e);
4823
4857
  });
4824
- let { handleConfirmShare: He } = vr({
4858
+ let { handleConfirmShare: Ue } = vr({
4825
4859
  emit: p,
4826
4860
  chatHelper: F,
4827
4861
  isStandaloneMode: I
4828
- }), Ue = (e, t) => {
4862
+ }), We = (e, t) => {
4829
4863
  p("execution-panel-change", e, t);
4830
- }, We = async (e) => {
4864
+ }, Ge = async (e) => {
4831
4865
  if (s.onCustomTabChange) return s.onCustomTabChange(e);
4832
4866
  let t = e.data?.props;
4833
4867
  if (t?.task_id != null && t?.node_id) return F.value?.message.getFlowAgentTaskNodeInfo(t.task_id, t.node_id);
4834
4868
  };
4835
4869
  return n({
4836
4870
  sendMessage: (e) => ue(e, [[]]),
4837
- stopGeneration: pe,
4871
+ stopGeneration: me,
4838
4872
  switchSession: async (e) => {
4839
4873
  if (!U.value) {
4840
4874
  console.error("[ChatBot] Cannot switch session: sessionBusinessManager not initialized");
@@ -4846,9 +4880,9 @@ var xr = /* @__PURE__ */ d({
4846
4880
  N(e, "Failed to switch session");
4847
4881
  }
4848
4882
  },
4849
- messages: Ee,
4850
- currentSession: q,
4851
- isGenerating: Oe,
4883
+ messages: De,
4884
+ currentSession: J,
4885
+ isGenerating: q,
4852
4886
  get isReady() {
4853
4887
  return B.value;
4854
4888
  },
@@ -4861,9 +4895,9 @@ var xr = /* @__PURE__ */ d({
4861
4895
  enterShareMode: () => S.value?.enterShareMode(),
4862
4896
  exitShareMode: () => S.value?.exitShareMode(),
4863
4897
  selectShortcut: (e, t) => {
4864
- _e(e, t);
4898
+ ve(e, t);
4865
4899
  },
4866
- sendShortcut: (e, t) => be(e, t),
4900
+ sendShortcut: (e, t) => xe(e, t),
4867
4901
  updateAgentInfo: async () => {
4868
4902
  let e = F.value;
4869
4903
  if (!e) return null;
@@ -4882,9 +4916,9 @@ var xr = /* @__PURE__ */ d({
4882
4916
  class: _([
4883
4917
  "ai-chatbot",
4884
4918
  s.extCls,
4885
- { "welcome-state": M(J) }
4919
+ { "welcome-state": M(Y) }
4886
4920
  ]),
4887
- style: y(M(je))
4921
+ style: y(M(Me))
4888
4922
  }, [u(M(V), {
4889
4923
  ref_key: "chatContainerRef",
4890
4924
  ref: S,
@@ -4894,52 +4928,53 @@ var xr = /* @__PURE__ */ d({
4894
4928
  "onUpdate:cite": n[1] ||= (e) => m(G) ? G.value = e : null,
4895
4929
  "render-mode": k.value,
4896
4930
  "onUpdate:renderMode": n[2] ||= (e) => k.value = e,
4897
- "selected-model": Be.value,
4898
- "onUpdate:selectedModel": n[3] ||= (e) => Be.value = e,
4931
+ "selected-model": Ve.value,
4932
+ "onUpdate:selectedModel": n[3] ||= (e) => Ve.value = e,
4899
4933
  "selected-shortcut": D.value,
4900
4934
  "onUpdate:selectedShortcut": n[4] ||= (e) => D.value = e,
4901
- "chat-loading": Le.value,
4935
+ "chat-loading": Re.value,
4902
4936
  "common-tippy-options": E.value,
4903
4937
  "execution-tab-visible": s.executionTabVisible,
4904
4938
  "get-side-render-component": s.getSideRenderComponent,
4905
4939
  "get-side-tab-render-component": s.getSideTabRenderComponent,
4906
- "message-status": M(xe),
4907
- "message-tools": M(Ce),
4908
- "message-tools-status": M(Se),
4909
- "menu-sources": M(ke),
4910
- messages: M(Ee),
4940
+ "message-status": M(Se),
4941
+ "message-tools": M(we),
4942
+ "message-tools-status": M(Ce),
4943
+ "menu-sources": M(Ae),
4944
+ messages: M(De),
4911
4945
  "model-value": M(oe),
4912
- models: ze.value,
4913
- "on-agent-action": M(Ne),
4914
- "on-agent-feedback": M(Pe),
4915
- "on-artifact-click": M(de),
4916
- "on-custom-tab-change": We,
4946
+ models: Be.value,
4947
+ "on-agent-action": M(Pe),
4948
+ "on-agent-feedback": M(X),
4949
+ "on-artifact-click": M(fe),
4950
+ "on-custom-tab-change": Ge,
4917
4951
  "on-interrupt-resume": M(ie),
4918
4952
  "on-send-message": M(ue),
4919
- "on-stop-sending": M(fe),
4953
+ "on-stop-sending": M(pe),
4920
4954
  "on-upload": M(K),
4921
- "on-user-action": M(X),
4922
- "on-user-input-confirm": M(Z),
4923
- "on-user-shortcut-confirm": M(Fe),
4924
- "opening-remark": M(Y),
4955
+ "on-user-action": M(Z),
4956
+ "on-user-input-confirm": M(Fe),
4957
+ "on-user-shortcut-confirm": M(Ie),
4958
+ "opening-remark": M(ke),
4925
4959
  placeholder: s.placeholder,
4926
4960
  "resize-props": d.value,
4927
4961
  "shortcut-id": D.value?.id,
4928
- shortcuts: M(Me),
4962
+ shortcuts: M(Ne),
4929
4963
  size: s.size,
4930
4964
  timezone: s.timezone,
4931
- "support-upload": M(Ae),
4932
- "update-tools": M(we),
4933
- "user-message-tools": M(Te),
4934
- "welcome-title": Re.value,
4935
- onCollapseChange: Ue,
4936
- onConfirmShare: M(He),
4937
- onDeleteShortcut: M(he),
4938
- onModelChange: Ve,
4939
- onSelectShortcut: M(me),
4940
- onShortcutClose: M(he),
4941
- onShortcutSubmit: M(ge),
4942
- onStopStreaming: M(Ie),
4965
+ "support-upload": M(je),
4966
+ "update-tools": M(Te),
4967
+ "user-message-tools": M(Ee),
4968
+ "welcome-title": ze.value,
4969
+ onCollapseChange: We,
4970
+ onConfirmShare: M(Ue),
4971
+ onDeleteFile: M(de),
4972
+ onDeleteShortcut: M(ge),
4973
+ onModelChange: He,
4974
+ onSelectShortcut: M(he),
4975
+ onShortcutClose: M(ge),
4976
+ onShortcutSubmit: M(_e),
4977
+ onStopStreaming: M(Le),
4943
4978
  "onUpdate:modelValue": M(ce)
4944
4979
  }, c({
4945
4980
  message: R(({ message: n, messageToolsStatus: r, onInterruptResume: i }) => [a(" 消费方提供了 #message slot 时,优先使用消费方的渲染 "), M(h).message ? O(t.$slots, "message", {
@@ -4949,12 +4984,12 @@ var xr = /* @__PURE__ */ d({
4949
4984
  onInterruptResume: i
4950
4985
  }) : (C(), o(e, { key: 1 }, [a(" 否则使用默认的 MessageRender "), u(M(re), {
4951
4986
  message: n,
4952
- "message-tools": M(Te),
4987
+ "message-tools": M(Ee),
4953
4988
  "message-tools-status": r,
4954
- "on-action": (e) => M(X)(e, n),
4955
- "on-input-confirm": (e, t) => M(Z)(n, e, t),
4989
+ "on-action": (e) => M(Z)(e, n),
4990
+ "on-input-confirm": (e, t) => M(Fe)(n, e, t),
4956
4991
  "on-interrupt-resume": i,
4957
- "on-shortcut-confirm": (e) => M(Fe)(n, e),
4992
+ "on-shortcut-confirm": (e) => M(Ie)(n, e),
4958
4993
  "tippy-options": E.value
4959
4994
  }, c({ _: 2 }, [t.$slots.codeHeader ? {
4960
4995
  name: "codeHeader",
@@ -4975,7 +5010,7 @@ var xr = /* @__PURE__ */ d({
4975
5010
  name: "welcome",
4976
5011
  fn: R((e) => [O(t.$slots, "welcome", v(f(e)))]),
4977
5012
  key: "0"
4978
- } : void 0]), 1032, /* @__PURE__ */ "aside-collapsed.cite.render-mode.selected-model.selected-shortcut.chat-loading.common-tippy-options.execution-tab-visible.get-side-render-component.get-side-tab-render-component.message-status.message-tools.message-tools-status.menu-sources.messages.model-value.models.on-agent-action.on-agent-feedback.on-artifact-click.on-interrupt-resume.on-send-message.on-stop-sending.on-upload.on-user-action.on-user-input-confirm.on-user-shortcut-confirm.opening-remark.placeholder.resize-props.shortcut-id.shortcuts.size.timezone.support-upload.update-tools.user-message-tools.welcome-title.onConfirmShare.onDeleteShortcut.onSelectShortcut.onShortcutClose.onShortcutSubmit.onStopStreaming.onUpdate:modelValue".split("."))], 6));
5013
+ } : void 0]), 1032, /* @__PURE__ */ "aside-collapsed.cite.render-mode.selected-model.selected-shortcut.chat-loading.common-tippy-options.execution-tab-visible.get-side-render-component.get-side-tab-render-component.message-status.message-tools.message-tools-status.menu-sources.messages.model-value.models.on-agent-action.on-agent-feedback.on-artifact-click.on-interrupt-resume.on-send-message.on-stop-sending.on-upload.on-user-action.on-user-input-confirm.on-user-shortcut-confirm.opening-remark.placeholder.resize-props.shortcut-id.shortcuts.size.timezone.support-upload.update-tools.user-message-tools.welcome-title.onConfirmShare.onDeleteFile.onDeleteShortcut.onSelectShortcut.onShortcutClose.onShortcutSubmit.onStopStreaming.onUpdate:modelValue".split("."))], 6));
4979
5014
  }
4980
5015
  }), Sr = /* @__PURE__ */ function(e) {
4981
5016
  return e.ERROR = "error", e.IDLE = "idle", e.LOADING_AGENT = "loading_agent", e.READY = "ready", e;