Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

feat: v1.3.0 - web search fallback, auto-pull embeddings, voice settings

PurpleDoubleDe157acdf6527
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 622806a7..835c88d3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,32 @@
All notable changes to Locally Uncensored are documented here.
+## [1.3.0] - 2026-03-31
+
+### Added
+- **RAG Document Chat**: Upload PDF, DOCX, or TXT files to chat with your documents
+ - Hybrid search (vector + BM25 keyword matching) for better retrieval
+ - Confidence score display with color-coded badges
+ - Ollama context window warning when model has insufficient context
+ - Automatic embedding model download (nomic-embed-text)
+ - Per-conversation RAG toggle and source citations
+- **Voice Integration**: Talk to your AI and hear responses
+ - Push-to-talk microphone button with Web Speech API
+ - Text-to-speech on any assistant message with sentence-level streaming
+ - Voice settings (voice selection, rate, pitch)
+ - Auto-send transcribed text option
+- **AI Agents**: Autonomous task execution with local tools
+ - ReAct-style reasoning loop with 5 built-in tools
+ - Web search, file read/write, Python code execution, image generation
+ - User approval required for destructive actions
+ - Task breakdown visualization and color-coded execution log
+ - Robust JSON parsing with 4-tier fallback and error recovery
+
+### Fixed
+- Cross-platform Python detection for code execution (Windows Store alias handling)
+- Web search now falls back to Brave Search when DuckDuckGo returns CAPTCHA
+
+
## [1.0.2] - 2026-03-25
### Fixed
diff --git a/package.json b/package.json
index 14b50bdc..7e534208 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,7 @@
{
"name": "locally-uncensored",
- "version": "1.2.1",
+ "version": "1.3.0",
+ "version": "1.3.0",
"private": false,
"description": "Private, local AI chat & image/video generation. No cloud, no censorship, no data collection. Powered by Ollama & ComfyUI.",
"license": "MIT",
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
index d2248f80..3bfd5ce1 100644
--- a/src-tauri/tauri.conf.json
+++ b/src-tauri/tauri.conf.json
@@ -1,7 +1,8 @@
{
"$schema": "https://raw.githubusercontent.com/tauri-apps/tauri/dev/crates/tauri-cli/schema.json",
"productName": "Locally Uncensored",
- "version": "1.2.1",
+ "version": "1.3.0",
+ "version": "1.3.0",
"identifier": "com.purpledoubled.locally-uncensored",
"build": {
"beforeBuildCommand": "npm run build",
diff --git a/src/components/chat/RAGPanel.tsx b/src/components/chat/RAGPanel.tsx
index 7a29ceb7..769ea301 100644
--- a/src/components/chat/RAGPanel.tsx
+++ b/src/components/chat/RAGPanel.tsx
@@ -12,6 +12,7 @@ import {
ChevronDown,
ChevronRight,
AlertTriangle,
+ Download,
} from 'lucide-react'
import { useRAG } from '../../hooks/useRAG'
import { useRAGStore } from '../../stores/ragStore'
@@ -46,6 +47,7 @@ export function RAGPanel({ conversationId }: Props) {
isIndexing,
indexingProgress,
contextWarning,
+ pullingEmbeddingModel,
uploadDocument,
removeDocument,
toggleRAG,
@@ -174,6 +176,25 @@ export function RAGPanel({ conversationId }: Props) {
)}
</AnimatePresence>
+ {/* Embedding model pull progress */}
+ <AnimatePresence>
+ {pullingEmbeddingModel && (
+ <motion.div
+ className="px-3 py-2"
+ initial={{ opacity: 0, height: 0 }}
+ animate={{ opacity: 1, height: 'auto' }}
+ exit={{ opacity: 0, height: 0 }}
+ >
+ <div className="flex items-center gap-1.5 p-2 rounded-lg bg-blue-500/10 border border-blue-500/20">
+ <Download size={12} className="text-blue-400 animate-bounce" />
+ <span className="text-[0.6rem] text-blue-400 leading-tight">
+ Downloading embedding model (nomic-embed-text)...
+ </span>
+ </div>
+ </motion.div>
+ )}
+ </AnimatePresence>
+
{/* Drop zone */}
<div className="px-3 pt-3 pb-1">
<div
diff --git a/src/components/settings/SettingsPage.tsx b/src/components/settings/SettingsPage.tsx
index 981dd8c2..d720b9c1 100644
--- a/src/components/settings/SettingsPage.tsx
+++ b/src/components/settings/SettingsPage.tsx
@@ -1,4 +1,5 @@
-import { ArrowLeft, RotateCcw, Sun, Moon } from 'lucide-react'
+import { useState, useEffect } from 'react'
+import { ArrowLeft, RotateCcw, Sun, Moon, Mic, Volume2, Check, X } from 'lucide-react'
import { useSettingsStore } from '../../stores/settingsStore'
import { useUIStore } from '../../stores/uiStore'
import { GlassCard } from '../ui/GlassCard'
@@ -6,10 +7,27 @@ import { GlowButton } from '../ui/GlowButton'
import { SliderControl } from './SliderControl'
import { ApiConfig } from './ApiConfig'
import { PersonaPanel } from '../personas/PersonaPanel'
+import { useVoiceStore } from '../../stores/voiceStore'
export function SettingsPage() {
const { settings, updateSettings, resetSettings } = useSettingsStore()
const { setView } = useUIStore()
+ const voiceSettings = useVoiceStore()
+ const [voices, setVoices] = useState<SpeechSynthesisVoice[]>([])
+
+ const sttSupported = typeof window !== 'undefined' && ('SpeechRecognition' in window || 'webkitSpeechRecognition' in window)
+ const ttsSupported = typeof window !== 'undefined' && 'speechSynthesis' in window
+
+ useEffect(() => {
+ if (!ttsSupported) return
+ const loadVoices = () => {
+ const v = speechSynthesis.getVoices()
+ if (v.length > 0) setVoices(v)
+ }
+ loadVoices()
+ speechSynthesis.addEventListener('voiceschanged', loadVoices)
+ return () => speechSynthesis.removeEventListener('voiceschanged', loadVoices)
+ }, [ttsSupported])
return (
<div className="h-full overflow-y-auto scrollbar-thin p-6">
@@ -96,6 +114,96 @@ export function SettingsPage() {
<ApiConfig endpoint={settings.apiEndpoint} onChange={(v) => updateSettings({ apiEndpoint: v })} />
</GlassCard>
+ <GlassCard>
+ <h2 className="text-sm font-semibold text-gray-900 dark:text-white mb-4 uppercase tracking-wider">Voice</h2>
+ <div className="space-y-4">
+ {/* Support indicators */}
+ <div className="flex items-center gap-4">
+ <div className="flex items-center gap-1.5">
+ {sttSupported ? (
+ <Check size={14} className="text-green-500" />
+ ) : (
+ <X size={14} className="text-red-500" />
+ )}
+ <span className="text-xs text-gray-600 dark:text-gray-300">Speech-to-Text</span>
+ </div>
+ <div className="flex items-center gap-1.5">
+ {ttsSupported ? (
+ <Check size={14} className="text-green-500" />
+ ) : (
+ <X size={14} className="text-red-500" />
+ )}
+ <span className="text-xs text-gray-600 dark:text-gray-300">Text-to-Speech</span>
+ </div>
+ </div>
+
+ {/* TTS Enabled toggle */}
+ <div className="flex items-center justify-between">
+ <div className="flex items-center gap-2">
+ <Volume2 size={16} className="text-gray-500 dark:text-gray-400" />
+ <label className="text-sm text-gray-600 dark:text-gray-300">TTS Enabled</label>
+ </div>
+ <button
+ onClick={() => voiceSettings.updateVoiceSettings({ ttsEnabled: !voiceSettings.ttsEnabled })}
+ className={`relative w-10 h-5 rounded-full transition-colors ${voiceSettings.ttsEnabled ? 'bg-green-500' : 'bg-gray-300 dark:bg-gray-600'}`}
+ >
+ <span className={`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white transition-transform ${voiceSettings.ttsEnabled ? 'translate-x-5' : ''}`} />
+ </button>
+ </div>
+
+ {/* TTS Voice dropdown */}
+ <div className="space-y-1.5">
+ <label className="text-sm text-gray-600 dark:text-gray-300">TTS Voice</label>
+ <select
+ value={voiceSettings.ttsVoice}
+ onChange={(e) => voiceSettings.updateVoiceSettings({ ttsVoice: e.target.value })}
+ className="w-full px-3 py-2 rounded-lg bg-gray-100 dark:bg-white/5 border border-gray-300 dark:border-white/10 text-gray-900 dark:text-white text-sm focus:outline-none focus:border-gray-400 dark:focus:border-white/20"
+ >
+ <option value="">System Default</option>
+ {voices.map((v) => (
+ <option key={v.name} value={v.name}>
+ {v.name} ({v.lang})
+ </option>
+ ))}
+ </select>
+ </div>
+
+ {/* TTS Rate slider */}
+ <SliderControl
+ label="TTS Rate"
+ value={voiceSettings.ttsRate}
+ min={0.5}
+ max={2}
+ step={0.1}
+ onChange={(v) => voiceSettings.updateVoiceSettings({ ttsRate: v })}
+ />
+
+ {/* TTS Pitch slider */}
+ <SliderControl
+ label="TTS Pitch"
+ value={voiceSettings.ttsPitch}
+ min={0.5}
+ max={2}
+ step={0.1}
+ onChange={(v) => voiceSettings.updateVoiceSettings({ ttsPitch: v })}
+ />
+
+ {/* Auto-send on transcribe toggle */}
+ <div className="flex items-center justify-between">
+ <div className="flex items-center gap-2">
+ <Mic size={16} className="text-gray-500 dark:text-gray-400" />
+ <label className="text-sm text-gray-600 dark:text-gray-300">Auto-send on Transcribe</label>
+ </div>
+ <button
+ onClick={() => voiceSettings.updateVoiceSettings({ autoSendOnTranscribe: !voiceSettings.autoSendOnTranscribe })}
+ className={`relative w-10 h-5 rounded-full transition-colors ${voiceSettings.autoSendOnTranscribe ? 'bg-green-500' : 'bg-gray-300 dark:bg-gray-600'}`}
+ >
+ <span className={`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white transition-transform ${voiceSettings.autoSendOnTranscribe ? 'translate-x-5' : ''}`} />
+ </button>
+ </div>
+ </div>
+ </GlassCard>
+
<GlassCard>
<h2 className="text-sm font-semibold text-gray-900 dark:text-white mb-4 uppercase tracking-wider">Personas</h2>
<PersonaPanel />
diff --git a/src/hooks/useRAG.ts b/src/hooks/useRAG.ts
index 0ee6dfff..5e5e61af 100644
--- a/src/hooks/useRAG.ts
+++ b/src/hooks/useRAG.ts
@@ -1,7 +1,7 @@
import { useCallback, useEffect } from "react"
import { useRAGStore } from "../stores/ragStore"
import { indexDocument, retrieveContext } from "../api/rag"
-import { getModelContext } from "../api/ollama"
+import { getModelContext, listModels, pullModel } from "../api/ollama"
import { useModelStore } from "../stores/modelStore"
import type { DocumentMeta, RAGContext } from "../types/rag"
@@ -15,6 +15,7 @@ export function useRAG(conversationId: string | null) {
const isIndexing = useRAGStore((s) => s.isIndexing)
const indexingProgress = useRAGStore((s) => s.indexingProgress)
const contextWarning = useRAGStore((s) => s.contextWarning)
+ const pullingEmbeddingModel = useRAGStore((s) => s.pullingEmbeddingModel)
// Check context window when RAG is toggled on or documents change
useEffect(() => {
@@ -48,10 +49,48 @@ export function useRAG(conversationId: string | null) {
async (file: File): Promise<DocumentMeta | null> => {
if (!conversationId) return null
- const { embeddingModel, setIndexing, setIndexingProgress, addDocument, addChunks } =
+ const { embeddingModel, setIndexing, setIndexingProgress, addDocument, addChunks, setPullingEmbeddingModel } =
useRAGStore.getState()
try {
+ // Check if embedding model exists, auto-pull if missing
+ const models = await listModels()
+ const hasEmbedding = models.some(
+ (m) => m.name === embeddingModel || m.name === embeddingModel + ":latest"
+ )
+
+ if (!hasEmbedding) {
+ const shouldPull = window.confirm(
+ `The embedding model "${embeddingModel}" is not installed. Download it now? (~274MB)`
+ )
+ if (!shouldPull) {
+ throw new Error("Embedding model not available")
+ }
+
+ setPullingEmbeddingModel(true)
+ try {
+ const pullRes = await pullModel(embeddingModel)
+ const reader = pullRes.body?.getReader()
+ if (reader) {
+ const decoder = new TextDecoder()
+ while (true) {
+ const { done, value } = await reader.read()
+ if (done) break
+ // Parse streaming pull progress (for logging)
+ const text = decoder.decode(value, { stream: true })
+ for (const line of text.split("\n").filter(Boolean)) {
+ try {
+ const json = JSON.parse(line)
+ if (json.status) console.log("[EmbeddingPull]", json.status)
+ } catch { /* skip non-JSON lines */ }
+ }
+ }
+ }
+ } finally {
+ setPullingEmbeddingModel(false)
+ }
+ }
+
setIndexing(true)
setIndexingProgress({ current: 0, total: 1 })
@@ -108,6 +147,7 @@ export function useRAG(conversationId: string | null) {
isIndexing,
indexingProgress,
contextWarning,
+ pullingEmbeddingModel,
uploadDocument,
removeDocument: removeDoc,
toggleRAG,
diff --git a/src/stores/ragStore.ts b/src/stores/ragStore.ts
index d8c8035a..710f115c 100644
--- a/src/stores/ragStore.ts
+++ b/src/stores/ragStore.ts
@@ -11,6 +11,7 @@ interface RAGState {
indexingProgress: { current: number; total: number } | null
lastRetrievedChunks: { chunk: TextChunk; score: number }[]
contextWarning: string | null
+ pullingEmbeddingModel: boolean
addDocument: (conversationId: string, meta: DocumentMeta) => void
removeDocument: (conversationId: string, docId: string) => void
@@ -23,6 +24,7 @@ interface RAGState {
clearConversationDocs: (conversationId: string) => void
setLastRetrievedChunks: (chunks: { chunk: TextChunk; score: number }[]) => void
setContextWarning: (warning: string | null) => void
+ setPullingEmbeddingModel: (pulling: boolean) => void
}
export const useRAGStore = create<RAGState>()(
@@ -36,6 +38,7 @@ export const useRAGStore = create<RAGState>()(
indexingProgress: null,
lastRetrievedChunks: [],
contextWarning: null,
+ pullingEmbeddingModel: false,
addDocument: (conversationId, meta) =>
set((state) => ({
@@ -93,6 +96,8 @@ export const useRAGStore = create<RAGState>()(
setLastRetrievedChunks: (chunks) => set({ lastRetrievedChunks: chunks }),
setContextWarning: (warning) => set({ contextWarning: warning }),
+
+ setPullingEmbeddingModel: (pulling) => set({ pullingEmbeddingModel: pulling }),
}),
{
name: "rag-store",
diff --git a/vite.config.ts b/vite.config.ts
index d31c819e..bcae3b44 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -642,7 +642,7 @@ function comfyLauncher(): Plugin {
})
})
- // API: Web search via DuckDuckGo lite
+ // API: Web search with DuckDuckGo + Brave Search fallback
server.middlewares.use('/local-api/web-search', (req, res) => {
if (req.method !== 'POST') { res.writeHead(405); res.end(); return }
let body = ''
@@ -657,59 +657,97 @@ function comfyLauncher(): Plugin {
}
const maxResults = count || 5
- const searchUrl = 'https://lite.duckduckgo.com/lite/?q=' + encodeURIComponent(query)
-
- https.get(searchUrl, { headers: { 'User-Agent': 'LocallyUncensored/1.1' } }, (response) => {
- let html = ''
- response.on('data', (chunk: Buffer) => { html += chunk.toString() })
- response.on('end', () => {
- try {
- const results: { title: string; url: string; snippet: string }[] = []
-
- // Parse DuckDuckGo lite HTML results
- const linkRegex = /<a[^>]+class="result-link"[^>]*href="([^"]*)"[^>]*>([\s\S]*?)<\/a>/gi
- const snippetRegex = /<td[^>]+class="result-snippet"[^>]*>([\s\S]*?)<\/td>/gi
-
- const links: { url: string; title: string }[] = []
- let linkMatch
- while ((linkMatch = linkRegex.exec(html)) !== null) {
- const linkUrl = linkMatch[1].replace(/&amp;/g, '&')
- const title = linkMatch[2].replace(/<[^>]*>/g, '').trim()
- if (linkUrl && title) links.push({ url: linkUrl, title })
- }
+ const browserUA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'
+
+ const parseDDGResults = (html: string): { title: string; url: string; snippet: string }[] => {
+ const results: { title: string; url: string; snippet: string }[] = []
+ const linkRegex = /<a[^>]+class="result-link"[^>]*href="([^"]*)"[^>]*>([\s\S]*?)<\/a>/gi
+ const snippetRegex = /<td[^>]+class="result-snippet"[^>]*>([\s\S]*?)<\/td>/gi
+ const links: { url: string; title: string }[] = []
+ let m
+ while ((m = linkRegex.exec(html)) !== null) {
+ const url = m[1].replace(/&amp;/g, '&')
+ const title = m[2].replace(/<[^>]*>/g, '').trim()
+ if (url && title) links.push({ url, title })
+ }
+ const snippets: string[] = []
+ while ((m = snippetRegex.exec(html)) !== null) {
+ snippets.push(m[1].replace(/<[^>]*>/g, '').trim())
+ }
+ for (let i = 0; i < Math.min(links.length, maxResults); i++) {
+ results.push({ title: links[i].title, url: links[i].url, snippet: snippets[i] || '' })
+ }
+ return results
+ }
- const snippets: string[] = []
- let snippetMatch
- while ((snippetMatch = snippetRegex.exec(html)) !== null) {
- snippets.push(snippetMatch[1].replace(/<[^>]*>/g, '').trim())
- }
+ const parseBraveResults = (html: string): { title: string; url: string; snippet: string }[] => {
+ const results: { title: string; url: string; snippet: string }[] = []
+ const titleRegex = /<a[^>]*class="[^"]*snippet-title[^"]*"[^>]*href="([^"]*)"[^>]*>([\s\S]*?)<\/a>/gi
+ const descRegex = /<p[^>]*class="[^"]*snippet-description[^"]*"[^>]*>([\s\S]*?)<\/p>/gi
+ const links: { url: string; title: string }[] = []
+ let m
+ while ((m = titleRegex.exec(html)) !== null) {
+ const url = m[1].replace(/&amp;/g, '&')
+ const title = m[2].replace(/<[^>]*>/g, '').replace(/<!---->/g, '').trim()
+ if (url && title && !url.startsWith('javascript:')) links.push({ url, title })
+ }
+ const snippets: string[] = []
+ while ((m = descRegex.exec(html)) !== null) {
+ snippets.push(m[1].replace(/<[^>]*>/g, '').replace(/<!---->/g, '').trim())
+ }
+ for (let i = 0; i < Math.min(links.length, maxResults); i++) {
+ results.push({ title: links[i].title, url: links[i].url, snippet: snippets[i] || '' })
+ }
+ return results
+ }
- for (let i = 0; i < Math.min(links.length, maxResults); i++) {
- results.push({
- title: links[i].title,
- url: links[i].url,
- snippet: snippets[i] || '',
- })
+ const fetchHTML = (url: string, headers: Record<string, string>): Promise<string> => {
+ return new Promise((resolve, reject) => {
+ const proto = url.startsWith('https') ? https : http
+ proto.get(url, { headers }, (response) => {
+ if (response.statusCode && response.statusCode >= 300 && response.statusCode < 400 && response.headers.location) {
+ fetchHTML(response.headers.location, headers).then(resolve, reject)
+ return
}
+ let data = ''
+ response.on('data', (chunk: Buffer) => { data += chunk.toString() })
+ response.on('end', () => resolve(data))
+ }).on('error', reject)
+ })
+ }
- res.writeHead(200, { 'Content-Type': 'application/json' })
- res.end(JSON.stringify({ results }))
- } catch (parseErr) {
- res.writeHead(200, { 'Content-Type': 'application/json' })
- res.end(JSON.stringify({ results: [], error: 'Failed to parse results' }))
+ // Try DuckDuckGo lite first
+ const ddgUrl = 'https://lite.duckduckgo.com/lite/?q=' + encodeURIComponent(query)
+ fetchHTML(ddgUrl, { 'User-Agent': browserUA, 'Accept': 'text/html', 'Accept-Language': 'en-US,en;q=0.9' })
+ .then((html) => {
+ if (html.includes('anomaly-modal') || html.includes('challenge-form')) {
+ console.log('[WebSearch] DuckDuckGo returned CAPTCHA, falling back to Brave Search')
+ throw new Error('DDG_CAPTCHA')
}
+ const results = parseDDGResults(html)
+ if (results.length === 0) throw new Error('DDG_EMPTY')
+ return results
+ })
+ .catch(() => {
+ // Fallback: Brave Search HTML scraping
+ const braveUrl = 'https://search.brave.com/search?q=' + encodeURIComponent(query) + '&source=web'
+ return fetchHTML(braveUrl, { 'User-Agent': browserUA, 'Accept': 'text/html', 'Accept-Language': 'en-US,en;q=0.9' })
+ .then((html) => parseBraveResults(html))
+ })
+ .then((results) => {
+ res.writeHead(200, { 'Content-Type': 'application/json' })
+ res.end(JSON.stringify({ results: results.slice(0, maxResults) }))
+ })
+ .catch((err) => {
+ res.writeHead(200, { 'Content-Type': 'application/json' })
+ res.end(JSON.stringify({ results: [], error: (err as Error).message || 'Search failed' }))
})
- }).on('error', (err) => {
- res.writeHead(200, { 'Content-Type': 'application/json' })
- res.end(JSON.stringify({ results: [], error: err.message }))
- })
} catch (err) {
res.writeHead(400, { 'Content-Type': 'application/json' })
res.end(JSON.stringify({ error: String(err) }))
}
})
})
-
},
}
}