Skip to content

Commit 2652c2c

Browse files
committed
debug connected
1 parent 6613cc0 commit 2652c2c

File tree

3 files changed

+44
-43
lines changed

3 files changed

+44
-43
lines changed

electron/main.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ class AppState {
112112
}
113113

114114
this.mainWindow = new BrowserWindow(windowSettings)
115-
116115
if (process.platform === "darwin") {
117116
this.mainWindow.setVisibleOnAllWorkspaces(true, {
118117
visibleOnFullScreen: true
@@ -281,7 +280,10 @@ class AppState {
281280
preview: await this.getImagePreview(path)
282281
}))
283282
)
284-
283+
console.log("regular screenshots")
284+
screenshots.forEach((screenshot: any) => {
285+
console.log(screenshot.path)
286+
})
285287
const result = await this.processScreenshotsHelper(screenshots)
286288

287289
if (result.success) {
@@ -324,9 +326,9 @@ class AppState {
324326
const result = await this.processExtraScreenshotsHelper(screenshots)
325327

326328
if (result.success) {
327-
console.log("Processing success:", result.data)
329+
console.log("Processing extra screenshots success:", result.data)
328330
this.mainWindow.webContents.send(
329-
this.PROCESSING_EVENTS.SUCCESS,
331+
this.PROCESSING_EVENTS.EXTRA_SUCCESS,
330332
result.data
331333
)
332334
} else {
@@ -478,9 +480,7 @@ class AppState {
478480

479481
ipcMain.handle("get-screenshots", async () => {
480482
console.log({
481-
view: this.view,
482-
screenshotsQueue: this.screenshotQueue,
483-
extraScreenshotQueue: this.extraScreenshotQueue
483+
view: this.view
484484
})
485485
try {
486486
let previews = []

src/App.tsx

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -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())

src/_pages/Solutions.tsx

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ interface problemStatementData {
3131
difficulty: string
3232
}
3333

34-
interface ThoughtsData {
35-
thoughts: string[]
36-
}
37-
3834
// Create an array of widths that look natural for text
3935
const naturalWidths = [
4036
"w-[230px]", // Shorter sentence
@@ -118,7 +114,7 @@ const Solutions: React.FC = () => {
118114
const [problemStatementData, setProblemStatementData] =
119115
useState<problemStatementData | null>(null)
120116
const [solutionData, setSolutionData] = useState<string | null>(null)
121-
const [thoughtsData, setThoughtsData] = useState<ThoughtsData | null>(null)
117+
const [thoughtsData, setThoughtsData] = useState<string[] | null>(null)
122118

123119
const [toastOpen, setToastOpen] = useState(false)
124120
const [toastMessage, setToastMessage] = useState<ToastMessage>({
@@ -186,11 +182,7 @@ const Solutions: React.FC = () => {
186182
setSolutionData(null)
187183
setThoughtsData(null)
188184
}),
189-
window.electronAPI.onProcessingExtraSuccess((data) => {
190-
console.log({ data })
191-
// queryClient.setQueryData(["problem_statement"], data)
192-
// queryClient.invalidateQueries(["problem_statement"])
193-
}),
185+
194186
window.electronAPI.onProcessingError((error: string) => {
195187
showToast(
196188
"Processing Failed",
@@ -337,7 +329,7 @@ const Solutions: React.FC = () => {
337329
thoughtsData && (
338330
<div className="space-y-3">
339331
<div className="space-y-1">
340-
{thoughtsData.thoughts.map((thought, index) => (
332+
{thoughtsData.map((thought, index) => (
341333
<div key={index} className="flex items-start gap-2">
342334
<div className="w-1 h-1 rounded-full bg-blue-400/80 mt-2 shrink-0" />
343335
<div>{thought}</div>

0 commit comments

Comments
 (0)