File tree Expand file tree Collapse file tree 1 file changed +11
-13
lines changed
Expand file tree Collapse file tree 1 file changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -54,21 +54,19 @@ async function list(client: Anthropic): Promise<ActionMetadata[]> {
5454
5555 return clientModels
5656 . map ( ( modelInfo ) => {
57- // Remove the final part if it's a date (8 digits)
58- const idParts = modelInfo . id . split ( '-' ) ;
59- const normalizedId = idParts [ idParts . length - 1 ] . match ( / ^ \d { 8 } $ / )
60- ? idParts . slice ( 0 , - 1 ) . join ( '-' )
61- : modelInfo . id ;
57+ // Remove the date suffix from the model id
58+ const normalizedId = modelInfo . id . replace ( / - \d { 8 } $ / , '' ) ;
59+ // Get the model reference from the supported models
6260 const ref = SUPPORTED_CLAUDE_MODELS [ normalizedId ] ;
63- return ref
64- ? modelActionMetadata ( {
65- name : ref . name ,
66- info : ref . info ,
67- configSchema : ref . configSchema ,
68- } )
69- : null ;
61+ // Return the model action metadata if the model is supported
62+ return ref ? modelActionMetadata ( {
63+ name : ref . name ,
64+ info : ref . info ,
65+ configSchema : ref . configSchema ,
66+ } ) : undefined ;
7067 } )
71- . filter ( Boolean ) as ActionMetadata [ ] ;
68+ // Filter out undefined values
69+ . filter ( ( metadata ) => metadata !== undefined ) ;
7270}
7371
7472/**
You can’t perform that action at this time.
0 commit comments