@ray-js/t-agent 0.0.5 → 0.0.6-beta-1
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/README-zh_CN.md +2 -2
- package/README.md +1 -1
- package/dist/chat/ChatAgent.js +3 -1
- package/dist/chat/ChatMessage.d.ts +1 -1
- package/dist/chat/ChatTile.d.ts +1 -0
- package/dist/chat/ChatTile.js +8 -0
- package/dist/chat/createChatAgent.d.ts +2 -2
- package/dist/plugins/ui.js +1 -0
- package/package.json +2 -2
package/README-zh_CN.md
CHANGED
|
@@ -667,7 +667,7 @@ const createAgent = () => {
|
|
|
667
667
|
withUI(), // 一般都需要应用 withUI 插件
|
|
668
668
|
withAssistant({
|
|
669
669
|
channel: 'your-channel-id', // 输入你的智能体ID
|
|
670
|
-
multiModal: false, // 是否开启多模态,默认为
|
|
670
|
+
multiModal: false, // 是否开启多模态,默认为 false
|
|
671
671
|
}),
|
|
672
672
|
withBuildIn()
|
|
673
673
|
);
|
|
@@ -685,7 +685,7 @@ const createAgent = () => {
|
|
|
685
685
|
参数:
|
|
686
686
|
|
|
687
687
|
- `channel` 智能体 ID
|
|
688
|
-
- `multiModal` 是否开启多模态,默认为
|
|
688
|
+
- `multiModal` 是否开启多模态,默认为 false
|
|
689
689
|
- `wireInputToAssistant` 是否将输入块传递给智能体,默认为 true,设置为 false 时,需要你自己编写 onInputBlocksPush Hook 来处理输入块
|
|
690
690
|
- `historySize` 历史消息大小,默认为 100
|
|
691
691
|
|
package/README.md
CHANGED
|
@@ -679,7 +679,7 @@ This plugin facilitates communication with applet AI agent platforms.
|
|
|
679
679
|
Parameters:
|
|
680
680
|
|
|
681
681
|
- `channel`: Agent ID
|
|
682
|
-
- `multiModal`: Enable multi-modal? Defaults to
|
|
682
|
+
- `multiModal`: Enable multi-modal? Defaults to false
|
|
683
683
|
- `wireInputToAssistant`: Should input blocks be passed to the agent? Defaults to true. Set to false if you plan to handle input blocks manually with the onInputBlocksPush Hook.
|
|
684
684
|
- `historySize`: Size of message history, default is 100.
|
|
685
685
|
|
package/dist/chat/ChatAgent.js
CHANGED
|
@@ -192,6 +192,7 @@ export default class ChatAgent {
|
|
|
192
192
|
await this.runWithCatchError(async () => {
|
|
193
193
|
try {
|
|
194
194
|
const parts = response.parts();
|
|
195
|
+
let partText = '';
|
|
195
196
|
var _iteratorAbruptCompletion = false;
|
|
196
197
|
var _didIteratorError = false;
|
|
197
198
|
var _iteratorError;
|
|
@@ -201,6 +202,7 @@ export default class ChatAgent {
|
|
|
201
202
|
{
|
|
202
203
|
message.setMeta(part.meta);
|
|
203
204
|
if (part.type === 'text') {
|
|
205
|
+
partText = part.text;
|
|
204
206
|
text = await textCompose(message, part.text, ChatMessageStatus.UPDATING);
|
|
205
207
|
await message.set({
|
|
206
208
|
status: ChatMessageStatus.UPDATING
|
|
@@ -239,7 +241,7 @@ export default class ChatAgent {
|
|
|
239
241
|
}
|
|
240
242
|
}
|
|
241
243
|
}
|
|
242
|
-
text = await textCompose(message,
|
|
244
|
+
text = await textCompose(message, partText, ChatMessageStatus.FINISH);
|
|
243
245
|
await message.set({
|
|
244
246
|
status: ChatMessageStatus.FINISH
|
|
245
247
|
}).bubble.setText(text).update();
|
|
@@ -19,7 +19,7 @@ export default class ChatMessage implements ChatMessageObject {
|
|
|
19
19
|
update(): Promise<void>;
|
|
20
20
|
remove(): Promise<void>;
|
|
21
21
|
_setIsShow(): void;
|
|
22
|
-
persist(payload
|
|
22
|
+
persist(payload?: any): Promise<void>;
|
|
23
23
|
setTilesLocked(locked: boolean): this;
|
|
24
24
|
removeTile(tile: ChatTile): void;
|
|
25
25
|
addTile(type: string, data: any, id?: string): ChatTile<any>;
|
package/dist/chat/ChatTile.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export default class ChatTile<T = any> implements ChatTileObject<T> {
|
|
|
11
11
|
constructor(message: ChatMessage, type: string, data?: T, children?: ChatTile[], id?: string);
|
|
12
12
|
setLocked(value: boolean): this;
|
|
13
13
|
addTile(type: string, data: any, id?: string): ChatTile<any>;
|
|
14
|
+
removeTile(tile: ChatTile): this;
|
|
14
15
|
/**
|
|
15
16
|
* 同 message 的 show
|
|
16
17
|
*/
|
package/dist/chat/ChatTile.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
+
import "core-js/modules/esnext.iterator.constructor.js";
|
|
3
4
|
import "core-js/modules/esnext.iterator.map.js";
|
|
4
5
|
import "core-js/modules/web.dom-collections.iterator.js";
|
|
5
6
|
import { generateId } from './utils';
|
|
@@ -29,6 +30,13 @@ export default class ChatTile {
|
|
|
29
30
|
this.children.push(tile);
|
|
30
31
|
return tile;
|
|
31
32
|
}
|
|
33
|
+
removeTile(tile) {
|
|
34
|
+
const index = this.children.indexOf(tile);
|
|
35
|
+
if (index !== -1) {
|
|
36
|
+
this.children.splice(index, 1);
|
|
37
|
+
}
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
32
40
|
|
|
33
41
|
/**
|
|
34
42
|
* 同 message 的 show
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChatAgentPlugin } from './types';
|
|
2
2
|
import ChatAgent from './ChatAgent';
|
|
3
|
-
type ExtractPluginReturnType<T extends ChatAgentPlugin<any>[]> = T extends [infer F, ...infer R] ? F extends ChatAgentPlugin<infer U> ? R extends ChatAgentPlugin<any>[] ? U & ExtractPluginReturnType<R> : U :
|
|
4
|
-
export declare function createChatAgent<T extends ChatAgentPlugin<any>[]>(...plugins: T): ChatAgent<
|
|
3
|
+
type ExtractPluginReturnType<T extends ChatAgentPlugin<any>[]> = T extends [infer F, ...infer R] ? F extends ChatAgentPlugin<infer U> ? R extends ChatAgentPlugin<any>[] ? U & ExtractPluginReturnType<R> : U : any : Record<string, unknown>;
|
|
4
|
+
export declare function createChatAgent<T extends ChatAgentPlugin<any>[]>(...plugins: T): ChatAgent<ExtractPluginReturnType<T>>;
|
|
5
5
|
export declare function applyChatAgentPlugins<T extends Record<string, unknown>, P extends ChatAgentPlugin<any>[]>(agent: ChatAgent<T>, ...plugins: P): ChatAgent<T & ExtractPluginReturnType<P>>;
|
|
6
6
|
export {};
|
package/dist/plugins/ui.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ray-js/t-agent",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6-beta-1",
|
|
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": "942a1aeceb65c55ba935409d386bc09f9874e283"
|
|
30
30
|
}
|