@ray-js/t-agent 0.0.7 → 0.0.8-beta-2

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 CHANGED
@@ -827,7 +827,7 @@ async function startAsr() {
827
827
 
828
828
  // 生成一个识别器
829
829
  const asr = Asr.detect(async res => {
830
- if (res.state === AsrDetectResultState.STARTING || res.state === AsrDetectResultState.END) {
830
+ if (res.state === AsrDetectResultState.MID || res.state === AsrDetectResultState.END) {
831
831
  // 全文
832
832
  const full = initial + res.text;
833
833
 
package/README.md CHANGED
@@ -822,7 +822,7 @@ async function startAsr() {
822
822
 
823
823
  // Generate a recognizer
824
824
  const asr = Asr.detect(async res => {
825
- if (res.state === AsrDetectResultState.STARTING || res.state === AsrDetectResultState.END) {
825
+ if (res.state === AsrDetectResultState.MID || res.state === AsrDetectResultState.END) {
826
826
  // Full text
827
827
  const full = initial + res.text;
828
828
 
@@ -1,5 +1,5 @@
1
1
  import { Hookable } from 'hookable';
2
- import { AbortSignalObject, AddHookCallback, ChatAgentHooks, ChatAgentHooksWithOrder, ChatAgentPlugin, ComposeHandler, InputBlock, ChatMessageObject, StreamResponseInstance } from './types';
2
+ import { AbortSignalObject, AddHookCallback, ChatAgentHooks, ChatAgentHooksWithOrder, ChatAgentPlugin, ChatMessageObject, ComposeHandler, InputBlock, StreamResponseInstance } from './types';
3
3
  import ChatSession from './ChatSession';
4
4
  import ChatMessage from './ChatMessage';
5
5
  type AddHook<T extends keyof ChatAgentHooks> = AddHookCallback<ChatAgentHooks, T>;
@@ -225,11 +225,10 @@ export default class ChatAgent {
225
225
  }
226
226
  }
227
227
  if (part.type === 'error') {
228
- if (part.level === 'error') {
229
- throw part.error;
230
- } else {
231
- await message.bubble.setStatus(BubbleTileStatus.WARNING).setText(part.error.message).update();
228
+ if (!message.bubble.text) {
229
+ message.bubble.setText(part.error.message);
232
230
  }
231
+ await message.bubble.setStatus(part.level === 'error' ? BubbleTileStatus.ERROR : BubbleTileStatus.WARNING).setInfo(part.error.message).update();
233
232
  }
234
233
  }
235
234
  }
@@ -9,7 +9,8 @@ export interface UIEventMap {
9
9
  message: ChatMessageObject;
10
10
  };
11
11
  scrollToBottom: {
12
- animation: boolean;
12
+ animation?: boolean;
13
+ follow?: boolean;
13
14
  };
14
15
  sendMessage: {
15
16
  blocks: InputBlock[];
@@ -17,6 +18,9 @@ export interface UIEventMap {
17
18
  setInputBlocks: {
18
19
  blocks: InputBlock[];
19
20
  };
21
+ networkChange: {
22
+ online: boolean;
23
+ };
20
24
  [key: string]: any;
21
25
  }
22
26
  export declare function withUI(): (agent: ChatAgent) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/t-agent",
3
- "version": "0.0.7",
3
+ "version": "0.0.8-beta-2",
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": "95aecc47d002cbf5e608c129478905c7fb458ea9"
29
+ "gitHead": "0fe6e7c1daafbeffd1394a7ee85ab4ae86d8f93e"
30
30
  }