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

@@ -1,13 +1,14 @@
import { cn } from '@/lib/utils';
import { useAppStore } from '@/store/app-store';
import type { AgentModel, CursorModelId } from '@automaker/types';
import type { ModelAlias, CursorModelId } from '@automaker/types';
import { stripProviderPrefix } from '@automaker/types';
import { CLAUDE_MODELS, CURSOR_MODELS } from '@/components/views/board-view/shared/model-constants';
interface PhaseModelSelectorProps {
label: string;
description: string;
value: AgentModel | CursorModelId;
onChange: (model: AgentModel | CursorModelId) => void;
value: ModelAlias | CursorModelId;
onChange: (model: ModelAlias | CursorModelId) => void;
}
export function PhaseModelSelector({
@@ -20,13 +21,10 @@ export function PhaseModelSelector({
// Filter Cursor models to only show enabled ones
const availableCursorModels = CURSOR_MODELS.filter((model) => {
const cursorId = model.id.replace('cursor-', '') as CursorModelId;
const cursorId = stripProviderPrefix(model.id) as CursorModelId;
return enabledCursorModels.includes(cursorId);
});
// Check if current value is a Claude model or Cursor model
const isClaudeModel = (v: string) => ['haiku', 'sonnet', 'opus'].includes(v);
return (
<div
className={cn(
@@ -50,7 +48,7 @@ export function PhaseModelSelector({
return (
<button
key={model.id}
onClick={() => onChange(model.id as AgentModel)}
onClick={() => onChange(model.id as ModelAlias)}
className={cn(
'px-3 py-1.5 rounded-lg text-xs font-medium',
'transition-all duration-150',
@@ -75,7 +73,7 @@ export function PhaseModelSelector({
{/* Cursor Models */}
{availableCursorModels.map((model) => {
const cursorId = model.id.replace('cursor-', '') as CursorModelId;
const cursorId = stripProviderPrefix(model.id) as CursorModelId;
const isActive = value === cursorId;
return (
<button