Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

feat(desktop): add model name input for OpenRouter configuration

Jiayuan Zhang7691f813761c
diff --git a/apps/desktop/src/renderer/src/components/api-key-dialog.tsx b/apps/desktop/src/renderer/src/components/api-key-dialog.tsx
index 672cc9a8c2..a0e92af4c7 100644
--- a/apps/desktop/src/renderer/src/components/api-key-dialog.tsx
+++ b/apps/desktop/src/renderer/src/components/api-key-dialog.tsx
@@ -18,7 +18,8 @@ interface ApiKeyDialogProps {
onOpenChange: (open: boolean) => void
providerId: string
providerName: string
- onSuccess?: () => void
+ showModelInput?: boolean
+ onSuccess?: (modelId?: string) => void
}
export function ApiKeyDialog({
@@ -26,9 +27,11 @@ export function ApiKeyDialog({
onOpenChange,
providerId,
providerName,
+ showModelInput,
onSuccess,
}: ApiKeyDialogProps) {
const [apiKey, setApiKey] = useState('')
+ const [modelId, setModelId] = useState('')
const [saving, setSaving] = useState(false)
const [error, setError] = useState<string | null>(null)
@@ -38,6 +41,11 @@ export function ApiKeyDialog({
return
}
+ if (showModelInput && !modelId.trim()) {
+ setError('Model name is required')
+ return
+ }
+
setSaving(true)
setError(null)
@@ -45,8 +53,9 @@ export function ApiKeyDialog({
const result = await window.electronAPI.provider.saveApiKey(providerId, apiKey.trim())
if (result.ok) {
setApiKey('')
+ setModelId('')
onOpenChange(false)
- onSuccess?.()
+ onSuccess?.(showModelInput ? modelId.trim() : undefined)
} else {
setError(result.error ?? 'Failed to save API key')
}
@@ -61,6 +70,7 @@ export function ApiKeyDialog({
const handleClose = (isOpen: boolean) => {
if (!isOpen) {
setApiKey('')
+ setModelId('')
setError(null)
}
onOpenChange(isOpen)
@@ -94,11 +104,32 @@ export function ApiKeyDialog({
}
}}
/>
- {error && (
- <p className="text-sm text-destructive">{error}</p>
- )}
</div>
+ {showModelInput && (
+ <div className="space-y-2">
+ <Label htmlFor="model-id">Model</Label>
+ <Input
+ id="model-id"
+ value={modelId}
+ onChange={(e) => setModelId(e.target.value)}
+ placeholder="anthropic/claude-sonnet-4"
+ onKeyDown={(e) => {
+ if (e.key === 'Enter' && !saving) {
+ handleSave()
+ }
+ }}
+ />
+ <p className="text-xs text-muted-foreground">
+ Enter the model identifier from your provider (e.g. anthropic/claude-sonnet-4)
+ </p>
+ </div>
+ )}
+
+ {error && (
+ <p className="text-sm text-destructive">{error}</p>
+ )}
+
<p className="text-xs text-muted-foreground">
Your API key is stored locally in <code className="bg-muted px-1 rounded">~/.super-multica/credentials.json5</code>
</p>
@@ -108,7 +139,7 @@ export function ApiKeyDialog({
<Button variant="outline" onClick={() => handleClose(false)} disabled={saving}>
Cancel
</Button>
- <Button onClick={handleSave} disabled={saving || !apiKey.trim()}>
+ <Button onClick={handleSave} disabled={saving || !apiKey.trim() || (showModelInput && !modelId.trim())}>
{saving && <HugeiconsIcon icon={Loading03Icon} className="size-4 animate-spin mr-2" />}
Save
</Button>