File tree Expand file tree Collapse file tree
packages/opencode/src/cli/cmd/tui/component/prompt Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -539,12 +539,25 @@ export function Prompt(props: PromptProps) {
539539 promptModelWarning ( )
540540 return
541541 }
542- const sessionID = props . sessionID
543- ? props . sessionID
544- : await ( async ( ) => {
545- const sessionID = await sdk . client . session . create ( { } ) . then ( ( x ) => x . data ! . id )
546- return sessionID
547- } ) ( )
542+
543+ let sessionID = props . sessionID
544+ if ( sessionID == null ) {
545+ const res = await sdk . client . session . create ( { } )
546+
547+ if ( res . error ) {
548+ console . log ( "Creating a session failed:" , res . error )
549+
550+ toast . show ( {
551+ message : "Creating a session failed. Open console for more details." ,
552+ variant : "error" ,
553+ } )
554+
555+ return
556+ }
557+
558+ sessionID = res . data . id
559+ }
560+
548561 const messageID = Identifier . ascending ( "message" )
549562 let inputText = store . prompt . input
550563
You can’t perform that action at this time.
0 commit comments