@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.
@@ -3948,6 +3948,7 @@ var bc = (e) => {
3948
3948
  更多: "More",
3949
3949
  算法方案评审单: "Algorithm Plan Review Ticket",
3950
3950
  评审中: "Reviewing",
3951
+ 审批中: "Approving",
3951
3952
  已废弃: "Abandoned",
3952
3953
  已批准: "Approved",
3953
3954
  已通过: "Approved",
@@ -53998,7 +53999,10 @@ var EZ = ["src"], DZ = {
53998
53999
  class: "info-message-content"
53999
54000
  }, L(e), 1))), 128))]));
54000
54001
  }
54001
- }), X1 = { class: "ai-tool-approval-card" }, Z1 = { class: "ai-tool-approval-card__header" }, Q1 = { class: "ai-tool-approval-card__title-wrap" }, $1 = { class: "ai-tool-approval-card__title" }, e0 = { class: "ai-tool-approval-card__fields" }, t0 = { class: "ai-tool-approval-card__field" }, n0 = { class: "ai-tool-approval-card__field" }, r0 = { class: "ai-tool-approval-card__processor" }, i0 = { class: "ai-tool-approval-card__processor-text" }, a0 = { class: "ai-tool-approval-card__actions" }, o0 = /* @__PURE__ */ V({
54002
+ }), X1 = { class: "ai-tool-approval-card" }, Z1 = { class: "ai-tool-approval-card__header" }, Q1 = { class: "ai-tool-approval-card__title-wrap" }, $1 = { class: "ai-tool-approval-card__title" }, e0 = { class: "ai-tool-approval-card__fields" }, t0 = { class: "ai-tool-approval-card__field" }, n0 = { class: "ai-tool-approval-card__field" }, r0 = {
54003
+ key: 0,
54004
+ class: "ai-tool-approval-card__processor"
54005
+ }, i0 = { class: "ai-tool-approval-card__processor-text" }, a0 = { class: "ai-tool-approval-card__actions" }, o0 = /* @__PURE__ */ V({
54002
54006
  __name: "tool-approval-card",
54003
54007
  props: {
54004
54008
  interrupt: {},
@@ -54018,7 +54022,7 @@ var EZ = ["src"], DZ = {
54018
54022
  submit_time: "",
54019
54023
  title: "",
54020
54024
  url: ""
54021
- }), l = Y(() => o.has(c.value.status)), u = Y(() => l.value ? "pending" : c.value.status), d = Y(() => l.value ? Z("评审中") : jc[c.value.status] ?? c.value.status), f = Y(() => c.value.approvers.filter(Boolean).join("、") || Z("无")), p = Y(() => c.value.url || c.value.sn), m = () => {
54025
+ }), l = Y(() => o.has(c.value.status)), u = Y(() => l.value ? "pending" : c.value.status), d = Y(() => l.value ? Z("审批中") : jc[c.value.status] ?? c.value.status), f = Y(() => c.value.approvers.filter(Boolean).join("、") || Z("无")), p = Y(() => c.value.url || c.value.sn), m = () => {
54022
54026
  c.value.url && window.open(c.value.url, "_blank", "noopener");
54023
54027
  }, h = () => {
54024
54028
  p.value && a(p.value);
@@ -54058,7 +54062,7 @@ var EZ = ["src"], DZ = {
54058
54062
  theme: "primary"
54059
54063
  })), qa(" " + L(d.value), 1)], 2)]),
54060
54064
  K("dl", e0, [K("div", t0, [K("dt", null, L(B(Z)("单据编号")), 1), K("dd", null, L(c.value.sn || "--"), 1)]), K("div", n0, [K("dt", null, L(B(Z)("提交时间")), 1), K("dd", null, L(c.value.submit_time || "--"), 1)])]),
