@ray-js/t-agent 0.0.8-beta-2 → 0.0.8
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 +43 -3
- package/README.md +46 -6
- package/dist/chat/types.d.ts +1 -0
- package/package.json +2 -2
package/README-zh_CN.md
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
[English](./README.md) | 简体中文
|
|
2
|
-
|
|
3
1
|
# AI 智能体 SDK
|
|
4
2
|
|
|
5
3
|
## 安装(ray 小程序)
|
|
@@ -1175,7 +1173,7 @@ const MyTilePart = () => {
|
|
|
1175
1173
|
|
|
1176
1174
|
### 替换或新增 tile
|
|
1177
1175
|
|
|
1178
|
-
如果你需要将某个 tile 替换成自己的实现,或者新增一个 tile
|
|
1176
|
+
如果你需要将某个 tile 替换成自己的实现,或者新增一个 tile,可以覆写 `renderTileAs`,例如:
|
|
1179
1177
|
|
|
1180
1178
|
```tsx
|
|
1181
1179
|
import { ImageTileData } from '@ray-js/t-agent';
|
|
@@ -1348,3 +1346,45 @@ const renderOptions = {
|
|
|
1348
1346
|
- `video:upload` 视频上传
|
|
1349
1347
|
- `videoThumb:view` 视频缩略图查看
|
|
1350
1348
|
- `videoThumb:upload` 视频缩略图上传
|
|
1349
|
+
|
|
1350
|
+
### 自定义多语言
|
|
1351
|
+
|
|
1352
|
+
如果你需要自定义 t-agent 里的多语言,可以覆写 `i18nTranslate` 函数,例如:
|
|
1353
|
+
|
|
1354
|
+
```tsx
|
|
1355
|
+
import { defaultRenderOptions } from '@ray-js/t-agent-ui-ray';
|
|
1356
|
+
|
|
1357
|
+
const renderOptions = {
|
|
1358
|
+
...defaultRenderOptions,
|
|
1359
|
+
i18nTranslate: (key: string) => {
|
|
1360
|
+
if (key === 'hello') {
|
|
1361
|
+
return '你好';
|
|
1362
|
+
}
|
|
1363
|
+
// 使用默认的多语言
|
|
1364
|
+
return I18n.t(key);
|
|
1365
|
+
},
|
|
1366
|
+
};
|
|
1367
|
+
```
|
|
1368
|
+
|
|
1369
|
+
以下是内置的多语言 key:
|
|
1370
|
+
|
|
1371
|
+
| key | 使用场景 | 含义 |
|
|
1372
|
+
| -------------------------------------------------- | ------------------------- | -------------------- |
|
|
1373
|
+
| t-agent.build-in.button.create_scene_manually | ButtonTile 内置按钮 | 手动创建场景 |
|
|
1374
|
+
| t-agent.build-in.button.enter_home_manage | ButtonTile 内置按钮 | 进入“家庭管理” |
|
|
1375
|
+
| t-agent.build-in.button.enter_room_manage | ButtonTile 内置按钮 | 进入“房间管理” |
|
|
1376
|
+
| t-agent.build-in.button.enter_alarm_message | ButtonTile 内置按钮 | 进入“告警消息列表” |
|
|
1377
|
+
| t-agent.build-in.button.enter_home_message | ButtonTile 内置按钮 | 进入“家庭消息列表” |
|
|
1378
|
+
| t-agent.build-in.button.enter_bulletin | ButtonTile 内置按钮 | 进入“通知消息列表” |
|
|
1379
|
+
| t-agent.build-in.button.enter_notification_setting | ButtonTile 内置按钮 | 进入“消息推送设置” |
|
|
1380
|
+
| t-agent.build-in.button.enter_personal_information | ButtonTile 内置按钮 | 进入“个人资料” |
|
|
1381
|
+
| t-agent.build-in.button.enter_account_security | ButtonTile 内置按钮 | 进入“账号与安全” |
|
|
1382
|
+
| t-agent.build-in.button.enter_setting | ButtonTile 内置按钮 | 进入“通用设置” |
|
|
1383
|
+
| t-agent.build-in.button.enter_paring | ButtonTile 内置按钮 | 进入“设备配网” |
|
|
1384
|
+
| t-agent.build-in.button.enter_share_device | ButtonTile 内置按钮 | 进入“设备分享” |
|
|
1385
|
+
| t-agent.build-in.button.enter_faq_feedback | ButtonTile 内置按钮 | 进入“常见问题与反馈” |
|
|
1386
|
+
| t-agent.build-in.button.questionnaire_take | ButtonTile 内置按钮 | 填写问卷 |
|
|
1387
|
+
| t-agent.build-in.button.set_home_location | ButtonTile 内置按钮 | 设置家庭位置 |
|
|
1388
|
+
| t-agent.input.voice.require-permission | MessageInput 切换语音输入 | 需要授权录音权限 |
|
|
1389
|
+
| t-agent.input.upload.failed | MessageInput 上传文件 | 文件上传失败 |
|
|
1390
|
+
| t-agent.message.feedback.success | BubbleTile 消息评价 | 反馈成功 |
|
package/README.md
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
English | [简体中文](./README-zh_CN.md)
|
|
2
|
-
|
|
3
1
|
# AI Intelligent Agent SDK
|
|
4
2
|
|
|
5
3
|
## Installation (ray mini-program)
|
|
@@ -84,7 +82,7 @@ const createAgent = () => {
|
|
|
84
82
|
hello.bubble.setText('Hello, world!');
|
|
85
83
|
result.messages.push(hello);
|
|
86
84
|
// Persist message for display upon next entry
|
|
87
|
-
await hello.persist(
|
|
85
|
+
await hello.persist();
|
|
88
86
|
});
|
|
89
87
|
|
|
90
88
|
// Message upon chat resume
|
|
@@ -661,7 +659,7 @@ const createAgent = () => {
|
|
|
661
659
|
withUI(), // Typically, the withUI plugin is necessary
|
|
662
660
|
withAssistant({
|
|
663
661
|
channel: 'your-channel-id', // Provide your agent ID
|
|
664
|
-
multiModal: false, // Enable multi-modal? Defaults to
|
|
662
|
+
multiModal: false, // Enable multi-modal? Defaults to false
|
|
665
663
|
}),
|
|
666
664
|
withBuildIn()
|
|
667
665
|
);
|
|
@@ -733,7 +731,7 @@ mock.hooks.hook('sendToAssistant', context => {
|
|
|
733
731
|
context.responseText = 'Hello, who are you?';
|
|
734
732
|
}
|
|
735
733
|
|
|
736
|
-
if (context.options.block?.includes('
|
|
734
|
+
if (context.options.block?.includes('card')) {
|
|
737
735
|
context.responseText = 'This is a card example';
|
|
738
736
|
context.responseExtensions = {
|
|
739
737
|
aiCards: [
|
|
@@ -751,7 +749,7 @@ mock.hooks.hook('sendToAssistant', context => {
|
|
|
751
749
|
};
|
|
752
750
|
}
|
|
753
751
|
|
|
754
|
-
if (context.options.block?.includes('
|
|
752
|
+
if (context.options.block?.includes('workflow')) {
|
|
755
753
|
context.responseText = 'This is a workflow';
|
|
756
754
|
context.responseExtensions = {
|
|
757
755
|
workflowAskOptions: {
|
|
@@ -1343,3 +1341,45 @@ The built-in `scene` includes the following:
|
|
|
1343
1341
|
- `video:upload` Video uploading
|
|
1344
1342
|
- `videoThumb:view` Video thumbnail viewing
|
|
1345
1343
|
- `videoThumb:upload` Video thumbnail uploading
|
|
1344
|
+
|
|
1345
|
+
### Custom Multilingual Support
|
|
1346
|
+
|
|
1347
|
+
If you need to customize multilingual support, you can override the `i18nTranslate` function, for example:
|
|
1348
|
+
|
|
1349
|
+
```tsx
|
|
1350
|
+
import { defaultRenderOptions } from '@ray-js/t-agent-ui-ray';
|
|
1351
|
+
|
|
1352
|
+
const renderOptions = {
|
|
1353
|
+
...defaultRenderOptions,
|
|
1354
|
+
i18nTranslate: (key: string) => {
|
|
1355
|
+
if (key === 'hello') {
|
|
1356
|
+
return 'Bonjour';
|
|
1357
|
+
}
|
|
1358
|
+
// Use default multilingual settings
|
|
1359
|
+
return I18n.t(key);
|
|
1360
|
+
},
|
|
1361
|
+
};
|
|
1362
|
+
```
|
|
1363
|
+
|
|
1364
|
+
Below are the built-in multilingual keys:
|
|
1365
|
+
|
|
1366
|
+
| key | Usage Context | Meaning |
|
|
1367
|
+
| -------------------------------------------------- | ---------------------------------- | ---------------------------------- |
|
|
1368
|
+
| t-agent.build-in.button.create_scene_manually | Built-in ButtonTile button | Manually create scene |
|
|
1369
|
+
| t-agent.build-in.button.enter_home_manage | Built-in ButtonTile button | Enter _"Home Management"_ |
|
|
1370
|
+
| t-agent.build-in.button.enter_room_manage | Built-in ButtonTile button | Enter _"Room Management"_ |
|
|
1371
|
+
| t-agent.build-in.button.enter_alarm_message | Built-in ButtonTile button | Enter _"Alarm Message List"_ |
|
|
1372
|
+
| t-agent.build-in.button.enter_home_message | Built-in ButtonTile button | Enter _"Home Message List"_ |
|
|
1373
|
+
| t-agent.build-in.button.enter_bulletin | Built-in ButtonTile button | Enter _"Bulletin Message List"_ |
|
|
1374
|
+
| t-agent.build-in.button.enter_notification_setting | Built-in ButtonTile button | Enter _"Notification Settings"_ |
|
|
1375
|
+
| t-agent.build-in.button.enter_personal_information | Built-in ButtonTile button | Enter _"Personal Information"_ |
|
|
1376
|
+
| t-agent.build-in.button.enter_account_security | Built-in ButtonTile button | Enter _"Account and Security"_ |
|
|
1377
|
+
| t-agent.build-in.button.enter_setting | Built-in ButtonTile button | Enter _"General Settings"_ |
|
|
1378
|
+
| t-agent.build-in.button.enter_paring | Built-in ButtonTile button | Enter _"Device Pairing"_ |
|
|
1379
|
+
| t-agent.build-in.button.enter_share_device | Built-in ButtonTile button | Enter _"Share Device"_ |
|
|
1380
|
+
| t-agent.build-in.button.enter_faq_feedback | Built-in ButtonTile button | Enter _"FAQs and Feedback"_ |
|
|
1381
|
+
| t-agent.build-in.button.questionnaire_take | Built-in ButtonTile button | Take the questionnaire |
|
|
1382
|
+
| t-agent.build-in.button.set_home_location | Built-in ButtonTile button | Set home location |
|
|
1383
|
+
| t-agent.input.voice.require-permission | MessageInput switch to voice input | Need to grant recording permission |
|
|
1384
|
+
| t-agent.input.upload.failed | MessageInput file upload | File upload failed |
|
|
1385
|
+
| t-agent.message.feedback.success | BubbleTile message feedback | Feedback successful |
|
package/dist/chat/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ray-js/t-agent",
|
|
3
|
-
"version": "0.0.8
|
|
3
|
+
"version": "0.0.8",
|
|
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": "686e9d17bd1a96074d3ac16ac2a3d73e1aa17f8f"
|
|
30
30
|
}
|