@siact/sime-x-vue 0.0.9 → 0.0.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@siact/sime-x-vue",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -28,11 +28,12 @@
28
28
  "node": ">=14"
29
29
  },
30
30
  "dependencies": {
31
+ "@ai-sdk/vue": "^3.0.116",
31
32
  "@visactor/vtable": "^1.16.2",
33
+ "ai": "6.0.39",
32
34
  "vue": "^3.4.19",
33
35
  "vue-sonner": "^1.1.2",
34
- "web-voice-kit": "^0.5.0",
35
- "@siact/sime-bridge": "0.0.1"
36
+ "web-voice-kit": "^0.5.0"
36
37
  },
37
38
  "devDependencies": {
38
39
  "@antfu/eslint-config": "^6.1.0",
@@ -52,11 +53,11 @@
52
53
  "prettier": "^3.6.2",
53
54
  "rimraf": "^3.0.2",
54
55
  "sass-embedded": "^1.93.2",
55
- "typescript": "^4.7.4",
56
+ "typescript": "^5.6.3",
56
57
  "vite": "^5.0.4",
57
58
  "vite-plugin-static-copy": "^3.1.4",
58
59
  "vue-eslint-parser": "^10.2.0",
59
- "vue-tsc": "^1.8.24"
60
+ "vue-tsc": "^2.0.0"
60
61
  },
