@@ -8,7 +8,7 @@ import { useTabs } from "@/context/tabs"
88import { useServerSync , type ServerSync } from "@/context/server-sync"
99import { useLanguage } from "@/context/language"
1010import { useLayout } from "@/context/layout"
11- import { useLocal } from "@/context/local"
11+ import { useLocal , type ModelSelection } from "@/context/local"
1212import { usePermission } from "@/context/permission"
1313import { type ContextItem , type ImageAttachmentPart , type Prompt , type usePrompt } from "@/context/prompt"
1414import { useSDK , type DirectorySDK } from "@/context/sdk"
@@ -191,6 +191,7 @@ type PromptSubmitInput = {
191191 onQueue ?: ( draft : FollowupDraft ) => void
192192 onAbort ?: ( ) => void
193193 onSubmit ?: ( ) => void
194+ model ?: ModelSelection
194195}
195196
196197export function createPromptSubmit ( input : PromptSubmitInput ) {
@@ -298,9 +299,10 @@ export function createPromptSubmit(input: PromptSubmitInput) {
298299 return
299300 }
300301
301- const currentModel = local . model . current ( )
302+ const modelSelection = input . model ?? local . model
303+ const currentModel = modelSelection . current ( )
302304 const currentAgent = local . agent . current ( )
303- const variant = local . model . variant . current ( )
305+ const variant = modelSelection . variant . current ( )
304306 if ( ! currentModel || ! currentAgent ) {
305307 showToast ( {
306308 title : language . t ( "prompt.toast.modelAgentRequired.title" ) ,
@@ -377,7 +379,11 @@ export function createPromptSubmit(input: PromptSubmitInput) {
377379 await startTransition ( ( ) => {
378380 if ( ! session ) return
379381 if ( shouldAutoAccept ) permission . enableAutoAccept ( session . id , sessionDirectory )
380- local . session . promote ( sessionDirectory , session . id )
382+ local . session . promote ( sessionDirectory , session . id , {
383+ agent : currentAgent . name ,
384+ model : { providerID : currentModel . provider . id , modelID : currentModel . id } ,
385+ variant : variant ?? null ,
386+ } )
381387 layout . handoff . setTabs ( base64Encode ( sessionDirectory ) , session . id )
382388 const draftID = search . draftId
383389 if ( draftID ) tabs . promoteDraft ( draftID , { server : tabs . draft ( draftID ) . server , sessionId : session . id } )
0 commit comments