File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,9 +33,6 @@ export default defineCommand({
3333 const key = flags . key as string | undefined ;
3434 const value = flags . value as string | undefined ;
3535
36- // Resolve hyphen aliases to underscore keys
37- const resolvedKey = KEY_ALIASES [ key ] || key ;
38-
3936 if ( ! key || value === undefined ) {
4037 throw new CLIError (
4138 '--key and --value are required.' ,
@@ -44,6 +41,9 @@ export default defineCommand({
4441 ) ;
4542 }
4643
44+ // Resolve hyphen aliases to underscore keys
45+ const resolvedKey : string = KEY_ALIASES [ key ] || key ;
46+
4747 if ( ! VALID_KEYS . includes ( resolvedKey ) ) {
4848 throw new CLIError (
4949 `Invalid config key "${ key } ". Valid keys: ${ VALID_KEYS . join ( ', ' ) } ` ,
Original file line number Diff line number Diff line change 1- import type { Config , ConfigFile } from '../config/schema' ;
1+ import type { Config } from '../config/schema' ;
22
33/**
44 * Resolve the model for a given modality.
5- * Priority: --model flag > config file default > hardcoded fallback.
5+ * Priority: --model flag > config default > hardcoded fallback.
66 */
77export function resolveModel (
8- modality : keyof Pick < ConfigFile , 'default_text_model ' | 'default_speech_model ' | 'default_video_model ' | 'default_music_model' > ,
8+ defaultKey : 'defaultTextModel ' | 'defaultSpeechModel ' | 'defaultVideoModel ' | 'defaultMusicModel' ,
99 fallback : string ,
1010 config : Config ,
1111 flags : Record < string , unknown > ,
@@ -14,8 +14,8 @@ export function resolveModel(
1414 if ( typeof flags . model === 'string' && flags . model . length > 0 ) {
1515 return flags . model ;
1616 }
17- // 2. Config file default
18- const configDefault = config [ modality ] as string | undefined ;
17+ // 2. Config default (runtime, camelCase)
18+ const configDefault = config [ defaultKey ] as string | undefined ;
1919 if ( configDefault ) return configDefault ;
2020 // 3. Hardcoded fallback
2121 return fallback ;
You can’t perform that action at this time.
0 commit comments