@blueking/chat-helper 0.0.1-beta.27 → 0.0.1-beta.28

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.
@@ -89,6 +89,10 @@ export declare class AGUIProtocol implements ISSEProtocol {
89
89
  * 处理步骤开始事件
90
90
  */
91
91
  handleStepStartedEvent(_event: IStepStartedEvent): void;
92
+ /**
93
+ * 自定义事件 处理临时消息,转换为 AI 文本消息
94
+ */
95
+ handleTempMessageCustomEvent(event: ICustomEvent): void;
92
96
  /**
93
97
  * 处理文本消息块事件
94
98
  */
@@ -69,6 +69,9 @@ import { CustomEventName, EventType } from './type.ts.js';
69
69
  case CustomEventName.KnowledgeRagEnd:
70
70
  this.handleKnowledgeRagEndCustomEvent(event);
71
71
  break;
72
+ case CustomEventName.TempMessage:
73
+ this.handleTempMessageCustomEvent(event);
74
+ break;
72
75
  default:
73
76
  break;
74
77
  }
@@ -186,6 +189,16 @@ import { CustomEventName, EventType } from './type.ts.js';
186
189
  // console.log('StepStarted:', _event);
187
190
  }
188
191
  /**
192
+ * 自定义事件 处理临时消息,转换为 AI 文本消息
193
+ */ handleTempMessageCustomEvent(event) {
194
+ const value = event.value;
195
+ this.messageModule.plusMessage({
196
+ role: MessageRole.Assistant,
197
+ content: value.message,
198
+ status: value.status
199
+ });
200
+ }
201
+ /**
189
202
  * 处理文本消息块事件
190
203
  */ handleTextMessageChunkEvent(event) {
191
204
  const message = this.messageModule.getCurrentLoadingMessage();
@@ -1,10 +1,11 @@
1
- import { type IMessageApi, type MessageRole } from '../message/type';
1
+ import { type IMessageApi, type MessageRole, type MessageStatus } from '../message/type';
2
2
  export declare enum CustomEventName {
3
3
  KnowledgeRagEnd = "knowledge_rag_end",
4
4
  KnowledgeRagResult = "knowledge_rag_result",
5
5
  KnowledgeRagStart = "knowledge_rag_start",
6
6
  KnowledgeRagTextContent = "knowledge_rag_text_content",
7
- ReferenceDocument = "reference_document"
7
+ ReferenceDocument = "reference_document",
8
+ TempMessage = "temp_message"
8
9
  }
9
10
  export declare enum EventType {
10
11
  ActivityDelta = "ACTIVITY_DELTA",
@@ -70,7 +71,7 @@ export interface IBaseEvent {
70
71
  export interface ICustomEvent extends IBaseEvent {
71
72
  name: CustomEventName;
72
73
  type: EventType.Custom;
73
- value: IKnowledgeRagResultCustomValue | IKnowledgeRagTextContentCustomValue | IReferenceDocumentCustomValue;
74
+ value: IKnowledgeRagResultCustomValue | IKnowledgeRagTextContentCustomValue | IReferenceDocumentCustomValue | ITempMessageCustomValue;
74
75
  }
75
76
  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;
76
77
  export type IKnowledgeRagResultCustomValue = IReferenceDocumentCustomValue;
@@ -98,6 +99,10 @@ export interface IRawEvent extends IBaseEvent {
98
99
  source?: string;
99
100
  type: EventType.Raw;
100
101
  }
102
+ export interface ITempMessageCustomValue {
103
+ message: string;
104
+ status: MessageStatus;
105
+ }
101
106
  export type IReferenceDocumentCustomValue = {
102
107
  name: string;
103
108
  originFileUrl?: string;
@@ -29,6 +29,7 @@
29
29
  CustomEventName["KnowledgeRagStart"] = "knowledge_rag_start";
30
30
  CustomEventName["KnowledgeRagTextContent"] = "knowledge_rag_text_content";
31
31
  CustomEventName["ReferenceDocument"] = "reference_document";
32
+ CustomEventName["TempMessage"] = "temp_message";
32
33
  })(CustomEventName || (CustomEventName = {}));
33
34
  export var EventType;
34
35
  (function(EventType) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blueking/chat-helper",
3
- "version": "0.0.1-beta.27",
3
+ "version": "0.0.1-beta.28",
4
4
  "description": "",
5
5
  "main": "./dist/index.ts.js",
6
6
  "types": "./dist/index.d.ts",
@@ -25,4 +25,4 @@
25
25
  "typescript": "^5.5.4",
26
26
  "vue-tsc": "^3.1.4"
27
27
  }
28
- }
28
+ }