@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.
- package/dist/event/ag-ui.d.ts +1 -1
- package/dist/event/ag-ui.ts.js +21 -2
- package/package.json +1 -1
package/dist/event/ag-ui.d.ts
CHANGED
|
@@ -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:
|
|
134
|
+
onError(error: Error): void;
|
|
135
135
|
onMessage(message: unknown): void;
|
|
136
136
|
onStart(): void;
|
|
137
137
|
}
|
package/dist/event/ag-ui.ts.js
CHANGED
|
@@ -320,12 +320,31 @@ let tempTimestamp = 0;
|
|
|
320
320
|
this.messageModule = message;
|
|
321
321
|
}
|
|
322
322
|
onDone() {
|
|
323
|
-
var
|
|
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
|
|
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 // 回调给上层
|