@@ -58,34 +58,14 @@ export class RooHandler extends BaseOpenAiCompatibleProvider<string> {
5858 const cloudService = CloudService . instance
5959
6060 this . authStateListener = ( state : { state : AuthState } ) => {
61- if ( state . state === "active-session" ) {
62- const newToken = cloudService . authService ?. getSessionToken ( )
63- this . client = new OpenAI ( {
64- baseURL : this . baseURL ,
65- apiKey : newToken ?? "unauthenticated" ,
66- defaultHeaders : DEFAULT_HEADERS ,
67- } )
68-
69- // Flush cache and reload models with the new auth token
70- flushModels ( "roo" )
71- . then ( ( ) => {
72- return this . loadDynamicModels ( this . fetcherBaseURL , newToken )
73- } )
74- . catch ( ( error ) => {
75- console . error ( "[RooHandler] Failed to reload models after auth:" , error )
76- } )
77- } else if ( state . state === "logged-out" ) {
78- this . client = new OpenAI ( {
79- baseURL : this . baseURL ,
80- apiKey : "unauthenticated" ,
81- defaultHeaders : DEFAULT_HEADERS ,
82- } )
83-
84- // Flush cache when logged out
85- flushModels ( "roo" ) . catch ( ( error ) => {
86- console . error ( "[RooHandler] Failed to flush models on logout:" , error )
87- } )
88- }
61+ // Update OpenAI client with current auth token
62+ // Note: Model cache flush/reload is handled by extension.ts authStateChangedHandler
63+ const newToken = cloudService . authService ?. getSessionToken ( )
64+ this . client = new OpenAI ( {
65+ baseURL : this . baseURL ,
66+ apiKey : newToken ?? "unauthenticated" ,
67+ defaultHeaders : DEFAULT_HEADERS ,
68+ } )
8969 }
9070
9171 cloudService . on ( "auth-state-changed" , this . authStateListener )
0 commit comments