@blueking/chat-helper 0.0.1-beta.5 → 0.0.1-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.
@@ -131,7 +131,7 @@ export declare class AGUIProtocol implements ISSEProtocol {
131
131
  handleToolCallStartEvent(event: IToolCallStartEvent): void;
132
132
  injectMessageModule(message: IMessageModule): void;
133
133
  onDone(): void;
134
- onError(error: unknown): void;
134
+ onError(error: Error): void;
135
135
  onMessage(message: unknown): void;
136
136
  onStart(): void;
137
137
  }
@@ -320,12 +320,31 @@ let tempTimestamp = 0;
320
320
  this.messageModule = message;
321
321
  }
322
322
  onDone() {
323
- var _this_onDoneCallback, _this;
323
+ var // 回调给上层
324
+ _this_onDoneCallback, _this;
324
325
  (_this_onDoneCallback = (_this = this).onDoneCallback) === null || _this_onDoneCallback === void 0 ? void 0 : _this_onDoneCallback.call(_this);
326
+ // 处理完成
327
+ const message = this.messageModule.getCurrentLoadingMessage();
328
+ if (message) {
329
+ message.status = MessageStatus.Complete;
330
+ }
325
331
  }
326
332
  onError(error) {
327
- var _this_onErrorCallback, _this;
333
+ var // 回调给上层
334
+ _this_onErrorCallback, _this;
328
335
  (_this_onErrorCallback = (_this = this).onErrorCallback) === null || _this_onErrorCallback === void 0 ? void 0 : _this_onErrorCallback.call(_this, error);
336
+ // 处理错误
337
+ const message = this.messageModule.getCurrentLoadingMessage();
338
+ if (message) {
339
+ message.status = MessageStatus.Error;
340
+ message.content = [
341
+ {
342
+ type: MessageContentType.Text,
343
+ data: error.message,
344
+ status: MessageContentStatus.Error
345
+ }
346
+ ];
347
+ }
329
348
  }
330
349
  onMessage(message) {
331
350
  var // 回调给上层
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blueking/chat-helper",
3
- "version": "0.0.1-beta.5",
3
+ "version": "0.0.1-beta.6",
4
4
  "description": "",
5
5
  "main": "./dist/index.ts.js",
6
6
  "scripts": {