File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
multimodal/gui-agent/operator-aio/src Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,13 @@ import type { AIOHybridOptions } from './types';
2020
2121const defaultLogger = new ConsoleLogger ( undefined , LogLevel . DEBUG ) ;
2222
23+ const arrowKeyMap = {
24+ arrowup : 'up' ,
25+ arrowdown : 'down' ,
26+ arrowleft : 'left' ,
27+ arrowright : 'right' ,
28+ } ;
29+
2330export class AIOHybridOperator extends Operator {
2431 private static currentInstance : AIOHybridOperator | null = null ;
2532 public static async create ( options : AIOHybridOptions ) : Promise < AIOHybridOperator > {
@@ -223,15 +230,18 @@ export class AIOHybridOperator extends Operator {
223230 }
224231 case 'hotkey' :
225232 case 'press' : {
226- const keyStr = actionInputs ?. key || actionInputs ?. hotkey ;
233+ let keyStr = actionInputs ?. key || actionInputs ?. hotkey ;
227234 if ( typeof keyStr !== 'string' ) {
228235 throw new Error ( 'key string is required when press or hotkey' ) ;
229236 }
230- const keys = keyStr . split ( / [ \s + ] / ) . filter ( ( k ) => k . length > 0 ) ;
237+ keyStr = keyStr . toLowerCase ( ) ;
238+ const keys = ( keyStr as string ) . split ( / [ \s + ] / ) . filter ( ( k ) => k . length > 0 ) ;
231239 if ( keys . length > 1 ) {
232240 await this . aioComputer . hotkey ( keys ) ;
233241 } else {
234- await this . aioComputer . press ( keyStr ) ;
242+ // Check if the key can be mapped using arrowKeyMap
243+ const mappedKey = arrowKeyMap [ keyStr as keyof typeof arrowKeyMap ] || keyStr ;
244+ await this . aioComputer . press ( mappedKey ) ;
235245 }
236246 break ;
237247 }
You can’t perform that action at this time.
0 commit comments