@@ -12,6 +12,7 @@ import {
1212 Moon ,
1313 OpenaiChatgptIcon ,
1414 PanelLeft ,
15+ Pencil ,
1516 Search ,
1617 Settings ,
1718 Sun ,
@@ -64,7 +65,7 @@ export const ChatHeader = memo(function ChatHeader(props: {
6465 // 模型下拉内嵌的执行模式分段器:请求切到 Chat("text") 或 Agent("tools")。
6566 // agent-dev 视为 Agent 的一种,由调用方决定是否保持不降级。
6667 onSelectExecutionMode : ( mode : "text" | "tools" ) => void ;
67- onOpenSettings : ( section ?: SectionId ) => void ;
68+ onOpenSettings : ( section ?: SectionId , providerId ?: string ) => void ;
6869 onToggleTheme : ( ) => void ;
6970 onOpenSidebar : ( ) => void ;
7071 preThemeActions ?: ReactNode ;
@@ -303,28 +304,50 @@ export const ChatHeader = memo(function ChatHeader(props: {
303304 return (
304305 < div key = { group . id } className = "flex flex-col gap-0.5" >
305306 { groupIndex > 0 ? < hr className = "my-1 h-px border-0 bg-muted" /> : null }
306- < button
307- type = "button"
308- onClick = { ( ) => toggleGroup ( group . id ) }
309- aria-expanded = { expanded }
310- title = { expanded ? t ( "chat.collapseProvider" ) : t ( "chat.expandProvider" ) }
311- className = "model-selector-group-label sticky top-0 z-10 flex h-[30px] w-full shrink-0 cursor-pointer items-center gap-1.5 bg-popover/95 px-2 py-0 text-left text-xs font-medium text-muted-foreground backdrop-blur transition-colors hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 supports-[backdrop-filter]:bg-popover/80 dark:text-white/80"
312- >
313- < ProviderBrandIcon
314- type = { group . providerType }
315- className = "h-3.5 w-3.5 opacity-90"
316- />
317- < span className = "min-w-0 flex-1 truncate" > { group . name } </ span >
318- < span className = "inline-flex h-4 min-w-[1.1rem] shrink-0 items-center justify-center rounded-full bg-muted/70 px-1 text-[10px] tabular-nums" >
319- { group . opts . length }
320- </ span >
321- < ChevronDown
322- className = { cn (
323- "h-3.5 w-3.5 shrink-0 transition-transform duration-200" ,
324- expanded && "rotate-180" ,
325- ) }
326- />
327- </ button >
307+ < div className = "group sticky top-0 z-10 flex h-[30px] shrink-0 items-stretch bg-popover/95 backdrop-blur transition-colors hover:bg-muted/40 focus-within:bg-muted/40 supports-[backdrop-filter]:bg-popover/80" >
308+ < button
309+ type = "button"
310+ onClick = { ( ) => toggleGroup ( group . id ) }
311+ aria-expanded = { expanded }
312+ className = "model-selector-group-label flex min-w-0 flex-1 cursor-pointer items-center gap-1.5 px-2 py-0 text-left text-xs font-medium text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 dark:text-white/80"
313+ >
314+ < ProviderBrandIcon
315+ type = { group . providerType }
316+ className = "h-3.5 w-3.5 opacity-90"
317+ />
318+ < span className = "min-w-0 flex-1 truncate" > { group . name } </ span >
319+ </ button >
320+ < button
321+ type = "button"
322+ onClick = { ( ) => {
323+ setIsModelPickerOpen ( false ) ;
324+ onOpenSettings ( "providers" , group . id ) ;
325+ } }
326+ aria-label = { `${ t ( "settings.editProvider" ) } : ${ group . name } ` }
327+ className = "pointer-events-none flex w-7 max-w-0 shrink-0 cursor-pointer items-center justify-center overflow-hidden text-muted-foreground/70 opacity-0 transition-[max-width,opacity,color,background-color] duration-150 group-hover:max-w-7 group-hover:pointer-events-auto group-hover:opacity-100 group-focus-within:max-w-7 group-focus-within:pointer-events-auto group-focus-within:opacity-100 hover:bg-muted/60 hover:text-foreground focus-visible:max-w-7 focus-visible:pointer-events-auto focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30"
328+ >
329+ < Pencil className = "h-3.5 w-3.5" />
330+ </ button >
331+ < button
332+ type = "button"
333+ onClick = { ( ) => toggleGroup ( group . id ) }
334+ aria-expanded = { expanded }
335+ aria-label = { `${
336+ expanded ? t ( "chat.collapseProvider" ) : t ( "chat.expandProvider" )
337+ } : ${ group . name } `}
338+ className = "model-selector-group-label flex shrink-0 cursor-pointer items-center gap-1.5 px-2 py-0 text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 dark:text-white/80"
339+ >
340+ < span className = "inline-flex h-4 min-w-[1.1rem] shrink-0 items-center justify-center rounded-full bg-muted/70 px-1 text-[10px] tabular-nums" >
341+ { group . opts . length }
342+ </ span >
343+ < ChevronDown
344+ className = { cn (
345+ "h-3.5 w-3.5 shrink-0 transition-transform duration-200" ,
346+ expanded && "rotate-180" ,
347+ ) }
348+ />
349+ </ button >
350+ </ div >
328351 { expanded
329352 ? group . opts . map ( ( option ) => {
330353 const isSelected = option . value === selectedValue ;
0 commit comments