@ray-js/t-agent-plugin-aistream 0.2.6-beta-4 → 0.2.6-beta-5
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/withAIStream.d.ts +5 -1
- package/dist/withAIStream.js +10 -0
- package/package.json +2 -2
package/dist/withAIStream.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChatAgent, ChatCardObject, ChatMessage, ChatTile, GetChatPluginHandler, InputBlock } from '@ray-js/t-agent';
|
|
1
|
+
import { ChatAgent, ChatCardObject, ChatMessage, ChatMessageStatus, ChatTile, GetChatPluginHandler, InputBlock } from '@ray-js/t-agent';
|
|
2
2
|
import { TTTAction } from './utils';
|
|
3
3
|
import { ConnectClientType, ReceivedTextSkillPacketBody } from './AIStreamTypes';
|
|
4
4
|
import { ChatHistoryStore, StoredMessageObject } from './ChatHistoryStore';
|
|
@@ -42,6 +42,9 @@ export interface AIStreamHooks {
|
|
|
42
42
|
onMessageParse: (msgItem: StoredMessageObject, result: {
|
|
43
43
|
messages: ChatMessage[];
|
|
44
44
|
}) => void;
|
|
45
|
+
onTextCompose: (respMsg: ChatMessage, status: ChatMessageStatus, result: {
|
|
46
|
+
text: string;
|
|
47
|
+
}) => void;
|
|
45
48
|
onSkillCompose: (skill: ReceivedTextSkillPacketBody[], respMsg: ChatMessage, result: {
|
|
46
49
|
messages: ChatMessage[];
|
|
47
50
|
}) => void;
|
|
@@ -78,6 +81,7 @@ export declare function withAIStream(options?: AIStreamOptions): (agent: ChatAge
|
|
|
78
81
|
data: string;
|
|
79
82
|
}>;
|
|
80
83
|
onSkillCompose: (fn: AIStreamHooks['onSkillCompose']) => () => void;
|
|
84
|
+
onTextCompose: (fn: AIStreamHooks['onTextCompose']) => () => void;
|
|
81
85
|
onSkillsEnd: (fn: AIStreamHooks['onSkillsEnd']) => () => void;
|
|
82
86
|
onCardsReceived: (fn: AIStreamHooks['onCardsReceived']) => () => void;
|
|
83
87
|
onTTTAction: (fn: AIStreamHooks['onTTTAction']) => () => void;
|
package/dist/withAIStream.js
CHANGED
|
@@ -354,6 +354,13 @@ export function withAIStream() {
|
|
|
354
354
|
logger.debug('withAIStream chat agent.flushStreamToShow');
|
|
355
355
|
const result = {
|
|
356
356
|
messages: await agent.flushStreamToShow(message, response, {
|
|
357
|
+
textCompose: async (message, text, status) => {
|
|
358
|
+
const result = {
|
|
359
|
+
text
|
|
360
|
+
};
|
|
361
|
+
await hooks.callHook('onTextCompose', message, status, result);
|
|
362
|
+
return result.text;
|
|
363
|
+
},
|
|
357
364
|
attachmentCompose: async (respMsg, part) => {
|
|
358
365
|
const result = {
|
|
359
366
|
messages: []
|
|
@@ -555,6 +562,9 @@ export function withAIStream() {
|
|
|
555
562
|
onSkillCompose: fn => {
|
|
556
563
|
return hooks.hook('onSkillCompose', fn);
|
|
557
564
|
},
|
|
565
|
+
onTextCompose: fn => {
|
|
566
|
+
return hooks.hook('onTextCompose', fn);
|
|
567
|
+
},
|
|
558
568
|
onSkillsEnd,
|
|
559
569
|
onCardsReceived: fn => {
|
|
560
570
|
return hooks.hook('onCardsReceived', fn);
|
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-5",
|
|
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": "60f0d3f33a78b76aae90b22942d9bf64c430e565"
|
|
39
39
|
}
|