@blueking/chat-helper 0.0.1-beta.30 → 0.0.1-beta.32

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.
@@ -62,6 +62,12 @@ export declare const useAgent: (mediator: IMediatorModule, protocol: ISSEProtoco
62
62
  content?: ({
63
63
  activityType: import("../message").ActivityType;
64
64
  content: {
65
+ nodes: Record<string, import("../event").IFlowAgentNode>;
66
+ task_id: number;
67
+ task_name: string;
68
+ task_outputs: string[];
69
+ task_state: import("../event").FlowTaskState;
70
+ } | {
65
71
  content: string;
66
72
  referenceDocument: {
67
73
  name: string;
@@ -355,6 +361,12 @@ export declare const useAgent: (mediator: IMediatorModule, protocol: ISSEProtoco
355
361
  content?: ({
356
362
  activityType: import("../message").ActivityType;
357
363
  content: {
364
+ nodes: Record<string, import("../event").IFlowAgentNode>;
365
+ task_id: number;
366
+ task_name: string;
367
+ task_outputs: string[];
368
+ task_state: import("../event").FlowTaskState;
369
+ } | {
358
370
  content: string;
359
371
  referenceDocument: {
360
372
  name: string;
@@ -154,7 +154,10 @@ import { MessageRole, MessageStatus } from '../message/index.ts.js';
154
154
  url: url || 'chat_completion/',
155
155
  method: 'POST',
156
156
  data: {
157
- session_code: sessionCode
157
+ session_code: sessionCode,
158
+ execute_kwargs: {
159
+ stream: true
160
+ }
158
161
  },
159
162
  controller: abortController,
160
163
  onDone,
@@ -31,6 +31,18 @@ export declare class AGUIProtocol implements ISSEProtocol {
31
31
  * 处理自定义事件
32
32
  */
33
33
  handleCustomEvent(event: ICustomEvent): void;
34
+ /**
35
+ * 自定义事件 处理流程编排任务结束
36
+ */
37
+ handleFlowAgentEndCustomEvent(_event: ICustomEvent): void;
38
+ /**
39
+ * 自定义事件 处理流程编排任务结果(增量更新节点状态)
40
+ */
41
+ handleFlowAgentResultCustomEvent(event: ICustomEvent): void;
42
+ /**
43
+ * 自定义事件 处理流程编排任务开始
44
+ */
45
+ handleFlowAgentStartCustomEvent(event: ICustomEvent): void;
34
46
  /**
35
47
  * 自定义事件 处理意图识别结束
36
48
  */
@@ -37,7 +37,7 @@
37
37
  }
38
38
  import { transferMessageApi2Message } from '../http/transform/index.ts.js';
39
39
  import { ActivityType, MessageRole, MessageStatus, MessageType } from '../message/index.ts.js';
40
- import { CustomEventName, EventType } from './type.ts.js';
40
+ import { CustomEventName, EventType, FlowTaskState } from './type.ts.js';
41
41
  /**
42
42
  * AGUI 协议
43
43
  * @param message - 消息模块
@@ -54,6 +54,15 @@ import { CustomEventName, EventType } from './type.ts.js';
54
54
  * 处理自定义事件
55
55
  */ handleCustomEvent(event) {
56
56
  switch(event.name){
57
+ case CustomEventName.FlowAgentStart:
58
+ this.handleFlowAgentStartCustomEvent(event);
59
+ break;
60
+ case CustomEventName.FlowAgentResult:
61
+ this.handleFlowAgentResultCustomEvent(event);
62
+ break;
63
+ case CustomEventName.FlowAgentEnd:
64
+ this.handleFlowAgentEndCustomEvent(event);
65
+ break;
57
66
  case CustomEventName.ReferenceDocument:
58
67
  this.handleReferenceDocumentCustomEvent(event);
59
68
  break;
@@ -77,6 +86,41 @@ import { CustomEventName, EventType } from './type.ts.js';
77
86
  }
78
87
  }
79
88
  /**
89
+ * 自定义事件 处理流程编排任务结束
90
+ */ handleFlowAgentEndCustomEvent(_event) {
91
+ const message = this.messageModule.getCurrentLoadingMessage();
92
+ if (message && message.role === MessageRole.Activity && message.activityType === ActivityType.FlowAgent) {
93
+ const value = _event.value;
94
+ message.content.task_outputs = value.task_outputs;
95
+ message.status = MessageStatus.Complete;
96
+ }
97
+ }
98
+ /**
99
+ * 自定义事件 处理流程编排任务结果(增量更新节点状态)
100
+ */ handleFlowAgentResultCustomEvent(event) {
101
+ const message = this.messageModule.getCurrentLoadingMessage();
102
+ if (message && message.role === MessageRole.Activity && message.activityType === ActivityType.FlowAgent) {
103
+ message.content = event.value;
104
+ }
105
+ }
106
+ /**
107
+ * 自定义事件 处理流程编排任务开始
108
+ */ handleFlowAgentStartCustomEvent(event) {
109
+ const value = event.value;
110
+ this.messageModule.plusMessage({
111
+ role: MessageRole.Activity,
112
+ activityType: ActivityType.FlowAgent,
113
+ content: {
114
+ nodes: {},
115
+ task_id: Number(value.task_id),
116
+ task_name: '',
117
+ task_outputs: [],
118
+ task_state: FlowTaskState.Created
119
+ },
120
+ status: MessageStatus.Streaming
121
+ });
122
+ }
123
+ /**
80
124
  * 自定义事件 处理意图识别结束
81
125
  */ handleKnowledgeRagEndCustomEvent(_event) {
82
126
  const message = this.messageModule.getCurrentLoadingMessage();
@@ -1,5 +1,8 @@
1
1
  import { type IMessageApi, type MessageRole, type MessageStatus } from '../message/type';
2
2
  export declare enum CustomEventName {
3
+ FlowAgentEnd = "flow_agent_end",
4
+ FlowAgentResult = "flow_agent_result",
5
+ FlowAgentStart = "flow_agent_start",
3
6
  KnowledgeRagEnd = "knowledge_rag_end",
4
7
  KnowledgeRagResult = "knowledge_rag_result",
5
8
  KnowledgeRagStart = "knowledge_rag_start",
@@ -35,6 +38,44 @@ export declare enum EventType {
35
38
  ToolCallResult = "TOOL_CALL_RESULT",
36
39
  ToolCallStart = "TOOL_CALL_START"
37
40
  }
41
+ /** BKFlow 收敛后的节点状态 - task.node 的状态枚举 */
42
+ export declare enum FlowNodeState {
43
+ /** 失败 */
44
+ Failed = "failed",
45
+ /** 执行中 */
46
+ Running = "running",
47
+ /** 成功 */
48
+ Success = "success",
49
+ /** 挂起 */
50
+ Suspended = "suspended"
51
+ }
52
+ /** BKFLOW 原始状态 - task 的状态枚举 */
53
+ export declare enum FlowTaskState {
54
+ /** 执行中 */
55
+ Blocked = "BLOCKED",
56
+ /** 执行中 */
57
+ Created = "CREATED",
58
+ /** 失败 */
59
+ Failed = "FAILED",
60
+ /** 成功 */
61
+ Finished = "FINISHED",
62
+ /** 执行中 */
63
+ LoopReady = "LOOP_READY",
64
+ /** 执行中 */
65
+ Ready = "READY",
66
+ /** 失败 */
67
+ Revoked = "REVOKED",
68
+ /** 失败 */
69
+ RollBackFailed = "ROLL_BACK_FAILED",
70
+ /** 执行中 */
71
+ RollBackSuccess = "ROLL_BACK_SUCCESS",
72
+ /** 执行中 */
73
+ RollingBack = "ROLLING_BACK",
74
+ /** 执行中 */
75
+ Running = "RUNNING",
76
+ /** 挂起 */
77
+ Suspended = "SUSPENDED"
78
+ }
38
79
  /**
39
80
  * Activity 代表 Agent 执行过程中的活动/动作/任务,可能包含结构化数据
40
81
  * 活动状态的增量更新
@@ -71,9 +112,32 @@ export interface IBaseEvent {
71
112
  export interface ICustomEvent extends IBaseEvent {
72
113
  name: CustomEventName;
73
114
  type: EventType.Custom;
74
- value: IKnowledgeRagResultCustomValue | IKnowledgeRagTextContentCustomValue | IReferenceDocumentCustomValue | ITempMessageCustomValue;
115
+ value: IFlowAgentEndCustomValue | IFlowAgentResultCustomValue | IFlowAgentStartCustomValue | IKnowledgeRagResultCustomValue | IKnowledgeRagTextContentCustomValue | IReferenceDocumentCustomValue | ITempMessageCustomValue;
75
116
  }
76
117
  export type IEvent = IActivityDeltaEvent | IActivitySnapshotEvent | ICustomEvent | IMessagesSnapshotEvent | IRawEvent | IRunErrorEvent | IRunFinishedEvent | IRunStartedEvent | IStateDeltaEvent | IStateSnapshotEvent | IStepFinishedEvent | IStepStartedEvent | ITextMessageChunkEvent | ITextMessageContentEvent | ITextMessageEndEvent | ITextMessageStartEvent | IThinkingEndEvent | IThinkingStartEvent | IThinkingTextMessageContentEvent | IThinkingTextMessageEndEvent | IThinkingTextMessageStartEvent | IToolCallArgsEvent | IToolCallChunkEvent | IToolCallEndEvent | IToolCallResultEvent | IToolCallStartEvent;
118
+ export interface IFlowAgentEndCustomValue {
119
+ task_outputs: string[];
120
+ }
121
+ export interface IFlowAgentNode {
122
+ /** 耗时(s) */
123
+ elapsed_time: number;
124
+ /** 节点id */
125
+ id: string;
126
+ /** 节点名称 */
127
+ name: string;
128
+ /** 节点状态 */
129
+ state: FlowNodeState;
130
+ }
131
+ export interface IFlowAgentResultCustomValue {
132
+ nodes: Record<string, IFlowAgentNode>;
133
+ task_id: number;
134
+ task_name: string;
135
+ task_outputs: string[];
136
+ task_state: FlowTaskState;
137
+ }
138
+ export interface IFlowAgentStartCustomValue {
139
+ task_id: string;
140
+ }
77
141
  export type IKnowledgeRagResultCustomValue = IReferenceDocumentCustomValue;
78
142
  export interface IKnowledgeRagTextContentCustomValue {
79
143
  cover: boolean;
@@ -24,6 +24,9 @@
24
24
  * IN THE SOFTWARE.
25
25
  */ export var CustomEventName;
26
26
  (function(CustomEventName) {
27
+ CustomEventName["FlowAgentEnd"] = "flow_agent_end";
28
+ CustomEventName["FlowAgentResult"] = "flow_agent_result";
29
+ CustomEventName["FlowAgentStart"] = "flow_agent_start";
27
30
  CustomEventName["KnowledgeRagEnd"] = "knowledge_rag_end";
28
31
  CustomEventName["KnowledgeRagResult"] = "knowledge_rag_result";
29
32
  CustomEventName["KnowledgeRagStart"] = "knowledge_rag_start";
@@ -60,3 +63,25 @@ export var EventType;
60
63
  EventType["ToolCallResult"] = "TOOL_CALL_RESULT";
61
64
  EventType["ToolCallStart"] = "TOOL_CALL_START";
62
65
  })(EventType || (EventType = {}));
66
+ export var FlowNodeState;
67
+ (function(FlowNodeState) {
68
+ /** 失败 */ FlowNodeState["Failed"] = "failed";
69
+ /** 执行中 */ FlowNodeState["Running"] = "running";
70
+ /** 成功 */ FlowNodeState["Success"] = "success";
71
+ /** 挂起 */ FlowNodeState["Suspended"] = "suspended";
72
+ })(FlowNodeState || (FlowNodeState = {}));
73
+ export var FlowTaskState;
74
+ (function(FlowTaskState) {
75
+ /** 执行中 */ FlowTaskState["Blocked"] = "BLOCKED";
76
+ /** 执行中 */ FlowTaskState["Created"] = "CREATED";
77
+ /** 失败 */ FlowTaskState["Failed"] = "FAILED";
78
+ /** 成功 */ FlowTaskState["Finished"] = "FINISHED";
79
+ /** 执行中 */ FlowTaskState["LoopReady"] = "LOOP_READY";
80
+ /** 执行中 */ FlowTaskState["Ready"] = "READY";
81
+ /** 失败 */ FlowTaskState["Revoked"] = "REVOKED";
82
+ /** 失败 */ FlowTaskState["RollBackFailed"] = "ROLL_BACK_FAILED";
83
+ /** 执行中 */ FlowTaskState["RollBackSuccess"] = "ROLL_BACK_SUCCESS";
84
+ /** 执行中 */ FlowTaskState["RollingBack"] = "ROLLING_BACK";
85
+ /** 执行中 */ FlowTaskState["Running"] = "RUNNING";
86
+ /** 挂起 */ FlowTaskState["Suspended"] = "SUSPENDED";
87
+ })(FlowTaskState || (FlowTaskState = {}));
@@ -40,6 +40,7 @@ export declare const useHttp: (options: IUseChatHelperOptions) => {
40
40
  batchDeleteMessages: (ids: string[], config?: import("./fetch").IRequestConfig) => Promise<number>;
41
41
  shareMessages: (sessionCode: string, contentIds: string[], expiredAt?: number, config?: import("./fetch").IRequestConfig) => Promise<import("./module/message").IShareMessagesResponse>;
42
42
  stopChat: (sessionCode: string, config?: import("./fetch").IRequestConfig) => Promise<void>;
43
+ getFlowAgentTaskNodeInfo: (taskId: number, nodeId: string, config?: import("./fetch").IRequestConfig) => Promise<import("..").IFlowAgentTaskNodeInfo>;
43
44
  };
44
45
  fetchClient: import("./fetch").FetchClient;
45
46
  };
@@ -37,6 +37,7 @@ export declare const useModule: (fetchClient: FetchClient) => {
37
37
  batchDeleteMessages: (ids: string[], config?: import("../fetch").IRequestConfig) => Promise<number>;
38
38
  shareMessages: (sessionCode: string, contentIds: string[], expiredAt?: number, config?: import("../fetch").IRequestConfig) => Promise<import("./message").IShareMessagesResponse>;
39
39
  stopChat: (sessionCode: string, config?: import("../fetch").IRequestConfig) => Promise<void>;
40
+ getFlowAgentTaskNodeInfo: (taskId: number, nodeId: string, config?: import("../fetch").IRequestConfig) => Promise<import("../..").IFlowAgentTaskNodeInfo>;
40
41
  };
41
42
  fetchClient: FetchClient;
42
43
  };
@@ -1,4 +1,4 @@
1
- import type { IMessage } from '../../message/type';
1
+ import type { IFlowAgentTaskNodeInfo, IMessage } from '../../message/type';
2
2
  import type { FetchClient, IRequestConfig } from '../fetch';
3
3
  /**
4
4
  * 分享消息接口返回数据
@@ -26,4 +26,5 @@ export declare const useMessage: (fetchClient: FetchClient) => {
26
26
  batchDeleteMessages: (ids: string[], config?: IRequestConfig) => Promise<number>;
27
27
  shareMessages: (sessionCode: string, contentIds: string[], expiredAt?: number, config?: IRequestConfig) => Promise<IShareMessagesResponse>;
28
28
  stopChat: (sessionCode: string, config?: IRequestConfig) => Promise<void>;
29
+ getFlowAgentTaskNodeInfo: (taskId: number, nodeId: string, config?: IRequestConfig) => Promise<IFlowAgentTaskNodeInfo>;
29
30
  };
@@ -82,6 +82,8 @@ import { transferMessage2MessageApi, transferMessageApi2Message } from '../trans
82
82
  const stopChat = (sessionCode, config)=>fetchClient.post(`session_content/stop/`, {
83
83
  session_code: sessionCode
84
84
  }, config);
85
+ // 获取流程引擎任务节点详情
86
+ const getFlowAgentTaskNodeInfo = (taskId, nodeId, config)=>fetchClient.get(`flow_agent/task_node_info/${taskId}/${nodeId}/`, undefined, config);
85
87
  return {
86
88
  getMessages,
87
89
  plusMessage,
@@ -89,6 +91,7 @@ import { transferMessage2MessageApi, transferMessageApi2Message } from '../trans
89
91
  deleteMessage,
90
92
  batchDeleteMessages,
91
93
  shareMessages,
92
- stopChat
94
+ stopChat,
95
+ getFlowAgentTaskNodeInfo
93
96
  };
94
97
  };
@@ -74,7 +74,7 @@ function _object_spread_props(target, source) {
74
74
  }
75
75
  return target;
76
76
  }
77
- import { MessageRole, MessageType } from '../../message/type.ts.js';
77
+ import { ActivityType, MessageRole, MessageType } from '../../message/type.ts.js';
78
78
  /**
79
79
  * 将 API 返回的消息数据转换为前端使用的消息数据
80
80
  * @param data API 返回的消息数据
@@ -93,20 +93,33 @@ import { MessageRole, MessageType } from '../../message/type.ts.js';
93
93
  case MessageRole.Activity:
94
94
  {
95
95
  const activityData = data;
96
- const result = _object_spread_props(_object_spread({}, baseMessage), {
97
- activityType: activityData.activity_type,
98
- content: Array.isArray(activityData.content) ? activityData.content.map((item)=>({
96
+ const transferReferenceDocumentApi2ReferenceDocument = (doc)=>doc.map((item)=>({
99
97
  name: item.name,
100
98
  originFileUrl: item.origin_file_url,
101
99
  url: item.url
102
- })) : {
103
- content: activityData.content.content,
104
- referenceDocument: activityData.content.reference_document.map((item)=>({
105
- name: item.name,
106
- originFileUrl: item.origin_file_url,
107
- url: item.url
108
- }))
109
- },
100
+ }));
101
+ let content;
102
+ switch(activityData.activity_type){
103
+ case ActivityType.ReferenceDocument:
104
+ content = transferReferenceDocumentApi2ReferenceDocument(activityData.content);
105
+ break;
106
+ case ActivityType.KnowledgeRag:
107
+ {
108
+ const ragContent = activityData.content;
109
+ content = {
110
+ content: ragContent.content,
111
+ referenceDocument: transferReferenceDocumentApi2ReferenceDocument(ragContent.reference_document)
112
+ };
113
+ break;
114
+ }
115
+ case ActivityType.FlowAgent:
116
+ default:
117
+ content = activityData.content;
118
+ break;
119
+ }
120
+ const result = _object_spread_props(_object_spread({}, baseMessage), {
121
+ activityType: activityData.activity_type,
122
+ content,
110
123
  role: activityData.role
111
124
  });
112
125
  return result;
@@ -344,20 +357,33 @@ import { MessageRole, MessageType } from '../../message/type.ts.js';
344
357
  case MessageRole.Activity:
345
358
  {
346
359
  const activityData = data;
347
- const result = _object_spread_props(_object_spread({}, baseMessage), {
348
- activity_type: activityData.activityType,
349
- content: Array.isArray(activityData.content) ? activityData.content.map((item)=>({
360
+ const transferReferenceDocument2ReferenceDocumentApi = (doc)=>doc.map((item)=>({
350
361
  name: item.name,
351
362
  origin_file_url: item.originFileUrl,
352
363
  url: item.url
353
- })) : {
354
- content: activityData.content.content,
355
- reference_document: activityData.content.referenceDocument.map((item)=>({
356
- name: item.name,
357
- origin_file_url: item.originFileUrl,
358
- url: item.url
359
- }))
360
- },
364
+ }));
365
+ let content;
366
+ switch(activityData.activityType){
367
+ case ActivityType.ReferenceDocument:
368
+ content = transferReferenceDocument2ReferenceDocumentApi(activityData.content);
369
+ break;
370
+ case ActivityType.KnowledgeRag:
371
+ {
372
+ const ragContent = activityData.content;
373
+ content = {
374
+ content: ragContent.content,
375
+ reference_document: transferReferenceDocument2ReferenceDocumentApi(ragContent.referenceDocument)
376
+ };
377
+ break;
378
+ }
379
+ case ActivityType.FlowAgent:
380
+ default:
381
+ content = activityData.content;
382
+ break;
383
+ }
384
+ const result = _object_spread_props(_object_spread({}, baseMessage), {
385
+ activity_type: activityData.activityType,
386
+ content,
361
387
  role: activityData.role
362
388
  });
363
389
  return result;
package/dist/index.d.ts CHANGED
@@ -64,6 +64,12 @@ export declare const useChatHelper: (options: IUseChatHelperOptions) => {
64
64
  content?: ({
65
65
  activityType: import("./message").ActivityType;
66
66
  content: {
67
+ nodes: Record<string, import("./event").IFlowAgentNode>;
68
+ task_id: number;
69
+ task_name: string;
70
+ task_outputs: string[];
71
+ task_state: import("./event").FlowTaskState;
72
+ } | {
67
73
  content: string;
68
74
  referenceDocument: {
69
75
  name: string;
@@ -357,6 +363,12 @@ export declare const useChatHelper: (options: IUseChatHelperOptions) => {
357
363
  content?: ({
358
364
  activityType: import("./message").ActivityType;
359
365
  content: {
366
+ nodes: Record<string, import("./event").IFlowAgentNode>;
367
+ task_id: number;
368
+ task_name: string;
369
+ task_outputs: string[];
370
+ task_state: import("./event").FlowTaskState;
371
+ } | {
360
372
  content: string;
361
373
  referenceDocument: {
362
374
  name: string;
@@ -629,6 +641,12 @@ export declare const useChatHelper: (options: IUseChatHelperOptions) => {
629
641
  content: ({
630
642
  activityType: import("./message").ActivityType;
631
643
  content: {
644
+ nodes: Record<string, import("./event").IFlowAgentNode>;
645
+ task_id: number;
646
+ task_name: string;
647
+ task_outputs: string[];
648
+ task_state: import("./event").FlowTaskState;
649
+ } | {
632
650
  content: string;
633
651
  referenceDocument: {
634
652
  name: string;
@@ -870,6 +888,12 @@ export declare const useChatHelper: (options: IUseChatHelperOptions) => {
870
888
  value: string | ({
871
889
  activityType: import("./message").ActivityType;
872
890
  content: {
891
+ nodes: Record<string, import("./event").IFlowAgentNode>;
892
+ task_id: number;
893
+ task_name: string;
894
+ task_outputs: string[];
895
+ task_state: import("./event").FlowTaskState;
896
+ } | {
873
897
  content: string;
874
898
  referenceDocument: {
875
899
  name: string;
@@ -1131,6 +1155,12 @@ export declare const useChatHelper: (options: IUseChatHelperOptions) => {
1131
1155
  content: ({
1132
1156
  activityType: import("./message").ActivityType;
1133
1157
  content: {
1158
+ nodes: Record<string, import("./event").IFlowAgentNode>;
1159
+ task_id: number;
1160
+ task_name: string;
1161
+ task_outputs: string[];
1162
+ task_state: import("./event").FlowTaskState;
1163
+ } | {
1134
1164
  content: string;
1135
1165
  referenceDocument: {
1136
1166
  name: string;
@@ -1372,6 +1402,12 @@ export declare const useChatHelper: (options: IUseChatHelperOptions) => {
1372
1402
  value: string | ({
1373
1403
  activityType: import("./message").ActivityType;
1374
1404
  content: {
1405
+ nodes: Record<string, import("./event").IFlowAgentNode>;
1406
+ task_id: number;
1407
+ task_name: string;
1408
+ task_outputs: string[];
1409
+ task_state: import("./event").FlowTaskState;
1410
+ } | {
1375
1411
  content: string;
1376
1412
  referenceDocument: {
1377
1413
  name: string;
@@ -1634,6 +1670,12 @@ export declare const useChatHelper: (options: IUseChatHelperOptions) => {
1634
1670
  content: ({
1635
1671
  activityType: import("./message").ActivityType;
1636
1672
  content: {
1673
+ nodes: Record<string, import("./event").IFlowAgentNode>;
1674
+ task_id: number;
1675
+ task_name: string;
1676
+ task_outputs: string[];
1677
+ task_state: import("./event").FlowTaskState;
1678
+ } | {
1637
1679
  content: string;
1638
1680
  referenceDocument: {
1639
1681
  name: string;
@@ -1875,6 +1917,12 @@ export declare const useChatHelper: (options: IUseChatHelperOptions) => {
1875
1917
  value: string | ({
1876
1918
  activityType: import("./message").ActivityType;
1877
1919
  content: {
1920
+ nodes: Record<string, import("./event").IFlowAgentNode>;
1921
+ task_id: number;
1922
+ task_name: string;
1923
+ task_outputs: string[];
1924
+ task_state: import("./event").FlowTaskState;
1925
+ } | {
1878
1926
  content: string;
1879
1927
  referenceDocument: {
1880
1928
  name: string;
@@ -2136,6 +2184,12 @@ export declare const useChatHelper: (options: IUseChatHelperOptions) => {
2136
2184
  content: ({
2137
2185
  activityType: import("./message").ActivityType;
2138
2186
  content: {
2187
+ nodes: Record<string, import("./event").IFlowAgentNode>;
2188
+ task_id: number;
2189
+ task_name: string;
2190
+ task_outputs: string[];
2191
+ task_state: import("./event").FlowTaskState;
2192
+ } | {
2139
2193
  content: string;
2140
2194
  referenceDocument: {
2141
2195
  name: string;
@@ -2377,6 +2431,12 @@ export declare const useChatHelper: (options: IUseChatHelperOptions) => {
2377
2431
  value: string | ({
2378
2432
  activityType: import("./message").ActivityType;
2379
2433
  content: {
2434
+ nodes: Record<string, import("./event").IFlowAgentNode>;
2435
+ task_id: number;
2436
+ task_name: string;
2437
+ task_outputs: string[];
2438
+ task_state: import("./event").FlowTaskState;
2439
+ } | {
2380
2440
  content: string;
2381
2441
  referenceDocument: {
2382
2442
  name: string;
@@ -2655,6 +2715,12 @@ export declare const useChatHelper: (options: IUseChatHelperOptions) => {
2655
2715
  list: import("vue").Ref<({
2656
2716
  activityType: import("./message").ActivityType;
2657
2717
  content: {
2718
+ nodes: Record<string, import("./event").IFlowAgentNode>;
2719
+ task_id: number;
2720
+ task_name: string;
2721
+ task_outputs: string[];
2722
+ task_state: import("./event").FlowTaskState;
2723
+ } | {
2658
2724
  content: string;
2659
2725
  referenceDocument: {
2660
2726
  name: string;
@@ -2893,6 +2959,12 @@ export declare const useChatHelper: (options: IUseChatHelperOptions) => {
2893
2959
  })[], import("./message").IMessage[] | ({
2894
2960
  activityType: import("./message").ActivityType;
2895
2961
  content: {
2962
+ nodes: Record<string, import("./event").IFlowAgentNode>;
2963
+ task_id: number;
2964
+ task_name: string;
2965
+ task_outputs: string[];
2966
+ task_state: import("./event").FlowTaskState;
2967
+ } | {
2896
2968
  content: string;
2897
2969
  referenceDocument: {
2898
2970
  name: string;
@@ -3136,6 +3208,12 @@ export declare const useChatHelper: (options: IUseChatHelperOptions) => {
3136
3208
  getCurrentLoadingMessage: () => {
3137
3209
  activityType: import("./message").ActivityType;
3138
3210
  content: {
3211
+ nodes: Record<string, import("./event").IFlowAgentNode>;
3212
+ task_id: number;
3213
+ task_name: string;
3214
+ task_outputs: string[];
3215
+ task_state: import("./event").FlowTaskState;
3216
+ } | {
3139
3217
  content: string;
3140
3218
  referenceDocument: {
3141
3219
  name: string;
@@ -3375,6 +3453,12 @@ export declare const useChatHelper: (options: IUseChatHelperOptions) => {
3375
3453
  getMessageByMessageId: (id: string) => {
3376
3454
  activityType: import("./message").ActivityType;
3377
3455
  content: {
3456
+ nodes: Record<string, import("./event").IFlowAgentNode>;
3457
+ task_id: number;
3458
+ task_name: string;
3459
+ task_outputs: string[];
3460
+ task_state: import("./event").FlowTaskState;
3461
+ } | {
3378
3462
  content: string;
3379
3463
  referenceDocument: {
3380
3464
  name: string;
@@ -3652,6 +3736,7 @@ export declare const useChatHelper: (options: IUseChatHelperOptions) => {
3652
3736
  batchDeleteMessages: (ids: string[], config?: import("./http").IRequestConfig) => Promise<number>;
3653
3737
  shareMessages: (sessionCode: string, contentIds: string[], expiredAt?: number, config?: import("./http").IRequestConfig) => Promise<import("./http/module/message").IShareMessagesResponse>;
3654
3738
  stopChat: (sessionCode: string, config?: import("./http").IRequestConfig) => Promise<void>;
3739
+ getFlowAgentTaskNodeInfo: (taskId: number, nodeId: string, config?: import("./http").IRequestConfig) => Promise<import("./message").IFlowAgentTaskNodeInfo>;
3655
3740
  };
3656
3741
  fetchClient: import("./http").FetchClient;
3657
3742
  };
@@ -1,4 +1,6 @@
1
+ import type { IFlowAgentResultCustomValue } from '../event/type';
1
2
  export declare enum ActivityType {
3
+ FlowAgent = "flow_agent",
2
4
  KnowledgeRag = "knowledge_rag",
3
5
  ReferenceDocument = "reference_document"
4
6
  }
@@ -39,12 +41,12 @@ export declare enum MessageType {
39
41
  }
40
42
  export interface IActivityMessage extends IBaseMessage {
41
43
  activityType: ActivityType;
42
- content: IKnowledgeRag | IReferenceDocument;
44
+ content: IFlowAgentResultCustomValue | IKnowledgeRag | IReferenceDocument;
43
45
  role: MessageRole.Activity;
44
46
  }
45
47
  export interface IActivityMessageApi extends IBaseMessageApi {
46
48
  activity_type: ActivityType;
47
- content: IKnowledgeRagApi | IReferenceDocumentApi;
49
+ content: IFlowAgentResultCustomValue | IKnowledgeRagApi | IReferenceDocumentApi;
48
50
  role: MessageRole.Activity;
49
51
  }
50
52
  export interface IAssistantMessage extends IBaseMessage {
@@ -107,6 +109,47 @@ export interface IDeveloperMessageApi extends IBaseMessageApi {
107
109
  content: string;
108
110
  role: MessageRole.Developer;
109
111
  }
112
+ export interface IFlowAgentTaskNodeInfo {
113
+ inputs: Record<string, unknown>;
114
+ node_id: string;
115
+ task_id: number;
116
+ basic_info: {
117
+ always_use_latest: boolean | null;
118
+ auto_retry: {
119
+ enable: boolean;
120
+ interval: number;
121
+ times: number;
122
+ };
123
+ error_ignorable: boolean;
124
+ node_name: string;
125
+ optional: boolean;
126
+ retryable: boolean;
127
+ skippable: boolean;
128
+ stage_name: string;
129
+ template_name: string;
130
+ timeout_config: {
131
+ action: string;
132
+ enable: boolean;
133
+ seconds: number;
134
+ };
135
+ };
136
+ outputs: {
137
+ key: string;
138
+ preset: boolean;
139
+ value: unknown;
140
+ }[];
141
+ plugin_output: {
142
+ key: string;
143
+ name: string;
144
+ schema: {
145
+ description: string;
146
+ enum: unknown[];
147
+ properties?: Record<string, unknown>;
148
+ type: string;
149
+ };
150
+ type: string;
151
+ }[];
152
+ }
110
153
  export interface IFunctionCall {
111
154
  arguments: string;
112
155
  description?: string;
@@ -24,6 +24,7 @@
24
24
  * IN THE SOFTWARE.
25
25
  */ export var ActivityType;
26
26
  (function(ActivityType) {
27
+ ActivityType["FlowAgent"] = "flow_agent";
27
28
  ActivityType["KnowledgeRag"] = "knowledge_rag";
28
29
  ActivityType["ReferenceDocument"] = "reference_document";
29
30
  })(ActivityType || (ActivityType = {}));
@@ -9,6 +9,12 @@ export declare const useMessage: (mediator: IMediatorModule) => {
9
9
  list: import("vue").Ref<({
10
10
  activityType: import("./type").ActivityType;
11
11
  content: {
12
+ nodes: Record<string, import("..").IFlowAgentNode>;
13
+ task_id: number;
14
+ task_name: string;
15
+ task_outputs: string[];
16
+ task_state: import("..").FlowTaskState;
17
+ } | {
12
18
  content: string;
13
19
  referenceDocument: {
14
20
  name: string;
@@ -247,6 +253,12 @@ export declare const useMessage: (mediator: IMediatorModule) => {
247
253
  })[], IMessage[] | ({
248
254
  activityType: import("./type").ActivityType;
249
255
  content: {
256
+ nodes: Record<string, import("..").IFlowAgentNode>;
257
+ task_id: number;
258
+ task_name: string;
259
+ task_outputs: string[];
260
+ task_state: import("..").FlowTaskState;
261
+ } | {
250
262
  content: string;
251
263
  referenceDocument: {
252
264
  name: string;
@@ -490,6 +502,12 @@ export declare const useMessage: (mediator: IMediatorModule) => {
490
502
  getCurrentLoadingMessage: () => {
491
503
  activityType: import("./type").ActivityType;
492
504
  content: {
505
+ nodes: Record<string, import("..").IFlowAgentNode>;
506
+ task_id: number;
507
+ task_name: string;
508
+ task_outputs: string[];
509
+ task_state: import("..").FlowTaskState;
510
+ } | {
493
511
  content: string;
494
512
  referenceDocument: {
495
513
  name: string;
@@ -729,6 +747,12 @@ export declare const useMessage: (mediator: IMediatorModule) => {
729
747
  getMessageByMessageId: (id: string) => {
730
748
  activityType: import("./type").ActivityType;
731
749
  content: {
750
+ nodes: Record<string, import("..").IFlowAgentNode>;
751
+ task_id: number;
752
+ task_name: string;
753
+ task_outputs: string[];
754
+ task_state: import("..").FlowTaskState;
755
+ } | {
732
756
  content: string;
733
757
  referenceDocument: {
734
758
  name: string;
@@ -25,6 +25,12 @@ export declare const useSession: (mediator: IMediatorModule) => {
25
25
  content: ({
26
26
  activityType: import("..").ActivityType;
27
27
  content: {
28
+ nodes: Record<string, import("..").IFlowAgentNode>;
29
+ task_id: number;
30
+ task_name: string;
31
+ task_outputs: string[];
32
+ task_state: import("..").FlowTaskState;
33
+ } | {
28
34
  content: string;
29
35
  referenceDocument: {
30
36
  name: string;
@@ -266,6 +272,12 @@ export declare const useSession: (mediator: IMediatorModule) => {
266
272
  value: string | ({
267
273
  activityType: import("..").ActivityType;
268
274
  content: {
275
+ nodes: Record<string, import("..").IFlowAgentNode>;
276
+ task_id: number;
277
+ task_name: string;
278
+ task_outputs: string[];
279
+ task_state: import("..").FlowTaskState;
280
+ } | {
269
281
  content: string;
270
282
  referenceDocument: {
271
283
  name: string;
@@ -527,6 +539,12 @@ export declare const useSession: (mediator: IMediatorModule) => {
527
539
  content: ({
528
540
  activityType: import("..").ActivityType;
529
541
  content: {
542
+ nodes: Record<string, import("..").IFlowAgentNode>;
543
+ task_id: number;
544
+ task_name: string;
545
+ task_outputs: string[];
546
+ task_state: import("..").FlowTaskState;
547
+ } | {
530
548
  content: string;
531
549
  referenceDocument: {
532
550
  name: string;
@@ -768,6 +786,12 @@ export declare const useSession: (mediator: IMediatorModule) => {
768
786
  value: string | ({
769
787
  activityType: import("..").ActivityType;
770
788
  content: {
789
+ nodes: Record<string, import("..").IFlowAgentNode>;
790
+ task_id: number;
791
+ task_name: string;
792
+ task_outputs: string[];
793
+ task_state: import("..").FlowTaskState;
794
+ } | {
771
795
  content: string;
772
796
  referenceDocument: {
773
797
  name: string;
@@ -1030,6 +1054,12 @@ export declare const useSession: (mediator: IMediatorModule) => {
1030
1054
  content: ({
1031
1055
  activityType: import("..").ActivityType;
1032
1056
  content: {
1057
+ nodes: Record<string, import("..").IFlowAgentNode>;
1058
+ task_id: number;
1059
+ task_name: string;
1060
+ task_outputs: string[];
1061
+ task_state: import("..").FlowTaskState;
1062
+ } | {
1033
1063
  content: string;
1034
1064
  referenceDocument: {
1035
1065
  name: string;
@@ -1271,6 +1301,12 @@ export declare const useSession: (mediator: IMediatorModule) => {
1271
1301
  value: string | ({
1272
1302
  activityType: import("..").ActivityType;
1273
1303
  content: {
1304
+ nodes: Record<string, import("..").IFlowAgentNode>;
1305
+ task_id: number;
1306
+ task_name: string;
1307
+ task_outputs: string[];
1308
+ task_state: import("..").FlowTaskState;
1309
+ } | {
1274
1310
  content: string;
1275
1311
  referenceDocument: {
1276
1312
  name: string;
@@ -1532,6 +1568,12 @@ export declare const useSession: (mediator: IMediatorModule) => {
1532
1568
  content: ({
1533
1569
  activityType: import("..").ActivityType;
1534
1570
  content: {
1571
+ nodes: Record<string, import("..").IFlowAgentNode>;
1572
+ task_id: number;
1573
+ task_name: string;
1574
+ task_outputs: string[];
1575
+ task_state: import("..").FlowTaskState;
1576
+ } | {
1535
1577
  content: string;
1536
1578
  referenceDocument: {
1537
1579
  name: string;
@@ -1773,6 +1815,12 @@ export declare const useSession: (mediator: IMediatorModule) => {
1773
1815
  value: string | ({
1774
1816
  activityType: import("..").ActivityType;
1775
1817
  content: {
1818
+ nodes: Record<string, import("..").IFlowAgentNode>;
1819
+ task_id: number;
1820
+ task_name: string;
1821
+ task_outputs: string[];
1822
+ task_state: import("..").FlowTaskState;
1823
+ } | {
1776
1824
  content: string;
1777
1825
  referenceDocument: {
1778
1826
  name: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blueking/chat-helper",
3
- "version": "0.0.1-beta.30",
3
+ "version": "0.0.1-beta.32",
4
4
  "description": "",
5
5
  "main": "./dist/index.ts.js",
6
6
  "types": "./dist/index.d.ts",