diff --git a/electron/LLMHelper.ts b/electron/LLMHelper.ts index 5edd592b..2694d889 100644 --- a/electron/LLMHelper.ts +++ b/electron/LLMHelper.ts @@ -25,7 +25,7 @@ export class LLMHelper { this.initializeOllamaModel() } else if (apiKey) { const genAI = new GoogleGenerativeAI(apiKey) - this.model = genAI.getGenerativeModel({ model: "gemini-2.0-flash" }) + this.model = genAI.getGenerativeModel({ model: "gemini-2.5-flash" }) console.log("[LLMHelper] Using Google Gemini") } else { throw new Error("Either provide Gemini API key or enable Ollama mode") @@ -298,7 +298,7 @@ export class LLMHelper { } public getCurrentModel(): string { - return this.useOllama ? this.ollamaModel : "gemini-2.0-flash"; + return this.useOllama ? this.ollamaModel : "gemini-2.5-flash"; } public async switchToOllama(model?: string, url?: string): Promise { @@ -318,7 +318,7 @@ export class LLMHelper { public async switchToGemini(apiKey?: string): Promise { if (apiKey) { const genAI = new GoogleGenerativeAI(apiKey); - this.model = genAI.getGenerativeModel({ model: "gemini-2.0-flash" }); + this.model = genAI.getGenerativeModel({ model: "gemini-2.5-flash" }); } if (!this.model && !apiKey) { diff --git a/src/_pages/Queue.tsx b/src/_pages/Queue.tsx index a62912ef..3801ed1f 100644 --- a/src/_pages/Queue.tsx +++ b/src/_pages/Queue.tsx @@ -11,6 +11,34 @@ import { import QueueCommands from "../components/Queue/QueueCommands" import ModelSelector from "../components/ui/ModelSelector" +// Simple markdown to HTML converter (no external dependency needed) +function simpleMarkdown(text: string): string { + if (!text) return ""; + let html = text + // Escape HTML + .replace(/&/g, "&") + .replace(//g, ">") + // Headers + .replace(/^### (.+)$/gm, "$1") + .replace(/^## (.+)$/gm, "$1") + .replace(/^# (.+)$/gm, "$1") + // Bold and italic + .replace(/\*\*\*(.+?)\*\*\*/g, "$1") + .replace(/\*\*(.+?)\*\*/g, "$1") + .replace(/\*(.+?)\*/g, "$1") + // Inline code + .replace(/`([^`]+)`/g, "$1") + // Bullet points + .replace(/^\* (.+)$/gm, "• $1") + .replace(/^- (.+)$/gm, "• $1") + // Numbered lists + .replace(/^\d+\. (.+)$/gm, " $1") + // Line breaks + .replace(/\n/g, "
") + return html; +} + interface QueueProps { setView: React.Dispatch> } @@ -276,7 +304,11 @@ const Queue: React.FC = ({ setView }) => { }`} style={{ wordBreak: "break-word", lineHeight: "1.4" }} > - {msg.text} + {msg.role === "user" ? ( + msg.text + ) : ( + + )} )) diff --git a/src/_pages/Solutions.tsx b/src/_pages/Solutions.tsx index 5806978a..ddfe0757 100644 --- a/src/_pages/Solutions.tsx +++ b/src/_pages/Solutions.tsx @@ -17,6 +17,42 @@ import { AudioResult } from "../types/audio" import SolutionCommands from "../components/Solutions/SolutionCommands" import Debug from "./Debug" +// Simple markdown to HTML converter (no external dependency needed) +function simpleMarkdown(text: string): string { + if (!text) return ""; + let html = text + // Escape HTML + .replace(/&/g, "&") + .replace(//g, ">") + // Headers + .replace(/^### (.+)$/gm, "$1") + .replace(/^## (.+)$/gm, "$1") + .replace(/^# (.+)$/gm, "$1") + // Bold and italic + .replace(/\*\*\*(.+?)\*\*\*/g, "$1") + .replace(/\*\*(.+?)\*\*/g, "$1") + .replace(/\*(.+?)\*/g, "$1") + // Inline code + .replace(/`([^`]+)`/g, "$1") + // Bullet points + .replace(/^\* (.+)$/gm, "• $1") + .replace(/^- (.+)$/gm, "• $1") + // Numbered lists + .replace(/^\d+\. (.+)$/gm, " $1") + // Line breaks + .replace(/\n/g, "
") + return html; +} + +// Helper to render content with markdown if it's a string +function renderContent(content: React.ReactNode): React.ReactNode { + if (typeof content === "string") { + return ; + } + return content; +} + // (Using global ElectronAPI type from src/types/electron.d.ts) export const ContentSection = ({ @@ -40,7 +76,7 @@ export const ContentSection = ({ ) : (
- {content} + {renderContent(content)}
)} @@ -508,8 +544,8 @@ const Solutions: React.FC = ({ setView }) => { {problemStatementData && !solutionData && (

- {problemStatementData?.output_format?.subtype === "voice" - ? "Processing voice input..." + {problemStatementData?.output_format?.subtype === "voice" + ? "Processing voice input..." : "Generating solutions..."}