54061
- K("div", r0, [q(B(wl), { class: "ai-tool-approval-card__processor-icon" }), Un((U(), W("span", i0, [qa(L(B(Z)("当前处理人")) + ":" + L(f.value), 1)])), [[B(Qz), { ...B(n) }]])]),
54065
+ l.value ? (U(), W("div", r0, [q(B(wl), { class: "ai-tool-approval-card__processor-icon" }), Un((U(), W("span", i0, [qa(L(B(Z)("当前处理人")) + ":" + L(f.value), 1)])), [[B(Qz), { ...B(n) }]])])) : J("v-if", !0),
54062
54066
  K("div", a0, [q(B(wO), {
54063
54067
  class: "ai-tool-approval-card__detail",
54064
54068
  disabled: !c.value.url,
@@ -55767,7 +55771,7 @@ var EZ = ["src"], DZ = {
55767
55771
  }
55768
55772
  };
55769
55773
  }, w2 = /* @__PURE__ */ function(e) {
55770
- 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;
55774
+ 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;
55771
55775
  }({}), T2 = /* @__PURE__ */ function(e) {
55772
55776
  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;
55773
55777
  }({}), E2 = /* @__PURE__ */ function(e) {
@@ -55800,6 +55804,9 @@ var EZ = ["src"], DZ = {
55800
55804
  case w2.FlowAgentEnd:
55801
55805
  this.handleFlowAgentEndCustomEvent(e);
55802
55806
  break;
55807
+ case w2.FlowAgentRestart:
55808
+ this.handleFlowAgentRestartCustomEvent(e);
55809
+ break;
55803
55810
  case w2.ReferenceDocument:
55804
55811
  this.handleReferenceDocumentCustomEvent(e);
55805
55812
  break;
@@ -55839,6 +55846,12 @@ var EZ = ["src"], DZ = {
55839
55846
  });
55840
55847
  }
55841
55848
  }
55849
+ handleFlowAgentRestartCustomEvent(e) {
55850
+ let t = e.value;
55851
+ this.messageModule.list.value.forEach((e) => {
55852
+ e.role === f2.Activity && e.activityType === d2.FlowAgent && e.content[0].task_id === t[0].task_id && (e.status = p2.Streaming);
55853
+ });
55854
+ }
55842
55855
  handleFlowAgentResultCustomEvent(e) {
55843
55856
  let t = this.messageModule.getCurrentLoadingMessage();
55844
55857
  t && t.role === f2.Activity && t.activityType === d2.FlowAgent && (t.content = e.value);
@@ -55850,7 +55863,7 @@ var EZ = ["src"], DZ = {
55850
55863
  activityType: d2.FlowAgent,
55851
55864
  content: t.map((e) => ({
55852
55865
  nodes: {},
55853
- task_id: Number(e.task_id),
55866
+ task_id: e.task_id,
55854
55867
  task_name: "",
55855
55868
  task_outputs: [],
55856
55869
  task_state: E2.Created
@@ -56124,11 +56137,11 @@ var EZ = ["src"], DZ = {
56124
56137
  }, j2 = /* @__PURE__ */ function(e) {
56125
56138
  return e.Running = "running", e.Finished = "finished", e.Failed = "failed", e.Cancelled = "cancelled", e;
56126
56139
  }({}), M2 = (e, t) => {
56127
- let n = /* @__PURE__ */ R(null), r = /* @__PURE__ */ R(!1), i = /* @__PURE__ */ R(!1), a = t || new A2(), o = null, s = null, c = () => (r.value = !0, e.http?.agent.getAgentInfo().then((e) => {
56140
+ let n = /* @__PURE__ */ R(null), r = /* @__PURE__ */ R(!1), i = /* @__PURE__ */ R(!1), a = t || new A2(), o = null, s = null, c = null, l = () => (r.value = !0, e.http?.agent.getAgentInfo().then((e) => {
56128
56141
  n.value = e;
56129
56142
  }).finally(() => {
56130
56143
  r.value = !1;
56131
- })), l = (t, n) => {
56144
+ })), u = (t, n) => {
56132
56145
  let r = t.promptSetting?.content?.at(-1);
56133
56146
  r?.role === f2.Pause && e.message?.createAndPlusMessage({
56134
56147
  role: f2.Assistant,
@@ -56137,12 +56150,12 @@ var EZ = ["src"], DZ = {
56137
56150
  sessionCode: n,
56138
56151
  property: { extra: { pause: !0 } }
56139
56152
  });
56140
- }, u = (t, n, r, i) => e.http?.message.userOperation(t, n, r, i).then(() => {
56141
- n === h2.ApprovalCancel ? (h(), m(t)) : d({
56153
+ }, d = (t, n, r, i) => e.http?.message.userOperation(t, n, r, i).then(() => {
56154
+ n === h2.ApprovalCancel ? (g(), h(t)) : f({
56142
56155
  sessionCode: t,
56143
56156
  config: i
56144
56157
  });
56145
- }), d = async ({ sessionCode: t, url: n, config: r, resume: s, input: c, lastMessageId: l }) => {
56158
+ }), f = async ({ sessionCode: t, url: n, config: r, resume: s, input: c, lastMessageId: l }) => {
56146
56159
  a instanceof A2 && a.injectMessageModule(e.message), c && e.message?.list.value.push({
56147
56160
  role: f2.User,
56148
56161
  content: c,
@@ -56166,7 +56179,7 @@ var EZ = ["src"], DZ = {
56166
56179
  i.value = !1, a.onDone?.call(a), c && e.http?.message?.getMessages(t).then((t) => {
56167
56180
  let n = e.message?.list.value.findLast((e) => e.role === f2.User);
56168
56181
  n.id = t.findLast((e) => e.role === f2.User).id;
56169
- }), m(t);
56182
+ }), h(t);
56170
56183
  },
56171
56184
  onError: (e) => {
56172
56185
  i.value = !1, a.onError?.call(a, e);
@@ -56179,63 +56192,63 @@ var EZ = ["src"], DZ = {
56179
56192
  },
56180
56193
  ...r
56181
56194
  }).catch(() => {});
56182
- }, f = async (t, n, r, i, a) => {
56195
+ }, p = async (t, n, r, i, a) => {
56183
56196
  await e.message?.createAndPlusMessage({
56184
56197
  role: f2.User,
56185
56198
  content: t,
56186
56199
  status: p2.Complete,
56187
56200
  sessionCode: n,
56188
56201
  ...a && { property: a }
56189
- }), d({
56202
+ }), f({
56190
56203
  sessionCode: n,
56191
56204
  url: r,
56192
56205
  config: i
56193
56206
  });
56194
- }, p = (t, n, r) => {
56207
+ }, m = (t, n, r) => {
56195
56208
  if (e.session?.current.value?.status === j2.Running) {
56196
56209
  let i = e.message?.list.value.at(-1)?.id;
56197
- d({
56210
+ f({
56198
56211
  sessionCode: t,
56199
56212
  url: n,
56200
56213
  config: r,
56201
56214
  lastMessageId: i
56202
56215
  });
56203
56216
  }
56204
- }, m = (t) => {
56217
+ }, h = (t) => {
56205
56218
  let n = e.message?.list.value.at(-1), r = n?.content?.outcome?.type === D2.Interrupt ? n.content.outcome.interrupts.find((e) => [O2.Pending, O2.Draft].includes(e.metadata?.ticket?.status)) : void 0;
56206
- n?.role === f2.Interrupt && r && e.http?.session.isResumeSession(t).then((n) => {
56207
- n ? d({
56219
+ n?.role === f2.Interrupt && r && (g(), s = new AbortController(), e.http?.session.isResumeSession(t, { controller: s }).then((n) => {
56220
+ n ? f({
56208
56221
  sessionCode: t,
56209
56222
  resume: {
56210
56223
  interruptId: r.id,
56211
56224
  status: k2.Resolved
56212
56225
  }
56213
- }) : s = setTimeout(() => {
56214
- t === e.session?.current?.value?.sessionCode && m(t);
56215
- }, 3e4);
56216
- });
56217
- }, h = () => {
56218
- s &&= (clearTimeout(s), null);
56226
+ }) : c = setTimeout(() => {
56227
+ t === e.session?.current?.value?.sessionCode && h(t);
56228
+ }, 1e4);
56229
+ }));
56230
+ }, g = () => {
56231
+ clearTimeout(c), c = null, s?.abort?.(), s = null;
56219
56232
  };
56220
56233
  return {
56221
56234
  info: n,
56222
56235
  isInfoLoading: r,
56223
56236
  isChatting: i,
56224
- chat: f,
56225
- handleRole: l,
56237
+ chat: p,
56238
+ handleRole: u,
56226
56239
  resendMessage: async (t, n, r, i, a) => {
56227
56240
  let o = e.message?.list.value || [], s = o.findIndex((e) => String(e.id) === t);
56228
56241
  if (s === -1) throw Error(`Message not found: ${t}`);
56229
56242
  let c = o[s];
56230
56243
  if (c.role !== f2.User) throw Error("Can only resend user messages");
56231
- let l = c.content, u = c.property, f = r ?? l, p = o.slice(s), m = e.message?.deleteMessages(p), h = e.message?.createAndPlusMessage({
56244
+ let l = c.content, u = c.property, d = r ?? l, p = o.slice(s), m = e.message?.deleteMessages(p), h = e.message?.createAndPlusMessage({
56232
56245
  role: f2.User,
56233
- content: f,
56246
+ content: d,
56234
56247
  status: p2.Complete,
56235
56248
  sessionCode: n,
56236
56249
  ...u && { property: u }
56237
56250
  });
56238
- d({
56251
+ f({
56239
56252
  sessionCode: n,
56240
56253
  url: i,
56241
56254
  config: a
@@ -56243,19 +56256,19 @@ var EZ = ["src"], DZ = {
56243
56256
  console.error("[resendMessage] API error:", e);
56244
56257
  });
56245
56258
  },
56246
- resumeStreamingChat: p,
56259
+ resumeStreamingChat: m,
56247
56260
  abortChat: () => {
56248
56261
  o?.abort?.(), o = null;
56249
56262
  },
56250
56263
  stopChat: async (t) => e.http.message?.stopChat(t),
56251
- getAgentInfo: c,
56264
+ getAgentInfo: l,
56252
56265
  reset: (e) => {
56253
56266
  a = e || new A2(), n.value = null, r.value = !1;
56254
56267
  },
56255
- pollResumeSession: m,
56256
- clearLongPollTimer: h,
56257
- userOperationStreamRequest: u,
56258
- streamRequest: d
56268
+ pollResumeSession: h,
56269
+ clearLongPollTimer: g,
56270
+ userOperationStreamRequest: d,
56271
+ streamRequest: f
56259
56272
  };
56260
56273
  };
56261
56274
  //#endregion
@@ -56472,8 +56485,8 @@ var F2 = class {
56472
56485
  return l.data;
56473
56486
  } catch (e) {
56474
56487
  if (a && clearTimeout(a), e instanceof Error && e.name === "AbortError") {
56475
- let e = R2("Request timeout", r, "ECONNABORTED", void 0);
56476
- throw this.dispatchError(e), this.applyResponseErrorInterceptors(e);
56488
+ console.warn("User canceled request", e.message);
56489
+ return;
56477
56490
  }
56478
56491
  let t = e.isAxiosError === !0 ? e : R2(e.message, r, e.code, void 0);
56479
56492
  throw this.dispatchError(t), this.applyResponseErrorInterceptors(t);