@blueking/ai-blueking 2.2.0-beta.4 → 2.2.0-beta.6

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.
@@ -20455,7 +20455,7 @@ var uT = (e) => ({
20455
20455
  }
20456
20456
  };
20457
20457
  }, CT = /* @__PURE__ */ function(e) {
20458
- return e.FlowAgentEnd = "flow_agent_end", e.FlowAgentResult = "flow_agent_result", e.FlowAgentStart = "flow_agent_start", e.FlowAgentUpdate = "flow_agent_update", e.KnowledgeRagEnd = "knowledge_rag_end", e.KnowledgeRagResult = "knowledge_rag_result", e.KnowledgeRagStart = "knowledge_rag_start", e.KnowledgeRagTextContent = "knowledge_rag_text_content", e.ReferenceDocument = "reference_document", e.TempMessage = "temp_message", e.ApprovalResult = "approval_result", e;
20458
+ return e.FlowAgentEnd = "flow_agent_end", e.FlowAgentResult = "flow_agent_result", e.FlowAgentStart = "flow_agent_start", e.FlowAgentUpdate = "flow_agent_update", e.FlowAgentRestart = "flow_agent_restart", e.KnowledgeRagEnd = "knowledge_rag_end", e.KnowledgeRagResult = "knowledge_rag_result", e.KnowledgeRagStart = "knowledge_rag_start", e.KnowledgeRagTextContent = "knowledge_rag_text_content", e.ReferenceDocument = "reference_document", e.TempMessage = "temp_message", e.ApprovalResult = "approval_result", e;
20459
20459
  }({}), wT = /* @__PURE__ */ function(e) {
20460
20460
  return e.ActivityDelta = "ACTIVITY_DELTA", e.ActivitySnapshot = "ACTIVITY_SNAPSHOT", e.Custom = "CUSTOM", e.MessagesSnapshot = "MESSAGES_SNAPSHOT", e.Raw = "RAW", e.RunError = "RUN_ERROR", e.RunFinished = "RUN_FINISHED", e.RunStarted = "RUN_STARTED", e.StateDelta = "STATE_DELTA", e.StateSnapshot = "STATE_SNAPSHOT", e.StepFinished = "STEP_FINISHED", e.StepStarted = "STEP_STARTED", e.TextMessageChunk = "TEXT_MESSAGE_CHUNK", e.TextMessageContent = "TEXT_MESSAGE_CONTENT", e.TextMessageEnd = "TEXT_MESSAGE_END", e.TextMessageStart = "TEXT_MESSAGE_START", e.ThinkingEnd = "THINKING_END", e.ThinkingStart = "THINKING_START", e.ThinkingTextMessageContent = "THINKING_TEXT_MESSAGE_CONTENT", e.ThinkingTextMessageEnd = "THINKING_TEXT_MESSAGE_END", e.ThinkingTextMessageStart = "THINKING_TEXT_MESSAGE_START", e.ToolCallArgs = "TOOL_CALL_ARGS", e.ToolCallChunk = "TOOL_CALL_CHUNK", e.ToolCallEnd = "TOOL_CALL_END", e.ToolCallResult = "TOOL_CALL_RESULT", e.ToolCallStart = "TOOL_CALL_START", e;
20461
20461
  }({}), TT = /* @__PURE__ */ function(e) {
@@ -20488,6 +20488,9 @@ var uT = (e) => ({
20488
20488
  case CT.FlowAgentEnd:
20489
20489
  this.handleFlowAgentEndCustomEvent(e);
20490
20490
  break;
20491
+ case CT.FlowAgentRestart:
20492
+ this.handleFlowAgentRestartCustomEvent(e);
20493
+ break;
20491
20494
  case CT.ReferenceDocument:
20492
20495
  this.handleReferenceDocumentCustomEvent(e);
20493
20496
  break;
@@ -20527,6 +20530,12 @@ var uT = (e) => ({
20527
20530
  });
20528
20531
  }
20529
20532
  }
20533
+ handleFlowAgentRestartCustomEvent(e) {
20534
+ let t = e.value;
20535
+ this.messageModule.list.value.forEach((e) => {
20536
+ e.role === Z.Activity && e.activityType === dT.FlowAgent && e.content[0].task_id === t[0].task_id && (e.status = fT.Streaming);
20537
+ });
20538
+ }
20530
20539
  handleFlowAgentResultCustomEvent(e) {
20531
20540
  let t = this.messageModule.getCurrentLoadingMessage();
20532
20541
  t && t.role === Z.Activity && t.activityType === dT.FlowAgent && (t.content = e.value);
@@ -20538,7 +20547,7 @@ var uT = (e) => ({
20538
20547
  activityType: dT.FlowAgent,
20539
20548
  content: t.map((e) => ({
20540
20549
  nodes: {},
20541
- task_id: Number(e.task_id),
20550
+ task_id: e.task_id,
20542
20551
  task_name: "",
20543
20552
  task_outputs: [],
20544
20553
  task_state: TT.Created
@@ -20812,11 +20821,11 @@ var uT = (e) => ({
20812
20821
  }, AT = /* @__PURE__ */ function(e) {
20813
20822
  return e.Running = "running", e.Finished = "finished", e.Failed = "failed", e.Cancelled = "cancelled", e;
20814
20823
  }({}), jT = (e, t) => {
20815
- let n = H(null), r = H(!1), i = H(!1), a = t || new kT(), o = null, s = null, c = () => (r.value = !0, e.http?.agent.getAgentInfo().then((e) => {
20824
+ let n = H(null), r = H(!1), i = H(!1), a = t || new kT(), o = null, s = null, c = null, l = () => (r.value = !0, e.http?.agent.getAgentInfo().then((e) => {
20816
20825
  n.value = e;
20817
20826
  }).finally(() => {
20818
20827
  r.value = !1;
20819
- })), l = (t, n) => {
20828
+ })), u = (t, n) => {
20820
20829
  let r = t.promptSetting?.content?.at(-1);
20821
20830
  r?.role === Z.Pause && e.message?.createAndPlusMessage({
20822
20831
  role: Z.Assistant,
@@ -20825,12 +20834,12 @@ var uT = (e) => ({
20825
20834
  sessionCode: n,
20826
20835
  property: { extra: { pause: !0 } }
20827
20836
  });
20828
- }, u = (t, n, r, i) => e.http?.message.userOperation(t, n, r, i).then(() => {
20829
- n === mT.ApprovalCancel ? (h(), m(t)) : d({
20837
+ }, d = (t, n, r, i) => e.http?.message.userOperation(t, n, r, i).then(() => {
20838
+ n === mT.ApprovalCancel ? (g(), h(t)) : f({
20830
20839
  sessionCode: t,
20831
20840
  config: i
20832
20841
  });
20833
- }), d = async ({ sessionCode: t, url: n, config: r, resume: s, input: c, lastMessageId: l }) => {
20842
+ }), f = async ({ sessionCode: t, url: n, config: r, resume: s, input: c, lastMessageId: l }) => {
20834
20843
  a instanceof kT && a.injectMessageModule(e.message), c && e.message?.list.value.push({
20835
20844
  role: Z.User,
20836
20845
  content: c,
@@ -20854,7 +20863,7 @@ var uT = (e) => ({
20854
20863
  i.value = !1, a.onDone?.call(a), c && e.http?.message?.getMessages(t).then((t) => {
20855
20864
  let n = e.message?.list.value.findLast((e) => e.role === Z.User);
20856
20865
  n.id = t.findLast((e) => e.role === Z.User).id;
20857
- }), m(t);
20866
+ }), h(t);
20858
20867
  },
20859
20868
  onError: (e) => {
20860
20869
  i.value = !1, a.onError?.call(a, e);
@@ -20867,63 +20876,63 @@ var uT = (e) => ({
20867
20876
  },
20868
20877
  ...r
20869
20878
  }).catch(() => {});
20870
- }, f = async (t, n, r, i, a) => {
20879
+ }, p = async (t, n, r, i, a) => {
20871
20880
  await e.message?.createAndPlusMessage({
20872
20881
  role: Z.User,
20873
20882
  content: t,
20874
20883
  status: fT.Complete,
20875
20884
  sessionCode: n,
20876
20885
  ...a && { property: a }
20877
- }), d({
20886
+ }), f({
20878
20887
  sessionCode: n,
20879
20888
  url: r,
20880
20889
  config: i
20881
20890
  });
20882
- }, p = (t, n, r) => {
20891
+ }, m = (t, n, r) => {
20883
20892
  if (e.session?.current.value?.status === AT.Running) {
20884
20893
  let i = e.message?.list.value.at(-1)?.id;
20885
- d({
20894
+ f({
20886
20895
  sessionCode: t,
20887
20896
  url: n,
20888
20897
  config: r,
20889
20898
  lastMessageId: i
20890
20899
  });
20891
20900
  }
20892
- }, m = (t) => {
20901
+ }, h = (t) => {
20893
20902
  let n = e.message?.list.value.at(-1), r = n?.content?.outcome?.type === ET.Interrupt ? n.content.outcome.interrupts.find((e) => [DT.Pending, DT.Draft].includes(e.metadata?.ticket?.status)) : void 0;
20894
- n?.role === Z.Interrupt && r && e.http?.session.isResumeSession(t).then((n) => {
20895
- n ? d({
20903
+ n?.role === Z.Interrupt && r && (g(), s = new AbortController(), e.http?.session.isResumeSession(t, { controller: s }).then((n) => {
20904
+ n ? f({
20896
20905
  sessionCode: t,
20897
20906
  resume: {
20898
20907
  interruptId: r.id,
20899
20908
  status: OT.Resolved
20900
20909
  }
20901
- }) : s = setTimeout(() => {
20902
- t === e.session?.current?.value?.sessionCode && m(t);
20903
- }, 3e4);
20904
- });
20905
- }, h = () => {
20906
- s &&= (clearTimeout(s), null);
20910
+ }) : c = setTimeout(() => {
20911
+ t === e.session?.current?.value?.sessionCode && h(t);
20912
+ }, 1e4);
20913
+ }));
20914
+ }, g = () => {
20915
+ clearTimeout(c), c = null, s?.abort?.(), s = null;
20907
20916
  };
20908
20917
  return {
20909
20918
  info: n,
20910
20919
  isInfoLoading: r,
20911
20920
  isChatting: i,
20912
- chat: f,
20913
- handleRole: l,
20921
+ chat: p,
20922
+ handleRole: u,
20914
20923
  resendMessage: async (t, n, r, i, a) => {
20915
20924
  let o = e.message?.list.value || [], s = o.findIndex((e) => String(e.id) === t);
20916
20925
  if (s === -1) throw Error(`Message not found: ${t}`);
20917
20926
  let c = o[s];
20918
20927
  if (c.role !== Z.User) throw Error("Can only resend user messages");
20919
- let l = c.content, u = c.property, f = r ?? l, p = o.slice(s), m = e.message?.deleteMessages(p), h = e.message?.createAndPlusMessage({
20928
+ let l = c.content, u = c.property, d = r ?? l, p = o.slice(s), m = e.message?.deleteMessages(p), h = e.message?.createAndPlusMessage({
20920
20929
  role: Z.User,
20921
- content: f,
20930
+ content: d,
20922
20931
  status: fT.Complete,
20923
20932
  sessionCode: n,
20924
20933
  ...u && { property: u }
20925
20934
  });
20926
- d({
20935
+ f({
20927
20936
  sessionCode: n,
20928
20937
  url: i,
20929
20938
  config: a
@@ -20931,19 +20940,19 @@ var uT = (e) => ({
20931
20940
  console.error("[resendMessage] API error:", e);
20932
20941
  });
20933
20942
  },
20934
- resumeStreamingChat: p,
20943
+ resumeStreamingChat: m,
20935
20944
  abortChat: () => {
20936
20945
  o?.abort?.(), o = null;
20937
20946
  },
20938
20947
  stopChat: async (t) => e.http.message?.stopChat(t),
20939
- getAgentInfo: c,
20948
+ getAgentInfo: l,
20940
20949
  reset: (e) => {
20941
20950
  a = e || new kT(), n.value = null, r.value = !1;
20942
20951
  },
20943
- pollResumeSession: m,
20944
- clearLongPollTimer: h,
20945
- userOperationStreamRequest: u,
20946
- streamRequest: d
20952
+ pollResumeSession: h,
20953
+ clearLongPollTimer: g,
20954
+ userOperationStreamRequest: d,
20955
+ streamRequest: f
20947
20956
  };
20948
20957
  };
20949
20958
  //#endregion
@@ -21160,8 +21169,8 @@ var PT = class {
21160
21169
  return l.data;
21161
21170
  } catch (e) {
21162
21171
  if (a && clearTimeout(a), e instanceof Error && e.name === "AbortError") {
21163
- let e = LT("Request timeout", r, "ECONNABORTED", void 0);
21164
- throw this.dispatchError(e), this.applyResponseErrorInterceptors(e);
21172
+ console.warn("User canceled request", e.message);
21173
+ return;
21165
21174
  }
21166
21175
  let t = e.isAxiosError === !0 ? e : LT(e.message, r, e.code, void 0);
21167
21176
  throw this.dispatchError(t), this.applyResponseErrorInterceptors(t);
@@ -24707,6 +24716,7 @@ var DA = (e) => {
24707
24716
  更多: "More",
24708
24717
  算法方案评审单: "Algorithm Plan Review Ticket",
24709
24718
  评审中: "Reviewing",
24719
+ 审批中: "Approving",
24710
24720
  已废弃: "Abandoned",
24711
24721
  已批准: "Approved",
24712
24722
  已通过: "Approved",
@@ -52299,7 +52309,10 @@ var PW = ["src"], FW = {
52299
52309
  class: "info-message-content"
52300
52310
  }, K(e), 1))), 128))]));
52301
52311
  }
52302
- }), iJ = { class: "ai-tool-approval-card" }, aJ = { class: "ai-tool-approval-card__header" }, oJ = { class: "ai-tool-approval-card__title-wrap" }, sJ = { class: "ai-tool-approval-card__title" }, cJ = { class: "ai-tool-approval-card__fields" }, lJ = { class: "ai-tool-approval-card__field" }, uJ = { class: "ai-tool-approval-card__field" }, dJ = { class: "ai-tool-approval-card__processor" }, fJ = { class: "ai-tool-approval-card__processor-text" }, pJ = { class: "ai-tool-approval-card__actions" }, mJ = /* @__PURE__ */ x({
52312
+ }), iJ = { class: "ai-tool-approval-card" }, aJ = { class: "ai-tool-approval-card__header" }, oJ = { class: "ai-tool-approval-card__title-wrap" }, sJ = { class: "ai-tool-approval-card__title" }, cJ = { class: "ai-tool-approval-card__fields" }, lJ = { class: "ai-tool-approval-card__field" }, uJ = { class: "ai-tool-approval-card__field" }, dJ = {
52313
+ key: 0,
52314
+ class: "ai-tool-approval-card__processor"
52315
+ }, fJ = { class: "ai-tool-approval-card__processor-text" }, pJ = { class: "ai-tool-approval-card__actions" }, mJ = /* @__PURE__ */ x({
52303
52316
  __name: "tool-approval-card",
52304
52317
  props: {
52305
52318
  interrupt: {},
@@ -52319,7 +52332,7 @@ var PW = ["src"], FW = {
52319
52332
  submit_time: "",
52320
52333
  title: "",
52321
52334
  url: ""
52322
- }), l = d(() => o.has(c.value.status)), u = d(() => l.value ? "pending" : c.value.status), f = d(() => l.value ? Q("评审中") : RA[c.value.status] ?? c.value.status), _ = d(() => c.value.approvers.filter(Boolean).join("、") || Q("无")), b = d(() => c.value.url || c.value.sn), x = () => {
52335
+ }), l = d(() => o.has(c.value.status)), u = d(() => l.value ? "pending" : c.value.status), f = d(() => l.value ? Q("审批中") : RA[c.value.status] ?? c.value.status), _ = d(() => c.value.approvers.filter(Boolean).join("、") || Q("无")), b = d(() => c.value.url || c.value.sn), x = () => {
52323
52336
  c.value.url && window.open(c.value.url, "_blank", "noopener");
52324
52337
  }, S = () => {
52325
52338
  b.value && a(b.value);
@@ -52359,7 +52372,7 @@ var PW = ["src"], FW = {
52359
52372
  theme: "primary"
52360
52373
  })), v(" " + K(f.value), 1)], 2)]),
52361
52374
  g("dl", cJ, [g("div", lJ, [g("dt", null, K(J(Q)("单据编号")), 1), g("dd", null, K(c.value.sn || "--"), 1)]), g("div", uJ, [g("dt", null, K(J(Q)("提交时间")), 1), g("dd", null, K(c.value.submit_time || "--"), 1)])]),
52362
- g("div", dJ, [y(J(jj), { class: "ai-tool-approval-card__processor-icon" }), he((V(), h("span", fJ, [v(K(J(Q)("当前处理人")) + ":" + K(_.value), 1)])), [[J(oN), { ...J(n) }]])]),
52375
+ l.value ? (V(), h("div", dJ, [y(J(jj), { class: "ai-tool-approval-card__processor-icon" }), he((V(), h("span", fJ, [v(K(J(Q)("当前处理人")) + ":" + K(_.value), 1)])), [[J(oN), { ...J(n) }]])])) : m("v-if", !0),
52363
52376
  g("div", pJ, [y(J(iy), {
52364
52377
  class: "ai-tool-approval-card__detail",
52365
52378
  disabled: !c.value.url,