feat: Add "API Keys & Models" link in Settings Dialog for better discoverability (#645)

* added api key and model in settings dialog

* added aria-label

* removed configure option from model-selector.tsx
This commit is contained in:
Marvelous Ikponmwosa
2026-01-28 14:36:54 +01:00
committed by GitHub
parent f6f693ee8d
commit 1258f98478
7 changed files with 32 additions and 25 deletions

View File

@@ -170,7 +170,6 @@ interface ChatInputProps {
selectedModelId?: string
onModelSelect?: (modelId: string | undefined) => void
showUnvalidatedModels?: boolean
onConfigureModels?: () => void
// Focus control props
shouldFocus?: boolean
onFocused?: () => void
@@ -194,7 +193,6 @@ export const ChatInput = forwardRef<ChatInputRef, ChatInputProps>(
selectedModelId,
onModelSelect = () => {},
showUnvalidatedModels = false,
onConfigureModels = () => {},
shouldFocus = false,
onFocused,
},
@@ -550,7 +548,6 @@ export const ChatInput = forwardRef<ChatInputRef, ChatInputProps>(
models={models}
selectedModelId={selectedModelId}
onSelect={onModelSelect}
onConfigure={onConfigureModels}
disabled={isDisabled}
showUnvalidatedModels={showUnvalidatedModels}
/>

View File

@@ -1368,7 +1368,6 @@ export default function ChatPanel({
selectedModelId={modelConfig.selectedModelId}
onModelSelect={modelConfig.setSelectedModelId}
showUnvalidatedModels={modelConfig.showUnvalidatedModels}
onConfigureModels={() => setShowModelConfigDialog(true)}
shouldFocus={shouldFocusInput}
onFocused={() => setShouldFocusInput(false)}
/>
@@ -1385,6 +1384,7 @@ export default function ChatPanel({
onMinimalStyleChange={setMinimalStyle}
vlmValidationEnabled={vlmValidationEnabled}
onVlmValidationChange={handleVlmValidationChange}
onOpenModelConfig={() => setShowModelConfigDialog(true)}
/>
<ModelConfigDialog

View File

@@ -7,7 +7,6 @@ import {
ChevronDown,
Monitor,
Server,
Settings2,
User,
} from "lucide-react"
import { useEffect, useMemo, useRef, useState } from "react"
@@ -34,7 +33,6 @@ interface ModelSelectorProps {
models: FlattenedModel[]
selectedModelId: string | undefined
onSelect: (modelId: string | undefined) => void
onConfigure: () => void
disabled?: boolean
showUnvalidatedModels?: boolean
}
@@ -85,7 +83,6 @@ export function ModelSelector({
models,
selectedModelId,
onSelect,
onConfigure,
disabled = false,
showUnvalidatedModels = false,
}: ModelSelectorProps) {
@@ -126,9 +123,7 @@ export function ModelSelector({
)
const handleSelect = (value: string) => {
if (value === "__configure__") {
onConfigure()
} else if (value === "__server_default__") {
if (value === "__server_default__") {
onSelect(undefined)
} else {
onSelect(value)
@@ -386,20 +381,6 @@ export function ModelSelector({
</>
)}
{/* Configure Option */}
<ModelSelectorSeparator />
<ModelSelectorGroup>
<ModelSelectorItem
value="__configure__"
onSelect={handleSelect}
className="cursor-pointer text-muted-foreground hover:text-foreground"
>
<Settings2 className="mr-2 h-4 w-4" />
<ModelSelectorName>
{dict.modelConfig.configureModels}
</ModelSelectorName>
</ModelSelectorItem>
</ModelSelectorGroup>
{/* Info text */}
<div className="px-3 py-2 text-xs text-muted-foreground border-t">
{showUnvalidatedModels

View File

@@ -1,6 +1,6 @@
"use client"
import { Github, Info, Moon, Sun, Tag } from "lucide-react"
import { ChevronRight, Github, Info, Moon, Sun, Tag } from "lucide-react"
import { usePathname, useRouter, useSearchParams } from "next/navigation"
import { Suspense, useEffect, useState } from "react"
import { toast } from "sonner"
@@ -70,6 +70,7 @@ interface SettingsDialogProps {
onMinimalStyleChange?: (value: boolean) => void
vlmValidationEnabled?: boolean
onVlmValidationChange?: (value: boolean) => void
onOpenModelConfig?: () => void
}
export const STORAGE_ACCESS_CODE_KEY = "next-ai-draw-io-access-code"
@@ -93,6 +94,7 @@ function SettingsContent({
onMinimalStyleChange = () => {},
vlmValidationEnabled = false,
onVlmValidationChange = () => {},
onOpenModelConfig,
}: SettingsDialogProps) {
const dict = useDictionary()
const router = useRouter()
@@ -284,6 +286,27 @@ function SettingsContent({
{/* Content */}
<div className="px-6 pb-6">
<div className="divide-y divide-border-subtle">
{/* API Keys & Models */}
{onOpenModelConfig && (
<SettingItem
label={dict.settings.apiKeysModels}
description={dict.settings.apiKeysModelsDescription}
>
<Button
variant="ghost"
size="sm"
className="h-9 w-9 p-0"
onClick={() => {
onOpenChange(false)
onOpenModelConfig()
}}
aria-label={dict.settings.apiKeysModels}
>
<ChevronRight className="h-4 w-4" />
</Button>
</SettingItem>
)}
{/* Access Code (conditional) */}
{accessCodeRequired && (
<div className="py-4 first:pt-0 space-y-3">