-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAgentProfiles.tsx
More file actions
142 lines (129 loc) · 4.75 KB
/
Copy pathAgentProfiles.tsx
File metadata and controls
142 lines (129 loc) · 4.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
import { Brain, Scale, Zap, Check } from 'lucide-react';
import { cn } from '../lib/utils';
import { DEFAULT_AGENT_PROFILES, AVAILABLE_MODELS, THINKING_LEVELS } from '../../shared/constants';
import { useSettingsStore, saveSettings } from '../stores/settings-store';
import type { AgentProfile } from '../../shared/types/settings';
/**
* Icon mapping for agent profile icons
*/
const iconMap: Record<string, React.ElementType> = {
Brain,
Scale,
Zap
};
/**
* Agent Profiles view component
* Displays preset agent profiles for quick model/thinking level configuration
*/
export function AgentProfiles() {
const settings = useSettingsStore((state) => state.settings);
const selectedProfileId = settings.selectedAgentProfile || 'auto';
const handleSelectProfile = async (profileId: string) => {
await saveSettings({ selectedAgentProfile: profileId });
};
/**
* Get human-readable model label
*/
const getModelLabel = (modelValue: string): string => {
const model = AVAILABLE_MODELS.find((m) => m.value === modelValue);
return model?.label || modelValue;
};
/**
* Get human-readable thinking level label
*/
const getThinkingLabel = (thinkingValue: string): string => {
const level = THINKING_LEVELS.find((l) => l.value === thinkingValue);
return level?.label || thinkingValue;
};
/**
* Render a single profile card
*/
const renderProfileCard = (profile: AgentProfile) => {
const isSelected = selectedProfileId === profile.id;
const Icon = iconMap[profile.icon || 'Brain'] || Brain;
return (
<button
type="button"
key={profile.id}
onClick={() => handleSelectProfile(profile.id)}
className={cn(
'relative w-full rounded-xl border p-6 text-left transition-all duration-200',
'hover:border-primary/50 hover:shadow-md',
isSelected
? 'border-primary bg-primary/5 shadow-sm'
: 'border-border bg-card'
)}
>
{/* Selected indicator */}
{isSelected && (
<div className="absolute right-4 top-4 flex h-6 w-6 items-center justify-center rounded-full bg-primary">
<Check className="h-4 w-4 text-primary-foreground" />
</div>
)}
{/* Profile content */}
<div className="flex items-start gap-4">
<div
className={cn(
'flex h-12 w-12 items-center justify-center rounded-lg',
isSelected ? 'bg-primary/10' : 'bg-muted'
)}
>
<Icon
className={cn(
'h-6 w-6',
isSelected ? 'text-primary' : 'text-muted-foreground'
)}
/>
</div>
<div className="flex-1 min-w-0">
<h3 className="font-semibold text-foreground">{profile.name}</h3>
<p className="mt-1 text-sm text-muted-foreground">
{profile.description}
</p>
{/* Model and thinking level badges */}
<div className="mt-4 flex flex-wrap gap-2">
<span className="inline-flex items-center rounded-md bg-muted px-2.5 py-1 text-xs font-medium text-muted-foreground">
{getModelLabel(profile.model)}
</span>
<span className="inline-flex items-center rounded-md bg-muted px-2.5 py-1 text-xs font-medium text-muted-foreground">
{getThinkingLabel(profile.thinkingLevel)} Thinking
</span>
</div>
</div>
</div>
</button>
);
};
return (
<div className="h-full flex flex-col overflow-hidden">
{/* Header */}
<div className="shrink-0 border-b border-border bg-background px-6 py-4">
<div className="flex items-center justify-between">
<div>
<h1 className="text-2xl font-bold text-foreground">Agent Profiles</h1>
<p className="mt-1 text-sm text-muted-foreground">
Select a preset configuration for model and thinking level
</p>
</div>
</div>
</div>
{/* Content */}
<div className="flex-1 overflow-auto p-6">
<div className="max-w-2xl mx-auto space-y-4">
{/* Description */}
<div className="rounded-lg bg-muted/50 p-4 mb-6">
<p className="text-sm text-muted-foreground">
Agent profiles provide preset configurations for Claude model and thinking level.
When you create a new task, these settings will be used as defaults. You can always
override them in the task creation wizard.
</p>
</div>
{/* Profile cards */}
<div className="space-y-3">
{DEFAULT_AGENT_PROFILES.map(renderProfileCard)}
</div>
</div>
</div>
</div>
);
}