@@ -21,6 +21,7 @@ import { ToolCallMessagePartComponent } from "../../types/message-part-component
2121import { Unsubscribe } from "../../types/unsuscribe" ;
2222import { toToolsJSONSchema } from "../../stream/schema-utils" ;
2323import { Tool } from "../../stream/tool-types" ;
24+ import { BODY_KEY } from "../../utils/request-keys" ;
2425
2526export type CustomUIDataTypes = {
2627 textDelta : string ;
@@ -190,6 +191,8 @@ export function ThreadPrimitiveRoot({ children, ...value }: { children: React.Re
190191 const system = useAiContext ( s => s . system ) ;
191192 const callSettings = useAiContext ( s => s . callSettings ) ;
192193 const config = useAiContext ( s => s . config ) ;
194+ const selectedModel = useAiContext ( s => s . selectedModel ) ;
195+ const disabledTools = useAiContext ( s => s . disabledTools ) ;
193196 const activeThreadId = useThreads ( s => s . activeThreadId ) ;
194197 const [ title , setTitle ] = useState ( 'New thread' ) ;
195198 const [ status , setStatus ] = useState < Thread [ 'status' ] > ( 'regular' ) ;
@@ -228,6 +231,8 @@ export function ThreadPrimitiveRoot({ children, ...value }: { children: React.Re
228231 system ?: string ;
229232 callSettings ?: unknown ;
230233 config ?: unknown ;
234+ selectedModel ?: string ;
235+ disabledTools ?: string [ ] ;
231236 } > ( { tools : { } } ) ;
232237 const addToolOutputRef = useRef <
233238 null | ( (
@@ -259,6 +264,8 @@ export function ThreadPrimitiveRoot({ children, ...value }: { children: React.Re
259264 ...( context . system ? { system : context . system } : { } ) ,
260265 ...( context . callSettings ? { callSettings : context . callSettings } : { } ) ,
261266 ...( context . config ? { config : context . config } : { } ) ,
267+ [ BODY_KEY . SELECTED_MODEL ] : context . selectedModel ?? "" ,
268+ [ BODY_KEY . DISABLED_TOOLS ] : context . disabledTools ?? [ ] ,
262269 tools : toToolsJSONSchema ( Object . values ( toolsRef . current ) as any ) as any ,
263270 } ,
264271 } ;
@@ -649,6 +656,8 @@ export function ThreadPrimitiveRoot({ children, ...value }: { children: React.Re
649656 system,
650657 callSettings,
651658 config,
659+ selectedModel : selectedModel ?? undefined ,
660+ disabledTools : disabledTools ?? [ ] ,
652661 } ;
653662 } , [ ] ) ;
654663
@@ -661,10 +670,12 @@ export function ThreadPrimitiveRoot({ children, ...value }: { children: React.Re
661670 system,
662671 callSettings,
663672 config,
673+ selectedModel : selectedModel ?? undefined ,
674+ disabledTools : disabledTools ?? [ ] ,
664675 } ;
665676 } ) ;
666677 return unsubscribe ;
667- } , [ system , callSettings , config ] ) ;
678+ } , [ system , callSettings , config , selectedModel , disabledTools ] ) ;
668679
669680 useEffect ( ( ) => {
670681 if ( ! storeRef . current ) return ;
0 commit comments