Compare commits

..

No commits in common. 'local-build' and 'main' have entirely different histories.

@ -70,7 +70,7 @@ The application uses unidentifiable global keyboard shortcuts that won't be dete
- Delete Last Screenshot: [Control or Cmd + L] - Delete Last Screenshot: [Control or Cmd + L]
- Process Screenshots: [Control or Cmd + Enter] - Process Screenshots: [Control or Cmd + Enter]
- Start New Problem: [Control or Cmd + R] - Start New Problem: [Control or Cmd + R]
- Quit: [Control or Cmd + Q] or [Control or Cmd + Shift + Q] - Quit: [Control or Cmd + Q]
- Decrease Opacity: [Control or Cmd + [] - Decrease Opacity: [Control or Cmd + []
- Increase Opacity: [Control or Cmd + ]] - Increase Opacity: [Control or Cmd + ]]
- Zoom Out: [Control or Cmd + -] - Zoom Out: [Control or Cmd + -]
@ -239,7 +239,6 @@ The packaged applications will be available in the `release` directory.
- View the generated solutions with detailed explanations - View the generated solutions with detailed explanations
- Use debugging feature by taking more screenshots of error messages or code - Use debugging feature by taking more screenshots of error messages or code
- Get structured analysis with identified issues, corrections, and optimizations - Get structured analysis with identified issues, corrections, and optimizations
- For system design answers, type follow-up questions in the box under the design (Enter to send, Shift+Enter for a new line)
- Toggle between solutions and queue views as needed - Toggle between solutions and queue views as needed
5. **Window Management** 5. **Window Management**

