File tree Expand file tree Collapse file tree
crates/agent-core-v2/src/app Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1961,16 +1961,12 @@ export default function App() {
19611961 } ;
19621962
19631963 const refreshModels = async ( ) : Promise < void > => {
1964- setModelsBusy ( true ) ;
19651964 try {
19661965 const nextModels = await invoke < Model [ ] > ( "refresh_models" ) ;
19671966 setModels ( nextModels ) ;
19681967 if ( nextModels . length === 0 ) showNotice ( "当前账号没有可用模型" ) ;
19691968 } catch {
1970- // 刷新失败时回退到配置中已缓存的模型列表。
1971- await loadModels ( ) ;
1972- } finally {
1973- setModelsBusy ( false ) ;
1969+ // Keep using the configured model list when the background refresh fails.
19741970 }
19751971 } ;
19761972
@@ -2024,15 +2020,18 @@ export default function App() {
20242020 . catch ( ( ) => {
20252021 // Vite's browser preview has no Tauri bridge.
20262022 } ) ;
2027- invoke < AuthStatus > ( "auth_status" )
2028- . then ( ( status ) => {
2029- if ( ! active ) return ;
2030- setAuth ( status ) ;
2031- if ( status . loggedIn ) void refreshModels ( ) ;
2032- } )
2033- . catch ( ( ) => {
2034- // Vite's browser preview has no Tauri bridge; the actual desktop app does.
2035- } ) ;
2023+ void loadModels ( ) . then ( ( ) => {
2024+ if ( ! active ) return ;
2025+ void invoke < AuthStatus > ( "auth_status" )
2026+ . then ( ( status ) => {
2027+ if ( ! active ) return ;
2028+ setAuth ( status ) ;
2029+ if ( status . loggedIn ) void refreshModels ( ) ;
2030+ } )
2031+ . catch ( ( ) => {
2032+ // Vite's browser preview has no Tauri bridge; the actual desktop app does.
2033+ } ) ;
2034+ } ) ;
20362035 return ( ) => {
20372036 active = false ;
20382037 } ;
Original file line number Diff line number Diff line change @@ -428,6 +428,12 @@ impl KimiCodeDesktopClient {
428428 }
429429
430430 pub async fn list_models ( & self ) -> Result < Vec < DesktopModel > , String > {
431+ self . app
432+ . get ( CONFIG_SERVICE_ID )
433+ . map_err ( |error| error. to_string ( ) ) ?
434+ . ready ( )
435+ . await
436+ . map_err ( |error| error. to_string ( ) ) ?;
431437 self . configured_desktop_models ( ) . await
432438 }
433439
You can’t perform that action at this time.
0 commit comments