@@ -6,7 +6,7 @@ import { useDigitalHumanStore } from '../store/digitalHumanStore';
66import { useChatSessionStore } from '../store/chatSessionStore' ;
77import { useSystemStore } from '../store/systemStore' ;
88import { TTSService , ASRService } from '../core/audio/audioService' ;
9- import { processVoiceCommand } from '../core/audio/voiceCommandProcessor ' ;
9+ import { createVoiceCommandExecutor } from '../core/voiceCommand ' ;
1010import { handleDialogueResponse } from '../core/dialogue/dialogueOrchestrator' ;
1111import React from 'react' ;
1212
@@ -516,18 +516,29 @@ describe('ASRService', () => {
516516 expect ( asrService ) . toBeDefined ( ) ;
517517 } ) ;
518518
519- it ( 'voice command processor handles cancel mute correctly' , ( ) => {
520- // Voice command processing is now in voiceCommandProcessor.ts
521- // This test verifies the integration via processVoiceCommand
519+ it ( 'voice command executor handles cancel mute correctly' , ( ) => {
520+ // Voice command processing now uses VoiceCommandExecutor
521+ // This test verifies the integration via createVoiceCommandExecutor
522522 useDigitalHumanStore . getState ( ) . setMuted ( true ) ;
523523
524- const matched = processVoiceCommand ( '取消静音' , {
525- play : ( ) => useDigitalHumanStore . getState ( ) . play ( ) ,
526- pause : ( ) => useDigitalHumanStore . getState ( ) . pause ( ) ,
527- reset : ( ) => useDigitalHumanStore . getState ( ) . reset ( ) ,
528- setMuted : ( m : boolean ) => useDigitalHumanStore . getState ( ) . setMuted ( m ) ,
524+ const executor = createVoiceCommandExecutor ( {
525+ systemControls : {
526+ play : ( ) => useDigitalHumanStore . getState ( ) . play ( ) ,
527+ pause : ( ) => useDigitalHumanStore . getState ( ) . pause ( ) ,
528+ reset : ( ) => useDigitalHumanStore . getState ( ) . reset ( ) ,
529+ setMuted : ( m : boolean ) => useDigitalHumanStore . getState ( ) . setMuted ( m ) ,
530+ } ,
531+ avatarControls : {
532+ setEmotion : ( ) => { } ,
533+ setExpression : ( ) => { } ,
534+ setAnimation : ( ) => { } ,
535+ setBehavior : ( ) => { } ,
536+ speak : ( ) => { } ,
537+ } ,
529538 } ) ;
530539
540+ const matched = executor . execute ( '取消静音' ) ;
541+
531542 expect ( matched ) . toBe ( true ) ;
532543 expect ( useDigitalHumanStore . getState ( ) . isMuted ) . toBe ( false ) ;
533544 } ) ;
0 commit comments