@ray-js/t-agent-ui-ray 0.2.8-beta.7 → 0.2.8-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.
- package/dist/i18n/strings.d.ts +16 -0
- package/dist/i18n/strings.js +16 -0
- package/dist/tiles/BubbleToolTile/index.js +27 -5
- package/dist/types.d.ts +1 -1
- package/package.json +2 -2
package/dist/i18n/strings.d.ts
CHANGED
|
@@ -95,6 +95,8 @@ declare const _default: {
|
|
|
95
95
|
't-agent.error.stream-exists': string;
|
|
96
96
|
't-agent.error.timeout': string;
|
|
97
97
|
't-agent.error.asr-empty': string;
|
|
98
|
+
't-agent.error.audio-packet-invalid': string;
|
|
99
|
+
't-agent.error.audio-not-found': string;
|
|
98
100
|
't-agent.message.delete.button': string;
|
|
99
101
|
};
|
|
100
102
|
'zh-Hant': {
|
|
@@ -193,6 +195,8 @@ declare const _default: {
|
|
|
193
195
|
't-agent.error.stream-exists': string;
|
|
194
196
|
't-agent.error.timeout': string;
|
|
195
197
|
't-agent.error.asr-empty': string;
|
|
198
|
+
't-agent.error.audio-packet-invalid': string;
|
|
199
|
+
't-agent.error.audio-not-found': string;
|
|
196
200
|
't-agent.message.delete.button': string;
|
|
197
201
|
};
|
|
198
202
|
en: {
|
|
@@ -291,6 +295,8 @@ declare const _default: {
|
|
|
291
295
|
't-agent.error.stream-exists': string;
|
|
292
296
|
't-agent.error.timeout': string;
|
|
293
297
|
't-agent.error.asr-empty': string;
|
|
298
|
+
't-agent.error.audio-packet-invalid': string;
|
|
299
|
+
't-agent.error.audio-not-found': string;
|
|
294
300
|
't-agent.message.delete.button': string;
|
|
295
301
|
};
|
|
296
302
|
ja: {
|
|
@@ -389,6 +395,8 @@ declare const _default: {
|
|
|
389
395
|
't-agent.error.stream-exists': string;
|
|
390
396
|
't-agent.error.timeout': string;
|
|
391
397
|
't-agent.error.asr-empty': string;
|
|
398
|
+
't-agent.error.audio-packet-invalid': string;
|
|
399
|
+
't-agent.error.audio-not-found': string;
|
|
392
400
|
't-agent.message.delete.button': string;
|
|
393
401
|
};
|
|
394
402
|
de: {
|
|
@@ -487,6 +495,8 @@ declare const _default: {
|
|
|
487
495
|
't-agent.error.stream-exists': string;
|
|
488
496
|
't-agent.error.timeout': string;
|
|
489
497
|
't-agent.error.asr-empty': string;
|
|
498
|
+
't-agent.error.audio-packet-invalid': string;
|
|
499
|
+
't-agent.error.audio-not-found': string;
|
|
490
500
|
't-agent.message.clear-history.button': string;
|
|
491
501
|
};
|
|
492
502
|
fr: {
|
|
@@ -585,6 +595,8 @@ declare const _default: {
|
|
|
585
595
|
't-agent.error.stream-exists': string;
|
|
586
596
|
't-agent.error.timeout': string;
|
|
587
597
|
't-agent.error.asr-empty': string;
|
|
598
|
+
't-agent.error.audio-packet-invalid': string;
|
|
599
|
+
't-agent.error.audio-not-found': string;
|
|
588
600
|
't-agent.message.clear-history.button': string;
|
|
589
601
|
};
|
|
590
602
|
es: {
|
|
@@ -683,6 +695,8 @@ declare const _default: {
|
|
|
683
695
|
't-agent.error.stream-exists': string;
|
|
684
696
|
't-agent.error.timeout': string;
|
|
685
697
|
't-agent.error.asr-empty': string;
|
|
698
|
+
't-agent.error.audio-packet-invalid': string;
|
|
699
|
+
't-agent.error.audio-not-found': string;
|
|
686
700
|
't-agent.message.clear-history.button': string;
|
|
687
701
|
};
|
|
688
702
|
it: {
|
|
@@ -781,6 +795,8 @@ declare const _default: {
|
|
|
781
795
|
't-agent.error.stream-exists': string;
|
|
782
796
|
't-agent.error.timeout': string;
|
|
783
797
|
't-agent.error.asr-empty': string;
|
|
798
|
+
't-agent.error.audio-packet-invalid': string;
|
|
799
|
+
't-agent.error.audio-not-found': string;
|
|
784
800
|
't-agent.message.clear-history.button': string;
|
|
785
801
|
};
|
|
786
802
|
};
|
package/dist/i18n/strings.js
CHANGED
|
@@ -96,6 +96,8 @@ export default {
|
|
|
96
96
|
't-agent.error.stream-exists': '消息发送异常,请稍后再试',
|
|
97
97
|
't-agent.error.timeout': '发送超时',
|
|
98
98
|
't-agent.error.asr-empty': '语音识别结果为空',
|
|
99
|
+
't-agent.error.audio-packet-invalid': '暂不支持该文本的朗读',
|
|
100
|
+
't-agent.error.audio-not-found': '语音已过期',
|
|
99
101
|
't-agent.message.delete.button': '删除消息'
|
|
100
102
|
},
|
|
101
103
|
'zh-Hant': {
|
|
@@ -194,6 +196,8 @@ export default {
|
|
|
194
196
|
't-agent.error.stream-exists': '消息發送異常,請稍後再試',
|
|
195
197
|
't-agent.error.timeout': '發送超時',
|
|
196
198
|
't-agent.error.asr-empty': '語音識別結果為空',
|
|
199
|
+
't-agent.error.audio-packet-invalid': '暫不支持該文本的朗讀',
|
|
200
|
+
't-agent.error.audio-not-found': '語音已過期',
|
|
197
201
|
't-agent.message.delete.button': '刪除消息'
|
|
198
202
|
},
|
|
199
203
|
en: {
|
|
@@ -292,6 +296,8 @@ export default {
|
|
|
292
296
|
't-agent.error.stream-exists': 'Message sending exception, please try again later',
|
|
293
297
|
't-agent.error.timeout': 'Sending timeout',
|
|
294
298
|
't-agent.error.asr-empty': 'Voice recognition result is empty',
|
|
299
|
+
't-agent.error.audio-packet-invalid': 'Reading this text aloud is not supported yet',
|
|
300
|
+
't-agent.error.audio-not-found': 'Audio has expired',
|
|
295
301
|
't-agent.message.delete.button': 'Delete Message'
|
|
296
302
|
},
|
|
297
303
|
ja: {
|
|
@@ -390,6 +396,8 @@ export default {
|
|
|
390
396
|
't-agent.error.stream-exists': 'メッセージ送信例外、後でもう一度お試しください',
|
|
391
397
|
't-agent.error.timeout': '送信タイムアウト',
|
|
392
398
|
't-agent.error.asr-empty': '音声認識結果が空です',
|
|
399
|
+
't-agent.error.audio-packet-invalid': 'このテキストの読み上げには対応していません',
|
|
400
|
+
't-agent.error.audio-not-found': '音声の有効期限が切れました',
|
|
393
401
|
't-agent.message.delete.button': 'メッセージを削除'
|
|
394
402
|
},
|
|
395
403
|
de: {
|
|
@@ -488,6 +496,8 @@ export default {
|
|
|
488
496
|
't-agent.error.stream-exists': 'Nachrichtensendeausnahme, bitte später erneut versuchen',
|
|
489
497
|
't-agent.error.timeout': 'Sendetimeout',
|
|
490
498
|
't-agent.error.asr-empty': 'Spracherkennungsergebnis ist leer',
|
|
499
|
+
't-agent.error.audio-packet-invalid': 'Das Vorlesen dieses Textes wird noch nicht unterstützt',
|
|
500
|
+
't-agent.error.audio-not-found': 'Audio ist abgelaufen',
|
|
491
501
|
't-agent.message.clear-history.button': 'Verlauf löschen'
|
|
492
502
|
},
|
|
493
503
|
fr: {
|
|
@@ -586,6 +596,8 @@ export default {
|
|
|
586
596
|
't-agent.error.stream-exists': "Exception d'envoi de message, veuillez réessayer plus tard",
|
|
587
597
|
't-agent.error.timeout': "Délai d'envoi dépassé",
|
|
588
598
|
't-agent.error.asr-empty': 'Le résultat de la reconnaissance vocale est vide',
|
|
599
|
+
't-agent.error.audio-packet-invalid': "La lecture à voix haute de ce texte n'est pas encore prise en charge",
|
|
600
|
+
't-agent.error.audio-not-found': "L'audio a expiré",
|
|
589
601
|
't-agent.message.clear-history.button': "Effacer l'historique"
|
|
590
602
|
},
|
|
591
603
|
es: {
|
|
@@ -684,6 +696,8 @@ export default {
|
|
|
684
696
|
't-agent.error.stream-exists': 'Excepción al enviar mensaje, por favor intenta más tarde',
|
|
685
697
|
't-agent.error.timeout': 'Tiempo de envío agotado',
|
|
686
698
|
't-agent.error.asr-empty': 'El resultado del reconocimiento de voz está vacío',
|
|
699
|
+
't-agent.error.audio-packet-invalid': 'La lectura en voz alta de este texto aún no es compatible',
|
|
700
|
+
't-agent.error.audio-not-found': 'El audio ha caducado',
|
|
687
701
|
't-agent.message.clear-history.button': 'Borrar historial'
|
|
688
702
|
},
|
|
689
703
|
it: {
|
|
@@ -782,6 +796,8 @@ export default {
|
|
|
782
796
|
't-agent.error.stream-exists': "Eccezione nell'invio del messaggio, riprova più tardi",
|
|
783
797
|
't-agent.error.timeout': 'Timeout di invio',
|
|
784
798
|
't-agent.error.asr-empty': 'Il risultato del riconoscimento vocale è vuoto',
|
|
799
|
+
't-agent.error.audio-packet-invalid': 'La lettura ad alta voce di questo testo non è ancora supportata',
|
|
800
|
+
't-agent.error.audio-not-found': "L'audio è scaduto",
|
|
785
801
|
't-agent.message.clear-history.button': 'Cancella cronologia'
|
|
786
802
|
}
|
|
787
803
|
};
|
|
@@ -4,6 +4,8 @@ import { View } from '@ray-js/components';
|
|
|
4
4
|
import './index.less';
|
|
5
5
|
import { useAgentSessionValue, useTranslate } from '../../hooks';
|
|
6
6
|
import { getMessageContent } from '../../utils';
|
|
7
|
+
import { AIStreamAppErrorCode } from '@ray-js/t-agent-plugin-aistream';
|
|
8
|
+
import logger from '../../logger';
|
|
7
9
|
const BubbleToolTile = props => {
|
|
8
10
|
const {
|
|
9
11
|
message,
|
|
@@ -16,11 +18,11 @@ const BubbleToolTile = props => {
|
|
|
16
18
|
const [audioPlaying] = useAgentSessionValue('AIStream.audioPlaying');
|
|
17
19
|
const [playingMessageId] = useAgentSessionValue('AIStream.playingMessageId');
|
|
18
20
|
const playing = !!audioPlaying && playingMessageId === message.id;
|
|
21
|
+
const t = useTranslate();
|
|
19
22
|
|
|
20
23
|
// UI 只负责发指令
|
|
21
24
|
|
|
22
25
|
const show = message.role === 'assistant' && isLatestMessage;
|
|
23
|
-
const t = useTranslate();
|
|
24
26
|
useEffect(() => {
|
|
25
27
|
if (!show) {
|
|
26
28
|
notifyHeightChanged();
|
|
@@ -38,10 +40,30 @@ const BubbleToolTile = props => {
|
|
|
38
40
|
}, /*#__PURE__*/React.createElement(View, {
|
|
39
41
|
className: "t-agent-bubble-tool-tile-button ".concat(playing ? 't-agent-bubble-tool-tile-play-active' : 't-agent-bubble-tool-tile-play'),
|
|
40
42
|
"data-testid": "t-agent-bubble-tool-tile-play",
|
|
41
|
-
onClick: () => {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
onClick: async () => {
|
|
44
|
+
try {
|
|
45
|
+
await props.emitTileEvent({
|
|
46
|
+
action: 'toggle'
|
|
47
|
+
});
|
|
48
|
+
} catch (e) {
|
|
49
|
+
if (e && e.code) {
|
|
50
|
+
if (e.code === AIStreamAppErrorCode.AUDIO_PACKET_INVALID) {
|
|
51
|
+
ty.showToast({
|
|
52
|
+
icon: 'none',
|
|
53
|
+
title: t('t-agent.error.audio-packet-invalid')
|
|
54
|
+
});
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (e.code === AIStreamAppErrorCode.FILE_DATA_READ_ERROR) {
|
|
58
|
+
ty.showToast({
|
|
59
|
+
icon: 'none',
|
|
60
|
+
title: t('t-agent.error.audio-not-found')
|
|
61
|
+
});
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
logger.error('BubbleToolTile toggle audio failed', e);
|
|
66
|
+
}
|
|
45
67
|
}
|
|
46
68
|
}), /*#__PURE__*/React.createElement(View, {
|
|
47
69
|
className: "t-agent-bubble-tool-tile-button t-agent-bubble-tool-tile-copy",
|
package/dist/types.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ export interface TileProps<T = any, P = any> {
|
|
|
49
49
|
* @param payload
|
|
50
50
|
*/
|
|
51
51
|
emitEvent: (payload: P) => void;
|
|
52
|
-
emitTileEvent: (payload: P) => void
|
|
52
|
+
emitTileEvent: (payload: P) => Promise<void>;
|
|
53
53
|
isLatestMessage?: boolean;
|
|
54
54
|
agent: UIChatAgent;
|
|
55
55
|
notifyHeightChanged: () => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ray-js/t-agent-ui-ray",
|
|
3
|
-
"version": "0.2.8-beta.
|
|
3
|
+
"version": "0.2.8-beta.9",
|
|
4
4
|
"author": "Tuya.inc",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"@types/echarts": "^4.9.22",
|
|
42
42
|
"@types/markdown-it": "^14.1.1"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "c56f397e86b83f47e11a838b64aa59dd7d189efe"
|
|
45
45
|
}
|