@ -7,7 +7,7 @@ import { OpenAI } from "openai"
interface Config { interface Config {
apiKey: string; apiKey: string;
apiProvider: "openai" | "gemini" | "anthropic" | "claude-code"; // Added provider selection apiProvider: "openai" | "gemini" | "anthropic"; // Added provider selection
extractionModel: string; extractionModel: string;
solutionModel: string; solutionModel: string;
debuggingModel: string; debuggingModel: string;
@ -20,9 +20,9 @@ export class ConfigHelper extends EventEmitter {
private defaultConfig: Config = { private defaultConfig: Config = {
apiKey: "", apiKey: "",
apiProvider: "gemini", // Default to Gemini apiProvider: "gemini", // Default to Gemini
extractionModel: "gemini-3.8-flash", // Default to Flash for faster responses extractionModel: "gemini-2.0-flash", // Default to Flash for faster responses
solutionModel: "gemini-3.8-flash", solutionModel: "gemini-2.0-flash",
debuggingModel: "gemini-3.8-flash", debuggingModel: "gemini-2.0-flash",
language: "python", language: "python",
opacity: 1.0 opacity: 1.0
}; };
@ -58,37 +58,29 @@ export class ConfigHelper extends EventEmitter {
/** /**
* Validate and sanitize model selection to ensure only allowed models are used * Validate and sanitize model selection to ensure only allowed models are used
*/ */
private sanitizeModelSelection(model: string, provider: Config["apiProvider"]): string { private sanitizeModelSelection(model: string, provider: "openai" | "gemini" | "anthropic"): string {
if (provider === "openai") { if (provider === "openai") {
// Only allow current GPT-6 models for OpenAI // Only allow gpt-4o and gpt-4o-mini for OpenAI
const allowedModels = ['gpt-6.1-sol', 'gpt-6-astra', 'gpt-6-luna']; const allowedModels = ['gpt-4o', 'gpt-4o-mini'];
if (!allowedModels.includes(model)) { if (!allowedModels.includes(model)) {
console.warn(`Invalid OpenAI model specified: ${model}. Using default model: gpt-6.1-sol`); console.warn(`Invalid OpenAI model specified: ${model}. Using default model: gpt-4o`);
return 'gpt-6.1-sol'; return 'gpt-4o';
} }
return model; return model;
} else if (provider === "gemini") { } else if (provider === "gemini") {
// Only allow current Gemini models // Only allow gemini-1.5-pro and gemini-2.0-flash for Gemini
const allowedModels = ['gemini-3.8-flash', 'gemini-4-argon', 'gemini-3.5-flash-lite']; const allowedModels = ['gemini-1.5-pro', 'gemini-2.0-flash'];
if (!allowedModels.includes(model)) { if (!allowedModels.includes(model)) {
console.warn(`Invalid Gemini model specified: ${model}. Using default model: gemini-3.8-flash`); console.warn(`Invalid Gemini model specified: ${model}. Using default model: gemini-2.0-flash`);
return 'gemini-3.8-flash'; // Changed default to flash return 'gemini-2.0-flash'; // Changed default to flash
} }
return model; return model;
} else if (provider === "anthropic") { } else if (provider === "anthropic") {
// Only allow Claude models // Only allow Claude models
const allowedModels = ['claude-opus-5-5', 'claude-sonnet-5-5', 'claude-haiku-5-5']; const allowedModels = ['claude-3-7-sonnet-20250219', 'claude-3-5-sonnet-20241022', 'claude-3-opus-20240229'];
if (!allowedModels.includes(model)) { if (!allowedModels.includes(model)) {
console.warn(`Invalid Anthropic model specified: ${model}. Using default model: claude-opus-5-5`); console.warn(`Invalid Anthropic model specified: ${model}. Using default model: claude-3-7-sonnet-20250219`);
return 'claude-opus-5-5'; return 'claude-3-7-sonnet-20250219';
}
return model;
} else if (provider === "claude-code") {
// Claude Code takes model aliases, which always point at the latest model in each tier
const allowedModels = ['opus', 'sonnet', 'haiku'];
if (!allowedModels.includes(model)) {
console.warn(`Invalid Claude Code model specified: ${model}. Using default model: opus`);
return 'opus';
} }
return model; return model;
} }
@ -103,7 +95,7 @@ export class ConfigHelper extends EventEmitter {
const config = JSON.parse(configData); const config = JSON.parse(configData);
// Ensure apiProvider is a valid value // Ensure apiProvider is a valid value
if (config.apiProvider !== "openai" && config.apiProvider !== "gemini" && config.apiProvider !== "anthropic" && config.apiProvider !== "claude-code") { if (config.apiProvider !== "openai" && config.apiProvider !== "gemini" && config.apiProvider !== "anthropic") {
config.apiProvider = "gemini"; // Default to Gemini if invalid config.apiProvider = "gemini"; // Default to Gemini if invalid
} }
@ -179,21 +171,17 @@ export class ConfigHelper extends EventEmitter {
// If provider is changing, reset models to the default for that provider // If provider is changing, reset models to the default for that provider
if (updates.apiProvider && updates.apiProvider !== currentConfig.apiProvider) { if (updates.apiProvider && updates.apiProvider !== currentConfig.apiProvider) {
if (updates.apiProvider === "openai") { if (updates.apiProvider === "openai") {
updates.extractionModel = "gpt-6.1-sol"; updates.extractionModel = "gpt-4o";
updates.solutionModel = "gpt-6.1-sol"; updates.solutionModel = "gpt-4o";
updates.debuggingModel = "gpt-6.1-sol"; updates.debuggingModel = "gpt-4o";
} else if (updates.apiProvider === "anthropic") { } else if (updates.apiProvider === "anthropic") {
updates.extractionModel = "claude-opus-5-5"; updates.extractionModel = "claude-3-7-sonnet-20250219";
updates.solutionModel = "claude-opus-5-5"; updates.solutionModel = "claude-3-7-sonnet-20250219";
updates.debuggingModel = "claude-opus-5-5"; updates.debuggingModel = "claude-3-7-sonnet-20250219";
} else if (updates.apiProvider === "claude-code") {
updates.extractionModel = "opus";
updates.solutionModel = "opus";
updates.debuggingModel = "opus";
} else { } else {
updates.extractionModel = "gemini-3.8-flash"; updates.extractionModel = "gemini-2.0-flash";
updates.solutionModel = "gemini-3.8-flash"; updates.solutionModel = "gemini-2.0-flash";
updates.debuggingModel = "gemini-3.8-flash"; updates.debuggingModel = "gemini-2.0-flash";
} }
} }
@ -231,10 +219,6 @@ export class ConfigHelper extends EventEmitter {
*/ */
public hasApiKey(): boolean { public hasApiKey(): boolean {
const config = this.loadConfig(); const config = this.loadConfig();
// Claude Code signs in with the user's Claude subscription, so it needs no key
if (config.apiProvider === "claude-code") {
return true;
}
return !!config.apiKey && config.apiKey.trim().length > 0; return !!config.apiKey && config.apiKey.trim().length > 0;
} }

@ -1,8 +1,6 @@
// ProcessingHelper.ts // ProcessingHelper.ts
import fs from "node:fs" import fs from "node:fs"
import os from "node:os"
import path from "node:path" import path from "node:path"
import { spawn } from "node:child_process"
import { ScreenshotHelper } from "./ScreenshotHelper" import { ScreenshotHelper } from "./ScreenshotHelper"
import { IProcessingHelperDeps } from "./main" import { IProcessingHelperDeps } from "./main"
import * as axios from "axios" import * as axios from "axios"
@ -27,7 +25,7 @@ interface GeminiResponse {
candidates: Array<{ candidates: Array<{
content: { content: {
parts: Array<{ parts: Array<{
text?: string; text: string;
}>; }>;
}; };
finishReason: string; finishReason: string;
@ -55,7 +53,6 @@ export class ProcessingHelper {
// AbortControllers for API requests // AbortControllers for API requests
private currentProcessingAbortController: AbortController | null = null private currentProcessingAbortController: AbortController | null = null
private currentExtraProcessingAbortController: AbortController | null = null private currentExtraProcessingAbortController: AbortController | null = null
private currentFollowUpAbortController: AbortController | null = null
constructor(deps: IProcessingHelperDeps) { constructor(deps: IProcessingHelperDeps) {
this.deps = deps this.deps = deps
@ -480,7 +477,7 @@ export class ProcessingHelper {
const messages = [ const messages = [
{ {
role: "system" as const, role: "system" as const,
content: "You are a coding challenge interpreter. Analyze the screenshot of the coding problem and extract all relevant information. Return the information in JSON format with these fields: problem_statement, constraints, example_input, example_output, problem_type. Set problem_type to 'system_design' if the screenshots ask you to design a system, product or architecture rather than write code, otherwise 'coding'. Use exactly these keys and no others. For a system design question, put the design question itself in problem_statement, word for word. Example or possible questions that a page says might be asked count as design questions; if several are listed, include all of them, numbered. Put surrounding guidance such as tips or evaluation criteria in constraints. Just return the structured JSON without any other text." content: "You are a coding challenge interpreter. Analyze the screenshot of the coding problem and extract all relevant information. Return the information in JSON format with these fields: problem_statement, constraints, example_input, example_output. Just return the structured JSON without any other text."
}, },
{ {
role: "user" as const, role: "user" as const,
@ -499,9 +496,10 @@ export class ProcessingHelper {
// Send to OpenAI Vision API // Send to OpenAI Vision API
const extractionResponse = await this.openaiClient.chat.completions.create({ const extractionResponse = await this.openaiClient.chat.completions.create({
model: config.extractionModel || "gpt-6.1-sol", model: config.extractionModel || "gpt-4o",
messages: messages, messages: messages,
max_completion_tokens: 16000 max_tokens: 4000,
temperature: 0.2
}); });
// Parse the response // Parse the response
@ -533,7 +531,7 @@ export class ProcessingHelper {
role: "user", role: "user",
parts: [ parts: [
{ {
text: `You are a coding challenge interpreter. Analyze the screenshots of the coding problem and extract all relevant information. Return the information in JSON format with these fields: problem_statement, constraints, example_input, example_output, problem_type. Set problem_type to 'system_design' if the screenshots ask you to design a system, product or architecture rather than write code, otherwise 'coding'. Use exactly these keys and no others. For a system design question, put the design question itself in problem_statement, word for word. Example or possible questions that a page says might be asked count as design questions; if several are listed, include all of them, numbered. Put surrounding guidance such as tips or evaluation criteria in constraints. Just return the structured JSON without any other text. Preferred coding language we gonna use for this problem is ${language}.` text: `You are a coding challenge interpreter. Analyze the screenshots of the coding problem and extract all relevant information. Return the information in JSON format with these fields: problem_statement, constraints, example_input, example_output. Just return the structured JSON without any other text. Preferred coding language we gonna use for this problem is ${language}.`
}, },
...imageDataList.map(data => ({ ...imageDataList.map(data => ({
inlineData: { inlineData: {
@ -547,11 +545,12 @@ export class ProcessingHelper {
// Make API request to Gemini // Make API request to Gemini
const response = await axios.default.post( const response = await axios.default.post(
`https://generativelanguage.googleapis.com/v1beta/models/${config.extractionModel || "gemini-3.8-flash"}:generateContent?key=${this.geminiApiKey}`, `https://generativelanguage.googleapis.com/v1beta/models/${config.extractionModel || "gemini-2.0-flash"}:generateContent?key=${this.geminiApiKey}`,
{ {
contents: geminiMessages, contents: geminiMessages,
generationConfig: { generationConfig: {
maxOutputTokens: 16000 temperature: 0.2,
maxOutputTokens: 4000
} }
}, },
{ signal } { signal }
@ -563,7 +562,7 @@ export class ProcessingHelper {
throw new Error("Empty response from Gemini API"); throw new Error("Empty response from Gemini API");
} }
const responseText = responseData.candidates[0].content.parts.map(part => part.text ?? "").join(""); const responseText = responseData.candidates[0].content.parts[0].text;
// Handle when Gemini might wrap the JSON in markdown code blocks // Handle when Gemini might wrap the JSON in markdown code blocks
const jsonText = responseText.replace(/```json|```/g, '').trim(); const jsonText = responseText.replace(/```json|```/g, '').trim();
@ -575,8 +574,8 @@ export class ProcessingHelper {
error: "Failed to process with Gemini API. Please check your API key or try again later." error: "Failed to process with Gemini API. Please check your API key or try again later."
}; };
} }
} else if (config.apiProvider === "anthropic" || config.apiProvider === "claude-code") { } else if (config.apiProvider === "anthropic") {
if (config.apiProvider === "anthropic" && !this.anthropicClient) { if (!this.anthropicClient) {
return { return {
success: false, success: false,
error: "Anthropic API key not configured. Please check your settings." error: "Anthropic API key not configured. Please check your settings."
@ -590,7 +589,7 @@ export class ProcessingHelper {
content: [ content: [
{ {
type: "text" as const, type: "text" as const,
text: `Extract the coding problem details from these screenshots. Return in JSON format with these fields: problem_statement, constraints, example_input, example_output, problem_type. Set problem_type to 'system_design' if the screenshots ask you to design a system, product or architecture rather than write code, otherwise 'coding'. Use exactly these keys and no others. For a system design question, put the design question itself in problem_statement, word for word. Example or possible questions that a page says might be asked count as design questions; if several are listed, include all of them, numbered. Put surrounding guidance such as tips or evaluation criteria in constraints. Preferred coding language is ${language}. Return only the JSON object, with no other text.` text: `Extract the coding problem details from these screenshots. Return in JSON format with these fields: problem_statement, constraints, example_input, example_output. Preferred coding language is ${language}.`
}, },
...imageDataList.map(data => ({ ...imageDataList.map(data => ({
type: "image" as const, type: "image" as const,
@ -604,19 +603,19 @@ export class ProcessingHelper {
} }
]; ];
const responseText = config.apiProvider === "claude-code" const response = await this.anthropicClient.messages.create({
? await this.runClaudeCode(config.extractionModel || "opus", messages, signal) model: config.extractionModel || "claude-3-7-sonnet-20250219",
: await this.createAnthropicText(config.extractionModel || "claude-opus-5-5", messages); max_tokens: 4000,
// Claude sometimes wraps the JSON in a sentence or a code fence; keep only the object messages: messages,
const jsonText = responseText.slice(responseText.indexOf("{"), responseText.lastIndexOf("}") + 1); temperature: 0.2
});
const responseText = (response.content[0] as { type: 'text', text: string }).text;
const jsonText = responseText.replace(/```json|```/g, '').trim();
problemInfo = JSON.parse(jsonText); problemInfo = JSON.parse(jsonText);
} catch (error: any) { } catch (error: any) {
console.error("Error using Anthropic API:", error); console.error("Error using Anthropic API:", error);
if (config.apiProvider === "claude-code") {
return { success: false, error: `Claude Code: ${error.message}` };
}
// Add specific handling for Claude's limitations // Add specific handling for Claude's limitations
if (error.status === 429) { if (error.status === 429) {
return { return {
@ -734,41 +733,8 @@ export class ProcessingHelper {
}); });
} }
// System design questions get a written design instead of code and complexity
const isSystemDesign = problemInfo.problem_type === "system_design";
// Create prompt for solution generation // Create prompt for solution generation
const promptText = isSystemDesign ? ` const promptText = `
Answer the following system design interview question the way a strong candidate would, following the Hello Interview delivery framework.
QUESTION:
${problemInfo.problem_statement}
ADDITIONAL CONTEXT:
${problemInfo.constraints || "None provided."}
If several design questions are listed, answer the first one and name the others in one line at the very end.
Use exactly these markdown sections, in this order:
## Functional Requirements
(the top 3 core requirements as "Users should be able to..." statements, then a short "Below the line (out of scope)" list)
## Non-Functional Requirements
(the 3 to 5 that matter most as "The system should..." statements, quantified where possible, such as "search latency under 500ms" or "availability over consistency", then a short "Below the line" list; include a scale estimate only where it changes the design)
## Core Entities
(a bulleted list of entity names with a few words each, not a full schema)
## API
(REST endpoints covering each functional requirement, such as "GET /businesses?query&lat&long&category -> Business[]"; take the user from the auth token, never from the request body)
## High-Level Design
(build it up one functional requirement at a time, with a ### subsection per requirement saying which components serve it and how a request flows through them; finish with one small ASCII diagram of the complete design, listing next to each database only the fields that matter)
## Deep Dives
(the 3 or 4 problems an interviewer would probe to meet the non-functional requirements, each as a ### heading phrased as a question; under each, give a Bad, Good and Great solution in a line or two apiece saying what each gets wrong, then explain the Great one in more depth)
## Key Decisions
(one bullet per decision, in the form "Decision: chosen option over the alternative, because of the trade-off")
Only for a data-processing system such as a web crawler, add a ## Data Flow section after API listing the steps from input to output.
Keep the high-level design simple and save the complexity for the deep dives. Always write the full answer: cover every section above completely, with no length limit, and never shorten a section, skip one or replace it with a summary. Use short bullets wherever prose isn't needed.
` : `
Generate a detailed solution for the following coding problem: Generate a detailed solution for the following coding problem:
PROBLEM STATEMENT: PROBLEM STATEMENT:
@ -809,12 +775,13 @@ Your solution should be efficient, well-commented, and handle edge cases.
// Send to OpenAI API // Send to OpenAI API
const solutionResponse = await this.openaiClient.chat.completions.create({ const solutionResponse = await this.openaiClient.chat.completions.create({
model: config.solutionModel || "gpt-6.1-sol", model: config.solutionModel || "gpt-4o",
messages: [ messages: [
{ role: "system", content: "You are an expert coding interview assistant. Provide clear, optimal solutions with detailed explanations." }, { role: "system", content: "You are an expert coding interview assistant. Provide clear, optimal solutions with detailed explanations." },
{ role: "user", content: promptText } { role: "user", content: promptText }
], ],
max_completion_tokens: 16000 max_tokens: 4000,
temperature: 0.2
}); });
responseContent = solutionResponse.choices[0].message.content; responseContent = solutionResponse.choices[0].message.content;
@ -842,11 +809,12 @@ Your solution should be efficient, well-commented, and handle edge cases.
// Make API request to Gemini // Make API request to Gemini
const response = await axios.default.post( const response = await axios.default.post(
`https://generativelanguage.googleapis.com/v1beta/models/${config.solutionModel || "gemini-3.8-flash"}:generateContent?key=${this.geminiApiKey}`, `https://generativelanguage.googleapis.com/v1beta/models/${config.solutionModel || "gemini-2.0-flash"}:generateContent?key=${this.geminiApiKey}`,
{ {
contents: geminiMessages, contents: geminiMessages,
generationConfig: { generationConfig: {
maxOutputTokens: 16000 temperature: 0.2,
maxOutputTokens: 4000
} }
}, },
{ signal } { signal }
@ -858,7 +826,7 @@ Your solution should be efficient, well-commented, and handle edge cases.
throw new Error("Empty response from Gemini API"); throw new Error("Empty response from Gemini API");
} }
responseContent = responseData.candidates[0].content.parts.map(part => part.text ?? "").join(""); responseContent = responseData.candidates[0].content.parts[0].text;
} catch (error) { } catch (error) {
console.error("Error using Gemini API for solution:", error); console.error("Error using Gemini API for solution:", error);
return { return {
@ -866,9 +834,9 @@ Your solution should be efficient, well-commented, and handle edge cases.
error: "Failed to generate solution with Gemini API. Please check your API key or try again later." error: "Failed to generate solution with Gemini API. Please check your API key or try again later."
}; };
} }
} else if (config.apiProvider === "anthropic" || config.apiProvider === "claude-code") { } else if (config.apiProvider === "anthropic") {
// Anthropic processing // Anthropic processing
if (config.apiProvider === "anthropic" && !this.anthropicClient) { if (!this.anthropicClient) {
return { return {
success: false, success: false,
error: "Anthropic API key not configured. Please check your settings." error: "Anthropic API key not configured. Please check your settings."
@ -889,16 +857,17 @@ Your solution should be efficient, well-commented, and handle edge cases.
]; ];
// Send to Anthropic API // Send to Anthropic API
responseContent = config.apiProvider === "claude-code" const response = await this.anthropicClient.messages.create({
? await this.runClaudeCode(config.solutionModel || "opus", messages, signal) model: config.solutionModel || "claude-3-7-sonnet-20250219",
: await this.createAnthropicText(config.solutionModel || "claude-opus-5-5", messages); max_tokens: 4000,
messages: messages,
temperature: 0.2
});
responseContent = (response.content[0] as { type: 'text', text: string }).text;
} catch (error: any) { } catch (error: any) {
console.error("Error using Anthropic API for solution:", error); console.error("Error using Anthropic API for solution:", error);
if (config.apiProvider === "claude-code") {
return { success: false, error: `Claude Code: ${error.message}` };
}
// Add specific handling for Claude's limitations // Add specific handling for Claude's limitations
if (error.status === 429) { if (error.status === 429) {
return { return {
@ -919,26 +888,6 @@ Your solution should be efficient, well-commented, and handle edge cases.
} }
} }
if (isSystemDesign) {
// The whole write-up is the design; its Key Decisions bullets fill the thoughts list
const decisionsMatch = responseContent?.match(/##\s*Key Decisions\s*\n([\s\S]*?)(?=\n##\s|$)/i);
const decisions = decisionsMatch
? decisionsMatch[1].split("\n")
.filter((line) => /^\s*(?:[-*•]|\d+\.)\s+/.test(line))
.map((line) => line.replace(/^\s*(?:[-*•]|\d+\.)\s+/, "").trim())
: [];
return {
success: true,
data: {
code: responseContent,
thoughts: decisions.length > 0 ? decisions : ["See the design below"],
time_complexity: "",
space_complexity: ""
}
};
}
// Extract parts from the response // Extract parts from the response
const codeMatch = responseContent.match(/```(?:\w+)?\s*([\s\S]*?)```/); const codeMatch = responseContent.match(/```(?:\w+)?\s*([\s\S]*?)```/);
const code = codeMatch ? codeMatch[1].trim() : responseContent; const code = codeMatch ? codeMatch[1].trim() : responseContent;
@ -1118,9 +1067,10 @@ If you include code examples, use proper markdown code blocks with language spec
} }
const debugResponse = await this.openaiClient.chat.completions.create({ const debugResponse = await this.openaiClient.chat.completions.create({
model: config.debuggingModel || "gpt-6.1-sol", model: config.debuggingModel || "gpt-4o",
messages: messages, messages: messages,
max_completion_tokens: 16000 max_tokens: 4000,
temperature: 0.2
}); });
debugContent = debugResponse.choices[0].message.content; debugContent = debugResponse.choices[0].message.content;
@ -1180,11 +1130,12 @@ If you include code examples, use proper markdown code blocks with language spec
} }
const response = await axios.default.post( const response = await axios.default.post(
`https://generativelanguage.googleapis.com/v1beta/models/${config.debuggingModel || "gemini-3.8-flash"}:generateContent?key=${this.geminiApiKey}`, `https://generativelanguage.googleapis.com/v1beta/models/${config.debuggingModel || "gemini-2.0-flash"}:generateContent?key=${this.geminiApiKey}`,
{ {
contents: geminiMessages, contents: geminiMessages,
generationConfig: { generationConfig: {
maxOutputTokens: 16000 temperature: 0.2,
maxOutputTokens: 4000
} }
}, },
{ signal } { signal }
@ -1196,7 +1147,7 @@ If you include code examples, use proper markdown code blocks with language spec
throw new Error("Empty response from Gemini API"); throw new Error("Empty response from Gemini API");
} }
debugContent = responseData.candidates[0].content.parts.map(part => part.text ?? "").join(""); debugContent = responseData.candidates[0].content.parts[0].text;
} catch (error) { } catch (error) {
console.error("Error using Gemini API for debugging:", error); console.error("Error using Gemini API for debugging:", error);
return { return {
@ -1204,8 +1155,8 @@ If you include code examples, use proper markdown code blocks with language spec
error: "Failed to process debug request with Gemini API. Please check your API key or try again later." error: "Failed to process debug request with Gemini API. Please check your API key or try again later."
}; };
} }
} else if (config.apiProvider === "anthropic" || config.apiProvider === "claude-code") { } else if (config.apiProvider === "anthropic") {
if (config.apiProvider === "anthropic" && !this.anthropicClient) { if (!this.anthropicClient) {
return { return {
success: false, success: false,
error: "Anthropic API key not configured. Please check your settings." error: "Anthropic API key not configured. Please check your settings."
@ -1264,16 +1215,17 @@ If you include code examples, use proper markdown code blocks with language spec
}); });
} }
debugContent = config.apiProvider === "claude-code" const response = await this.anthropicClient.messages.create({
? await this.runClaudeCode(config.debuggingModel || "opus", messages, signal) model: config.debuggingModel || "claude-3-7-sonnet-20250219",
: await this.createAnthropicText(config.debuggingModel || "claude-opus-5-5", messages); max_tokens: 4000,
messages: messages,
temperature: 0.2
});
debugContent = (response.content[0] as { type: 'text', text: string }).text;
} catch (error: any) { } catch (error: any) {
console.error("Error using Anthropic API for debugging:", error); console.error("Error using Anthropic API for debugging:", error);
if (config.apiProvider === "claude-code") {
return { success: false, error: `Claude Code: ${error.message}` };
}
// Add specific handling for Claude's limitations // Add specific handling for Claude's limitations
if (error.status === 429) { if (error.status === 429) {
return { return {
@ -1338,128 +1290,9 @@ If you include code examples, use proper markdown code blocks with language spec
} }
} }
/**
* Answer a follow-up question about a system design answer. The question, the design
* and the earlier follow-ups go in as a single prompt, so every provider (including the
* Claude Code CLI, which takes one turn per call) sees the whole conversation.
*/
public async answerFollowUp(request: {
design: string
history: Array<{ question: string; answer: string }>
question: string
}): Promise<{ success: boolean; data?: string; error?: string }> {
const problemInfo = this.deps.getProblemInfo();
const config = configHelper.loadConfig();
const earlierFollowUps = request.history
.map((turn) => `Q: ${turn.question}\nA: ${turn.answer}`)
.join("\n\n");
const promptText = `
You are an expert system design interview assistant. You answered the system design question below; now answer a follow-up question about your design.
QUESTION:
${problemInfo?.problem_statement || "Not available."}
ADDITIONAL CONTEXT:
${problemInfo?.constraints || "None provided."}
YOUR DESIGN:
${request.design}
${earlierFollowUps ? `\nEARLIER FOLLOW-UPS:\n${earlierFollowUps}\n` : ""}
FOLLOW-UP QUESTION:
${request.question}
Always give the full write-up: answer the follow-up completely and in depth, with no length limit, building on the design above rather than repeating it. If it changes a requirement or adds a constraint, walk through everything in the design that changes and why. Use markdown with short bullets wherever prose isn't needed, and add an ASCII diagram if it helps.
`;
this.currentFollowUpAbortController = new AbortController();
const { signal } = this.currentFollowUpAbortController;
try {
let answer: string | null | undefined;
if (config.apiProvider === "openai") {
if (!this.openaiClient) {
return { success: false, error: "OpenAI API key not configured. Please check your settings." };
}
const response = await this.openaiClient.chat.completions.create({
model: config.solutionModel || "gpt-6.1-sol",
messages: [{ role: "user", content: promptText }],
max_completion_tokens: 16000
}, { signal });
answer = response.choices[0].message.content;
} else if (config.apiProvider === "gemini") {
if (!this.geminiApiKey) {
return { success: false, error: "Gemini API key not configured. Please check your settings." };
}
const response = await axios.default.post(
`https://generativelanguage.googleapis.com/v1beta/models/${config.solutionModel || "gemini-3.8-flash"}:generateContent?key=${this.geminiApiKey}`,
{
contents: [{ role: "user", parts: [{ text: promptText }] }],
generationConfig: {
maxOutputTokens: 16000
}
},
{ signal }
);
const responseData = response.data as GeminiResponse;
answer = responseData.candidates?.[0]?.content?.parts?.map(part => part.text ?? "").join("");
} else if (config.apiProvider === "anthropic" || config.apiProvider === "claude-code") {
if (config.apiProvider === "anthropic" && !this.anthropicClient) {
return { success: false, error: "Anthropic API key not configured. Please check your settings." };
}
const messages = [
{
role: "user" as const,
content: [{ type: "text" as const, text: promptText }]
}
];
answer = config.apiProvider === "claude-code"
? await this.runClaudeCode(config.solutionModel || "opus", messages, signal)
: await this.createAnthropicText(config.solutionModel || "claude-opus-5-5", messages, signal);
}
if (!answer?.trim()) {
return { success: false, error: "The model returned an empty answer. Please try again." };
}
return { success: true, data: answer.trim() };
} catch (error: any) {
console.error("Error answering follow-up:", error);
if (signal.aborted) {
return { success: false, error: "The follow-up was canceled." };
}
return {
success: false,
error: config.apiProvider === "claude-code"
? `Claude Code: ${error.message}`
: error.message || "Failed to answer the follow-up. Please try again."
};
} finally {
// A reset may already have replaced this controller with a newer request's
if (this.currentFollowUpAbortController?.signal === signal) {
this.currentFollowUpAbortController = null;
}
}
}
public cancelOngoingRequests(): void { public cancelOngoingRequests(): void {
let wasCancelled = false let wasCancelled = false
if (this.currentFollowUpAbortController) {
this.currentFollowUpAbortController.abort()
this.currentFollowUpAbortController = null
}
if (this.currentProcessingAbortController) { if (this.currentProcessingAbortController) {
this.currentProcessingAbortController.abort() this.currentProcessingAbortController.abort()
this.currentProcessingAbortController = null this.currentProcessingAbortController = null
@ -1481,125 +1314,4 @@ Always give the full write-up: answer the follow-up completely and in depth, wit
mainWindow.webContents.send(this.deps.PROCESSING_EVENTS.NO_SCREENSHOTS) mainWindow.webContents.send(this.deps.PROCESSING_EVENTS.NO_SCREENSHOTS)
} }
} }
/**
* Send a request to Claude and return the text of its reply.
* Current Claude models think before answering (thinking tokens count toward
* max_tokens) and reject a custom temperature. Opus and Sonnet requests opt into
* server-side refusal fallbacks; Haiku has none.
*/
private async createAnthropicText(
model: string,
messages: Anthropic.Beta.Messages.BetaMessageParam[],
signal?: AbortSignal
): Promise<string> {
if (!this.anthropicClient) {
throw new Error("Anthropic client not initialized");
}
// SDK 0.39 predates the fallbacks parameter, hence the cast below
const fallbackParams = model.startsWith("claude-haiku")
? {}
: { betas: ["server-side-fallback-2026-07-01"], fallbacks: "default" };
const response = await this.anthropicClient.beta.messages.create({
model,
max_tokens: 16000,
messages,
...fallbackParams
} as Anthropic.Beta.Messages.MessageCreateParamsNonStreaming, { signal });
if ((response.stop_reason as string) === "refusal") {
throw new Error("Claude declined to answer this request.");
}
return response.content
.filter((block): block is Anthropic.Beta.Messages.BetaTextBlock => block.type === "text")
.map((block) => block.text)
.join("");
}
/**
* Send a request through the local Claude Code CLI, so it counts against the user's
* Claude subscription instead of API billing. Messages go in as stream-json, which lets
* screenshots travel inline, with every tool disabled and the user's own Claude Code
* customizations (CLAUDE.md, hooks, MCP servers) switched off by --safe-mode.
*/
private runClaudeCode(
model: string,
messages: Anthropic.Beta.Messages.BetaMessageParam[],
signal?: AbortSignal
): Promise<string> {
// Drop the variables a parent Claude Code session sets (a nested session refuses to
// start) and any API key, so the CLI signs in with the subscription
const env: NodeJS.ProcessEnv = {};
for (const [name, value] of Object.entries(process.env)) {
if (!/^(CLAUDECODE$|CLAUDE_CODE_|CLAUDE_PID$|CLAUDE_EFFORT$|ANTHROPIC_API_KEY$)/.test(name)) {
env[name] = value;
}
}
// Apps opened from Finder get a minimal PATH, so add the usual install locations
env.PATH = [env.PATH, path.join(os.homedir(), ".local", "bin"), "/opt/homebrew/bin", "/usr/local/bin"]
.filter(Boolean)
.join(path.delimiter);
const args = [
"-p",
"--input-format", "stream-json",
"--output-format", "stream-json",
"--verbose",
"--model", model,
// Matches the API's default for Opus; Claude Code's own default runs far longer per answer
"--effort", "medium",
"--tools", "",
"--safe-mode",
"--no-session-persistence",
"--system-prompt", "You are an expert coding interview assistant. Follow the user's instructions exactly and answer directly."
];
return new Promise((resolve, reject) => {
const child = spawn("claude", args, {
cwd: app.getPath("temp"),
env,
signal,
timeout: 5 * 60 * 1000
});
let stdout = "";
let stderr = "";
child.stdout.on("data", (chunk) => { stdout += chunk; });
child.stderr.on("data", (chunk) => { stderr += chunk; });
// A failed spawn also fails the stdin write; the process "error" event reports it
child.stdin.on("error", () => {});
child.on("error", (error: NodeJS.ErrnoException) => {
reject(error.code === "ENOENT"
? new Error("Claude Code isn't installed or isn't on your PATH. Install it from claude.com/claude-code and sign in with your Claude account.")
: error);
});
child.on("close", (code) => {
// The final stream-json event is the result: { type: "result", is_error, result }
let result: { is_error?: boolean; result?: string } | undefined;
for (const line of stdout.split("\n")) {
try {
const event = JSON.parse(line);
if (event.type === "result") result = event;
} catch {
// Not a JSON event line
}
}
if (result && !result.is_error && typeof result.result === "string") {
resolve(result.result);
} else {
reject(new Error(result?.result || stderr.trim() || `exited with code ${code} without a result`));
}
});
child.stdin.end(
messages.map((message) => JSON.stringify({ type: "user", message })).join("\n") + "\n"
);
});
}
} }

@ -103,23 +103,6 @@ export function initializeIpcHandlers(deps: IIpcHandlerDeps): void {
await deps.processingHelper?.processScreenshots() await deps.processingHelper?.processScreenshots()
}) })
ipcMain.handle(
"ask-follow-up",
async (
_event,
request: {
design: string
history: Array<{ question: string; answer: string }>
question: string
}
) => {
if (!deps.processingHelper) {
return { success: false, error: "The app hasn't finished starting. Please try again." }
}
return deps.processingHelper.answerFollowUp(request)
}
)
// Window dimension handlers // Window dimension handlers
ipcMain.handle( ipcMain.handle(
"update-content-dimensions", "update-content-dimensions",

@ -11,8 +11,6 @@ import * as dotenv from "dotenv"
// Constants // Constants
const isDev = process.env.NODE_ENV === "development" const isDev = process.env.NODE_ENV === "development"
// Set SHOW_IN_CAPTURE=1 to let screenshots and screen sharing see the window (useful for debugging)
const contentProtection = process.env.SHOW_IN_CAPTURE !== "1"
// Application State // Application State
const state = { const state = {
@ -311,7 +309,7 @@ async function createWindow(): Promise<void> {
}) })
// Enhanced screen capture resistance // Enhanced screen capture resistance
state.mainWindow.setContentProtection(contentProtection) state.mainWindow.setContentProtection(true)
state.mainWindow.setVisibleOnAllWorkspaces(true, { state.mainWindow.setVisibleOnAllWorkspaces(true, {
visibleOnFullScreen: true visibleOnFullScreen: true
@ -415,7 +413,7 @@ function showMainWindow(): void {
state.mainWindow.setVisibleOnAllWorkspaces(true, { state.mainWindow.setVisibleOnAllWorkspaces(true, {
visibleOnFullScreen: true visibleOnFullScreen: true
}); });
state.mainWindow.setContentProtection(contentProtection); state.mainWindow.setContentProtection(true);
state.mainWindow.setOpacity(0); // Set opacity to 0 before showing state.mainWindow.setOpacity(0); // Set opacity to 0 before showing
state.mainWindow.showInactive(); // Use showInactive instead of show+focus state.mainWindow.showInactive(); // Use showInactive instead of show+focus
state.mainWindow.setOpacity(1); // Then set opacity to 1 after showing state.mainWindow.setOpacity(1); // Then set opacity to 1 after showing
@ -479,15 +477,12 @@ function setWindowDimensions(width: number, height: number): void {
const primaryDisplay = screen.getPrimaryDisplay() const primaryDisplay = screen.getPrimaryDisplay()
const workArea = primaryDisplay.workAreaSize const workArea = primaryDisplay.workAreaSize
const maxWidth = Math.floor(workArea.width * 0.5) const maxWidth = Math.floor(workArea.width * 0.5)
// Keep the window on screen; taller content scrolls inside it
const { y: workTop, height: workHeight } = primaryDisplay.workArea
const maxHeight = Math.max(550, workTop + workHeight - currentY)
state.mainWindow.setBounds({ state.mainWindow.setBounds({
x: Math.min(currentX, workArea.width - maxWidth), x: Math.min(currentX, workArea.width - maxWidth),
y: currentY, y: currentY,
width: Math.min(width + 32, maxWidth), width: Math.min(width + 32, maxWidth),
height: Math.min(Math.ceil(height), maxHeight) height: Math.ceil(height)
}) })
} }
} }

@ -35,11 +35,6 @@ const electronAPI = {
ipcRenderer.invoke("update-content-dimensions", dimensions), ipcRenderer.invoke("update-content-dimensions", dimensions),
clearStore: () => ipcRenderer.invoke("clear-store"), clearStore: () => ipcRenderer.invoke("clear-store"),
getScreenshots: () => ipcRenderer.invoke("get-screenshots"), getScreenshots: () => ipcRenderer.invoke("get-screenshots"),
askFollowUp: (request: {
design: string
history: Array<{ question: string; answer: string }>
question: string
}) => ipcRenderer.invoke("ask-follow-up", request),
deleteScreenshot: (path: string) => deleteScreenshot: (path: string) =>
ipcRenderer.invoke("delete-screenshot", path), ipcRenderer.invoke("delete-screenshot", path),
toggleMainWindow: async () => { toggleMainWindow: async () => {

@ -111,11 +111,6 @@ export class ShortcutsHelper {
app.quit() app.quit()
}) })
globalShortcut.register("CommandOrControl+Shift+Q", () => {
console.log("Command/Ctrl + Shift + Q pressed. Quitting application.")
app.quit()
})
// Adjust opacity shortcuts // Adjust opacity shortcuts
globalShortcut.register("CommandOrControl+[", () => { globalShortcut.register("CommandOrControl+[", () => {
console.log("Command/Ctrl + [ pressed. Decreasing opacity.") console.log("Command/Ctrl + [ pressed. Decreasing opacity.")

@ -182,8 +182,8 @@ function App() {
// Event listeners for process events // Event listeners for process events
const onApiKeyInvalid = () => { const onApiKeyInvalid = () => {
showToast( showToast(
"API Key Missing", "API Key Invalid",
"The selected provider has no valid API key. Add one in Settings, or choose Claude Code to use your Claude subscription.", "Your OpenAI API key appears to be invalid or has insufficient credits",
"error" "error"
) )
setApiKeyDialogOpen(true) setApiKeyDialogOpen(true)

@ -103,134 +103,6 @@ const SolutionSection = ({
) )
} }
interface FollowUp {
id: number
question: string
answer: string | null
error?: string
}
const FollowUpSection = ({ design }: { design: string }) => {
const [followUps, setFollowUps] = useState<FollowUp[]>([])
const [question, setQuestion] = useState("")
const latestFollowUpRef = useRef<HTMLDivElement>(null)
const isAsking = followUps.some(
(followUp) => followUp.answer === null && !followUp.error
)
// Bring each new question into view so its answer appears right below it
useEffect(() => {
latestFollowUpRef.current?.scrollIntoView({
behavior: "smooth",
block: "start"
})
}, [followUps.length])
const askFollowUp = async () => {
const trimmedQuestion = question.trim()
if (!trimmedQuestion || isAsking) return
const id = Date.now()
// Failed follow-ups have no answer, so they don't go back to the model
const history = followUps.flatMap((followUp) =>
followUp.answer
? [{ question: followUp.question, answer: followUp.answer }]
: []
)
setFollowUps((current) => [
...current,
{ id, question: trimmedQuestion, answer: null }
])
setQuestion("")
let result: { success: boolean; data?: string; error?: string }
try {
result = await window.electronAPI.askFollowUp({
design,
history,
question: trimmedQuestion
})
} catch (error) {
console.error("Error asking follow-up:", error)
result = { success: false }
}
setFollowUps((current) =>
current.map((followUp) => {
if (followUp.id !== id) return followUp
return result.success && result.data
? { ...followUp, answer: result.data }
: {
...followUp,
error: result.error || "Failed to answer the follow-up."
}
})
)
}
return (
<div className="space-y-2">
<h2 className="text-[13px] font-medium text-white tracking-wide">
Follow-ups
</h2>
{followUps.map((followUp, index) => (
<div
key={followUp.id}
ref={index === followUps.length - 1 ? latestFollowUpRef : undefined}
className="space-y-2"
>
<div className="text-[13px] leading-[1.4] text-gray-100 bg-white/10 rounded-md px-3 py-2 whitespace-pre-wrap">
{followUp.question}
</div>
{followUp.error ? (
<p className="text-xs text-red-400">{followUp.error}</p>
) : followUp.answer === null ? (
<p className="text-xs bg-gradient-to-r from-gray-300 via-gray-100 to-gray-300 bg-clip-text text-transparent animate-pulse">
Thinking...
</p>
) : (
<SyntaxHighlighter
language="markdown"
style={dracula}
customStyle={{
maxWidth: "100%",
margin: 0,
padding: "1rem",
whiteSpace: "pre-wrap",
wordBreak: "break-word",
backgroundColor: "rgba(22, 27, 34, 0.5)"
}}
wrapLongLines={true}
>
{followUp.answer}
</SyntaxHighlighter>
)}
</div>
))}
<textarea
value={question}
onChange={(e) => setQuestion(e.target.value)}
onKeyDown={(e) => {
// Enter sends; Shift+Enter adds a line. Cmd+Enter is the global process shortcut.
if (e.key === "Enter" && !e.shiftKey && !e.nativeEvent.isComposing) {
e.preventDefault()
askFollowUp()
}
}}
rows={2}
placeholder={
isAsking
? "Waiting for the answer..."
: "Ask about any part of the design, e.g. how would this handle 10x the traffic? (Enter to send)"
}
className="w-full resize-none rounded-md border border-white/10 bg-white/5 px-3 py-2 text-[13px] leading-[1.4] text-gray-100 placeholder:text-gray-500 focus:outline-none focus:border-white/30"
/>
</div>
)
}
export const ComplexitySection = ({ export const ComplexitySection = ({
timeComplexity, timeComplexity,
spaceComplexity, spaceComplexity,
@ -311,7 +183,6 @@ const Solutions: React.FC<SolutionsProps> = ({
const [debugProcessing, setDebugProcessing] = useState(false) const [debugProcessing, setDebugProcessing] = useState(false)
const [problemStatementData, setProblemStatementData] = const [problemStatementData, setProblemStatementData] =
useState<ProblemStatementData | null>(null) useState<ProblemStatementData | null>(null)
const isSystemDesign = problemStatementData?.problem_type === "system_design"
const [solutionData, setSolutionData] = useState<string | null>(null) const [solutionData, setSolutionData] = useState<string | null>(null)
const [thoughtsData, setThoughtsData] = useState<string[] | null>(null) const [thoughtsData, setThoughtsData] = useState<string[] | null>(null)
const [timeComplexityData, setTimeComplexityData] = useState<string | null>( const [timeComplexityData, setTimeComplexityData] = useState<string | null>(
@ -653,7 +524,7 @@ const Solutions: React.FC<SolutionsProps> = ({
{solutionData && ( {solutionData && (
<> <>
<ContentSection <ContentSection
title={`${isSystemDesign ? "Key Decisions" : "My Thoughts"} (${COMMAND_KEY} + Arrow keys to scroll)`} title={`My Thoughts (${COMMAND_KEY} + Arrow keys to scroll)`}
content={ content={
thoughtsData && ( thoughtsData && (
<div className="space-y-3"> <div className="space-y-3">
@ -675,21 +546,17 @@ const Solutions: React.FC<SolutionsProps> = ({
/> />
<SolutionSection <SolutionSection
title={isSystemDesign ? "Design" : "Solution"} title="Solution"
content={solutionData} content={solutionData}
isLoading={!solutionData} isLoading={!solutionData}
currentLanguage={isSystemDesign ? "markdown" : currentLanguage} currentLanguage={currentLanguage}
/> />
{isSystemDesign ? ( <ComplexitySection
<FollowUpSection design={solutionData} /> timeComplexity={timeComplexityData}
) : ( spaceComplexity={spaceComplexityData}
<ComplexitySection isLoading={!timeComplexityData || !spaceComplexityData}
timeComplexity={timeComplexityData} />
spaceComplexity={spaceComplexityData}
isLoading={!timeComplexityData || !spaceComplexityData}
/>
)}
</> </>
)} )}
</div> </div>

@ -13,7 +13,7 @@ import { Button } from "../ui/button";
import { Settings } from "lucide-react"; import { Settings } from "lucide-react";
import { useToast } from "../../contexts/toast"; import { useToast } from "../../contexts/toast";
type APIProvider = "openai" | "gemini" | "anthropic" | "claude-code"; type APIProvider = "openai" | "gemini" | "anthropic";
type AIModel = { type AIModel = {
id: string; id: string;
@ -28,7 +28,6 @@ type ModelCategory = {
openaiModels: AIModel[]; openaiModels: AIModel[];
geminiModels: AIModel[]; geminiModels: AIModel[];
anthropicModels: AIModel[]; anthropicModels: AIModel[];
claudeCodeModels: AIModel[];
}; };
// Define available models for each category // Define available models for each category
@ -39,70 +38,43 @@ const modelCategories: ModelCategory[] = [
description: 'Model used to analyze screenshots and extract problem details', description: 'Model used to analyze screenshots and extract problem details',
openaiModels: [ openaiModels: [
{ {
id: "gpt-6.1-sol", id: "gpt-4o",
name: "GPT-6.1 Sol", name: "gpt-4o",
description: "Best overall performance for problem extraction" description: "Best overall performance for problem extraction"
}, },
{ {
id: "gpt-6-astra", id: "gpt-4o-mini",
name: "GPT-6 Astra", name: "gpt-4o-mini",
description: "Most capable, but slower and more expensive" description: "Faster, more cost-effective option"
},
{
id: "gpt-6-luna",
name: "GPT-6 Luna",
description: "Fastest, most cost-effective option"
} }
], ],
geminiModels: [ geminiModels: [
{ {
id: "gemini-3.8-flash", id: "gemini-1.5-pro",
name: "Gemini 3.8 Flash", name: "Gemini 1.5 Pro",
description: "Best overall performance for problem extraction" description: "Best overall performance for problem extraction"
}, },
{ {
id: "gemini-4-argon", id: "gemini-2.0-flash",
name: "Gemini 4 Argon", name: "Gemini 2.0 Flash",
description: "Most capable, but slower and more expensive" description: "Faster, more cost-effective option"
},
{
id: "gemini-3.5-flash-lite",
name: "Gemini 3.5 Flash-Lite",
description: "Fastest, most cost-effective option"
} }
], ],
anthropicModels: [ anthropicModels: [
{ {
id: "claude-opus-5-5", id: "claude-3-7-sonnet-20250219",
name: "Claude Opus 5.5", name: "Claude 3.7 Sonnet",
description: "Best overall performance for problem extraction" description: "Best overall performance for problem extraction"
}, },
{ {
id: "claude-sonnet-5-5", id: "claude-3-5-sonnet-20241022",
name: "Claude Sonnet 5.5", name: "Claude 3.5 Sonnet",
description: "Balanced performance and speed"
},
{
id: "claude-haiku-5-5",
name: "Claude Haiku 5.5",
description: "Fastest, most cost-effective option"
}
],
claudeCodeModels: [
{
id: "opus",
name: "Opus (latest)",
description: "Most capable, uses more of your plan's limits"
},
{
id: "sonnet",
name: "Sonnet (latest)",
description: "Balanced performance and speed" description: "Balanced performance and speed"
}, },
{ {
id: "haiku", id: "claude-3-opus-20240229",
name: "Haiku (latest)", name: "Claude 3 Opus",
description: "Fastest option" description: "Top-level intelligence, fluency, and understanding"
} }
] ]
}, },
@ -112,70 +84,43 @@ const modelCategories: ModelCategory[] = [
description: 'Model used to generate coding solutions', description: 'Model used to generate coding solutions',
openaiModels: [ openaiModels: [
{ {
id: "gpt-6.1-sol", id: "gpt-4o",
name: "GPT-6.1 Sol", name: "gpt-4o",
description: "Strong overall performance for coding tasks" description: "Strong overall performance for coding tasks"
}, },
{ {
id: "gpt-6-astra", id: "gpt-4o-mini",
name: "GPT-6 Astra", name: "gpt-4o-mini",
description: "Most capable, but slower and more expensive" description: "Faster, more cost-effective option"
},
{
id: "gpt-6-luna",
name: "GPT-6 Luna",
description: "Fastest, most cost-effective option"
} }
], ],
geminiModels: [ geminiModels: [
{ {
id: "gemini-3.8-flash", id: "gemini-1.5-pro",
name: "Gemini 3.8 Flash", name: "Gemini 1.5 Pro",
description: "Strong overall performance for coding tasks" description: "Strong overall performance for coding tasks"
}, },
{ {
id: "gemini-4-argon", id: "gemini-2.0-flash",
name: "Gemini 4 Argon", name: "Gemini 2.0 Flash",
description: "Most capable, but slower and more expensive" description: "Faster, more cost-effective option"
},
{
id: "gemini-3.5-flash-lite",
name: "Gemini 3.5 Flash-Lite",
description: "Fastest, most cost-effective option"
} }
], ],
anthropicModels: [ anthropicModels: [
{ {
id: "claude-opus-5-5", id: "claude-3-7-sonnet-20250219",
name: "Claude Opus 5.5", name: "Claude 3.7 Sonnet",
description: "Strong overall performance for coding tasks" description: "Strong overall performance for coding tasks"
}, },
{ {
id: "claude-sonnet-5-5", id: "claude-3-5-sonnet-20241022",
name: "Claude Sonnet 5.5", name: "Claude 3.5 Sonnet",
description: "Balanced performance and speed" description: "Balanced performance and speed"
}, },
{ {
id: "claude-haiku-5-5", id: "claude-3-opus-20240229",
name: "Claude Haiku 5.5", name: "Claude 3 Opus",
description: "Fastest, most cost-effective option" description: "Top-level intelligence, fluency, and understanding"
}
],
claudeCodeModels: [
{
id: "opus",
name: "Opus (latest)",
description: "Most capable, uses more of your plan's limits"
},
{
id: "sonnet",
name: "Sonnet (latest)",
description: "Balanced performance and speed"
},
{
id: "haiku",
name: "Haiku (latest)",
description: "Fastest option"
} }
] ]
}, },
@ -185,70 +130,43 @@ const modelCategories: ModelCategory[] = [
description: 'Model used to debug and improve solutions', description: 'Model used to debug and improve solutions',
openaiModels: [ openaiModels: [
{ {
id: "gpt-6.1-sol", id: "gpt-4o",
name: "GPT-6.1 Sol", name: "gpt-4o",
description: "Best for analyzing code and error messages" description: "Best for analyzing code and error messages"
}, },
{ {
id: "gpt-6-astra", id: "gpt-4o-mini",
name: "GPT-6 Astra", name: "gpt-4o-mini",
description: "Most capable, but slower and more expensive" description: "Faster, more cost-effective option"
},
{
id: "gpt-6-luna",
name: "GPT-6 Luna",
description: "Fastest, most cost-effective option"
} }
], ],
geminiModels: [ geminiModels: [
{ {
id: "gemini-3.8-flash", id: "gemini-1.5-pro",
name: "Gemini 3.8 Flash", name: "Gemini 1.5 Pro",
description: "Best for analyzing code and error messages" description: "Best for analyzing code and error messages"
}, },
{ {
id: "gemini-4-argon", id: "gemini-2.0-flash",
name: "Gemini 4 Argon", name: "Gemini 2.0 Flash",
description: "Most capable, but slower and more expensive" description: "Faster, more cost-effective option"
},
{
id: "gemini-3.5-flash-lite",
name: "Gemini 3.5 Flash-Lite",
description: "Fastest, most cost-effective option"
} }
], ],
anthropicModels: [ anthropicModels: [
{ {
id: "claude-opus-5-5", id: "claude-3-7-sonnet-20250219",
name: "Claude Opus 5.5", name: "Claude 3.7 Sonnet",
description: "Best for analyzing code and error messages" description: "Best for analyzing code and error messages"
}, },
{ {
id: "claude-sonnet-5-5", id: "claude-3-5-sonnet-20241022",
name: "Claude Sonnet 5.5", name: "Claude 3.5 Sonnet",
description: "Balanced performance and speed" description: "Balanced performance and speed"
}, },
{ {
id: "claude-haiku-5-5", id: "claude-3-opus-20240229",
name: "Claude Haiku 5.5", name: "Claude 3 Opus",
description: "Fastest, most cost-effective option" description: "Top-level intelligence, fluency, and understanding"
}
],
claudeCodeModels: [
{
id: "opus",
name: "Opus (latest)",
description: "Most capable, uses more of your plan's limits"
},
{
id: "sonnet",
name: "Sonnet (latest)",
description: "Balanced performance and speed"
},
{
id: "haiku",
name: "Haiku (latest)",
description: "Fastest option"
} }
] ]
} }
@ -263,9 +181,9 @@ export function SettingsDialog({ open: externalOpen, onOpenChange }: SettingsDia
const [open, setOpen] = useState(externalOpen || false); const [open, setOpen] = useState(externalOpen || false);
const [apiKey, setApiKey] = useState(""); const [apiKey, setApiKey] = useState("");
const [apiProvider, setApiProvider] = useState<APIProvider>("openai"); const [apiProvider, setApiProvider] = useState<APIProvider>("openai");
const [extractionModel, setExtractionModel] = useState("gpt-6.1-sol"); const [extractionModel, setExtractionModel] = useState("gpt-4o");
const [solutionModel, setSolutionModel] = useState("gpt-6.1-sol"); const [solutionModel, setSolutionModel] = useState("gpt-4o");
const [debuggingModel, setDebuggingModel] = useState("gpt-6.1-sol"); const [debuggingModel, setDebuggingModel] = useState("gpt-4o");
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
const { showToast } = useToast(); const { showToast } = useToast();
@ -302,9 +220,9 @@ export function SettingsDialog({ open: externalOpen, onOpenChange }: SettingsDia
.then((config: Config) => { .then((config: Config) => {
setApiKey(config.apiKey || ""); setApiKey(config.apiKey || "");
setApiProvider(config.apiProvider || "openai"); setApiProvider(config.apiProvider || "openai");
setExtractionModel(config.extractionModel || "gpt-6.1-sol"); setExtractionModel(config.extractionModel || "gpt-4o");
setSolutionModel(config.solutionModel || "gpt-6.1-sol"); setSolutionModel(config.solutionModel || "gpt-4o");
setDebuggingModel(config.debuggingModel || "gpt-6.1-sol"); setDebuggingModel(config.debuggingModel || "gpt-4o");
}) })
.catch((error: unknown) => { .catch((error: unknown) => {
console.error("Failed to load config:", error); console.error("Failed to load config:", error);
@ -322,21 +240,17 @@ export function SettingsDialog({ open: externalOpen, onOpenChange }: SettingsDia
// Reset models to defaults when changing provider // Reset models to defaults when changing provider
if (provider === "openai") { if (provider === "openai") {
setExtractionModel("gpt-6.1-sol"); setExtractionModel("gpt-4o");
setSolutionModel("gpt-6.1-sol"); setSolutionModel("gpt-4o");
setDebuggingModel("gpt-6.1-sol"); setDebuggingModel("gpt-4o");
} else if (provider === "gemini") { } else if (provider === "gemini") {
setExtractionModel("gemini-3.8-flash"); setExtractionModel("gemini-1.5-pro");
setSolutionModel("gemini-3.8-flash"); setSolutionModel("gemini-1.5-pro");
setDebuggingModel("gemini-3.8-flash"); setDebuggingModel("gemini-1.5-pro");
} else if (provider === "anthropic") { } else if (provider === "anthropic") {
setExtractionModel("claude-opus-5-5"); setExtractionModel("claude-3-7-sonnet-20250219");
setSolutionModel("claude-opus-5-5"); setSolutionModel("claude-3-7-sonnet-20250219");
setDebuggingModel("claude-opus-5-5"); setDebuggingModel("claude-3-7-sonnet-20250219");
} else if (provider === "claude-code") {
setExtractionModel("opus");
setSolutionModel("opus");
setDebuggingModel("opus");
} }
}; };
@ -404,14 +318,14 @@ export function SettingsDialog({ open: externalOpen, onOpenChange }: SettingsDia
<DialogHeader> <DialogHeader>
<DialogTitle>API Settings</DialogTitle> <DialogTitle>API Settings</DialogTitle>
<DialogDescription className="text-white/70"> <DialogDescription className="text-white/70">
Configure your API key and model preferences. You'll need your own API key, or Claude Code signed in with a Claude subscription. Configure your API key and model preferences. You'll need your own API key to use this application.
</DialogDescription> </DialogDescription>
</DialogHeader> </DialogHeader>
<div className="space-y-4 py-4"> <div className="space-y-4 py-4">
{/* API Provider Selection */} {/* API Provider Selection */}
<div className="space-y-2"> <div className="space-y-2">
<label className="text-sm font-medium text-white">API Provider</label> <label className="text-sm font-medium text-white">API Provider</label>
<div className="grid grid-cols-2 gap-2"> <div className="flex gap-2">
<div <div
className={`flex-1 p-2 rounded-lg cursor-pointer transition-colors ${ className={`flex-1 p-2 rounded-lg cursor-pointer transition-colors ${
apiProvider === "openai" apiProvider === "openai"
@ -428,7 +342,7 @@ export function SettingsDialog({ open: externalOpen, onOpenChange }: SettingsDia
/> />
<div className="flex flex-col"> <div className="flex flex-col">
<p className="font-medium text-white text-sm">OpenAI</p> <p className="font-medium text-white text-sm">OpenAI</p>
<p className="text-xs text-white/60">GPT-6 models</p> <p className="text-xs text-white/60">GPT-4o models</p>
</div> </div>
</div> </div>
</div> </div>
@ -448,7 +362,7 @@ export function SettingsDialog({ open: externalOpen, onOpenChange }: SettingsDia
/> />
<div className="flex flex-col"> <div className="flex flex-col">
<p className="font-medium text-white text-sm">Gemini</p> <p className="font-medium text-white text-sm">Gemini</p>
<p className="text-xs text-white/60">Gemini 3.8 and 4 models</p> <p className="text-xs text-white/60">Gemini 1.5 models</p>
</div> </div>
</div> </div>
</div> </div>
@ -468,43 +382,13 @@ export function SettingsDialog({ open: externalOpen, onOpenChange }: SettingsDia
/> />
<div className="flex flex-col"> <div className="flex flex-col">
<p className="font-medium text-white text-sm">Claude</p> <p className="font-medium text-white text-sm">Claude</p>
<p className="text-xs text-white/60">Claude API key</p> <p className="text-xs text-white/60">Claude 3 models</p>
</div>
</div>
</div>
<div
className={`flex-1 p-2 rounded-lg cursor-pointer transition-colors ${
apiProvider === "claude-code"
? "bg-white/10 border border-white/20"
: "bg-black/30 border border-white/5 hover:bg-white/5"
}`}
onClick={() => handleProviderChange("claude-code")}
>
<div className="flex items-center gap-2">
<div
className={`w-3 h-3 rounded-full ${
apiProvider === "claude-code" ? "bg-white" : "bg-white/20"
}`}
/>
<div className="flex flex-col">
<p className="font-medium text-white text-sm">Claude Code</p>
<p className="text-xs text-white/60">Your Claude subscription</p>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{apiProvider === "claude-code" ? (
<div className="p-2 rounded-md bg-white/5 border border-white/10">
<p className="text-xs text-white/80 mb-1">No API key needed</p>
<p className="text-xs text-white/60">
Requests run through the Claude Code CLI on this computer and count against your
Claude plan's usage limits. Install Claude Code and sign in with your Claude account
first. Responses are slower than the API.
</p>
</div>
) : (
<div className="space-y-2"> <div className="space-y-2">
<label className="text-sm font-medium text-white" htmlFor="apiKey"> <label className="text-sm font-medium text-white" htmlFor="apiKey">
{apiProvider === "openai" ? "OpenAI API Key" : {apiProvider === "openai" ? "OpenAI API Key" :
@ -529,7 +413,7 @@ export function SettingsDialog({ open: externalOpen, onOpenChange }: SettingsDia
</p> </p>
)} )}
<p className="text-xs text-white/50"> <p className="text-xs text-white/50">
Your API key is stored locally and never sent to any server except {apiProvider === "openai" ? "OpenAI" : apiProvider === "gemini" ? "Google" : "Anthropic"} Your API key is stored locally and never sent to any server except {apiProvider === "openai" ? "OpenAI" : "Google"}
</p> </p>
<div className="mt-2 p-2 rounded-md bg-white/5 border border-white/10"> <div className="mt-2 p-2 rounded-md bg-white/5 border border-white/10">
<p className="text-xs text-white/80 mb-1">Don't have an API key?</p> <p className="text-xs text-white/80 mb-1">Don't have an API key?</p>
@ -572,7 +456,6 @@ export function SettingsDialog({ open: externalOpen, onOpenChange }: SettingsDia
)} )}
</div> </div>
</div> </div>
)}
<div className="space-y-2 mt-4"> <div className="space-y-2 mt-4">
<label className="text-sm font-medium text-white mb-2 block">Keyboard Shortcuts</label> <label className="text-sm font-medium text-white mb-2 block">Keyboard Shortcuts</label>
@ -628,7 +511,6 @@ export function SettingsDialog({ open: externalOpen, onOpenChange }: SettingsDia
const models = const models =
apiProvider === "openai" ? category.openaiModels : apiProvider === "openai" ? category.openaiModels :
apiProvider === "gemini" ? category.geminiModels : apiProvider === "gemini" ? category.geminiModels :
apiProvider === "claude-code" ? category.claudeCodeModels :
category.anthropicModels; category.anthropicModels;
return ( return (
@ -693,7 +575,7 @@ export function SettingsDialog({ open: externalOpen, onOpenChange }: SettingsDia
<Button <Button
className="px-4 py-3 bg-white text-black rounded-xl font-medium hover:bg-white/90 transition-colors" className="px-4 py-3 bg-white text-black rounded-xl font-medium hover:bg-white/90 transition-colors"
onClick={handleSave} onClick={handleSave}
disabled={isLoading || (apiProvider !== "claude-code" && !apiKey)} disabled={isLoading || !apiKey}
> >
{isLoading ? "Saving..." : "Save Settings"} {isLoading ? "Saving..." : "Save Settings"}
</Button> </Button>

@ -61,11 +61,6 @@ export interface ElectronAPI {
openLink: (url: string) => void openLink: (url: string) => void
onApiKeyInvalid: (callback: () => void) => () => void onApiKeyInvalid: (callback: () => void) => () => void
removeListener: (eventName: string, callback: (...args: any[]) => void) => void removeListener: (eventName: string, callback: (...args: any[]) => void) => void
askFollowUp: (request: {
design: string
history: Array<{ question: string; answer: string }>
question: string
}) => Promise<{ success: boolean; data?: string; error?: string }>
} }
declare global { declare global {

@ -11,7 +11,6 @@ export interface SolutionsResponse {
export interface ProblemStatementData { export interface ProblemStatementData {
problem_statement: string problem_statement: string
problem_type?: "coding" | "system_design"
input_format: { input_format: {
description: string description: string
parameters: any[] parameters: any[]

Loading…
Cancel
Save