@somecat/ai-assist-sdk 1.1.24 → 1.1.26

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/index.mjs CHANGED
@@ -1,31 +1,47 @@
1
- import { l as a, o as t, a as o, c as r, j as n, e as i, q as g, f as p, t as u, d as C, i as f, g as l, v, k as c, x as d, y as h, z as x, A as m, r as S, B as T, C as y, n as A, D as E, s as M, E as w, b as D, u as Q, w as b } from "./chunks/index-CWRmx9Cv.mjs";
1
+ import { V as t, a as o, b as r, c as n, d as i, e as g, f as C, g as p, h as c, i as u, j as A, k as E, l as N, m as _, n as l, o as T, p as d, q as f, r as h, s as v, t as x, u as M, v as S, w as m, x as O, y as R, z as D, A as L, B as V, C as I, D as y } from "./chunks/engine-DxdqzC3A.mjs";
2
+ const e = {
3
+ /** 中文普通话,弱标点(逗号、句号) */
4
+ CN_NORMAL_WEAK: 1537,
5
+ /** 中文普通话,加强标点(逗号、句号、问号、感叹号)—— 推荐 */
6
+ CN_NORMAL_STRONG: 15372,
7
+ /** 中文多方言,弱标点(支持粤语、四川话、东北话) */
8
+ CN_DIALECT: 15376,
9
+ /** 英语,无标点 */
10
+ EN_NORMAL_WEAK: 1737,
11
+ /** 英语,加强标点(逗号、句号、问号) */
12
+ EN_NORMAL_STRONG: 17372
13
+ };
2
14
  export {
3
- a as applyTheme,
4
- t as chatQuery,
5
- o as createAuthAxios,
6
- r as createConversation,
7
- n as deleteConversation,
8
- i as ensureTitleConversation,
9
- g as extractPlainText,
10
- p as formatQuestions,
11
- u as getAppConfig,
12
- C as getConfig,
13
- f as getConversationList,
15
+ e as VOICE_DEV_PID,
16
+ t as VoiceClient,
17
+ o as VoiceEngine,
18
+ r as VoiceRecorder,
19
+ n as applyTheme,
20
+ i as chatQuery,
21
+ g as createAuthAxios,
22
+ C as createConversation,
23
+ p as deleteConversation,
24
+ c as ensureTitleConversation,
25
+ u as extractPlainText,
26
+ A as formatQuestions,
27
+ E as getAppConfig,
28
+ N as getConfig,
29
+ _ as getConversationList,
14
30
  l as getConversationMessages,
15
- v as getMessageInfo,
16
- c as getPersonalInfo,
17
- d as getSuggestedQuestions,
31
+ T as getMessageInfo,
32
+ d as getPersonalInfo,
33
+ f as getSuggestedQuestions,
18
34
  h as http,
19
- x as parseSSEData,
20
- m as processSSEData,
21
- S as renderMarkdown,
22
- T as request,
23
- y as resolveTheme,
24
- A as setConfig,
25
- E as statusText,
26
- M as stopMessage,
27
- w as textError,
28
- D as updateConversation,
29
- Q as useClipboard,
30
- b as watchSystemTheme
35
+ v as parseSSEData,
36
+ x as processSSEData,
37
+ M as renderMarkdown,
38
+ S as request,
39
+ m as resolveTheme,
40
+ O as setConfig,
41
+ R as statusText,
42
+ D as stopMessage,
43
+ L as textError,
44
+ V as updateConversation,
45
+ I as useClipboard,
46
+ y as watchSystemTheme
31
47
  };
@@ -0,0 +1,44 @@
1
+ import { default as React } from 'react';
2
+ import { VoiceConfig, VoiceStatus, VoiceResult, VoiceError } from '../../core/voice';
3
+ export interface VoiceInputProps {
4
+ /** 百度实时语音识别配置 */
5
+ config: VoiceConfig;
6
+ /** 占位提示文案 */
7
+ placeholder?: string;
8
+ /** 按钮文案:开始录音 */
9
+ startText?: string;
10
+ /** 按钮文案:停止录音 */
11
+ stopText?: string;
12
+ /** 按钮文案:连接中 */
13
+ connectingText?: string;
14
+ /** 按钮文案:识别中 */
15
+ stoppingText?: string;
16
+ /** 容器附加类名 */
17
+ className?: string;
18
+ /** 任意识别结果回调 */
19
+ onResult?: (result: VoiceResult) => void;
20
+ /** 最终结果回调(每次句子结束触发) */
21
+ onFinal?: (text: string, result: VoiceResult) => void;
22
+ /** 错误回调 */
23
+ onError?: (error: VoiceError) => void;
24
+ /** 状态变化回调 */
25
+ onStatusChange?: (status: VoiceStatus) => void;
26
+ /** 录音结束、最终文本回调(累积全部最终文本) */
27
+ onComplete?: (fullText: string) => void;
28
+ }
29
+ export interface VoiceInputRef {
30
+ /** 开始录音 */
31
+ start: () => Promise<void>;
32
+ /** 停止录音并等待最终结果 */
33
+ stop: () => void;
34
+ /** 立即取消 */
35
+ cancel: () => void;
36
+ /** 获取当前文本 */
37
+ getText: () => string;
38
+ /** 清空文本 */
39
+ clear: () => void;
40
+ /** 获取当前状态 */
41
+ getStatus: () => VoiceStatus;
42
+ }
43
+ declare const VoiceInput: React.ForwardRefExoticComponent<VoiceInputProps & React.RefAttributes<VoiceInputRef>>;
44
+ export default VoiceInput;
@@ -1,15 +1,18 @@
1
1
  import { default as React } from 'react';
2
2
  import { default as AiAssist } from './components/AiAssist';
3
+ import { default as VoiceInput } from './components/VoiceInput';
3
4
  import { AiAssistConfig } from '../core/types';
4
5
  export type { AiAssistConfig, AiAssistTheme } from '../core/types';
5
6
  export declare const initAiAssist: (config: AiAssistConfig) => void;
6
7
  export declare const mountAiAssist: (container?: HTMLElement) => void;
7
8
  export declare const unmountAiAssist: () => void;
8
- export { AiAssist };
9
+ export { AiAssist, VoiceInput };
10
+ export type { VoiceInputProps, VoiceInputRef } from './components/VoiceInput';
9
11
  declare const _default: {
10
12
  initAiAssist: (config: AiAssistConfig) => void;
11
13
  mountAiAssist: (container?: HTMLElement) => void;
12
14
  unmountAiAssist: () => void;
13
15
  AiAssist: React.FC<{}>;
16
+ VoiceInput: React.ForwardRefExoticComponent<import('.').VoiceInputProps & React.RefAttributes<import('.').VoiceInputRef>>;
14
17
  };
15
18
  export default _default;