Initialize profile scoped views before loading

This commit is contained in:
ekko
2026-05-24 10:11:03 +08:00
committed by ekko
parent f8a1b2f6ae
commit f4c70bd849
10 changed files with 85 additions and 11 deletions
@@ -5,17 +5,26 @@ import { useI18n } from 'vue-i18n'
import ProvidersPanel from '@/components/hermes/models/ProvidersPanel.vue'
import ProviderFormModal from '@/components/hermes/models/ProviderFormModal.vue'
import { useModelsStore } from '@/stores/hermes/models'
import { useProfilesStore } from '@/stores/hermes/profiles'
import { checkCopilotToken } from '@/api/hermes/copilot-auth'
const { t } = useI18n()
const modelsStore = useModelsStore()
const profilesStore = useProfilesStore()
const showModal = ref(false)
onMounted(async () => {
async function loadProvidersForProfile() {
if (!profilesStore.activeProfileName || profilesStore.profiles.length === 0) {
await profilesStore.fetchProfiles()
}
// 先 invalidate 后端 copilot 缓存(gh logout / VS Code 退出后下一次 list 立刻反映),
// 再拉 providers 与 appStore 的模型显示名配置。check-token 失败不阻断。
try { await checkCopilotToken() } catch { /* ignore */ }
await modelsStore.fetchProviders()
}
onMounted(async () => {
await loadProvidersForProfile()
})
function openCreateModal() {