Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions electron/LLMHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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<void> {
Expand All @@ -318,7 +318,7 @@ export class LLMHelper {
public async switchToGemini(apiKey?: string): Promise<void> {
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) {
Expand Down
34 changes: 33 additions & 1 deletion src/_pages/Queue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
// Headers
.replace(/^### (.+)$/gm, "<strong>$1</strong>")
.replace(/^## (.+)$/gm, "<strong style='font-size:1.1em'>$1</strong>")
.replace(/^# (.+)$/gm, "<strong style='font-size:1.2em'>$1</strong>")
// Bold and italic
.replace(/\*\*\*(.+?)\*\*\*/g, "<strong><em>$1</em></strong>")
.replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>")
.replace(/\*(.+?)\*/g, "<em>$1</em>")
// Inline code
.replace(/`([^`]+)`/g, "<code style='background:rgba(0,0,0,0.1);padding:1px 4px;border-radius:3px;font-size:0.9em'>$1</code>")
// Bullet points
.replace(/^\* (.+)$/gm, "• $1")
.replace(/^- (.+)$/gm, "• $1")
// Numbered lists
.replace(/^\d+\. (.+)$/gm, " $1")
// Line breaks
.replace(/\n/g, "<br/>")
return html;
}

interface QueueProps {
setView: React.Dispatch<React.SetStateAction<"queue" | "solutions" | "debug">>
}
Expand Down Expand Up @@ -276,7 +304,11 @@ const Queue: React.FC<QueueProps> = ({ setView }) => {
}`}
style={{ wordBreak: "break-word", lineHeight: "1.4" }}
>
{msg.text}
{msg.role === "user" ? (
msg.text
) : (
<span dangerouslySetInnerHTML={{ __html: simpleMarkdown(msg.text) }} />
)}
</div>
</div>
))
Expand Down
42 changes: 39 additions & 3 deletions src/_pages/Solutions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
// Headers
.replace(/^### (.+)$/gm, "<strong>$1</strong>")
.replace(/^## (.+)$/gm, "<strong style='font-size:1.1em'>$1</strong>")
.replace(/^# (.+)$/gm, "<strong style='font-size:1.2em'>$1</strong>")
// Bold and italic
.replace(/\*\*\*(.+?)\*\*\*/g, "<strong><em>$1</em></strong>")
.replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>")
.replace(/\*(.+?)\*/g, "<em>$1</em>")
// Inline code
.replace(/`([^`]+)`/g, "<code style='background:rgba(255,255,255,0.1);padding:1px 4px;border-radius:3px;font-size:0.9em'>$1</code>")
// Bullet points
.replace(/^\* (.+)$/gm, "• $1")
.replace(/^- (.+)$/gm, "• $1")
// Numbered lists
.replace(/^\d+\. (.+)$/gm, " $1")
// Line breaks
.replace(/\n/g, "<br/>")
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 <span dangerouslySetInnerHTML={{ __html: simpleMarkdown(content) }} />;
}
return content;
}

// (Using global ElectronAPI type from src/types/electron.d.ts)

export const ContentSection = ({
Expand All @@ -40,7 +76,7 @@ export const ContentSection = ({
</div>
) : (
<div className="text-[13px] leading-[1.4] text-gray-100 max-w-[600px]">
{content}
{renderContent(content)}
</div>
)}
</div>
Expand Down Expand Up @@ -508,8 +544,8 @@ const Solutions: React.FC<SolutionsProps> = ({ setView }) => {
{problemStatementData && !solutionData && (
<div className="mt-4 flex">
<p className="text-xs bg-gradient-to-r from-gray-300 via-gray-100 to-gray-300 bg-clip-text text-transparent animate-pulse">
{problemStatementData?.output_format?.subtype === "voice"
? "Processing voice input..."
{problemStatementData?.output_format?.subtype === "voice"
? "Processing voice input..."
: "Generating solutions..."}
</p>
</div>
Expand Down