@siact/sime-x-vue 0.0.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/package.json ADDED
@@ -0,0 +1,73 @@
1
+ {
2
+ "name": "@siact/sime-x-vue",
3
+ "version": "0.0.2",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "type": "module",
8
+ "sideEffects": [
9
+ "dist/*",
10
+ "src/theme/*"
11
+ ],
12
+ "main": "dist/sime-x-vue.umd.js",
13
+ "module": "dist/sime-x-vue.mjs",
14
+ "style": "dist/style.css",
15
+ "types": "types/index.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./types/index.d.ts",
19
+ "import": "./dist/sime-x-vue.mjs",
20
+ "require": "./dist/sime-x-vue.umd.js"
21
+ },
22
+ "./style.css": {
23
+ "import": "./dist/style.css",
24
+ "require": "./dist/style.css"
25
+ }
26
+ },
27
+ "engines": {
28
+ "node": ">=14"
29
+ },
30
+ "dependencies": {
31
+ "@visactor/vtable": "^1.16.2",
32
+ "vue": "^3.4.19",
33
+ "vue-sonner": "^1.1.2",
34
+ "web-voice-kit": "^0.4.0",
35
+ "@siact/sime-bridge": "0.0.1"
36
+ },
37
+ "devDependencies": {
38
+ "@antfu/eslint-config": "^6.1.0",
39
+ "@types/node": "^24.9.1",
40
+ "@typescript-eslint/eslint-plugin": "^8.46.2",
41
+ "@typescript-eslint/parser": "^8.46.2",
42
+ "@typescript-eslint/typescript-estree": "^8.46.2",
43
+ "@vitejs/plugin-vue": "^5.0.3",
44
+ "core-js": "^3.34.0",
45
+ "eslint": "^9.38.0",
46
+ "eslint-config-prettier": "^10.1.8",
47
+ "eslint-define-config": "^2.1.0",
48
+ "eslint-plugin-import": "^2.32.0",
49
+ "eslint-plugin-prettier": "^5.5.4",
50
+ "eslint-plugin-simple-import-sort": "^12.1.1",
51
+ "eslint-plugin-vue": "^10.5.1",
52
+ "prettier": "^3.6.2",
53
+ "rimraf": "^3.0.2",
54
+ "sass-embedded": "^1.93.2",
55
+ "typescript": "^4.7.4",
56
+ "vite": "^5.0.4",
57
+ "vite-plugin-static-copy": "^3.1.4",
58
+ "vue-eslint-parser": "^10.2.0",
59
+ "vue-tsc": "^1.8.24"
60
+ },
61
+ "files": [
62
+ "dist",
63
+ "types"
64
+ ],
65
+ "scripts": {
66
+ "dev": "vite",
67
+ "build": "npm run build:type && vite build",
68
+ "build:type": "npm run clear:type && vue-tsc --declaration --emitDeclarationOnly --project tsconfig.build.json",
69
+ "clear:type": "rimraf ./types",
70
+ "lint": "eslint . --ext .js,.vue,.ts,.tsx",
71
+ "lint-fix": "eslint . --fix --ext .vue,.js,.ts,.tsx"
72
+ }
73
+ }
@@ -0,0 +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;
@@ -0,0 +1,17 @@
1
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
2
+ visible: boolean;
3
+ text?: string | undefined;
4
+ }>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
5
+ visible: boolean;
6
+ text?: string | undefined;
7
+ }>>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
8
+ export default _default;
9
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
10
+ type __VLS_TypePropsToRuntimeProps<T> = {
11
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
12
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
13
+ } : {
14
+ type: import('vue').PropType<T[K]>;
15
+ required: true;
16
+ };
17
+ };
@@ -0,0 +1,49 @@
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
+ /** 语音配置 */
16
+ voiceConfig: VoiceConfig;
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
+ /** 语音配置 */
31
+ voiceConfig: VoiceConfig;
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
+ };
@@ -0,0 +1,41 @@
1
+ interface XSize {
2
+ width: number;
3
+ height: number;
4
+ }
5
+ interface xDialogSize {
6
+ width: number;
7
+ height: number;
8
+ }
9
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
10
+ xLogo?: string | undefined;
11
+ xSize?: XSize | undefined;
12
+ xTitle?: string | undefined;
13
+ xTheme?: "light" | "dark" | "system" | undefined;
14
+ xDialogSize?: xDialogSize | undefined;
15
+ wakeWords?: string[] | undefined;
16
+ modelPath?: string | undefined;
17
+ }>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
18
+ "start-transcribing": () => void;
19
+ "stop-transcribing": () => void;
20
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
21
+ xLogo?: string | undefined;
22
+ xSize?: XSize | undefined;
23
+ xTitle?: string | undefined;
24
+ xTheme?: "light" | "dark" | "system" | undefined;
25
+ xDialogSize?: xDialogSize | undefined;
26
+ wakeWords?: string[] | undefined;
27
+ modelPath?: string | undefined;
28
+ }>>> & Readonly<{
29
+ "onStart-transcribing"?: (() => any) | undefined;
30
+ "onStop-transcribing"?: (() => any) | undefined;
31
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
32
+ export default _default;
33
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
34
+ type __VLS_TypePropsToRuntimeProps<T> = {
35
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
36
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
37
+ } : {
38
+ type: import('vue').PropType<T[K]>;
39
+ required: true;
40
+ };
41
+ };
@@ -0,0 +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;
@@ -0,0 +1,20 @@
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
+ };
@@ -0,0 +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;
@@ -0,0 +1,4 @@
1
+ export { default as AiChatbotProvider } from './components/sime-provider.vue';
2
+ export { default as AiChatbotX } from './components/sime-x.vue';
3
+ export * from './injection-key';
4
+ export * from './types';
@@ -0,0 +1,6 @@
1
+ import type { InjectionKey } from 'vue';
2
+ import type { AiChatbotXContext } from './types';
3
+ export declare const AiChatbotXKey: InjectionKey<AiChatbotXContext>;
4
+ export declare function injectStrict<T>(key: InjectionKey<T>): T;
5
+ export declare function injectStrict<T>(key: InjectionKey<T>, defaultValue: T, treatDefaultAsFactory?: false): T;
6
+ export declare function injectStrict<T>(key: InjectionKey<T>, defaultValue: T | (() => T), treatDefaultAsFactory: true): T;
@@ -0,0 +1,14 @@
1
+ import { DiscoveredCommand } from '@siact/sime-bridge';
2
+ export declare const ensureMicrophonePermission: () => Promise<boolean>;
3
+ /**
4
+ * 语音命令匹配函数
5
+ * @param {string} userInput - 用户输入的原始语音文本
6
+ * @param {Array} commandList - 命令列表对象数组
7
+ * @param {number} threshold - 相似度阈值 (0-1),默认 0.5
8
+ */
9
+ export declare function matchVoiceCommand(userInput: string, commandList: DiscoveredCommand[], threshold?: number): {
10
+ confidence: number;
11
+ name: string;
12
+ description: string;
13
+ parameters?: import("@siact/sime-bridge").CommandParameter[] | undefined;
14
+ } | null;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,44 @@
1
+ import type { CommandDefinition, DiscoveredCommand } from "@siact/sime-bridge";
2
+ export declare enum clientCommandKey {
3
+ SET_THEME = "SiMeAgent_setTheme",
4
+ APPEND_MESSAGE = "SiMeAgent_appendMessage",
5
+ WAKE = "SiMeAgent_wake",
6
+ TRANSITION = "SiMeAgent_transition",
7
+ TRANSITION_END = "SiMeAgent_transition_end",
8
+ START_NEW_CONVERSATION = "SiMeAgent_startNewConversation",
9
+ RECOGNITION = "SiMeAgent_recognition"
10
+ }
11
+ export interface VoiceConfig {
12
+ appId: string;
13
+ apiKey: string;
14
+ websocketUrl: string;
15
+ }
16
+ export interface AiChatbotXContext {
17
+ chatbotUrl: () => string;
18
+ appId: () => string;
19
+ appToken: () => string;
20
+ voiceConfig: () => VoiceConfig;
21
+ registerCommand: (cmd: CommandDefinition) => void;
22
+ unregisterCommand: (name: string) => void;
23
+ clientCommand: () => Promise<DiscoveredCommand[]>;
24
+ hostCommads: () => Promise<DiscoveredCommand[]>;
25
+ appendMessage: (message: string) => Promise<void>;
26
+ setTheme: (theme: string) => Promise<void>;
27
+ weak: () => Promise<void>;
28
+ startListening: () => Promise<void>;
29
+ stopListening: () => Promise<void>;
30
+ toggleCollapse: () => Promise<void>;
31
+ openDialog: () => Promise<void>;
32
+ closeDialog: () => Promise<void>;
33
+ registerVoiceMethods: (methods: {
34
+ start: () => Promise<void>;
35
+ stop: () => Promise<void>;
36
+ toggleCollapse: () => Promise<void>;
37
+ openDialog: () => Promise<void>;
38
+ closeDialog: () => Promise<void>;
39
+ }) => void;
40
+ startNewConversation: () => Promise<void>;
41
+ setIframeElement: (iframe: HTMLIFrameElement) => void;
42
+ recognition: (message: string, commands: DiscoveredCommand[]) => Promise<any>;
43
+ executeCommand: (commandName: string, args?: any[]) => Promise<any>;
44
+ }