@ray-js/t-agent-ui-ray 0.2.8-beta.7 → 0.2.8-beta.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.
@@ -95,6 +95,7 @@ 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;
98
99
  't-agent.message.delete.button': string;
99
100
  };
100
101
  'zh-Hant': {
@@ -193,6 +194,7 @@ declare const _default: {
193
194
  't-agent.error.stream-exists': string;
194
195
  't-agent.error.timeout': string;
195
196
  't-agent.error.asr-empty': string;
197
+ 't-agent.error.audio-packet-invalid': string;
196
198
  't-agent.message.delete.button': string;
197
199
  };
198
200
  en: {
@@ -291,6 +293,7 @@ declare const _default: {
291
293
  't-agent.error.stream-exists': string;
292
294
  't-agent.error.timeout': string;
293
295
  't-agent.error.asr-empty': string;
296
+ 't-agent.error.audio-packet-invalid': string;
294
297
  't-agent.message.delete.button': string;
295
298
  };
296
299
  ja: {
@@ -389,6 +392,7 @@ declare const _default: {
389
392
  't-agent.error.stream-exists': string;
390
393
  't-agent.error.timeout': string;
391
394
  't-agent.error.asr-empty': string;
395
+ 't-agent.error.audio-packet-invalid': string;
392
396
  't-agent.message.delete.button': string;
393
397
  };
394
398
  de: {
@@ -487,6 +491,7 @@ declare const _default: {
487
491
  't-agent.error.stream-exists': string;
488
492
  't-agent.error.timeout': string;
489
493
  't-agent.error.asr-empty': string;
494
+ 't-agent.error.audio-packet-invalid': string;
490
495
  't-agent.message.clear-history.button': string;
491
496
  };
492
497
  fr: {
@@ -585,6 +590,7 @@ declare const _default: {
585
590
  't-agent.error.stream-exists': string;
586
591
  't-agent.error.timeout': string;
587
592
  't-agent.error.asr-empty': string;
593
+ 't-agent.error.audio-packet-invalid': string;
588
594
  't-agent.message.clear-history.button': string;
589
595
  };
590
596
  es: {
@@ -683,6 +689,7 @@ declare const _default: {
683
689
  't-agent.error.stream-exists': string;
684
690
  't-agent.error.timeout': string;
685
691
  't-agent.error.asr-empty': string;
692
+ 't-agent.error.audio-packet-invalid': string;
686
693
  't-agent.message.clear-history.button': string;
687
694
  };
688
695
  it: {
@@ -781,6 +788,7 @@ declare const _default: {
781
788
  't-agent.error.stream-exists': string;
782
789
  't-agent.error.timeout': string;
783
790
  't-agent.error.asr-empty': string;
791
+ 't-agent.error.audio-packet-invalid': string;
784
792
  't-agent.message.clear-history.button': string;
785
793
  };
786
794
  };
@@ -96,6 +96,7 @@ 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': '暂不支持该文本的朗读',
99
100
  't-agent.message.delete.button': '删除消息'
100
101
  },
101
102
  'zh-Hant': {
@@ -194,6 +195,7 @@ export default {
194
195
  't-agent.error.stream-exists': '消息發送異常,請稍後再試',
195
196
  't-agent.error.timeout': '發送超時',
196
197
  't-agent.error.asr-empty': '語音識別結果為空',
198
+ 't-agent.error.audio-packet-invalid': '暫不支持該文本的朗讀',
197
199
  't-agent.message.delete.button': '刪除消息'
198
200
  },
199
201
  en: {
@@ -292,6 +294,7 @@ export default {
292
294
  't-agent.error.stream-exists': 'Message sending exception, please try again later',
293
295
  't-agent.error.timeout': 'Sending timeout',
294
296
  't-agent.error.asr-empty': 'Voice recognition result is empty',
297
+ 't-agent.error.audio-packet-invalid': 'Reading this text aloud is not supported yet',
295
298
  't-agent.message.delete.button': 'Delete Message'
296
299
  },
297
300
  ja: {
@@ -390,6 +393,7 @@ export default {
390
393
  't-agent.error.stream-exists': 'メッセージ送信例外、後でもう一度お試しください',
391
394
  't-agent.error.timeout': '送信タイムアウト',
392
395
  't-agent.error.asr-empty': '音声認識結果が空です',
396
+ 't-agent.error.audio-packet-invalid': 'このテキストの読み上げには対応していません',
393
397
  't-agent.message.delete.button': 'メッセージを削除'
394
398
  },
395
399
  de: {
@@ -488,6 +492,7 @@ export default {
488
492
  't-agent.error.stream-exists': 'Nachrichtensendeausnahme, bitte später erneut versuchen',
489
493
  't-agent.error.timeout': 'Sendetimeout',
490
494
  't-agent.error.asr-empty': 'Spracherkennungsergebnis ist leer',
495
+ 't-agent.error.audio-packet-invalid': 'Das Vorlesen dieses Textes wird noch nicht unterstützt',
491
496
  't-agent.message.clear-history.button': 'Verlauf löschen'
492
497
  },
493
498
  fr: {
@@ -586,6 +591,7 @@ export default {
586
591
  't-agent.error.stream-exists': "Exception d'envoi de message, veuillez réessayer plus tard",
587
592
  't-agent.error.timeout': "Délai d'envoi dépassé",
588
593
  't-agent.error.asr-empty': 'Le résultat de la reconnaissance vocale est vide',
594
+ 't-agent.error.audio-packet-invalid': "La lecture à voix haute de ce texte n'est pas encore prise en charge",
589
595
  't-agent.message.clear-history.button': "Effacer l'historique"
590
596
  },
591
597
  es: {
@@ -684,6 +690,7 @@ export default {
684
690
  't-agent.error.stream-exists': 'Excepción al enviar mensaje, por favor intenta más tarde',
685
691
  't-agent.error.timeout': 'Tiempo de envío agotado',
686
692
  't-agent.error.asr-empty': 'El resultado del reconocimiento de voz está vacío',
693
+ 't-agent.error.audio-packet-invalid': 'La lectura en voz alta de este texto aún no es compatible',
687
694
  't-agent.message.clear-history.button': 'Borrar historial'
688
695
  },
689
696
  it: {
@@ -782,6 +789,7 @@ export default {
782
789
  't-agent.error.stream-exists': "Eccezione nell'invio del messaggio, riprova più tardi",
783
790
  't-agent.error.timeout': 'Timeout di invio',
784
791
  't-agent.error.asr-empty': 'Il risultato del riconoscimento vocale è vuoto',
792
+ 't-agent.error.audio-packet-invalid': 'La lettura ad alta voce di questo testo non è ancora supportata',
785
793
  't-agent.message.clear-history.button': 'Cancella cronologia'
786
794
  }
787
795
  };
@@ -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,21 @@ 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
- props.emitTileEvent({
43
- action: 'toggle'
44
- });
43
+ onClick: async () => {
44
+ try {
45
+ await props.emitTileEvent({
46
+ action: 'toggle'
47
+ });
48
+ } catch (e) {
49
+ if (e && e.code && e.code === AIStreamAppErrorCode.AUDIO_PACKET_INVALID) {
50
+ ty.showToast({
51
+ icon: 'none',
52
+ title: t('t-agent.error.audio-packet-invalid')
53
+ });
54
+ } else {
55
+ logger.error('BubbleToolTile toggle audio failed', e);
56
+ }
57
+ }
45
58
  }
46
59
  }), /*#__PURE__*/React.createElement(View, {
47
60
  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.7",
3
+ "version": "0.2.8-beta.8",
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": "0219043e3dc004cf8200714fd0251ae6a0c686fb"
44
+ "gitHead": "98ec699238fdf0f1ad9c4404e46d0dca5583cebe"
45
45
  }