mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-04 21:23: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,
|
CursorModelId,
|
||||||
} from '@automaker/types';
|
} from '@automaker/types';
|
||||||
import { CURSOR_MODEL_MAP, cursorModelHasThinking } 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';
|
import { CLAUDE_MODELS, THINKING_LEVELS, ICON_OPTIONS } from '../constants';
|
||||||
|
|
||||||
interface ProfileFormProps {
|
interface ProfileFormProps {
|
||||||
@@ -34,6 +35,8 @@ export function ProfileForm({
|
|||||||
isEditing,
|
isEditing,
|
||||||
hotkeyActive,
|
hotkeyActive,
|
||||||
}: ProfileFormProps) {
|
}: ProfileFormProps) {
|
||||||
|
const { enabledCursorModels } = useAppStore();
|
||||||
|
|
||||||
const [formData, setFormData] = useState({
|
const [formData, setFormData] = useState({
|
||||||
name: profile.name || '',
|
name: profile.name || '',
|
||||||
description: profile.description || '',
|
description: profile.description || '',
|
||||||
@@ -223,7 +226,14 @@ export function ProfileForm({
|
|||||||
Cursor Model
|
Cursor Model
|
||||||
</Label>
|
</Label>
|
||||||
<div className="flex flex-col gap-2">
|
<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
|
<button
|
||||||
key={id}
|
key={id}
|
||||||
type="button"
|
type="button"
|
||||||
@@ -262,7 +272,8 @@ export function ProfileForm({
|
|||||||
</Badge>
|
</Badge>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
))}
|
))
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
{formData.cursorModel && cursorModelHasThinking(formData.cursorModel) && (
|
{formData.cursorModel && cursorModelHasThinking(formData.cursorModel) && (
|
||||||
<p className="text-xs text-muted-foreground">
|
<p className="text-xs text-muted-foreground">
|
||||||
|
|||||||
Reference in New Issue
Block a user