@@ -3,8 +3,8 @@ import { cn } from "@/lib/utils";
33import type { FrontendWorkspaceMetadata } from "@/types/workspace" ;
44import type { RuntimeConfig } from "@/types/runtime" ;
55import { parseRuntimeString } from "@/utils/chatCommands" ;
6- import { getRuntimeKey } from "@/constants/storage" ;
7- import { useSendMessageOptions } from "@/hooks/useSendMessageOptions " ;
6+ import { getRuntimeKey , getModelKey } from "@/constants/storage" ;
7+ import { useModelLRU } from "@/hooks/useModelLRU " ;
88
99interface FirstMessageInputProps {
1010 projectPath : string ;
@@ -25,8 +25,10 @@ export function FirstMessageInput({ projectPath, onWorkspaceCreated }: FirstMess
2525 const [ error , setError ] = useState < string | null > ( null ) ;
2626 const inputRef = useRef < HTMLTextAreaElement > ( null ) ;
2727
28- // Use standard send message options (project-scoped, not workspace-specific)
29- const sendMessageOptions = useSendMessageOptions ( `__project__${ projectPath } ` ) ;
28+ // Get most recent model from LRU (project-scoped preference)
29+ const { recentModels } = useModelLRU ( ) ;
30+ const projectModelKey = getModelKey ( `__project__${ projectPath } ` ) ;
31+ const preferredModel = localStorage . getItem ( projectModelKey ) ?? recentModels [ 0 ] ;
3032
3133 const handleSend = useCallback ( async ( ) => {
3234 if ( ! input . trim ( ) || isSending ) return ;
@@ -43,7 +45,7 @@ export function FirstMessageInput({ projectPath, onWorkspaceCreated }: FirstMess
4345 : undefined ;
4446
4547 const result = await window . api . workspace . sendMessage ( null , input , {
46- ... sendMessageOptions ,
48+ model : preferredModel ,
4749 runtimeConfig,
4850 projectPath, // Pass projectPath when workspaceId is null
4951 } ) ;
@@ -77,7 +79,7 @@ export function FirstMessageInput({ projectPath, onWorkspaceCreated }: FirstMess
7779 setError ( `Failed to create workspace: ${ errorMessage } ` ) ;
7880 setIsSending ( false ) ;
7981 }
80- } , [ input , isSending , projectPath , sendMessageOptions , onWorkspaceCreated ] ) ;
82+ } , [ input , isSending , projectPath , preferredModel , onWorkspaceCreated ] ) ;
8183
8284 const handleKeyDown = useCallback (
8385 ( e : React . KeyboardEvent < HTMLTextAreaElement > ) => {
0 commit comments