mirror of
https://github.com/leonvanzyl/autocoder.git
synced 2026-03-30 01:03:09 +00:00
feat: add API provider selection UI and fix stuck features on agent crash
API Provider Selection: - Add provider switcher in Settings modal (Claude, Kimi, GLM, Ollama, Custom) - Auth tokens stored locally only (registry.db), never returned by API - get_effective_sdk_env() builds provider-specific env vars for agent subprocess - All chat sessions (spec, expand, assistant) use provider settings - Backward compatible: defaults to Claude, env vars still work as override Fix Stuck Features: - Add _cleanup_stale_features() to process_manager.py - Reset in_progress features when agent stops, crashes, or fails healthcheck - Prevents features from being permanently stuck after rate limit crashes - Uses separate SQLAlchemy engine to avoid session conflicts with subprocess Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
|
||||
import * as api from '../lib/api'
|
||||
import type { FeatureCreate, FeatureUpdate, ModelsResponse, ProjectSettingsUpdate, Settings, SettingsUpdate } from '../lib/types'
|
||||
import type { FeatureCreate, FeatureUpdate, ModelsResponse, ProjectSettingsUpdate, ProvidersResponse, Settings, SettingsUpdate } from '../lib/types'
|
||||
|
||||
// ============================================================================
|
||||
// Projects
|
||||
@@ -268,6 +268,27 @@ const DEFAULT_SETTINGS: Settings = {
|
||||
testing_agent_ratio: 1,
|
||||
playwright_headless: true,
|
||||
batch_size: 3,
|
||||
api_provider: 'claude',
|
||||
api_base_url: null,
|
||||
api_has_auth_token: false,
|
||||
api_model: null,
|
||||
}
|
||||
|
||||
const DEFAULT_PROVIDERS: ProvidersResponse = {
|
||||
providers: [
|
||||
{ id: 'claude', name: 'Claude (Anthropic)', base_url: null, models: DEFAULT_MODELS.models, default_model: 'claude-opus-4-5-20251101', requires_auth: false },
|
||||
],
|
||||
current: 'claude',
|
||||
}
|
||||
|
||||
export function useAvailableProviders() {
|
||||
return useQuery({
|
||||
queryKey: ['available-providers'],
|
||||
queryFn: api.getAvailableProviders,
|
||||
staleTime: 300000,
|
||||
retry: 1,
|
||||
placeholderData: DEFAULT_PROVIDERS,
|
||||
})
|
||||
}
|
||||
|
||||
export function useAvailableModels() {
|
||||
@@ -319,6 +340,8 @@ export function useUpdateSettings() {
|
||||
},
|
||||
onSettled: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['settings'] })
|
||||
queryClient.invalidateQueries({ queryKey: ['available-models'] })
|
||||
queryClient.invalidateQueries({ queryKey: ['available-providers'] })
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user