fix: skip model API requests when no auth token is present (#643)

Prevents infinite retry loop on /api/hermes/available-models when
accessing the app without a token, which triggers server-side 429
rate limiting. Both loadModels() and fetchProviders() now bail out
early if hasApiKey() returns false.

Closes #606

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
ekko
2026-05-12 10:19:14 +08:00
committed by GitHub
parent c36b320e18
commit 73b919e07c
4 changed files with 6 additions and 0 deletions
+1
View File
@@ -12,6 +12,7 @@ const mockSystemApi = vi.hoisted(() => ({
}))
vi.mock('@/api/hermes/system', () => mockSystemApi)
vi.mock('@/api/client', () => ({ hasApiKey: () => true }))
import { useAppStore } from '@/stores/hermes/app'
+1
View File
@@ -10,6 +10,7 @@ const mockSystemApi = vi.hoisted(() => ({
}))
vi.mock('@/api/hermes/system', () => mockSystemApi)
vi.mock('@/api/client', () => ({ hasApiKey: () => true }))
import { useAppStore } from '@/stores/hermes/app'
import { useModelsStore } from '@/stores/hermes/models'