61
62
  "files": [
62
63
  "dist",
@@ -1,2 +1,2 @@
1
- declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
- export default _default;
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -0,0 +1,47 @@
1
+ import { Chat } from '@ai-sdk/vue';
2
+ import type { UIMessage } from 'ai';
3
+ import type { AgentChatTransportOptions } from '../lib/agent-chat-transport';
4
+ type __VLS_Props = {
5
+ /** streamInvoke endpoint URL */
6
+ api: string;
7
+ /** 项目 ID */
8
+ projectId?: string;
9
+ /** 是否只读 */
10
+ isReadonly?: boolean;
11
+ /** 欢迎标题 */
12
+ welcomeTitle?: string;
13
+ /** 欢迎描述 */
14
+ welcomeDescription?: string;
15
+ /** 快捷建议 */
16
+ suggestions?: string[];
17
+ /** 是否全宽 */
18
+ fullWidth?: boolean;
19
+ /** 自定义工具名称映射 */
20
+ toolNames?: Record<string, string>;
21
+ /** 额外 transport 配置 */
22
+ transportOptions?: Partial<AgentChatTransportOptions>;
23
+ /** 额外 headers */
24
+ headers?: Record<string, string>;
25
+ /** 额外 body */
26
+ body?: Record<string, unknown>;
27
+ };
28
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {
29
+ chat: Chat<UIMessage<unknown, import("ai").UIDataTypes, import("ai").UITools>>;
30
+ sendMessage: (text: string) => Promise<void>;
31
+ clearMessages: () => void;
32
+ stop: () => Promise<void>;
33
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
34
+ error: (error: Error) => any;
35
+ finish: (message: UIMessage<unknown, import("ai").UIDataTypes, import("ai").UITools>) => any;
36
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
37
+ onError?: ((error: Error) => any) | undefined;
38
+ onFinish?: ((message: UIMessage<unknown, import("ai").UIDataTypes, import("ai").UITools>) => any) | undefined;
39
+ }>, {
40
+ isReadonly: boolean;
41
+ welcomeTitle: string;
42
+ welcomeDescription: string;
43
+ suggestions: string[];
44
+ fullWidth: boolean;
45
+ toolNames: Record<string, string>;
46
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
47
+ export default _default;
@@ -1,49 +1,26 @@
1
- import { VoiceConfig } from '../types';
2
- declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
3
- /** 项目名称 */
4
- project: string;
5
- /** 项目描述 */
6
- description?: string | undefined;
7
- /** 是否开启调试模式 */
8
- debug?: boolean | undefined;
9
- /** iframeUrl */
10
- chatbotUrl: string;
11
- /** appId */
12
- appId: string;
13
- /** appToken */
14
- appToken: string;
15
- /** 语音配置(可选,也可直接在 voiceAssistant 组件上传入) */
16
- voiceConfig?: VoiceConfig | undefined;
17
- }>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
18
- /** 项目名称 */
19
- project: string;
20
- /** 项目描述 */
21
- description?: string | undefined;
22
- /** 是否开启调试模式 */
23
- debug?: boolean | undefined;
24
- /** iframeUrl */
25
- chatbotUrl: string;
26
- /** appId */
27
- appId: string;
28
- /** appToken */
29
- appToken: string;
30
- /** 语音配置(可选,也可直接在 voiceAssistant 组件上传入) */
31
- voiceConfig?: VoiceConfig | undefined;
32
- }>>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, {
33
- default?(_: {}): any;
34
- }>;
35
- export default _default;
36
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
37
- type __VLS_TypePropsToRuntimeProps<T> = {
38
- [K in keyof T]-?: {} extends Pick<T, K> ? {
39
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
40
- } : {
41
- type: import('vue').PropType<T[K]>;
42
- required: true;
43
- };
44
- };
45
- type __VLS_WithTemplateSlots<T, S> = T & {
46
- new (): {
47
- $slots: S;
48
- };
49
- };
1
+ type __VLS_Props = {
2
+ /** 项目名称 */
3
+ project: string;
4
+ /** 项目描述 */
5
+ description?: string;
6
+ /** 是否开启调试模式 */
7
+ debug?: boolean;
8
+ /** iframeUrl */
9
+ chatbotUrl: string;
10
+ /** appId */
11
+ appId: string;
12
+ /** appToken */
13
+ appToken: string;
14
+ };
15
+ declare var __VLS_1: {};
16
+ type __VLS_Slots = {} & {
17
+ default?: (props: typeof __VLS_1) => any;
18
+ };
19
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
20
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
21
+ export default _default;
22
+ type __VLS_WithSlots<T, S> = T & {
23
+ new (): {
24
+ $slots: S;
25
+ };
26
+ };
@@ -1,2 +1,2 @@
1
- declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
- export default _default;
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -1,28 +1,12 @@
1
- import type { ToolState } from '../lib/data-stream-parser';
2
- declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
3
- toolName: string;
4
- toolCallId: string;
5
- args?: any;
6
- result?: any;
7
- state: ToolState;
8
- errorText?: string | undefined;
9
- isExecuting?: boolean | undefined;
10
- }>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
11
- toolName: string;
12
- toolCallId: string;
13
- args?: any;
14
- result?: any;
15
- state: ToolState;
16
- errorText?: string | undefined;
17
- isExecuting?: boolean | undefined;
18
- }>>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
19
- export default _default;
20
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
21
- type __VLS_TypePropsToRuntimeProps<T> = {
22
- [K in keyof T]-?: {} extends Pick<T, K> ? {
23
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
24
- } : {
25
- type: import('vue').PropType<T[K]>;
26
- required: true;
27
- };
28
- };
1
+ import type { ToolState } from '../lib/data-stream-parser';
2
+ type __VLS_Props = {
3
+ toolName: string;
4
+ toolCallId: string;
5
+ args?: any;
6
+ result?: any;
7
+ state: ToolState;
8
+ errorText?: string;
9
+ isExecuting?: boolean;
10
+ };
11
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ export default _default;
@@ -1,44 +1,24 @@
1
- import type { VoiceConfig } from '../types';
2
- interface XSize {
3
- width: number;
4
- height: number;
5
- }
6
- interface BubbleSize {
7
- width?: string;
8
- maxHeight?: string;
9
- }
10
- declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
11
- xLogo?: string | undefined;
12
- xTitle?: string | undefined;
13
- xSize?: XSize | undefined;
14
- xTheme?: "light" | "dark" | "system" | undefined;
15
- wakeWords?: string[] | undefined;
16
- modelPath?: string | undefined;
17
- projectId?: string | undefined;
18
- invokeUrl?: string | undefined;
19
- voiceConfig?: VoiceConfig | undefined;
20
- bubbleSize?: BubbleSize | undefined;
21
- bubbleDismissDelay?: number | undefined;
22
- }>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
23
- xLogo?: string | undefined;
24
- xTitle?: string | undefined;
25
- xSize?: XSize | undefined;
26
- xTheme?: "light" | "dark" | "system" | undefined;
27
- wakeWords?: string[] | undefined;
28
- modelPath?: string | undefined;
29
- projectId?: string | undefined;
30
- invokeUrl?: string | undefined;
31
- voiceConfig?: VoiceConfig | undefined;
32
- bubbleSize?: BubbleSize | undefined;
33
- bubbleDismissDelay?: number | undefined;
34
- }>>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
35
- export default _default;
36
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
37
- type __VLS_TypePropsToRuntimeProps<T> = {
38
- [K in keyof T]-?: {} extends Pick<T, K> ? {
39
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
40
- } : {
41
- type: import('vue').PropType<T[K]>;
42
- required: true;
43
- };
44
- };
1
+ import type { VoiceConfig } from '../types';
2
+ interface XSize {
3
+ width: number;
4
+ height: number;
5
+ }
6
+ interface BubbleSize {
7
+ width?: string;
8
+ maxHeight?: string;
9
+ }
10
+ type __VLS_Props = {
11
+ xLogo?: string;
12
+ xTitle?: string;
13
+ xSize?: XSize;
14
+ xTheme?: 'light' | 'dark' | 'system';
15
+ wakeWords?: string[];
16
+ modelPath?: string;
17
+ projectId?: string;
18
+ invokeUrl?: string;
19
+ voiceConfig?: VoiceConfig;
20
+ bubbleSize?: BubbleSize;
21
+ bubbleDismissDelay?: number;
22
+ };
23
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
24
+ export default _default;
@@ -1,20 +1,8 @@
1
- type VoiceStatus = 'wake' | 'listening' | 'standby';
2
- declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
3
- status: VoiceStatus;
4
- transcriptionText?: string | undefined;
5
- isTranscribing?: boolean | undefined;
6
- }>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
7
- status: VoiceStatus;
8
- transcriptionText?: string | undefined;
9
- isTranscribing?: boolean | undefined;
10
- }>>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
11
- export default _default;
12
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
13
- type __VLS_TypePropsToRuntimeProps<T> = {
14
- [K in keyof T]-?: {} extends Pick<T, K> ? {
15
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
16
- } : {
17
- type: import('vue').PropType<T[K]>;
18
- required: true;
19
- };
20
- };
1
+ type VoiceStatus = 'wake' | 'listening' | 'standby';
2
+ type __VLS_Props = {
3
+ status: VoiceStatus;
4
+ transcriptionText?: string;
5
+ isTranscribing?: boolean;
6
+ };
7
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
+ export default _default;
@@ -1,6 +1,6 @@
1
- export { useTTS } from './use-tts';
2
- export { useBubble } from './use-bubble';
3
- export type { BubbleSize, UseBubbleOptions } from './use-bubble';
4
- export { useVoiceRecognition } from './use-voice-recognition';
5
- export type { VoiceStatus } from './use-voice-recognition';
6
- export { useAgentInvoke } from './use-agent-invoke';
1
+ export { useTTS } from './use-tts';
2
+ export { useBubble } from './use-bubble';
3
+ export type { BubbleSize, UseBubbleOptions } from './use-bubble';
4
+ export { useVoiceRecognition } from './use-voice-recognition';
5
+ export type { VoiceStatus } from './use-voice-recognition';
6
+ export { useAgentInvoke } from './use-agent-invoke';
@@ -1,79 +1,79 @@
1
- import type { Ref } from 'vue';
2
- import { type ToolCallPart, type ToolResultPart } from '../lib/data-stream-parser';
3
- import type { AiChatbotXContext } from '../types';
4
- export interface UseAgentInvokeOptions {
5
- endpoint: Ref<string>;
6
- projectId?: string;
7
- aiChatbotX: AiChatbotXContext;
8
- /** TTS 控制 */
9
- tts: {
10
- speak: (text: string) => void;
11
- feed: (delta: string) => void;
12
- flush: () => void;
13
- stop: () => void;
14
- };
15
- /** 气泡控制 */
16
- bubble: {
17
- open: () => void;
18
- scheduleDismiss: () => void;
19
- scrollToBottom: () => void;
20
- };
21
- /** 会话记忆超时(ms),超过此时间未发起新对话则自动清空历史,默认 120000(2分钟) */
22
- sessionTimeoutMs?: number;
23
- /** 最大保留历史轮数(一轮 = user + assistant),默认 10 */
24
- maxHistoryTurns?: number;
25
- }
26
- /**
27
- * Agent 调用 composable
28
- *
29
- * 管理 Agent 调用、流式解析、工具执行、文本/工具状态。
30
- * 支持中断(abort)以便在唤醒时取消正在进行的调用。
31
- */
32
- export declare function useAgentInvoke(options: UseAgentInvokeOptions): {
33
- isInvoking: Ref<boolean, boolean>;
34
- currentTextContent: Ref<string, string>;
35
- currentToolParts: Ref<({
36
- type: "tool-call";
37
- toolCallId: string;
38
- toolName: string;
39
- args: any;
40
- state: import("../lib/data-stream-parser").ToolState;
41
- } | {
42
- type: "tool-result";
43
- toolCallId: string;
44
- toolName: string;
45
- args: any;
46
- result: any;
47
- state: import("../lib/data-stream-parser").ToolState;
48
- })[], (ToolCallPart | ToolResultPart)[] | ({
49
- type: "tool-call";
50
- toolCallId: string;
51
- toolName: string;
52
- args: any;
53
- state: import("../lib/data-stream-parser").ToolState;
54
- } | {
55
- type: "tool-result";
56
- toolCallId: string;
57
- toolName: string;
58
- args: any;
59
- result: any;
60
- state: import("../lib/data-stream-parser").ToolState;
61
- })[]>;
62
- executingTools: Ref<Set<string> & Omit<Set<string>, keyof Set<any>>, Set<string> | (Set<string> & Omit<Set<string>, keyof Set<any>>)>;
63
- hasAnyContent: import("vue").ComputedRef<boolean>;
64
- conversationHistory: Ref<{
65
- role: 'user' | 'assistant';
66
- content: string;
67
- }[], {
68
- role: 'user' | 'assistant';
69
- content: string;
70
- }[] | {
71
- role: 'user' | 'assistant';
72
- content: string;
73
- }[]>;
74
- toolDisplayName: (name: string) => string;
75
- invoke: (question: string) => Promise<void>;
76
- abort: () => void;
77
- resetState: () => void;
78
- clearHistory: () => void;
79
- };
1
+ import type { Ref } from 'vue';
2
+ import { type ToolCallPart, type ToolResultPart } from '../lib/data-stream-parser';
3
+ import type { AiChatbotXContext } from '../types';
4
+ export interface UseAgentInvokeOptions {
5
+ endpoint: Ref<string>;
6
+ projectId?: string;
7
+ aiChatbotX: AiChatbotXContext;
8
+ /** TTS 控制 */
9
+ tts: {
10
+ speak: (text: string) => void;
11
+ feed: (delta: string) => void;
12
+ flush: () => void;
13
+ stop: () => void;
14
+ };
15
+ /** 气泡控制 */
16
+ bubble: {
17
+ open: () => void;
18
+ scheduleDismiss: () => void;
19
+ scrollToBottom: () => void;
20
+ };
21
+ /** 会话记忆超时(ms),超过此时间未发起新对话则自动清空历史,默认 120000(2分钟) */
22
+ sessionTimeoutMs?: number;
23
+ /** 最大保留历史轮数(一轮 = user + assistant),默认 10 */
24
+ maxHistoryTurns?: number;
25
+ }
26
+ /**
27
+ * Agent 调用 composable
28
+ *
29
+ * 管理 Agent 调用、流式解析、工具执行、文本/工具状态。
30
+ * 支持中断(abort)以便在唤醒时取消正在进行的调用。
31
+ */
32
+ export declare function useAgentInvoke(options: UseAgentInvokeOptions): {
33
+ isInvoking: Ref<boolean, boolean>;
34
+ currentTextContent: Ref<string, string>;
35
+ currentToolParts: Ref<({
36
+ type: "tool-call";
37
+ toolCallId: string;
38
+ toolName: string;
39
+ args: any;
40
+ state: import("../lib/data-stream-parser").ToolState;
41
+ } | {
42
+ type: "tool-result";
43
+ toolCallId: string;
44
+ toolName: string;
45
+ args: any;
46
+ result: any;
47
+ state: import("../lib/data-stream-parser").ToolState;
48
+ })[], (ToolCallPart | ToolResultPart)[] | ({
49
+ type: "tool-call";
50
+ toolCallId: string;
51
+ toolName: string;
52
+ args: any;
53
+ state: import("../lib/data-stream-parser").ToolState;
54
+ } | {
55
+ type: "tool-result";
56
+ toolCallId: string;
57
+ toolName: string;
58
+ args: any;
59
+ result: any;
60
+ state: import("../lib/data-stream-parser").ToolState;
61
+ })[]>;
62
+ executingTools: Ref<Set<string> & Omit<Set<string>, keyof Set<any>>, Set<string> | (Set<string> & Omit<Set<string>, keyof Set<any>>)>;
63
+ hasAnyContent: import("vue").ComputedRef<boolean>;
64
+ conversationHistory: Ref<{
65
+ role: "user" | "assistant";
66
+ content: string;
67
+ }[], {
68
+ role: "user" | "assistant";
69
+ content: string;
70
+ }[] | {
71
+ role: "user" | "assistant";
72
+ content: string;
73
+ }[]>;
74
+ toolDisplayName: (name: string) => string;
75
+ invoke: (question: string) => Promise<void>;
76
+ abort: () => void;
77
+ resetState: () => void;
78
+ clearHistory: () => void;
79
+ };
@@ -1,41 +1,41 @@
1
- import type { Ref } from 'vue';
2
- export interface BubbleSize {
3
- /** 气泡最大宽度,如 '380px' 或 '86vw' */
4
- width?: string;
5
- /** 气泡最大高度,如 '520px' 或 '58vh' */
6
- maxHeight?: string;
7
- }
8
- export interface UseBubbleOptions {
9
- /** 自动消失延迟 (ms),默认 4000 */
10
- dismissDelay?: number;
11
- /** 外部 isSpeaking 引用,TTS 播报期间阻止消失 */
12
- isSpeaking?: Ref<boolean>;
13
- /** 外部 hasPendingAudio 引用,TTS 已提交内容但尚未开始播放(覆盖异步窗口期) */
14
- hasPendingAudio?: Ref<boolean>;
15
- /** 外部 isInvoking 引用,调用期间阻止消失 */
16
- isInvoking?: Ref<boolean>;
17
- /** 气泡尺寸 */
18
- bubbleSize?: BubbleSize;
19
- }
20
- /**
21
- * 气泡生命周期 composable
22
- *
23
- * 管理气泡显示/隐藏、自动消失倒计时、滚动。
24
- * 核心保证:TTS 播报期间(含异步等待 WebSocket 的窗口期)气泡绝不消失。
25
- */
26
- export declare function useBubble(options?: UseBubbleOptions): {
27
- visible: Ref<boolean, boolean>;
28
- fadingOut: Ref<boolean, boolean>;
29
- show: import("vue").ComputedRef<boolean>;
30
- style: import("vue").ComputedRef<{
31
- width: string | undefined;
32
- maxHeight: string | undefined;
33
- }>;
34
- stackRef: Ref<HTMLElement | null, HTMLElement | null>;
35
- open: () => void;
36
- hide: () => void;
37
- cancelDismiss: () => void;
38
- scheduleDismiss: () => void;
39
- scrollToBottom: () => void;
40
- destroy: () => void;
41
- };
1
+ import type { Ref } from 'vue';
2
+ export interface BubbleSize {
3
+ /** 气泡最大宽度,如 '380px' 或 '86vw' */
4
+ width?: string;
5
+ /** 气泡最大高度,如 '520px' 或 '58vh' */
6
+ maxHeight?: string;
7
+ }
8
+ export interface UseBubbleOptions {
9
+ /** 自动消失延迟 (ms),默认 4000 */
10
+ dismissDelay?: number;
11
+ /** 外部 isSpeaking 引用,TTS 播报期间阻止消失 */
12
+ isSpeaking?: Ref<boolean>;
13
+ /** 外部 hasPendingAudio 引用,TTS 已提交内容但尚未开始播放(覆盖异步窗口期) */
14
+ hasPendingAudio?: Ref<boolean>;
15
+ /** 外部 isInvoking 引用,调用期间阻止消失 */
16
+ isInvoking?: Ref<boolean>;
17
+ /** 气泡尺寸 */
18
+ bubbleSize?: BubbleSize;
19
+ }
20
+ /**
21
+ * 气泡生命周期 composable
22
+ *
23
+ * 管理气泡显示/隐藏、自动消失倒计时、滚动。
24
+ * 核心保证:TTS 播报期间(含异步等待 WebSocket 的窗口期)气泡绝不消失。
25
+ */
26
+ export declare function useBubble(options?: UseBubbleOptions): {
27
+ visible: Ref<boolean, boolean>;
28
+ fadingOut: Ref<boolean, boolean>;
29
+ show: import("vue").ComputedRef<boolean>;
30
+ style: import("vue").ComputedRef<{
31
+ width: string | undefined;
32
+ maxHeight: string | undefined;
33
+ }>;
34
+ stackRef: Ref<HTMLElement | null, HTMLElement | null>;
35
+ open: () => void;
36
+ hide: () => void;
37
+ cancelDismiss: () => void;
38
+ scheduleDismiss: () => void;
39
+ scrollToBottom: () => void;
40
+ destroy: () => void;
41
+ };
@@ -1,18 +1,18 @@
1
- import type { VoiceConfig } from '../types';
2
- /**
3
- * TTS 语音播报 composable
4
- *
5
- * 管理讯飞 SpeechSynthesizerStandalone 的生命周期、
6
- * 句子级缓冲、Markdown 清理、AudioContext 预热。
7
- */
8
- export declare function useTTS(getVoiceConfig: () => VoiceConfig | null): {
9
- isSpeaking: import("vue").Ref<boolean, boolean>;
10
- hasPendingAudio: import("vue").Ref<boolean, boolean>;
11
- warmUpAudio: () => void;
12
- speak: (text: string) => Promise<void>;
13
- feed: (delta: string) => void;
14
- flush: () => void;
15
- stop: () => void;
16
- destroy: () => void;
17
- setOnQueueEmpty: (cb: () => void) => void;
18
- };
1
+ import type { VoiceConfig } from '../types';
2
+ /**
3
+ * TTS 语音播报 composable
4
+ *
5
+ * 管理讯飞 SpeechSynthesizerStandalone 的生命周期、
6
+ * 句子级缓冲、Markdown 清理、AudioContext 预热。
7
+ */
8
+ export declare function useTTS(getVoiceConfig: () => VoiceConfig | null): {
9
+ isSpeaking: import("vue").Ref<boolean, boolean>;
10
+ hasPendingAudio: import("vue").Ref<boolean, boolean>;
11
+ warmUpAudio: () => void;
12
+ speak: (text: string) => Promise<void>;
13
+ feed: (delta: string) => void;
14
+ flush: () => void;
15
+ stop: () => void;
16
+ destroy: () => void;
17
+ setOnQueueEmpty: (cb: () => void) => void;
18
+ };