mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-05 09:33:07 +00:00
feat: Update ProfileForm to conditionally display enabled Cursor models
- Integrated useAppStore to fetch enabledCursorModels for dynamic rendering of Cursor model selection. - Added a message to inform users when no Cursor models are enabled, guiding them to settings for configuration. - Refactored the model selection logic to filter available models based on the enabled list, enhancing user experience and clarity.
This commit is contained in:
@@ -17,6 +17,7 @@ import type {
|
||||
CursorModelId,
|
||||
} from '@automaker/types';
|
||||
import { CURSOR_MODEL_MAP, cursorModelHasThinking } from '@automaker/types';
|
||||
import { useAppStore } from '@/store/app-store';
|
||||
import { CLAUDE_MODELS, THINKING_LEVELS, ICON_OPTIONS } from '../constants';
|
||||
|
||||
interface ProfileFormProps {
|
||||
@@ -34,6 +35,8 @@ export function ProfileForm({
|
||||
isEditing,
|
||||
hotkeyActive,
|
||||
}: ProfileFormProps) {
|
||||
const { enabledCursorModels } = useAppStore();
|
||||
|
||||
const [formData, setFormData] = useState({
|
||||
name: profile.name || '',
|
||||
description: profile.description || '',
|
||||
@@ -223,7 +226,14 @@ export function ProfileForm({
|
||||
Cursor Model
|
||||
</Label>
|
||||
<div className="flex flex-col gap-2">
|
||||
{Object.entries(CURSOR_MODEL_MAP).map(([id, config]) => (
|
||||
{enabledCursorModels.length === 0 ? (
|
||||
<div className="text-sm text-muted-foreground p-3 border border-dashed rounded-md text-center">
|
||||
No Cursor models enabled. Enable models in Settings → AI Providers.
|
||||
</div>
|
||||
) : (
|
||||
Object.entries(CURSOR_MODEL_MAP)
|
||||
.filter(([id]) => enabledCursorModels.includes(id as CursorModelId))
|
||||
.map(([id, config]) => (
|
||||
<button
|
||||
key={id}
|
||||
type="button"
|
||||
@@ -262,7 +272,8 @@ export function ProfileForm({
|
||||
</Badge>
|
||||
</div>
|
||||
</button>
|
||||
))}
|
||||
))
|
||||
)}
|
||||
</div>
|
||||
{formData.cursorModel && cursorModelHasThinking(formData.cursorModel) && (
|
||||
<p className="text-xs text-muted-foreground">
|
||||
|
||||
Reference in New Issue
Block a user