diff --git a/apps/desktop/src/components/agent-settings-dialog.tsx b/apps/desktop/src/components/agent-settings-dialog.tsx new file mode 100644 index 00000000..3f44d548 --- /dev/null +++ b/apps/desktop/src/components/agent-settings-dialog.tsx @@ -0,0 +1,130 @@ +import { useState, useEffect } from 'react' +import { + Dialog, + DialogContent, + DialogHeader, + DialogFooter, + DialogTitle, + DialogDescription, +} from '@multica/ui/components/ui/dialog' +import { Button } from '@multica/ui/components/ui/button' +import { Input } from '@multica/ui/components/ui/input' +import { Textarea } from '@multica/ui/components/ui/textarea' +import { Label } from '@multica/ui/components/ui/label' +import { HugeiconsIcon } from '@hugeicons/react' +import { Loading03Icon } from '@hugeicons/core-free-icons' + +interface AgentSettingsDialogProps { + open: boolean + onOpenChange: (open: boolean) => void +} + +export function AgentSettingsDialog({ open, onOpenChange }: AgentSettingsDialogProps) { + const [loading, setLoading] = useState(false) + const [saving, setSaving] = useState(false) + const [name, setName] = useState('') + const [userContent, setUserContent] = useState('') + const [profileId, setProfileId] = useState() + + // Load profile data when dialog opens + useEffect(() => { + if (open) { + loadProfile() + } + }, [open]) + + const loadProfile = async () => { + setLoading(true) + try { + const data = await window.electronAPI.profile.get() + setProfileId(data.profileId) + setName(data.name ?? '') + setUserContent(data.userContent ?? '') + } catch (err) { + console.error('Failed to load profile:', err) + } finally { + setLoading(false) + } + } + + const handleSave = async () => { + setSaving(true) + try { + // Update name if changed + await window.electronAPI.profile.updateName(name) + // Update user content + await window.electronAPI.profile.updateUser(userContent) + onOpenChange(false) + } catch (err) { + console.error('Failed to save profile:', err) + } finally { + setSaving(false) + } + } + + return ( + + + + Edit Agent + + Customize your agent's name and personal settings. + + + + {loading ? ( +
+ +
+ ) : ( +
+ {/* Profile ID (read-only) */} + {profileId && ( +
+ Profile: {profileId} +
+ )} + + {/* Name */} +
+ + setName(e.target.value)} + placeholder="My Assistant" + /> +
+ + {/* User Content */} +
+ +

+ Help the agent understand you better. Share your preferences, role, or any context. +

+