This repository was archived by the owner on Apr 18, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed
app/[lang]/chatgpt-startling-by-each-step/[id] Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,6 @@ function StartlingStepDetail({
5757
5858 const handleResponse = ( response : ResponseSend ) => {
5959 const assistantMessage = response . filter ( ( message ) => message . role === "assistant" ) ;
60- console . log ( assistantMessage ) ;
6160 const assistantResponse = assistantMessage [ 0 ] . content ;
6261 setResponse ( assistantResponse ) ;
6362
Original file line number Diff line number Diff line change @@ -29,30 +29,30 @@ function ExecutePromptButton(props: ExecButtonProps) {
2929 const [ isLoading , setIsLoading ] = useState ( props . loading ) ;
3030 const { isOpen, onOpen, onClose } = useDisclosure ( ) ;
3131 const [ hasLogin , setHasLogin ] = useState ( false ) ;
32- const [ localId , setLocalId ] = useState ( props . conversationId ) ;
3332
3433 const handleClick = async ( ) => {
3534 try {
3635 await UserAPI . isLoggedIn ( ) ;
36+ setHasLogin ( true ) ;
3737 } catch ( e ) {
3838 onOpen ( ) ;
3939 setHasLogin ( false ) ;
4040 }
4141
42- if ( ! localId ) {
42+ let conversationId = props . conversationId ;
43+ if ( ! props . conversationId ) {
4344 setIsLoading ( true ) ;
4445 const conversation : ResponseCreateConversation = await createConversation ( ) ;
4546 if ( ! conversation ) {
4647 return ;
4748 }
4849
49- const conversationId = conversation . id || 0 ;
50- setLocalId ( conversationId ) ;
50+ conversationId = conversation . id as number ;
5151 props . updateConversationId ? props . updateConversationId ( conversationId ) : null ;
5252 }
5353
54- if ( localId ) {
55- const response : any = await sendMessage ( localId , props . text ) ;
54+ if ( conversationId ) {
55+ const response : any = await sendMessage ( conversationId , props . text ) ;
5656 if ( response && props . handleResponse ) {
5757 props . handleResponse ( response as ResponseSend ) ;
5858 }
You can’t perform that action at this time.
0 commit comments