@@ -76,35 +76,44 @@ const App: React.FC = () => {
7676 const cleanupFunctions = [
7777 window . electronAPI . onProcessingStart ( ( ) => {
7878 setView ( "solutions" )
79+ console . log ( "starting processing" )
7980 } ) ,
8081 window . electronAPI . onProcessingSuccess ( async ( data ) => {
81- queryClient . setQueryData ( [ "problem_statement" ] , data )
82- queryClient . invalidateQueries ( [ "problem_statement" ] )
83- try {
84- // Step 2: Generate solutions
85- console . log ( "Trying to generate solutions" )
86- const solutionsResponse = await axios . post (
87- "http://0.0.0.0:8000/generate_solutions" ,
88- { problem_info : data } ,
89- {
90- timeout : 300000
91- }
92- )
93- console . log ( "Solutions response:" , solutionsResponse . data )
94-
95- // Extract solution code and thoughts from the new schema
96- const solutionCode = solutionsResponse . data . solution . code
97- const thoughtProcess = {
98- thoughts : solutionsResponse . data . solution . thoughts ,
99- description : solutionsResponse . data . solution . description
82+ if ( view == "queue" ) {
83+ console . log ( "the view is queue" )
84+ queryClient . setQueryData ( [ "problem_statement" ] , data )
85+ queryClient . invalidateQueries ( [ "problem_statement" ] )
86+ try {
87+ // Step 2: Generate solutions
88+ console . log ( "Trying to generate solutions" )
89+ const solutionsResponse = await axios . post (
90+ "http://0.0.0.0:8000/generate_solutions" ,
91+ { problem_info : data } ,
92+ {
93+ timeout : 300000
94+ }
95+ )
96+ // Extract solution code and thoughts from the new schema
97+ console . log ( { solutionsResponse } )
98+ const solutionCode = solutionsResponse . data . solution . code
99+ const thoughtProcess = solutionsResponse . data . solution . thoughts
100+
101+ // Store both code and thoughts in React Query
102+ queryClient . setQueryData ( [ "solution" ] , solutionCode )
103+ queryClient . setQueryData ( [ "thoughts" ] , thoughtProcess )
104+ } catch ( error ) {
105+ console . log ( "error generating solutions" )
100106 }
101-
102- // Store both code and thoughts in React Query
103- queryClient . setQueryData ( [ "solution" ] , solutionCode )
104- queryClient . setQueryData ( [ "thoughts" ] , thoughtProcess )
105- } catch ( error ) {
106- console . log ( "error generating solutions" )
107107 }
108+ } ) ,
109+ window . electronAPI . onProcessingExtraSuccess ( ( data ) => {
110+ console . log ( "solutions data" , { data } )
111+ queryClient . invalidateQueries ( [ "solution" ] )
112+ queryClient . invalidateQueries ( [ "thoughts" ] )
113+ const solutionCode = data . solution . code
114+ const thoughtProcess = data . solution . thoughts
115+ queryClient . setQueryData ( [ "solution" ] , solutionCode )
116+ queryClient . setQueryData ( [ "thoughts" ] , thoughtProcess )
108117 } )
109118 ]
110119 return ( ) => cleanupFunctions . forEach ( ( cleanup ) => cleanup ( ) )
0 commit comments