@ray-js/t-agent 0.2.0-beta-3 → 0.2.0-beta-4
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/StreamRequest.d.ts +14 -0
- package/dist/chat/StreamRequest.js +19 -0
- package/dist/chat/types.d.ts +3 -0
- package/dist/plugins/ui.d.ts +0 -1
- package/dist/plugins/ui.js +1 -10
- package/package.json +2 -2
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { InputBlock, StreamRequestInstance } from './types';
|
|
2
|
+
export default class StreamRequest implements StreamRequestInstance {
|
|
3
|
+
readonly blocks: InputBlock[];
|
|
4
|
+
private aborted;
|
|
5
|
+
constructor(blocks: InputBlock[]);
|
|
6
|
+
sent(): void;
|
|
7
|
+
parts(): void;
|
|
8
|
+
/**
|
|
9
|
+
* Cancel the request stream.
|
|
10
|
+
*
|
|
11
|
+
* @param reason
|
|
12
|
+
*/
|
|
13
|
+
cancel(reason: any): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
export default class StreamRequest {
|
|
3
|
+
constructor(blocks) {
|
|
4
|
+
_defineProperty(this, "aborted", false);
|
|
5
|
+
this.blocks = blocks;
|
|
6
|
+
}
|
|
7
|
+
sent() {}
|
|
8
|
+
parts() {}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Cancel the request stream.
|
|
12
|
+
*
|
|
13
|
+
* @param reason
|
|
14
|
+
*/
|
|
15
|
+
cancel() {
|
|
16
|
+
this.aborted = true;
|
|
17
|
+
throw new Error('cancel() can only be called after parts()');
|
|
18
|
+
}
|
|
19
|
+
}
|
package/dist/chat/types.d.ts
CHANGED
|
@@ -177,6 +177,9 @@ export declare enum FinishReason {
|
|
|
177
177
|
ABORT = "abort",
|
|
178
178
|
ERROR = "error"
|
|
179
179
|
}
|
|
180
|
+
export type StreamRequestInstance = {
|
|
181
|
+
blocks: InputBlock[];
|
|
182
|
+
};
|
|
180
183
|
export type StreamResponseInstance = {
|
|
181
184
|
parts: () => AsyncIterable<MessagePart>;
|
|
182
185
|
cancel: (reason: any) => Promise<void>;
|
package/dist/plugins/ui.d.ts
CHANGED
package/dist/plugins/ui.js
CHANGED
|
@@ -53,19 +53,10 @@ export function withUI() {
|
|
|
53
53
|
result: null
|
|
54
54
|
};
|
|
55
55
|
await hooks.callHook(hookName, context);
|
|
56
|
-
if (context.error) {
|
|
57
|
-
throw context.error;
|
|
58
|
-
}
|
|
59
56
|
return context.result;
|
|
60
57
|
},
|
|
61
58
|
hook: (hookName, fn) => {
|
|
62
|
-
return hooks.hook(hookName,
|
|
63
|
-
try {
|
|
64
|
-
await fn(context);
|
|
65
|
-
} catch (error) {
|
|
66
|
-
context.error = error;
|
|
67
|
-
}
|
|
68
|
-
});
|
|
59
|
+
return hooks.hook(hookName, fn);
|
|
69
60
|
},
|
|
70
61
|
emitter,
|
|
71
62
|
emitEvent,
|
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-4",
|
|
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": "1728f8a1cac6b2ca53e506e06171808fbf38efdc"
|
|
30
30
|
}
|