@ray-js/t-agent-plugin-aistream 0.2.0-beta-7 → 0.2.0-beta-9
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.
|
@@ -23,7 +23,8 @@ export class AIStreamSessionError extends Error {
|
|
|
23
23
|
export function sendBlocksToAIStream(params) {
|
|
24
24
|
const {
|
|
25
25
|
session,
|
|
26
|
-
blocks
|
|
26
|
+
blocks,
|
|
27
|
+
signal
|
|
27
28
|
} = params;
|
|
28
29
|
let audioEmitter = null;
|
|
29
30
|
let amplitudeCount = 0;
|
|
@@ -64,6 +65,11 @@ export function sendBlocksToAIStream(params) {
|
|
|
64
65
|
value: JSON.stringify(attribute)
|
|
65
66
|
}]
|
|
66
67
|
}));
|
|
68
|
+
if (signal !== null && signal !== void 0 && signal.aborted) {
|
|
69
|
+
canceled = true;
|
|
70
|
+
controller.close();
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
67
73
|
if (error) {
|
|
68
74
|
controller.error(error);
|
|
69
75
|
closed = true;
|
package/dist/withAIStream.d.ts
CHANGED
|
@@ -16,8 +16,6 @@ export interface AIStreamOptions {
|
|
|
16
16
|
};
|
|
17
17
|
/** 历史消息数量,默认1000,为0的话,则已分页的方式取全部数据 */
|
|
18
18
|
historySize?: number;
|
|
19
|
-
/** 是否支持多模态 */
|
|
20
|
-
multiModal?: boolean;
|
|
21
19
|
/** 是否将输入块传递给智能体,默认为 true,设置为 false 时,需要你自己编写 onInputBlocksPush Hook 来处理输入块 */
|
|
22
20
|
wireInput?: boolean;
|
|
23
21
|
/** 索引ID,如果传了 createChatHistoryStore,则会覆盖 */
|
package/dist/withAIStream.js
CHANGED
|
@@ -30,7 +30,6 @@ export function withAIStream() {
|
|
|
30
30
|
onAgentDispose,
|
|
31
31
|
onTileEvent
|
|
32
32
|
} = agent;
|
|
33
|
-
agent.session.initValue('multiModal', options.multiModal);
|
|
34
33
|
const ui = agent.plugins.ui;
|
|
35
34
|
onAgentStart(async () => {
|
|
36
35
|
/**
|
|
@@ -197,6 +196,7 @@ export function withAIStream() {
|
|
|
197
196
|
const result = sendBlocksToAIStream({
|
|
198
197
|
blocks,
|
|
199
198
|
session: streamSession,
|
|
199
|
+
signal,
|
|
200
200
|
attribute: _objectSpread({}, extraOptions)
|
|
201
201
|
});
|
|
202
202
|
signal === null || signal === void 0 || signal.addEventListener('abort', event => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ray-js/t-agent-plugin-aistream",
|
|
3
|
-
"version": "0.2.0-beta-
|
|
3
|
+
"version": "0.2.0-beta-9",
|
|
4
4
|
"author": "Tuya.inc",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/url-parse": "^1.4.11"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "cfe00de066a09da4a63e7c965d42a622f95cda4c"
|
|
39
39
|
}
|