@@ -13,6 +13,7 @@ import {
1313} from "@/components/ui/accordion" ;
1414import { Badge } from "@/components/ui/badge" ;
1515import { Button } from "@/components/ui/button" ;
16+ import { Checkbox } from "@/components/ui/checkbox" ;
1617import {
1718 Combobox ,
1819 ComboboxContent ,
@@ -77,9 +78,11 @@ import {
7778import { parseProtocolsJSON } from "@/features/chat/model/chat-adapter-options" ;
7879import { JsonCodeEditor } from "@/shared/components/json-code-editor" ;
7980import {
81+ imageStreamEnabledFromCapabilities ,
8082 MODEL_CAPABILITIES_PLACEHOLDER ,
8183 ModelCapabilitiesGuideButton ,
8284 ModelCapabilitiesQuickConfig ,
85+ setImageStreamEnabledInCapabilities ,
8386} from "@/features/admin/components/sections/models/model-capabilities-config" ;
8487import type { NativeToolDefinition } from "@/shared/lib/model-option-policy" ;
8588
@@ -118,6 +121,14 @@ const MODEL_SHEET_VENDOR_OPTIONS: VendorOption[] = [
118121 } ) ,
119122] ;
120123
124+ const IMAGE_MEDIA_PROTOCOLS = new Set ( [
125+ "openai_image_generations" ,
126+ "openai_image_edits" ,
127+ "google_image_generation" ,
128+ "xai_image" ,
129+ "xai_image_edits" ,
130+ ] ) ;
131+
121132function buildInitialState ( target : AdminLLMModelDTO | null ) : FormState {
122133 if ( ! target ) {
123134 return {
@@ -248,6 +259,17 @@ export function ModelSheet({ open, mode, target, onClose, onSuccess }: ModelShee
248259 ] ) ) ,
249260 [ sources , target ?. protocolsJSON ] ,
250261 ) ;
262+ const imageStreamEnabled = imageStreamEnabledFromCapabilities ( form . capabilitiesJSON ) ;
263+ const showImageStreamControl = routeProtocols . some ( ( protocol ) => IMAGE_MEDIA_PROTOCOLS . has ( protocol . trim ( ) ) ) ;
264+
265+ function updateImageStreamEnabled ( enabled : boolean ) {
266+ const nextValue = setImageStreamEnabledInCapabilities ( form . capabilitiesJSON , enabled ) ;
267+ if ( nextValue === null ) {
268+ toast . error ( t ( "sheet.capabilitiesQuick.invalidJSON" ) ) ;
269+ return ;
270+ }
271+ setField ( "capabilitiesJSON" , nextValue ) ;
272+ }
251273
252274 function handleClose ( ) {
253275 onClose ( ) ;
@@ -590,6 +612,22 @@ export function ModelSheet({ open, mode, target, onClose, onSuccess }: ModelShee
590612 < ModelCapabilitiesGuideButton t = { t } />
591613 </ div >
592614 </ div >
615+ { showImageStreamControl ? (
616+ < label
617+ htmlFor = "model-image-stream-enabled"
618+ className = "mb-2 flex min-w-0 items-center gap-2 px-1 py-1"
619+ >
620+ < Checkbox
621+ id = "model-image-stream-enabled"
622+ checked = { imageStreamEnabled }
623+ disabled = { pending }
624+ onCheckedChange = { ( checked ) => updateImageStreamEnabled ( checked === true ) }
625+ />
626+ < span className = "min-w-0 truncate text-xs font-medium text-foreground" >
627+ { t ( "sheet.imageStreamEnabled" ) }
628+ </ span >
629+ </ label >
630+ ) : null }
593631 < JsonCodeEditor
594632 id = "model-capabilities-json"
595633 value = { form . capabilitiesJSON }
0 commit comments