@ray-js/t-agent 0.2.0-beta-17 → 0.2.0-beta.18
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/chat/ChatAgent.js
CHANGED
|
@@ -223,8 +223,9 @@ export default class ChatAgent {
|
|
|
223
223
|
messages.push(m);
|
|
224
224
|
}
|
|
225
225
|
} else if (part.type === 'error') {
|
|
226
|
-
|
|
227
|
-
|
|
226
|
+
const code = part.error.code;
|
|
227
|
+
if (code) {
|
|
228
|
+
message.bubble.setCode(code);
|
|
228
229
|
}
|
|
229
230
|
await message.bubble.setStatus(part.level === 'error' ? BubbleTileStatus.ERROR : BubbleTileStatus.WARNING).setInfo(part.error.message).update();
|
|
230
231
|
} else if (part.type === 'abort') {
|
|
@@ -265,7 +266,11 @@ export default class ChatAgent {
|
|
|
265
266
|
const info = await errorCompose(message, text, error);
|
|
266
267
|
let status = BubbleTileStatus.ERROR;
|
|
267
268
|
if (isAbortError(error)) {
|
|
268
|
-
status = BubbleTileStatus.
|
|
269
|
+
status = BubbleTileStatus.ABORTED;
|
|
270
|
+
}
|
|
271
|
+
const code = error.code;
|
|
272
|
+
if (code) {
|
|
273
|
+
message.bubble.setCode(code);
|
|
269
274
|
}
|
|
270
275
|
await message.set({
|
|
271
276
|
status: ChatMessageStatus.FINISH
|
|
@@ -11,6 +11,8 @@ export default class ChatBubbleTile extends ChatTile<BubbleTileData> {
|
|
|
11
11
|
setStatus(status: BubbleTileStatus): this;
|
|
12
12
|
get info(): string;
|
|
13
13
|
setInfo(info: string): this;
|
|
14
|
+
get code(): string;
|
|
15
|
+
setCode(code: string): this;
|
|
14
16
|
constructor(_message: ChatMessage, data?: BubbleTileData, children?: ChatTile[], id?: string);
|
|
15
17
|
private ensureTextTile;
|
|
16
18
|
/**
|
|
@@ -22,6 +24,7 @@ export default class ChatBubbleTile extends ChatTile<BubbleTileData> {
|
|
|
22
24
|
data: {
|
|
23
25
|
status: BubbleTileStatus;
|
|
24
26
|
info: string;
|
|
27
|
+
code: string;
|
|
25
28
|
};
|
|
26
29
|
id: string;
|
|
27
30
|
type: string;
|
|
@@ -39,6 +39,13 @@ export default class ChatBubbleTile extends ChatTile {
|
|
|
39
39
|
this.data.info = info;
|
|
40
40
|
return this;
|
|
41
41
|
}
|
|
42
|
+
get code() {
|
|
43
|
+
return this.data.code || '';
|
|
44
|
+
}
|
|
45
|
+
setCode(code) {
|
|
46
|
+
this.data.code = code;
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
42
49
|
constructor(_message) {
|
|
43
50
|
let data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
44
51
|
status: BubbleTileStatus.NORMAL
|
|
@@ -115,7 +122,8 @@ export default class ChatBubbleTile extends ChatTile {
|
|
|
115
122
|
return _objectSpread(_objectSpread({}, super.toObject()), {}, {
|
|
116
123
|
data: {
|
|
117
124
|
status: this.status,
|
|
118
|
-
info: this.info
|
|
125
|
+
info: this.info,
|
|
126
|
+
code: this.code
|
|
119
127
|
}
|
|
120
128
|
});
|
|
121
129
|
}
|
package/dist/chat/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ray-js/t-agent",
|
|
3
|
-
"version": "0.2.0-beta
|
|
3
|
+
"version": "0.2.0-beta.18",
|
|
4
4
|
"author": "Tuya.inc",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"build": "ray build --type=component --output dist",
|
|
27
27
|
"clean": "rimraf ./dist"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "3826cdeac61109618670dcbbeafd4103113f04d7"
|
|
30
30
|
}
|