@ray-js/t-agent-plugin-aistream 0.2.6-beta-3 → 0.2.6-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.
|
@@ -272,7 +272,8 @@ mock.hooks.hook('sendEventEnd', async context => {
|
|
|
272
272
|
}
|
|
273
273
|
const ctx = {
|
|
274
274
|
data: event.data,
|
|
275
|
-
responseText: ''
|
|
275
|
+
responseText: '',
|
|
276
|
+
wordDelayMs: 100
|
|
276
277
|
};
|
|
277
278
|
const [error] = await tryCatch(() => mock.hooks.callHook('sendToAIStream', ctx));
|
|
278
279
|
if (error) {
|
|
@@ -297,6 +298,7 @@ mock.hooks.hook('sendEventEnd', async context => {
|
|
|
297
298
|
return;
|
|
298
299
|
}
|
|
299
300
|
const text = ctx.responseText || '⚠️ No mock text response matched!';
|
|
301
|
+
const wordDelayMs = ctx.wordDelayMs || 100;
|
|
300
302
|
const words = splitString(text);
|
|
301
303
|
if (event.controller.signal.aborted || session.closed) {
|
|
302
304
|
return;
|
|
@@ -309,7 +311,7 @@ mock.hooks.hook('sendEventEnd', async context => {
|
|
|
309
311
|
const bizId = generateId();
|
|
310
312
|
event.replyText(StreamFlag.START);
|
|
311
313
|
for (const word of words) {
|
|
312
|
-
await mock.sleep(
|
|
314
|
+
await mock.sleep(wordDelayMs);
|
|
313
315
|
if (event.controller.signal.aborted || session.closed) {
|
|
314
316
|
return;
|
|
315
317
|
}
|
package/dist/utils/mock.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ray-js/t-agent-plugin-aistream",
|
|
3
|
-
"version": "0.2.6-beta-
|
|
3
|
+
"version": "0.2.6-beta-4",
|
|
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": "c1afc79e00950e8eb385ec233f74e1677a9c93cf"
|
|
39
39
|
}
|