@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.
- package/dist/standalone/index.es.min.js +50 -37
- package/dist/standalone/index.iife.min.js +153 -153
- package/dist/standalone/index.umd.min.js +170 -170
- package/dist/vue2/index.es.min.js +50 -37
- package/dist/vue2/index.iife.min.js +4 -4
- package/dist/vue2/index.umd.min.js +4 -4
- package/dist/vue3/index.es.min.js +43 -34
- package/dist/vue3/index.iife.min.js +4 -4
- package/dist/vue3/index.umd.min.js +2 -2
- package/package.json +3 -3
|
@@ -670,7 +670,7 @@ var _e = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAAGVn0euAAAA
|
|
|
670
670
|
}
|
|
671
671
|
};
|
|
672
672
|
}, Y = /* @__PURE__ */ function(e) {
|
|
673
|
-
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;
|
|
673
|
+
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;
|
|
674
674
|
}({}), X = /* @__PURE__ */ function(e) {
|
|
675
675
|
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;
|
|
676
676
|
}({}), ke = /* @__PURE__ */ function(e) {
|
|
@@ -703,6 +703,9 @@ var _e = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAAGVn0euAAAA
|
|
|
703
703
|
case Y.FlowAgentEnd:
|
|
704
704
|
this.handleFlowAgentEndCustomEvent(e);
|
|
705
705
|
break;
|
|
706
|
+
case Y.FlowAgentRestart:
|
|
707
|
+
this.handleFlowAgentRestartCustomEvent(e);
|
|
708
|
+
break;
|
|
706
709
|
case Y.ReferenceDocument:
|
|
707
710
|
this.handleReferenceDocumentCustomEvent(e);
|
|
708
711
|
break;
|
|
@@ -742,6 +745,12 @@ var _e = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAAGVn0euAAAA
|
|
|
742
745
|
});
|
|
743
746
|
}
|
|
744
747
|
}
|
|
748
|
+
handleFlowAgentRestartCustomEvent(e) {
|
|
749
|
+
let t = e.value;
|
|
750
|
+
this.messageModule.list.value.forEach((e) => {
|
|
751
|
+
e.role === q.Activity && e.activityType === K.FlowAgent && e.content[0].task_id === t[0].task_id && (e.status = J.Streaming);
|
|
752
|
+
});
|
|
753
|
+
}
|
|
745
754
|
handleFlowAgentResultCustomEvent(e) {
|
|
746
755
|
let t = this.messageModule.getCurrentLoadingMessage();
|
|
747
756
|
t && t.role === q.Activity && t.activityType === K.FlowAgent && (t.content = e.value);
|
|
@@ -753,7 +762,7 @@ var _e = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAAGVn0euAAAA
|
|
|
753
762
|
activityType: K.FlowAgent,
|
|
754
763
|
content: t.map((e) => ({
|
|
755
764
|
nodes: {},
|
|
756
|
-
task_id:
|
|
765
|
+
task_id: e.task_id,
|
|
757
766
|
task_name: "",
|
|
758
767
|
task_outputs: [],
|
|
759
768
|
task_state: ke.Created
|
|
@@ -1027,11 +1036,11 @@ var _e = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAAGVn0euAAAA
|
|
|
1027
1036
|
}, Ne = /* @__PURE__ */ function(e) {
|
|
1028
1037
|
return e.Running = "running", e.Finished = "finished", e.Failed = "failed", e.Cancelled = "cancelled", e;
|
|
1029
1038
|
}({}), Pe = (e, t) => {
|
|
1030
|
-
let n = w(null), r = w(!1), i = w(!1), a = t || new Z(), o = null, s = null, c = () => (r.value = !0, e.http?.agent.getAgentInfo().then((e) => {
|
|
1039
|
+
let n = w(null), r = w(!1), i = w(!1), a = t || new Z(), o = null, s = null, c = null, l = () => (r.value = !0, e.http?.agent.getAgentInfo().then((e) => {
|
|
1031
1040
|
n.value = e;
|
|
1032
1041
|
}).finally(() => {
|
|
1033
1042
|
r.value = !1;
|
|
1034
|
-
})),
|
|
1043
|
+
})), u = (t, n) => {
|
|
1035
1044
|
let r = t.promptSetting?.content?.at(-1);
|
|
1036
1045
|
r?.role === q.Pause && e.message?.createAndPlusMessage({
|
|
1037
1046
|
role: q.Assistant,
|
|
@@ -1040,12 +1049,12 @@ var _e = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAAGVn0euAAAA
|
|
|
1040
1049
|
sessionCode: n,
|
|
1041
1050
|
property: { extra: { pause: !0 } }
|
|
1042
1051
|
});
|
|
1043
|
-
},
|
|
1044
|
-
n === be.ApprovalCancel ? (
|
|
1052
|
+
}, d = (t, n, r, i) => e.http?.message.userOperation(t, n, r, i).then(() => {
|
|
1053
|
+
n === be.ApprovalCancel ? (g(), h(t)) : f({
|
|
1045
1054
|
sessionCode: t,
|
|
1046
1055
|
config: i
|
|
1047
1056
|
});
|
|
1048
|
-
}),
|
|
1057
|
+
}), f = async ({ sessionCode: t, url: n, config: r, resume: s, input: c, lastMessageId: l }) => {
|
|
1049
1058
|
a instanceof Z && a.injectMessageModule(e.message), c && e.message?.list.value.push({
|
|
1050
1059
|
role: q.User,
|
|
1051
1060
|
content: c,
|
|
@@ -1069,7 +1078,7 @@ var _e = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAAGVn0euAAAA
|
|
|
1069
1078
|
i.value = !1, a.onDone?.call(a), c && e.http?.message?.getMessages(t).then((t) => {
|
|
1070
1079
|
let n = e.message?.list.value.findLast((e) => e.role === q.User);
|
|
1071
1080
|
n.id = t.findLast((e) => e.role === q.User).id;
|
|
1072
|
-
}),
|
|
1081
|
+
}), h(t);
|
|
1073
1082
|
},
|
|
1074
1083
|
onError: (e) => {
|
|
1075
1084
|
i.value = !1, a.onError?.call(a, e);
|
|
@@ -1082,63 +1091,63 @@ var _e = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAAGVn0euAAAA
|
|
|
1082
1091
|
},
|
|
1083
1092
|
...r
|
|
1084
1093
|
}).catch(() => {});
|
|
1085
|
-
},
|
|
1094
|
+
}, p = async (t, n, r, i, a) => {
|
|
1086
1095
|
await e.message?.createAndPlusMessage({
|
|
1087
1096
|
role: q.User,
|
|
1088
1097
|
content: t,
|
|
1089
1098
|
status: J.Complete,
|
|
1090
1099
|
sessionCode: n,
|
|
1091
1100
|
...a && { property: a }
|
|
1092
|
-
}),
|
|
1101
|
+
}), f({
|
|
1093
1102
|
sessionCode: n,
|
|
1094
1103
|
url: r,
|
|
1095
1104
|
config: i
|
|
1096
1105
|
});
|
|
1097
|
-
},
|
|
1106
|
+
}, m = (t, n, r) => {
|
|
1098
1107
|
if (e.session?.current.value?.status === Ne.Running) {
|
|
1099
1108
|
let i = e.message?.list.value.at(-1)?.id;
|
|
1100
|
-
|
|
1109
|
+
f({
|
|
1101
1110
|
sessionCode: t,
|
|
1102
1111
|
url: n,
|
|
1103
1112
|
config: r,
|
|
1104
1113
|
lastMessageId: i
|
|
1105
1114
|
});
|
|
1106
1115
|
}
|
|
1107
|
-
},
|
|
1116
|
+
}, h = (t) => {
|
|
1108
1117
|
let n = e.message?.list.value.at(-1), r = n?.content?.outcome?.type === Ae.Interrupt ? n.content.outcome.interrupts.find((e) => [je.Pending, je.Draft].includes(e.metadata?.ticket?.status)) : void 0;
|
|
1109
|
-
n?.role === q.Interrupt && r && e.http?.session.isResumeSession(t).then((n) => {
|
|
1110
|
-
n ?
|
|
1118
|
+
n?.role === q.Interrupt && r && (g(), s = new AbortController(), e.http?.session.isResumeSession(t, { controller: s }).then((n) => {
|
|
1119
|
+
n ? f({
|
|
1111
1120
|
sessionCode: t,
|
|
1112
1121
|
resume: {
|
|
1113
1122
|
interruptId: r.id,
|
|
1114
1123
|
status: Me.Resolved
|
|
1115
1124
|
}
|
|
1116
|
-
}) :
|
|
1117
|
-
t === e.session?.current?.value?.sessionCode &&
|
|
1118
|
-
},
|
|
1119
|
-
});
|
|
1120
|
-
},
|
|
1121
|
-
|
|
1125
|
+
}) : c = setTimeout(() => {
|
|
1126
|
+
t === e.session?.current?.value?.sessionCode && h(t);
|
|
1127
|
+
}, 1e4);
|
|
1128
|
+
}));
|
|
1129
|
+
}, g = () => {
|
|
1130
|
+
clearTimeout(c), c = null, s?.abort?.(), s = null;
|
|
1122
1131
|
};
|
|
1123
1132
|
return {
|
|
1124
1133
|
info: n,
|
|
1125
1134
|
isInfoLoading: r,
|
|
1126
1135
|
isChatting: i,
|
|
1127
|
-
chat:
|
|
1128
|
-
handleRole:
|
|
1136
|
+
chat: p,
|
|
1137
|
+
handleRole: u,
|
|
1129
1138
|
resendMessage: async (t, n, r, i, a) => {
|
|
1130
1139
|
let o = e.message?.list.value || [], s = o.findIndex((e) => String(e.id) === t);
|
|
1131
1140
|
if (s === -1) throw Error(`Message not found: ${t}`);
|
|
1132
1141
|
let c = o[s];
|
|
1133
1142
|
if (c.role !== q.User) throw Error("Can only resend user messages");
|
|
1134
|
-
let l = c.content, u = c.property,
|
|
1143
|
+
let l = c.content, u = c.property, d = r ?? l, p = o.slice(s), m = e.message?.deleteMessages(p), h = e.message?.createAndPlusMessage({
|
|
1135
1144
|
role: q.User,
|
|
1136
|
-
content:
|
|
1145
|
+
content: d,
|
|
1137
1146
|
status: J.Complete,
|
|
1138
1147
|
sessionCode: n,
|
|
1139
1148
|
...u && { property: u }
|
|
1140
1149
|
});
|
|
1141
|
-
|
|
1150
|
+
f({
|
|
1142
1151
|
sessionCode: n,
|
|
1143
1152
|
url: i,
|
|
1144
1153
|
config: a
|
|
@@ -1146,19 +1155,19 @@ var _e = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAAGVn0euAAAA
|
|
|
1146
1155
|
console.error("[resendMessage] API error:", e);
|
|
1147
1156
|
});
|
|
1148
1157
|
},
|
|
1149
|
-
resumeStreamingChat:
|
|
1158
|
+
resumeStreamingChat: m,
|
|
1150
1159
|
abortChat: () => {
|
|
1151
1160
|
o?.abort?.(), o = null;
|
|
1152
1161
|
},
|
|
1153
1162
|
stopChat: async (t) => e.http.message?.stopChat(t),
|
|
1154
|
-
getAgentInfo:
|
|
1163
|
+
getAgentInfo: l,
|
|
1155
1164
|
reset: (e) => {
|
|
1156
1165
|
a = e || new Z(), n.value = null, r.value = !1;
|
|
1157
1166
|
},
|
|
1158
|
-
pollResumeSession:
|
|
1159
|
-
clearLongPollTimer:
|
|
1160
|
-
userOperationStreamRequest:
|
|
1161
|
-
streamRequest:
|
|
1167
|
+
pollResumeSession: h,
|
|
1168
|
+
clearLongPollTimer: g,
|
|
1169
|
+
userOperationStreamRequest: d,
|
|
1170
|
+
streamRequest: f
|
|
1162
1171
|
};
|
|
1163
1172
|
};
|
|
1164
1173
|
//#endregion
|
|
@@ -1375,8 +1384,8 @@ var Ie = class {
|
|
|
1375
1384
|
return l.data;
|
|
1376
1385
|
} catch (e) {
|
|
1377
1386
|
if (a && clearTimeout(a), e instanceof Error && e.name === "AbortError") {
|
|
1378
|
-
|
|
1379
|
-
|
|
1387
|
+
console.warn("User canceled request", e.message);
|
|
1388
|
+
return;
|
|
1380
1389
|
}
|
|
1381
1390
|
let t = e.isAxiosError === !0 ? e : ze(e.message, r, e.code, void 0);
|
|
1382
1391
|
throw this.dispatchError(t), this.applyResponseErrorInterceptors(t);
|