@@ -8,18 +8,30 @@ import {
88
99export { XAI_BASE_URL , XAI_REDIRECT_URI , XAI_REFRESH_SKEW_MS } ;
1010
11+ const GROK_47 = "grok-4.7" ;
12+
1113// Local extension over the vendor fallback list (CL-5691): grok-4.7 rides the
1214// same OAuth proxy as the older Grok generations but the vendored catalog has
13- // not caught up yet. The default stays the first vendor entry; drop this shim
14- // once the vendor fallback lists grok-4.7 itself.
15- const [ firstVendorModel , secondVendorModel , ...restVendorModels ] =
16- VENDOR_XAI_DEFAULT_MODELS ;
17- export const XAI_DEFAULT_MODELS = [
18- firstVendorModel ,
19- secondVendorModel ,
20- "grok-4.7" ,
21- ...restVendorModels ,
22- ] as const ;
15+ // not caught up yet. Insert after the second vendor entry and skip when the
16+ // vendor list already includes it so a vendor bump cannot duplicate. The
17+ // default stays the first vendor entry.
18+ export function extendVendorXaiDefaultModels (
19+ vendorModels : readonly string [ ] ,
20+ ) : readonly [ string , ...string [ ] ] {
21+ if ( vendorModels . some ( ( id ) => id === GROK_47 ) ) {
22+ const [ first , ...rest ] = vendorModels ;
23+ if ( first === undefined ) return [ GROK_47 ] ;
24+ return [ first , ...rest ] ;
25+ }
26+ const [ first , second , ...rest ] = vendorModels ;
27+ if ( first === undefined ) return [ GROK_47 ] ;
28+ if ( second === undefined ) return [ first , GROK_47 ] ;
29+ return [ first , second , GROK_47 , ...rest ] ;
30+ }
31+
32+ export const XAI_DEFAULT_MODELS = extendVendorXaiDefaultModels (
33+ VENDOR_XAI_DEFAULT_MODELS ,
34+ ) ;
2335
2436const xaiRedirect = new URL ( XAI_REDIRECT_URI ) ;
2537export const XAI_CALLBACK_PORT = Number ( xaiRedirect . port ) ;
0 commit comments