feat(ui): Enhance AI model handling with Cursor support

- Refactor model handling to support both Claude and Cursor models across various components.
- Introduce `stripProviderPrefix` utility for consistent model ID processing.
- Update `CursorProvider` to utilize `isCursorModel` for model validation.
- Implement model override functionality in GitHub issue validation and enhancement routes.
- Add `useCursorStatusInit` hook to initialize Cursor CLI status on app startup.
- Update UI components to reflect changes in model selection and validation processes.

This update improves the flexibility of AI model usage and enhances user experience by allowing quick model overrides.
This commit is contained in:
Kacper
2025-12-30 04:01:56 +01:00
parent 3d655c3298
commit 39f2c8c9ff
38 changed files with 713 additions and 258 deletions

View File

@@ -11,7 +11,7 @@ import { Brain, Bot, Terminal } from 'lucide-react';
import { toast } from 'sonner';
import type {
AIProfile,
AgentModel,
ModelAlias,
ThinkingLevel,
ModelProvider,
CursorModelId,
@@ -42,7 +42,7 @@ export function ProfileForm({
description: profile.description || '',
provider: (profile.provider || 'claude') as ModelProvider,
// Claude-specific
model: profile.model || ('sonnet' as AgentModel),
model: profile.model || ('sonnet' as ModelAlias),
thinkingLevel: profile.thinkingLevel || ('none' as ThinkingLevel),
// Cursor-specific
cursorModel: profile.cursorModel || ('auto' as CursorModelId),
@@ -62,7 +62,7 @@ export function ProfileForm({
});
};
const handleModelChange = (model: AgentModel) => {
const handleModelChange = (model: ModelAlias) => {
setFormData({
...formData,
model,

View File

@@ -1,5 +1,5 @@
import { Brain, Zap, Scale, Cpu, Rocket, Sparkles } from 'lucide-react';
import type { AgentModel, ThinkingLevel } from '@/store/app-store';
import type { ModelAlias, ThinkingLevel } from '@/store/app-store';
// Icon mapping for profiles
export const PROFILE_ICONS: Record<string, React.ComponentType<{ className?: string }>> = {
@@ -22,7 +22,7 @@ export const ICON_OPTIONS = [
];
// Model options for the form
export const CLAUDE_MODELS: { id: AgentModel; label: string }[] = [
export const CLAUDE_MODELS: { id: ModelAlias; label: string }[] = [
{ id: 'haiku', label: 'Claude Haiku' },
{ id: 'sonnet', label: 'Claude Sonnet' },
{ id: 'opus', label: 'Claude Opus' },

View File

@@ -1,8 +1,8 @@
import type { AgentModel, ModelProvider, AIProfile } from '@automaker/types';
import type { ModelAlias, ModelProvider, AIProfile } from '@automaker/types';
import { CURSOR_MODEL_MAP } from '@automaker/types';
// Helper to determine provider from model (legacy, always returns 'claude')
export function getProviderFromModel(model: AgentModel): ModelProvider {
export function getProviderFromModel(model: ModelAlias): ModelProvider {
return 'claude';
}