Local, full Windows search replacement, clipboard manager, and launcher: files, apps, settings and semantic media search with Google's EmbeddingGemma 2.
Rust clipboard-historyembedding-modelsembeddinggemma-2embeddinggemma2embeddingslocal-firstmcp-serversearchsemantic-searchwindows-11
Add voice popup preferences and remote embedding and dictation servers
ampersandru3040020876b6
diff --git a/Build-Rust.ps1 b/Build-Rust.ps1index 2687d0e..f134f93 100644--- a/Build-Rust.ps1+++ b/Build-Rust.ps1@@ -82,8 +82,8 @@ if (Test-Path $taskPortable) { throw 'Portable staging directory already exists.New-Item -ItemType Directory -Force $taskPortable | Out-NullGet-ChildItem -LiteralPath $taskBundle | Copy-Item -Destination $taskPortable -Recurse -ForceSet-Content -LiteralPath (Join-Path $taskPortable 'portable.flag') -Value '' -Encoding ascii-Compress-Archive -Path (Join-Path $taskPortable '*') -DestinationPath 'dist/installer/VectorDash-Rust-0.3.17-x64.zip' -Force-$taskInstaller='dist/installer/VectorDash-Rust-Setup-0.3.17-x64.exe'-$taskZip='dist/installer/VectorDash-Rust-0.3.17-x64.zip'+Compress-Archive -Path (Join-Path $taskPortable '*') -DestinationPath 'dist/installer/VectorDash-Rust-0.3.18-x64.zip' -Force+$taskInstaller='dist/installer/VectorDash-Rust-Setup-0.3.18-x64.exe'+$taskZip='dist/installer/VectorDash-Rust-0.3.18-x64.zip'@($taskInstaller,$taskZip) | ForEach-Object {((Get-FileHash -LiteralPath $_ -Algorithm SHA256).Hash.ToLowerInvariant()+' '+(Split-Path $_ -Leaf))} | Set-Content 'dist/installer/RUST-SHA256SUMS.txt' -Encoding asciiWrite-Output "Native installer and portable ZIP ready."diff --git a/README.md b/README.mdindex 5297cab..5c393b2 100644--- a/README.md+++ b/README.md@@ -24,9 +24,9 @@ Search by name or exact words, or describe what you remember. Google's **Embeddi- **Your sources, your choice:** index names only for fast drive-wide search, or fully index selected folders. Nested Full folders override Quick drives. Select multiple search sources, exclude files/types or common Windows cache folders, and see Full/Quick counts and recent additions.- **Advanced and saved searches:** combine filenames, wildcards, size and dates, such as name:dog*.jpg size:>1MB or ext:pdf modified:today. Save queries together with their modes, sources and exclusions; rename or remove them in Settings.- **Automatic updates:** monitor new, modified and removed files, or schedule scans. Automatic changes obey CPU/GPU, inactivity and power conditions even when periodic scanning is Manual. Optional NTFS journal tracking replays saved changes when volume access is available; folder notifications and recovery scans provide fallback. Pause/cancel indexing and inspect VectorDash, model and File logs.-- **Flexible setup:** choose GPU, iGPU or CPU/system memory; install selected optional features or remove downloaded tools. Status shows disk usage and live process RAM/VRAM. Local models warm when Hybrid/Semantic search opens, with loading progress, and can unload after an adjustable idle period. Optional game/full-screen rules pause indexing and unload models; Load anyway overrides model limits for that search session. Option to use your own remote llama-server that serves EmbeddingGemma 2.+- **Flexible setup:** choose GPU, iGPU or CPU/system memory; install selected optional features or remove downloaded tools. Status shows disk usage and live process RAM/VRAM. Local models warm when Hybrid/Semantic search opens, with loading progress, and can unload after an adjustable idle period. Optional game/full-screen rules pause indexing and unload models; Load anyway overrides model limits for that search session. Select Local or Remote for the embedding server; remote setup includes model discovery, a context budget and an embeddings check. Media search requires a compatible multimodal embedding server.- **Emoji and clipboard:** an offline full-color emoji grid and optional clipboard history for text, links and images, with timestamps, previews and expiry. Optionally search copied images by meaning with EmbeddingGemma 2.-- **Voice dictation:** optional local Parakeet speech recognition on CPU or NVIDIA GPU. Choose a microphone and fp16/8-bit model; watch the full-width waveform inside the search field and let silence finish recording. Trailing sentence punctuation is removed from transcriptions. A soft sound and a rotating red-to-orange trail indicate recording. The model loads immediately on activation and unloads immediately or after your chosen idle interval. Dictation stays in your active search mode; in AI mode it submits the transcription automatically.+- **Voice dictation:** optional local Parakeet speech recognition on CPU or NVIDIA GPU, or a remote OpenAI-compatible transcription server. Choose a microphone and fp16/8-bit model; watch the full-width waveform inside the search field and let silence finish recording. Trailing sentence punctuation is removed from transcriptions. A soft sound and a rotating red-to-orange trail indicate recording. The model loads immediately on activation and unloads immediately or after your chosen idle interval. Dictation stays in your active search mode; in AI mode it submits the transcription automatically. Set a voice-shortcut popup default (Search, Clipboard or AI), response length and automatic read aloud in Settings.- **Make it yours:** light/dark themes, app accent colors, popup tint/transparency/gradient, a collapsible icon sidebar, remembered window positions, and one red Save / outlined Undo bar for settings. About includes updates and a changelog covering releases since your installed version.<img width="1000" height="678" alt="20261013-0738-48 7475530" src="https://github.com/user-attachments/assets/1eabcb5e-63ae-47d6-872b-fa72d85b91cd" />@@ -35,7 +35,7 @@ Search by name or exact words, or describe what you remember. Google's **EmbeddiSwitch to **AI** to ask questions using your own local or remote **OpenAI-compatible server**. In **AI settings**, enter a base URL such as `http://localhost:8080/v1`, an optional API key, and your model; refresh to select from the server's models and set a maximum context size.-Enable **AI chat** and select a model to show the AI tab; disabled AI and clipboard modes stay hidden and are skipped by Tab. Choose **Brief** (3–4 sentences), **Medium** (8–12 sentences or two paragraphs) or **Full** (model default). Press **Enter** to send, ask follow-up questions, or **Stop** a request. A purple-to-blue trail indicates AI processing. Answers support Markdown, full-color emoji and scrolling; **Ctrl+C** or the reply’s Copy button copies the last answer. Follow-up questions scroll to the new response. Reported prompt/decode speeds appear when the server supplies them. With a vision-capable model, attach a monitor, window or selected screen area to ask about what you see. Sent screenshots appear as clickable thumbnails with a copy option. AI requests and screenshots go to your configured server. Optional **Text to speech** settings connect a separate OpenAI-compatible speech server: refresh models/voices, select a voice, and use the reply’s speaker button or **Read Aloud**. Supported speech servers stream audio as it arrives; other servers fall back to normal audio playback. Dictation pauses read aloud, and closing a search window stops it.+Enable **AI chat** and select a model to show the AI tab; disabled AI and clipboard modes stay hidden and are skipped by Tab. Choose **Brief** (one or two direct, spoken-style sentences), **Medium** (8–12 sentences or two paragraphs) or **Full** (model default). Press **Enter** to send, ask follow-up questions, or **Stop** a request. A purple-to-blue trail indicates AI processing. Answers support Markdown, full-color emoji and scrolling; **Ctrl+C** or the reply’s Copy button copies the last answer. Follow-up questions scroll to the new response. Reported prompt/decode speeds appear when the server supplies them. With a vision-capable model, attach a monitor, window or selected screen area to ask about what you see. Sent screenshots appear as clickable thumbnails with a copy option. AI requests and screenshots go to your configured server. Enable or disable **Text to speech** in AI settings; disabled TTS hides read-aloud controls. Optional speech settings connect a separate OpenAI-compatible speech server: refresh models/voices, select a voice, and use the reply’s speaker button or **Read Aloud**. Supported speech servers stream audio as it arrives; other servers fall back to normal audio playback. Dictation pauses read aloud, and closing a search window stops it.The optional **MCP server**, on the same settings page, lets compatible agents search indexed files and retrieve file information. Keep it local or enable access on your LAN, with optional bearer authentication. See [MCP setup](docs/MCP.md) for connection details. AI chat and MCP are optional; ordinary file search works independently.diff --git a/native/Cargo.lock b/native/Cargo.lockindex ee6fbc7..568a8b3 100644--- a/native/Cargo.lock+++ b/native/Cargo.lock@@ -3050,6 +3050,16 @@ version = "0.3.17"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"+[[package]]+name = "mime_guess"+version = "2.0.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e"+dependencies = [+ "mime",+ "unicase",+]+[[package]]name = "mime_guess2"version = "2.3.1"@@ -4461,6 +4471,7 @@ dependencies = ["hyper-util","js-sys","log",+ "mime_guess","percent-encoding","pin-project-lite","quinn",@@ -5705,7 +5716,7 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"[[package]]name = "vectordash"-version = "0.3.17"+version = "0.3.18"dependencies = ["anyhow","arboard",diff --git a/native/Cargo.toml b/native/Cargo.tomlindex 7b6d6bb..88fb3f6 100644--- a/native/Cargo.toml+++ b/native/Cargo.toml@@ -1,6 +1,6 @@[package]name = "vectordash"-version = "0.3.17"+version = "0.3.18"edition = "2024"license = "MIT"[dependencies]@@ -37,7 +37,7 @@ sha2 = "0.10"subtle = "2"tiny_http = "0.12"ureq = { version = "3", features = ["json"] }-reqwest = { version = "0.13", default-features = false, features = ["rustls", "json", "stream"] }+reqwest = { version = "0.13", default-features = false, features = ["rustls", "json", "stream", "multipart"] }tokio = { version = "1", features = ["rt", "time", "macros"] }walkdir = "2"notify = "8"diff --git a/native/src/ai.rs b/native/src/ai.rsindex d6e0f22..4121b32 100644--- a/native/src/ai.rs+++ b/native/src/ai.rs@@ -522,7 +522,7 @@ mod metrics_tests {pub fn response_instruction(style: &str) -> Option<&'static str> {match style {"Brief" => Some(- "Answer in 3–4 clear sentences. Keep the response brief and focused on the question; avoid unnecessary introductions.",+ "Answer like a concise voice assistant: give the answer directly in one or two short sentences. Use natural spoken language. Skip introductions, repetition, lists and unnecessary detail; add more only when essential for accuracy or safety.",),"Medium" => Some("Answer in 8–12 clear sentences or two well-developed paragraphs. Include useful explanation and key details without unnecessary repetition.",@@ -536,7 +536,7 @@ mod response_style_tests {#[test]fn requested_length_is_current_and_full_keeps_server_default() {for (style, target) in [- ("Brief", Some("3–4")),+ ("Brief", Some("voice assistant")),("Medium", Some("8–12")),("Full", None),] {@@ -624,3 +624,33 @@ mod connection_tests {worker.join().unwrap();}}++pub fn voice_tool(s: &Settings) -> &str {+ match s.voice_popup_tool.as_str() {+ "AI" if s.llm_enabled && !s.llm_model.trim().is_empty() => "AI",+ "Clipboard" if s.clipboard_enabled => "Clipboard",+ _ => "Search",+ }+}++#[cfg(test)]+mod voice_default_tests {+ use super::*;+ #[test]+ fn unavailable_voice_modes_fall_back_to_search() {+ let mut s = Settings {+ voice_popup_tool: "AI".into(),+ llm_enabled: true,+ llm_model: "chat".into(),+ ..Default::default()+ };+ assert_eq!(voice_tool(&s), "AI");+ s.llm_enabled = false;+ assert_eq!(voice_tool(&s), "Search");+ s.voice_popup_tool = "Clipboard".into();+ s.clipboard_enabled = true;+ assert_eq!(voice_tool(&s), "Clipboard");+ s.clipboard_enabled = false;+ assert_eq!(voice_tool(&s), "Search");+ }+}diff --git a/native/src/app.rs b/native/src/app.rsindex 6cc1ea4..95b183f 100644--- a/native/src/app.rs+++ b/native/src/app.rs@@ -35,6 +35,14 @@ const CATEGORIES: [&str; 7] = ["Code","Programs",];+#[derive(Default)]+struct RemoteState {+ signature: String,+ models: Vec<String>,+ note: String,+ error: bool,+ busy: bool,+}pub struct App {home: PathBuf,s: Settings,@@ -220,6 +228,7 @@ pub struct App {tts_paused: Arc<AtomicBool>,status_clocks: [Option<(String, Instant)>; 3],connections: [ConnectionState; 2],+ remote_servers: [RemoteState; 2],read_aloud: bool,clipboard_thumbs: HashMap<i64, egui::TextureHandle>,clipboard_thumb_pending: std::collections::HashSet<i64>,@@ -305,7 +314,7 @@ impl App {egui_extras::install_image_loaders(&cc.egui_ctx);let saved_start_hidden = s.start_hidden;let window_state = crate::config::WindowState::load(&home);- let read_aloud = s.tts_auto;+ let read_aloud = s.tts_enabled && s.tts_auto;let response_length = s.llm_response.clone();let mut app = Self {home,@@ -503,6 +512,7 @@ impl App {tts_paused: Arc::new(AtomicBool::new(false)),status_clocks: [None, None, None],connections: std::array::from_fn(|_| ConnectionState::default()),+ remote_servers: std::array::from_fn(|_| RemoteState::default()),read_aloud,clipboard_thumbs: HashMap::new(),clipboard_thumb_pending: std::collections::HashSet::new(),@@ -560,6 +570,13 @@ impl App {if let Some(style) = get("--smoke-response") {app.response_length = style;}+ if std::env::args().any(|a| a == "--smoke-voice-closed") {+ app.search_visible = false;+ }+ if std::env::args().any(|a| a == "--smoke-remote-catalog") {+ app.refresh_remote(0, false);+ app.refresh_remote(1, false);+ }if std::env::args().any(|a| a == "--smoke-test-connections") {app.start_connection_test(0);app.start_connection_test(1);@@ -654,7 +671,7 @@ impl App {Ok(()) => {self.engine.control.update_settings(self.s.clone());self.saved_settings = self.s.clone();- self.read_aloud = self.s.tts_auto;+ self.read_aloud = self.s.tts_enabled && self.s.tts_auto;crate::platform::set_game_names(&self.s.game_processes);self.model_warm_attempted = false;self.model_warm_error = None;@@ -693,6 +710,19 @@ impl App {}fn apply_settings(&mut self, ctx: &egui::Context) {let previous = self.saved_settings.clone();+ if previous.remote_embeddings() != self.s.remote_embeddings() {+ let models = self.engine.models.clone();+ std::thread::spawn(move || {+ let _ = models.stop();+ });+ }+ if previous.remote_dictation() != self.s.remote_dictation() {+ std::thread::spawn(crate::dictation::stop);+ }+ if !self.s.tts_enabled {+ self.stop_read_aloud();+ self.read_aloud = false;+ }let startup_changed = previous.start_with_windows != self.s.start_with_windows;let hotkeys_changed = (previous.hotkey.as_str(),@@ -795,6 +825,11 @@ impl App {&& crate::platform::main_window_visible(){ctx.send_viewport_cmd(egui::ViewportCommand::Focus);+ if self.tool == "AI" {+ self.read_aloud =+ self.saved_settings.tts_enabled && self.saved_settings.voice_read_aloud;+ self.response_length = self.saved_settings.voice_response.clone();+ }self.toggle_dictation();continue;}@@ -806,6 +841,24 @@ impl App {let scoped_summon = matches!(&event, Event::ScopedSummon(..));match event {Event::VoiceSummon(_) => {}+ Event::RemoteCatalog(index, signature, result) => {+ if signature == self.remote_signature(index) {+ let state = &mut self.remote_servers[index];+ state.signature = signature;+ state.busy = false;+ match result {+ Ok(catalog) => {+ state.models = catalog.models;+ state.note = catalog.note;+ state.error = false;+ }+ Err(error) => {+ state.note = error;+ state.error = true;+ }+ }+ }+ }Event::Microphones(result) => {self.microphones_loaded = true;self.microphones_busy = false;@@ -859,7 +912,7 @@ impl App {self.query = text;self.changed();ctx.memory_mut(|m| m.request_focus(egui::Id::new("query")));- self.dictation_status = if self.saved_settings.dictation_keep_loaded+ self.dictation_status = if self.saved_settings.remote_dictation() { "Dictation complete · Remote".into() } else if self.saved_settings.dictation_keep_loaded{"Dictation complete · Parakeet retained until idle".into()} else {@@ -1021,7 +1074,9 @@ impl App {images: vec![],});}- if self.read_aloud+ if self.s.tts_enabled+ && self.saved_settings.tts_enabled+ && self.read_aloud&& !self.ai_answer.is_empty()&& self.search_visible&& crate::platform::main_window_visible()@@ -1358,6 +1413,10 @@ impl App {egui::WindowLevel::AlwaysOnTop,));if voice_summon {+ self.tool = crate::ai::voice_tool(&self.saved_settings).into();+ self.read_aloud =+ self.saved_settings.tts_enabled && self.saved_settings.voice_read_aloud;+ self.response_length = self.saved_settings.voice_response.clone();self.toggle_dictation();}}@@ -1439,7 +1498,7 @@ impl App {self.model_warm_error = None;}if self.model_warm_attempted- || !self.s.remote_url.is_empty()+ || self.s.remote_embeddings()|| self.engine.models.search_hold(&self.s).is_some()|| self.engine.models.loading.load(Ordering::Acquire)|| self.index_clearing@@ -1459,7 +1518,7 @@ impl App {});}fn model_search_panel(&mut self, ui: &mut egui::Ui) {- if self.mode == "Names" || !self.s.remote_url.is_empty() {+ if self.mode == "Names" || self.s.remote_embeddings() {return;}if self.engine.models.loading.load(Ordering::Acquire) {@@ -2056,13 +2115,13 @@ impl App {{self.ask_ai();}- ui.add(egui::Checkbox::new(+ if self.saved_settings.tts_enabled {ui.add(egui::Checkbox::new(&mut self.read_aloud,RichText::new("Read Aloud").size(11.0),)).on_hover_text("Automatically read completed AI replies using your TTS server",- );+ );}},);if ui@@ -2071,7 +2130,7 @@ impl App {{self.new_conversation();}- egui::ComboBox::from_id_salt("ai-response-length").width(125.0).selected_text(format!("Response: {}",self.response_length)).show_ui(ui,|ui|{for style in ["Brief","Medium","Full"]{ui.selectable_value(&mut self.response_length,style.into(),style);}}).response.on_hover_text("Response length: Brief (3–4 sentences), Medium (8–12 sentences or two paragraphs), Full (model default)");+ egui::ComboBox::from_id_salt("ai-response-length").width(125.0).selected_text(format!("Response: {}",self.response_length)).show_ui(ui,|ui|{for style in ["Brief","Medium","Full"]{ui.selectable_value(&mut self.response_length,style.into(),style);}}).response.on_hover_text("Response length: Brief (concise voice assistant), Medium (8–12 sentences or two paragraphs), Full (model default)");if ui.add_enabled(!self.ai_busy && self.saved_settings.llm_vision,@@ -3179,15 +3238,18 @@ impl App {let usage=self.component_stats.get(key).cloned().unwrap_or_default();let installed=if key=="dictation"{crate::dictation::ready(&self.home,&self.s)}else if key=="ffmpeg"||key=="pdf"{usage.disk>0}else{Path::new(match key{"runtime"=>&self.s.server,"embedding"=>&self.s.model,"encoder"=>&self.s.projector,_=>&self.s.ocr}).is_file()};let active=if key=="dictation"{crate::dictation::pid()!=0}else if key=="encoder"{self.engine.models.media_loaded()}else if key=="runtime"||key=="embedding"{loaded}else{usage.ram>0};- let state=if active{"Loaded"}else if installed{"Installed · on demand"}else{"Not installed"};- let color=crate::appearance::component_color(ui.visuals().dark_mode, active, installed);+ let remote=if key=="dictation"{self.s.remote_dictation()}else{["runtime","embedding","encoder"].contains(&key)&&self.s.remote_embeddings()};+ let state=if remote{"Remote"}else if active{"Loaded"}else if installed{"Installed · on demand"}else{"Not installed"};+ let color=if remote{self.accent()}else{crate::appearance::component_color(ui.visuals().dark_mode, active, installed)};ui.horizontal_wrapped(|ui|{- ui.label(name);+ if remote&&key=="runtime" {ui.label("Embedding model server");}else if remote&&key=="dictation" {ui.label(format!("Dictation · {}",if self.s.dictation_model.is_empty(){"Select model"}else{self.s.dictation_model.as_str()}));}else {ui.label(if remote&&key=="embedding"&&!self.s.remote_model.is_empty(){self.s.remote_model.as_str()}else{name});}ui.label(RichText::new(state).color(color));- if self.component_stats_busy&&self.component_stats.is_empty(){ui.weak("Measuring…");}+ if remote { ui.weak(if key=="encoder"{"Server managed · requires multimodal embedding support"}else{"Server managed · no local model loaded"}); }+ else if self.component_stats_busy&&self.component_stats.is_empty(){ui.weak("Measuring…");}else if key=="pdf"{ui.weak(format!("RAM shared with app · Disk {}",crate::resources::format_bytes(usage.disk)));}else{ui.weak(format!("{}RAM {} · VRAM {} · Disk {}",if usage.shared{"Shared " }else{""},crate::resources::format_bytes(usage.ram),usage.vram.map(crate::resources::format_bytes).unwrap_or_else(||"Unavailable".into()),crate::resources::format_bytes(usage.disk)));}ui.with_layout(egui::Layout::right_to_left(egui::Align::Center),|ui|{+ if remote {return;}let managed=crate::resources::managed(&self.home,&self.s,key);if installed{if ui.add_enabled(!self.setup_busy&&managed,egui::Button::new("Uninstall")).on_hover_text(if managed{"Remove this downloaded item"}else{"External or bundled: managed by its installer"}).clicked(){self.remove_component=Some(key.into());}}else if ui.add_enabled(!self.setup_busy&&!["ffmpeg","pdf"].contains(&key),egui::Button::new("Install")).clicked(){self.install_component(key);}@@ -3197,7 +3259,7 @@ impl App {ui.weak("EmbeddingGemma, encoder and llama-server share one inference process; shared RAM/VRAM totals are not separate allocations. VRAM is dedicated GPU memory sampled by Windows.");ui.horizontal(|ui|{let loaded=self.engine.models.loaded.load(Ordering::Acquire);- if ui.add_enabled(!self.setup_busy&&!loaded,egui::Button::new("Start")).clicked(){+ if ui.add_enabled(!self.setup_busy&&!loaded&&!self.s.remote_embeddings(),egui::Button::new("Start")).clicked(){self.save();let settings=self.s.clone();let models=self.engine.models.clone();let media=Path::new(&self.s.projector).is_file();let tx=self.engine.tx.clone();self.setup_busy=true;std::thread::spawn(move||{let _=tx.send(Event::Setup(models.start(&settings,media).map(|_|vec![]).map_err(|e|e.to_string())));});}@@ -3208,6 +3270,126 @@ impl App {});ui.add_space(12.0);}+ fn remote_signature(&self, index: usize) -> String {+ use std::hash::{Hash, Hasher};+ let mut hash = std::collections::hash_map::DefaultHasher::new();+ if index == 0 {+ (&self.s.remote_url, &self.s.remote_key, &self.s.remote_model).hash(&mut hash);+ } else {+ (+ &self.s.dictation_url,+ &self.s.dictation_key,+ &self.s.dictation_model,+ )+ .hash(&mut hash);+ }+ hash.finish().to_string()+ }+ fn refresh_remote(&mut self, index: usize, check: bool) {+ let signature = self.remote_signature(index);+ let state = &mut self.remote_servers[index];+ state.signature = signature.clone();+ state.busy = true;+ state.note.clear();+ let (url, key, model) = if index == 0 {+ (+ self.s.remote_url.clone(),+ self.s.remote_key.clone(),+ self.s.remote_model.clone(),+ )+ } else {+ (+ self.s.dictation_url.clone(),+ self.s.dictation_key.clone(),+ self.s.dictation_model.clone(),+ )+ };+ let tx = self.engine.tx.clone();+ std::thread::spawn(move || {+ let result =+ crate::remote::catalog(&url, &key, &model, check).map_err(|e| e.to_string());+ let _ = tx.send(Event::RemoteCatalog(index, signature, result));+ });+ }+ fn remote_server_ui(&mut self, ui: &mut egui::Ui, index: usize) {+ let signature = self.remote_signature(index);+ if self.remote_servers[index].signature != signature {+ self.remote_servers[index] = RemoteState {+ signature,+ ..Default::default()+ };+ }+ let busy = self.remote_servers[index].busy;+ let (url, key, model, context) = if index == 0 {+ (+ &mut self.s.remote_url,+ &mut self.s.remote_key,+ &mut self.s.remote_model,+ &mut self.s.remote_context,+ )+ } else {+ (+ &mut self.s.dictation_url,+ &mut self.s.dictation_key,+ &mut self.s.dictation_model,+ &mut self.s.dictation_context,+ )+ };+ field(ui, "API base URL", url);+ ui.weak("Example: http://localhost:8080/v1");+ secret(ui, "API key (optional)", key);+ let mut refresh = false;+ let mut check = false;+ ui.horizontal_wrapped(|ui| {+ ui.label("Model");+ egui::ComboBox::from_id_salt(("remote-model", index))+ .selected_text(if model.is_empty() {+ "Select model"+ } else {+ model.as_str()+ })+ .width(260.0)+ .show_ui(ui, |ui| {+ for id in &self.remote_servers[index].models {+ ui.selectable_value(model, id.clone(), id);+ }+ });+ refresh = ui+ .add_enabled(!busy, egui::Button::new("Refresh models / Test"))+ .clicked();+ });+ field(ui, "Or enter a model ID", model);+ ui.add(+ egui::DragValue::new(context)+ .range(128..=131072)+ .prefix("Server context (tokens): "),+ );+ if index == 0 {+ ui.weak("Used as a conservative input budget; oversized text is split. Remote servers receive indexed text/media and semantic queries. Server configuration determines actual context and media support. Changing the embedding model requires re-indexing full-indexed files to keep vectors compatible.");+ check = ui+ .add_enabled(+ !busy && !model.is_empty(),+ egui::Button::new("Check embeddings enabled"),+ )+ .clicked();+ } else {+ ui.weak("Context is informational; transcription servers manage their own context. Sends microphone audio to /v1/audio/transcriptions when you dictate.");+ }+ if busy {+ ui.spinner();+ } else if !self.remote_servers[index].note.is_empty() {+ ui.label(RichText::new(&self.remote_servers[index].note).color(+ if self.remote_servers[index].error {+ Color32::RED+ } else {+ Color32::from_rgb(40, 180, 85)+ },+ ));+ }+ if refresh || check {+ self.refresh_remote(index, check);+ }+ }fn models(&mut self, ui: &mut egui::Ui) {if !self.component_stats_busy && self.component_stats_at.elapsed() > Duration::from_secs(3){@@ -3225,111 +3407,124 @@ impl App {}self.components_ui(ui);- ui.checkbox(&mut self.s.unload_idle, "Unload local models when idle");- if self.s.unload_idle {- ui.add(- egui::Slider::new(&mut self.s.unload_minutes, 1..=120)- .text("Idle unload (minutes)"),- );+ ui.heading("Embedding Model Server");+ let mut server = if self.s.remote_embeddings() {+ "Remote"+ } else {+ "Local"+ }+ .to_owned();+ combo(ui, "embedding-server", &mut server, &["Local", "Remote"]);+ if server+ != if self.s.remote_embeddings() {+ "Remote"+ } else {+ "Local"+ }+ {+ self.s.embedding_server = server.clone();}+ if server == "Local" {+ ui.checkbox(&mut self.s.unload_idle, "Unload local models when idle");+ if self.s.unload_idle {+ ui.add(+ egui::Slider::new(&mut self.s.unload_minutes, 1..=120)+ .text("Idle unload (minutes)"),+ );+ }- ui.label("An unloaded model may take a few seconds to load for the next Hybrid or Semantic search. File/Folder Names search needs no model.");- ui.checkbox(- &mut self.s.pause_for_game,- "Unload local models and pause indexing when a game is detected",- );- ui.checkbox(- &mut self.s.pause_for_fullscreen,- "Unload local models and pause indexing for full-screen applications",- );- ui.horizontal(|ui| {+ ui.label("An unloaded model may take a few seconds to load for the next Hybrid or Semantic search. File/Folder Names search needs no model.");+ ui.checkbox(+ &mut self.s.pause_for_game,+ "Unload local models and pause indexing when a game is detected",+ );+ ui.checkbox(+ &mut self.s.pause_for_fullscreen,+ "Unload local models and pause indexing for full-screen applications",+ );+ ui.horizontal(|ui| {ui.label("Additional game executable names");ui.text_edit_singleline(&mut self.s.game_processes).on_hover_text("Comma-separated names, such as forza.exe, cs2.exe. Windows detection also recognizes full-screen Direct3D and common game install paths.");});- ui.checkbox(- &mut self.s.defer_search_model,- "Delay search model loading while CPU/GPU or power limits are not met",- );- ui.label("Uses Scheduling resource limits; keyboard/mouse activity is ignored for searches. Load anyway applies only while the current search window remains open.");- ui.checkbox(- &mut self.s.show_model_notices,- "Show unloaded-model notices in search",- );+ ui.checkbox(+ &mut self.s.defer_search_model,+ "Delay search model loading while CPU/GPU or power limits are not met",+ );+ ui.label("Uses Scheduling resource limits; keyboard/mouse activity is ignored for searches. Load anyway applies only while the current search window remains open.");+ ui.checkbox(+ &mut self.s.show_model_notices,+ "Show unloaded-model notices in search",+ );- ui.label("OCR and media helpers run only while needed. Remote servers are managed by their host.");- ui.heading("Inference hardware");- combo(- ui,- "hardware",- &mut self.s.hardware,- &["CPU / system RAM", "Dedicated GPU", "Integrated GPU"],- );- if self.s.hardware != "CPU / system RAM" {+ ui.label("OCR and media helpers run only while needed. Remote servers are managed by their host.");+ ui.heading("Inference hardware");combo(ui,- "backend",- &mut self.s.runtime_backend,- &["Auto", "CUDA", "Vulkan"],+ "hardware",+ &mut self.s.hardware,+ &["CPU / system RAM", "Dedicated GPU", "Integrated GPU"],);- ui.label(format!("Setup backend: {}. CUDA is recommended for NVIDIA; Vulkan supports Intel/AMD and compatible NVIDIA builds.",if self.s.backend()=="cuda-"{"CUDA"}else{"Vulkan"}));- if self.devices_server != self.s.server && !self.devices_loading {- self.refresh_devices();- }- let text = self- .devices- .iter()- .find(|(id, _)| *id == self.s.device)- .map(|(id, name)| format!("{id} — {name}"))- .unwrap_or_else(|| {- if self.s.device.is_empty() {- if self.devices_loading {- "Detecting devices…".into()+ if self.s.hardware != "CPU / system RAM" {+ combo(+ ui,+ "backend",+ &mut self.s.runtime_backend,+ &["Auto", "CUDA", "Vulkan"],+ );+ ui.label(format!("Setup backend: {}. CUDA is recommended for NVIDIA; Vulkan supports Intel/AMD and compatible NVIDIA builds.",if self.s.backend()=="cuda-"{"CUDA"}else{"Vulkan"}));+ if self.devices_server != self.s.server && !self.devices_loading {+ self.refresh_devices();+ }+ let text = self+ .devices+ .iter()+ .find(|(id, _)| *id == self.s.device)+ .map(|(id, name)| format!("{id} — {name}"))+ .unwrap_or_else(|| {+ if self.s.device.is_empty() {+ if self.devices_loading {+ "Detecting devices…".into()+ } else {+ "Select GPU / iGPU".into()+ }} else {- "Select GPU / iGPU".into()+ self.s.device.clone()}- } else {- self.s.device.clone()- }- });- egui::ComboBox::from_id_salt("device_choice")- .selected_text(text)- .width(ui.available_width().min(620.0))- .show_ui(ui, |ui| {- for (id, name) in &self.devices {- ui.selectable_value(- &mut self.s.device,- id.clone(),- format!("{id} — {name}"),- );- }- });- if ui- .add_enabled(!self.devices_loading, egui::Button::new("Refresh devices"))- .clicked()- {- self.refresh_devices();- }- if self.s.device.to_ascii_uppercase().starts_with("CUDA") {- ui.label("Selected device backend: CUDA");- } else if !self.s.device.is_empty() {- ui.label("Selected device backend: Vulkan");+ });+ egui::ComboBox::from_id_salt("device_choice")+ .selected_text(text)+ .width(ui.available_width().min(620.0))+ .show_ui(ui, |ui| {+ for (id, name) in &self.devices {+ ui.selectable_value(+ &mut self.s.device,+ id.clone(),+ format!("{id} — {name}"),+ );+ }+ });+ if ui+ .add_enabled(!self.devices_loading, egui::Button::new("Refresh devices"))+ .clicked()+ {+ self.refresh_devices();+ }+ if self.s.device.to_ascii_uppercase().starts_with("CUDA") {+ ui.label("Selected device backend: CUDA");+ } else if !self.s.device.is_empty() {+ ui.label("Selected device backend: Vulkan");+ }}+ ui.collapsing("Advanced device identifier", |ui| {+ field(ui, "Device identifier", &mut self.s.device);+ });+ combo(ui, "quant", &mut self.s.quant, &["Q8_0", "BF16"]);+ path_field(ui, "llama-server", &mut self.s.server);+ path_field(ui, "EmbeddingGemma 2 GGUF", &mut self.s.model);+ path_field(ui, "Matching mmproj", &mut self.s.projector);+ } else {+ self.remote_server_ui(ui, 0);}- ui.collapsing("Advanced device identifier", |ui| {- field(ui, "Device identifier", &mut self.s.device);- });- combo(ui, "quant", &mut self.s.quant, &["Q8_0", "BF16"]);- path_field(ui, "llama-server", &mut self.s.server);- path_field(ui, "EmbeddingGemma 2 GGUF", &mut self.s.model);- path_field(ui, "Matching mmproj", &mut self.s.projector);- ui.add_space(12.0);- ui.heading("Remote model server");- field(- ui,- "Remote llama-server URL (blank uses local)",- &mut self.s.remote_url,- );- secret(ui, "Remote bearer key", &mut self.s.remote_key);ui.collapsing("Optional download tokens", |ui| {secret(ui, "GitHub download token", &mut self.s.github_token);secret(ui, "Hugging Face token", &mut self.s.hf_token);@@ -3347,29 +3542,39 @@ impl App {path_field(ui, "FFmpeg (bundled by default)", &mut self.s.ffmpeg);ui.add_space(12.0);ui.heading("Dictation");- ui.label("Parakeet TDT 0.6B v2 · English speech-to-text");combo(ui,- "dictation-device",- &mut self.s.dictation_device,- &["CPU", "NVIDIA CUDA"],+ "dictation-server",+ &mut self.s.dictation_server,+ &["Local", "Remote"],);- egui::ComboBox::from_id_salt("dictation-quant").selected_text(match crate::dictation::quant(&self.s){"fp16"=>"fp16",_=>"8-bit"}).show_ui(ui,|ui|{+ if !self.s.remote_dictation() {+ ui.label("Parakeet TDT 0.6B v2 · English speech-to-text");+ combo(+ ui,+ "dictation-device",+ &mut self.s.dictation_device,+ &["CPU", "NVIDIA CUDA"],+ );+ egui::ComboBox::from_id_salt("dictation-quant").selected_text(match crate::dictation::quant(&self.s){"fp16"=>"fp16",_=>"8-bit"}).show_ui(ui,|ui|{ui.selectable_value(&mut self.s.dictation_quant,"fp16".into(),"fp16");ui.selectable_value(&mut self.s.dictation_quant,"8-bit".into(),"8-bit");}).response.on_hover_text("Quantization is independent of device. CUDA can fall back to CPU for unsupported 8-bit operators.");- ui.checkbox(- &mut self.s.dictation_keep_loaded,- "Keep Parakeet loaded between transcriptions",- );- if self.s.dictation_keep_loaded {- ui.add(- egui::Slider::new(&mut self.s.dictation_unload_minutes, 1..=120)- .text("Unload after idle (minutes)"),+ ui.checkbox(+ &mut self.s.dictation_keep_loaded,+ "Keep Parakeet loaded between transcriptions",);+ if self.s.dictation_keep_loaded {+ ui.add(+ egui::Slider::new(&mut self.s.dictation_unload_minutes, 1..=120)+ .text("Unload after idle (minutes)"),+ );+ } else {+ ui.weak("Unloads immediately after each transcription.");+ }} else {- ui.weak("Unloads immediately after each transcription.");+ self.remote_server_ui(ui, 1);}ui.horizontal(|ui| {ui.label("Text batch size");@@ -3437,6 +3642,30 @@ impl App {self.refresh_microphones();}});+ ui.label("Voice shortcut popup defaults");+ combo(+ ui,+ "voice-popup-tool",+ &mut self.s.voice_popup_tool,+ &["Search", "Clipboard", "AI"],+ );+ ui.weak("Applies when opening a closed search window. An open window keeps its current page. Disabled AI/Clipboard falls back to Search.");+ ui.add_enabled(+ self.s.tts_enabled,+ egui::Checkbox::new(+ &mut self.s.voice_read_aloud,+ "Read aloud AI answers started with the voice shortcut",+ ),+ )+ .on_hover_text("Enable text to speech in AI settings first");+ if self.s.voice_popup_tool == "AI" {+ combo(+ ui,+ "voice-response",+ &mut self.s.voice_response,+ &["Brief", "Medium", "Full"],+ );+ }ui.checkbox(&mut self.s.dictation_auto_finish,"Transcribe automatically after I stop speaking",@@ -3799,6 +4028,9 @@ impl App {self.tts_busy = false;}fn start_read_aloud(&mut self, text: String) {+ if !self.s.tts_enabled || !self.saved_settings.tts_enabled {+ return;+ }self.stop_read_aloud();self.tts_job += 1;let id = self.tts_job;@@ -3990,18 +4222,19 @@ impl App {{ctx.copy_text(self.ai_answer.clone());}- if ui- .add(egui::Button::image(crate::icons::image(- crate::icons::Icon::Speaker,- self.accent(),- 20.0,- )))- .on_hover_text(if self.tts_busy {- "Stop read aloud"- } else {- "Read last response aloud"- })- .clicked()+ if self.saved_settings.tts_enabled+ && ui+ .add(egui::Button::image(crate::icons::image(+ crate::icons::Icon::Speaker,+ self.accent(),+ 20.0,+ )))+ .on_hover_text(if self.tts_busy {+ "Stop read aloud"+ } else {+ "Read last response aloud"+ })+ .clicked(){if self.tts_busy {self.stop_read_aloud();@@ -4382,8 +4615,16 @@ impl App {ui.weak("Estimated conversation + response budget, not a server context resize. Tokenizers differ. Old turns are removed automatically when needed.");ui.separator();ui.heading("Text to speech");+ if ui+ .checkbox(&mut self.s.tts_enabled, "Enable text to speech")+ .changed()+ && !self.s.tts_enabled+ {+ self.stop_read_aloud();+ }let previous_tts = (self.s.tts_url.clone(), self.s.tts_model.clone());let previous_voice = self.s.tts_voice.clone();+ ui.add_enabled_ui(self.s.tts_enabled, |ui| {ui.label("API base URL");self.connection_row(ui, true);ui.weak("Example: http://localhost:8880/v1 (include /v1)");@@ -4436,6 +4677,7 @@ impl App {ui.text_edit_singleline(&mut self.s.tts_voice);ui.checkbox(&mut self.s.tts_auto, "Read AI responses aloud by default");ui.weak("Generated voice audio. Answers are sent to your TTS server only when read aloud is enabled or requested. Some servers do not offer voice discovery; enter the voice ID manually.");+ });if previous_tts != (self.s.tts_url.clone(), self.s.tts_model.clone()) {self.tts_voice_job += 1;self.tts_voice_busy = false;@@ -4856,6 +5098,11 @@ impl eframe::App for App {if found{i.events.retain(|e|!matches!(e,egui::Event::Key{key,modifiers,..} if crate::ai::shortcut(*key,*modifiers)==self.saved_settings.dictation_hotkey));}found});if invoke {+ if self.tool == "AI" {+ self.read_aloud =+ self.saved_settings.tts_enabled && self.saved_settings.voice_read_aloud;+ self.response_length = self.saved_settings.voice_response.clone();+ }self.toggle_dictation();}}@@ -5392,7 +5639,7 @@ impl eframe::App for App {}if !self.collapsed {ui.label("Your files and data stay on your computer");- ui.label("Everything runs locally");+ ui.label("Your index stays on this PC");}});});@@ -5437,7 +5684,7 @@ impl eframe::App for App {ctx.animate_bool_with_time(egui::Id::new("popup-expansion"), !empty, 0.18);let panel = self.tool == "Search"&& self.mode != "Names"- && self.s.remote_url.is_empty()+ && !self.s.remote_embeddings()&& (self.engine.models.loading.load(Ordering::Acquire)|| self.engine.models.search_hold(&self.s).is_some()|| self.model_warm_error.is_some()@@ -5918,7 +6165,15 @@ impl eframe::App for App {if self.startup.elapsed() > Duration::from_secs(self.smoke_seconds)&& (self.qa_screenshot.is_none() || self.qa_captured){- let data = serde_json::json!({"ok":true,"native_rust":true,"tool":self.tool,"tools":self.saved_settings.search_tools(),"footer":self.footer_text(),"dictation_status":self.dictation_status,"query":self.query,"ai_busy":self.ai_busy,"ai_answer":self.ai_answer,"model_loaded":self.engine.models.loaded.load(Ordering::Relaxed),"frames":self.frames,"max_frame_interval_ms":self.max_frame_ms,"dark_mode":ctx.style().visuals.dark_mode,"hidden_reopened":self.qa_hidden_reopened,"ocr_enabled":self.s.ocr_enabled,"ocr_setup_selected":self.ocr_setup,"results":self.hits.len(),"selected":self.selected,"result_scroll_offset":self.result_scroll_offset,"scope":self.scope,"quick_look":self.large_preview,"quick_look_size":self.qa_child_size,"cpu":crate::scheduling::metrics().cpu,"gpu":crate::scheduling::metrics().gpu,"query_focus":ctx.memory(|m|m.has_focus(egui::Id::new("query"))),"ai_metrics":self.ai_metrics.label(),"tts_busy":self.tts_busy,"tts_paused":self.tts_paused.load(Ordering::Acquire),"connection_results":self.connections.iter().map(|s|s.result.as_ref().map(|r|r.is_ok())).collect::<Vec<_>>(),"ai_scroll_offset":self.ai_scroll_offset,"qa_ai_scroll_before":self.qa_ai_scroll_before,"qa_ai_followup_sent":self.qa_ai_followup_sent,"tts_status":self.tts_status,"tts_notice":self.tts_notice,"tts_voices":self.tts_voices,"response_length":self.response_length,"toolbar_top":self.qa_toolbar_top,"filters_top":self.qa_filter_top,"query_selected":egui::text_edit::TextEditState::load(ctx,egui::Id::new("query")).and_then(|s|s.cursor.char_range()).map(|r|r.as_sorted_char_range().len()).unwrap_or(0)});+ let mut data = serde_json::json!({"ok":true,"native_rust":true,"tool":self.tool,"tools":self.saved_settings.search_tools(),"footer":self.footer_text(),"dictation_status":self.dictation_status,"query":self.query,"ai_busy":self.ai_busy,"ai_answer":self.ai_answer,"model_loaded":self.engine.models.loaded.load(Ordering::Relaxed),"frames":self.frames,"max_frame_interval_ms":self.max_frame_ms,"dark_mode":ctx.style().visuals.dark_mode,"hidden_reopened":self.qa_hidden_reopened,"ocr_enabled":self.s.ocr_enabled,"ocr_setup_selected":self.ocr_setup,"results":self.hits.len(),"selected":self.selected,"result_scroll_offset":self.result_scroll_offset,"scope":self.scope,"quick_look":self.large_preview,"quick_look_size":self.qa_child_size,"cpu":crate::scheduling::metrics().cpu,"gpu":crate::scheduling::metrics().gpu,"query_focus":ctx.memory(|m|m.has_focus(egui::Id::new("query"))),"ai_metrics":self.ai_metrics.label(),"tts_busy":self.tts_busy,"tts_paused":self.tts_paused.load(Ordering::Acquire),"connection_results":self.connections.iter().map(|s|s.result.as_ref().map(|r|r.is_ok())).collect::<Vec<_>>(),"ai_scroll_offset":self.ai_scroll_offset,"qa_ai_scroll_before":self.qa_ai_scroll_before,"qa_ai_followup_sent":self.qa_ai_followup_sent,"tts_status":self.tts_status,"tts_notice":self.tts_notice,"tts_voices":self.tts_voices,"response_length":self.response_length,"toolbar_top":self.qa_toolbar_top,"filters_top":self.qa_filter_top,"query_selected":egui::text_edit::TextEditState::load(ctx,egui::Id::new("query")).and_then(|s|s.cursor.char_range()).map(|r|r.as_sorted_char_range().len()).unwrap_or(0)});+ data["read_aloud"] = serde_json::json!(self.read_aloud);+ data["tts_enabled"] = serde_json::json!(self.saved_settings.tts_enabled);+ data["remote_status"] = serde_json::json!(+ self.remote_servers+ .iter()+ .map(|r| r.note.clone())+ .collect::<Vec<_>>()+ );let _ = std::fs::write(report, data.to_string());self.exiting = true;ctx.send_viewport_cmd(egui::ViewportCommand::Close);diff --git a/native/src/config.rs b/native/src/config.rsindex 45bdd74..0e9ad44 100644--- a/native/src/config.rs+++ b/native/src/config.rs@@ -33,6 +33,9 @@ pub struct Settings {pub auto_check_updates: bool,pub auto_update: bool,pub skip_windows_churn: bool,+ pub embedding_server: String,+ pub remote_model: String,+ pub remote_context: u32,pub remote_url: String,pub remote_key: String,pub server: String,@@ -104,6 +107,14 @@ pub struct Settings {pub ocr: String,pub ocr_languages: String,pub ffmpeg: String,+ pub dictation_server: String,+ pub dictation_url: String,+ pub dictation_key: String,+ pub dictation_model: String,+ pub dictation_context: u32,+ pub voice_popup_tool: String,+ pub voice_read_aloud: bool,+ pub voice_response: String,pub dictation_quant: String,pub microphone: String,pub dictation_auto_finish: bool,@@ -117,6 +128,7 @@ pub struct Settings {pub llm_vision: bool,pub llm_url: String,pub llm_key: String,+ pub tts_enabled: bool,pub tts_url: String,pub tts_key: String,pub tts_model: String,@@ -153,6 +165,9 @@ impl Default for Settings {auto_check_updates: true,auto_update: false,skip_windows_churn: true,+ embedding_server: String::new(),+ remote_model: String::new(),+ remote_context: 2048,remote_url: String::new(),remote_key: String::new(),server: String::new(),@@ -224,6 +239,14 @@ impl Default for Settings {ocr: String::new(),ocr_languages: "eng".into(),ffmpeg: String::new(),+ dictation_server: "Local".into(),+ dictation_url: "http://localhost:8080/v1".into(),+ dictation_key: String::new(),+ dictation_model: String::new(),+ dictation_context: 2048,+ voice_popup_tool: "Search".into(),+ voice_read_aloud: false,+ voice_response: "Brief".into(),dictation_quant: "Auto".into(),microphone: String::new(),dictation_auto_finish: true,@@ -237,6 +260,7 @@ impl Default for Settings {llm_vision: false,llm_url: "http://localhost:8080/v1".into(),llm_key: String::new(),+ tts_enabled: true,tts_url: String::new(),tts_key: String::new(),tts_model: String::new(),@@ -361,6 +385,13 @@ pub fn mode<'a>(path: &str, s: &'a Settings) -> &'a str {.unwrap_or("quick")}impl Settings {+ pub fn remote_embeddings(&self) -> bool {+ self.embedding_server == "Remote"+ || (self.embedding_server.is_empty() && !self.remote_url.trim().is_empty())+ }+ pub fn remote_dictation(&self) -> bool {+ self.dictation_server == "Remote"+ }pub fn load(home: &Path) -> Result<Self> {let file = home.join("settings.json");let mut s: Self = if file.exists() {@@ -369,10 +400,19 @@ impl Settings {Self::default()};s.voice_search_hotkey = s.dictation_hotkey.clone();+ if s.embedding_server.is_empty() {+ s.embedding_server = if s.remote_url.trim().is_empty() {+ "Local"+ } else {+ "Remote"+ }+ .into();+ }for value in [&mut s.llm_key,&mut s.tts_key,&mut s.remote_key,+ &mut s.dictation_key,&mut s.hf_token,&mut s.github_token,&mut s.mcp_token,@@ -389,6 +429,7 @@ impl Settings {&mut s.llm_key,&mut s.tts_key,&mut s.remote_key,+ &mut s.dictation_key,&mut s.hf_token,&mut s.github_token,&mut s.mcp_token,@@ -1003,3 +1044,37 @@ mod tool_visibility_tests {assert!(!Settings::load(dir.path()).unwrap().ai_chat_available());}}++#[cfg(test)]+mod server_mode_tests {+ use super::*;+ #[test]+ fn explicit_local_preserves_remote_details_without_using_them() {+ let mut s = Settings {+ remote_url: "https://example.test/v1".into(),+ ..Default::default()+ };+ assert!(s.remote_embeddings());+ s.embedding_server = "Local".into();+ assert!(!s.remote_embeddings());+ s.embedding_server = "Remote".into();+ assert!(s.remote_embeddings());+ assert!(!s.remote_dictation());+ s.dictation_server = "Remote".into();+ assert!(s.remote_dictation());+ }+ #[test]+ fn remote_secret_and_voice_defaults_round_trip() {+ let temp = tempfile::tempdir().unwrap();+ let s = Settings {+ embedding_server: "Local".into(),+ dictation_key: "voice-secret".into(),+ voice_popup_tool: "AI".into(),+ voice_response: "Medium".into(),+ voice_read_aloud: true,+ ..Default::default()+ };+ s.save(temp.path()).unwrap();+ assert_eq!(Settings::load(temp.path()).unwrap(), s);+ }+}diff --git a/native/src/dictation.rs b/native/src/dictation.rsindex a17925b..a2b02f6 100644--- a/native/src/dictation.rs+++ b/native/src/dictation.rs@@ -353,9 +353,13 @@ pub fn run(mut state: impl FnMut(&str),) -> Result<String> {anyhow::ensure!(- ready(home, s),+ s.remote_dictation() || ready(home, s),"Download Parakeet dictation in Models & hardware first");+ anyhow::ensure!(+ !s.remote_dictation() || !s.dictation_model.trim().is_empty(),+ "Select a remote dictation model in Models & hardware"+ );let _activity = Activity::new();let host = cpal::default_host();let device = if s.microphone.is_empty() {@@ -419,10 +423,14 @@ pub fn run(let warm_cancel = cancel.clone();let mut warm = WarmStart {cancel: cancel.clone(),- handle: Some(std::thread::spawn(move || {- let _activity = Activity::new();- preload(&warm_home, &warm_settings, &warm_cancel)- })),+ handle: if s.remote_dictation() {+ None+ } else {+ Some(std::thread::spawn(move || {+ let _activity = Activity::new();+ preload(&warm_home, &warm_settings, &warm_cancel)+ }))+ },};activation_sound();stream.play()?;@@ -510,6 +518,9 @@ pub fn run(}writer.finalize()?;state("Transcribing…");+ if s.remote_dictation() {+ return crate::remote::transcribe(s, &wav, &cancel);+ }warm.handle.take().unwrap()diff --git a/native/src/engine.rs b/native/src/engine.rsindex dfe3411..b4efe9c 100644--- a/native/src/engine.rs+++ b/native/src/engine.rs@@ -135,6 +135,11 @@ pub enum Event {Screenshot(Result<Vec<u8>, String>),Update(crate::updates::Update),AiChunk(u64, String),+ RemoteCatalog(+ usize,+ String,+ std::result::Result<crate::remote::Catalog, String>,+ ),ConnectionTest(usize, u64, Result<(), String>),AiMetrics(u64, crate::ai::Metrics),TtsCatalog(@@ -705,7 +710,11 @@ impl Engine {"{}|{}|{}|{}|{}|{}|{}|{}",s.model,s.projector,- s.remote_url,+ if s.remote_embeddings() {+ format!("{}|{}", s.remote_url, s.remote_model)+ } else {+ String::new()+ },s.index_images,s.index_audio,s.index_video,@@ -1024,7 +1033,7 @@ impl Engine {);file_progress.phase = format!("EmbeddingGemma 2 — {}",- if !s.remote_url.is_empty() {+ if s.remote_embeddings() {"remote server".into()} else if s.hardware == "CPU / system RAM" {"local CPU".into()diff --git a/native/src/launcher.rs b/native/src/launcher.rsindex 4828b3d..d3dab80 100644--- a/native/src/launcher.rs+++ b/native/src/launcher.rs@@ -107,7 +107,17 @@ impl Clipboard {Ok(c)}fn model_key(s: &crate::config::Settings) -> String {- format!("{}|{}|{}|{}", s.model, s.projector, s.remote_url, s.server)+ format!(+ "{}|{}|{}|{}",+ s.model,+ s.projector,+ if s.remote_embeddings() {+ format!("{}|{}", s.remote_url, s.remote_model)+ } else {+ String::new()+ },+ s.server+ )}pub fn index_next_image(&self,diff --git a/native/src/main.rs b/native/src/main.rsindex db8e292..5c8502b 100644--- a/native/src/main.rs+++ b/native/src/main.rs@@ -19,6 +19,7 @@ mod models;mod pdf;mod platform;mod previews;+mod remote;mod resources;mod scheduling;mod search_filters;diff --git a/native/src/models.rs b/native/src/models.rsindex 5c0d942..1fbb8b8 100644--- a/native/src/models.rs+++ b/native/src/models.rs@@ -60,6 +60,7 @@ impl Default for Models {agent: ureq::Agent::config_builder().timeout_connect(Some(Duration::from_secs(3))).timeout_global(Some(Duration::from_secs(90)))+ .max_redirects(0).http_status_as_error(false).build().into(),@@ -74,10 +75,14 @@ impl Default for Models {}impl Models {pub fn url(s: &Settings) -> String {- if s.remote_url.is_empty() {+ if !s.remote_embeddings() {"http://127.0.0.1:8788".into()} else {- s.remote_url.trim_end_matches('/').into()+ s.remote_url+ .trim()+ .trim_end_matches('/')+ .trim_end_matches("/v1")+ .into()}}pub fn stop(&self) -> Result<()> {@@ -155,14 +160,14 @@ impl Models {self.load_phase.lock().unwrap().clone()}pub fn search_hold(&self, s: &Settings) -> Option<&'static str> {- if self.session_override.load(Ordering::Acquire) {+ if s.remote_embeddings() || self.session_override.load(Ordering::Acquire) {None} else {crate::scheduling::model_hold(s, crate::scheduling::metrics())}}fn ensure(&self, s: &Settings, media: bool) -> Result<()> {- if !s.remote_url.is_empty() {+ if !!s.remote_embeddings() {return Ok(());}if !self.loaded.load(Ordering::Acquire) {@@ -182,7 +187,7 @@ impl Models {.lock().map_err(|_| anyhow::anyhow!("Model state unavailable"))?;state.last_used = Instant::now();- if !s.remote_url.is_empty() {+ if !!s.remote_embeddings() {return Ok(());}anyhow::ensure!(@@ -328,7 +333,16 @@ impl Models {}}fn marker(&self, s: &Settings) -> Result<String> {- let key = format!("{}|{}", Self::url(s), s.projector);+ let key = format!(+ "{}|{}|{}",+ Self::url(s),+ s.projector,+ if s.remote_embeddings() {+ s.remote_model.as_str()+ } else {+ ""+ }+ );if let Some((_, marker)) = self.inner.lock()@@ -339,8 +353,8 @@ impl Models {{return Ok(marker.clone());}- let mut req = self.agent.get(format!("{}/props", Self::url(s)));- if !s.remote_key.is_empty() {+ let mut req = self.agent.get(crate::ai::endpoint(&Self::url(s), "props")?);+ if s.remote_embeddings() && !s.remote_key.is_empty() {req = req.header("Authorization", format!("Bearer {}", s.remote_key));}let props: Value = req.call()?.body_mut().read_json()?;@@ -357,11 +371,17 @@ impl Models {url.starts_with("http://") || url.starts_with("https://"),"Server URL must use HTTP or HTTPS");- let mut req = self.agent.post(format!("{url}/v1/embeddings"));- if !s.remote_key.is_empty() {+ let mut req = self.agent.post(crate::remote::api(&url, "embeddings")?);+ if s.remote_embeddings() && !s.remote_key.is_empty() {req = req.header("Authorization", format!("Bearer {}", s.remote_key));}- let mut response = req.send_json(json!({"input":input}))?;+ let mut response = req.send_json(+ if s.remote_embeddings() && !s.remote_model.trim().is_empty() {+ json!({"model":s.remote_model,"input":input})+ } else {+ json!({"input":input})+ },+ )?;let status = response.status().as_u16();let body: Value = response.body_mut()@@ -395,6 +415,38 @@ impl Models {return Ok(vec![]);}self.ensure(s, false)?;+ if s.remote_embeddings()+ && texts+ .iter()+ .any(|t| t.chars().count() > s.remote_context.clamp(128, 131072) as usize * 2)+ {+ let mut output = vec![];+ for text in texts {+ let parts =+ crate::content::chunks(text, s.remote_context.clamp(128, 131072) as usize * 2)+ .into_iter()+ .map(|(t, _)| t)+ .collect::<Vec<_>>();+ let parts = if parts.is_empty() {+ vec![text.clone()]+ } else {+ parts+ };+ let vectors = self.text_batch(s, &parts)?;+ let mut combined = vec![0.0; vectors[0].len()];+ for vector in vectors {+ anyhow::ensure!(+ vector.len() == combined.len(),+ "Embedding dimensions changed"+ );+ for (a, b) in combined.iter_mut().zip(vector) {+ *a += b;+ }+ }+ output.push(normalize(combined));+ }+ return Ok(output);+ }match self.post(s, json!(texts)) {Ok(v) => {anyhow::ensure!(@@ -481,7 +533,11 @@ impl Models {"{}|{}|{}|{}|{}",Self::url(s),s.remote_key,- s.model,+ if s.remote_embeddings() {+ &s.remote_model+ } else {+ &s.model+ },s.server,q);diff --git a/native/src/remote.rs b/native/src/remote.rsnew file mode 100644index 0000000..dcda2a1--- /dev/null+++ b/native/src/remote.rs@@ -0,0 +1,237 @@+use anyhow::{Context, Result};+use serde_json::{Value, json};+use std::{+ path::Path,+ sync::{+ Arc,+ atomic::{AtomicBool, Ordering},+ },+ time::Duration,+};+#[derive(Clone, Debug)]+pub struct Catalog {+ pub models: Vec<String>,+ pub note: String,+}+pub fn api(base: &str, path: &str) -> Result<String> {+ let base = base.trim().trim_end_matches('/');+ crate::ai::endpoint(+ &format!("{}/v1", base.strip_suffix("/v1").unwrap_or(base)),+ path,+ )+}+fn client() -> Result<reqwest::Client> {+ Ok(reqwest::Client::builder()+ .connect_timeout(Duration::from_secs(5))+ .timeout(Duration::from_secs(120))+ .redirect(reqwest::redirect::Policy::none())+ .build()?)+}+async fn json_response(response: reqwest::Response) -> Result<Value> {+ let status = response.status();+ let mut response = response;+ let mut bytes = vec![];+ while let Some(chunk) = response.chunk().await? {+ anyhow::ensure!(+ bytes.len() + chunk.len() <= 1024 * 1024,+ "Server response exceeded the limit"+ );+ bytes.extend_from_slice(&chunk);+ }+ let value: Value = serde_json::from_slice(&bytes).context("Server did not return JSON")?;+ anyhow::ensure!(+ status.is_success(),+ "Server HTTP {}: {}",+ status.as_u16(),+ value["error"]["message"]+ .as_str()+ .unwrap_or("Request failed")+ .chars()+ .take(300)+ .collect::<String>()+ );+ Ok(value)+}+pub fn catalog(base: &str, key: &str, model: &str, check_embeddings: bool) -> Result<Catalog> {+ let runtime = tokio::runtime::Builder::new_current_thread()+ .enable_all()+ .build()?;+ runtime.block_on(async {+ let client = client()?;+ let mut req = client.get(api(base, "models")?);+ if !key.trim().is_empty() {+ req = req.bearer_auth(key.trim());+ }+ let value = json_response(req.send().await?).await?;+ let mut models = value["data"]+ .as_array()+ .context("Server did not return a model list")?+ .iter()+ .filter_map(|v| v["id"].as_str())+ .take(1000)+ .map(str::to_owned)+ .collect::<Vec<_>>();+ models.sort();+ models.dedup();+ let note = if check_embeddings {+ anyhow::ensure!(!model.trim().is_empty(), "Select an embedding model first");+ let mut req = client+ .post(api(base, "embeddings")?)+ .json(&json!({"model":model,"input":"VectorDash embedding connection test."}));+ if !key.trim().is_empty() {+ req = req.bearer_auth(key.trim());+ }+ let value = json_response(req.send().await?).await?;+ let vector = value["data"][0]["embedding"]+ .as_array()+ .context("Embeddings are not enabled: no vector returned")?;+ anyhow::ensure!(+ !vector.is_empty()+ && vector+ .iter()+ .all(|v| v.as_f64().is_some_and(f64::is_finite)),+ "Invalid embedding vector"+ );+ format!("Embeddings enabled · {} dimensions", vector.len())+ } else {+ "Connection Successful".into()+ };+ Ok(Catalog { models, note })+ })+}+pub fn transcribe(+ s: &crate::config::Settings,+ wav: &Path,+ cancel: &Arc<AtomicBool>,+) -> Result<String> {+ anyhow::ensure!(+ !s.dictation_model.trim().is_empty(),+ "Select a remote dictation model in Models & hardware"+ );+ let audio = std::fs::read(wav)?;+ anyhow::ensure!(+ audio.len() <= 4 * 1024 * 1024,+ "Dictation audio exceeded the limit"+ );+ let runtime = tokio::runtime::Builder::new_current_thread()+ .enable_all()+ .build()?;+ runtime.block_on(async {+ let part=reqwest::multipart::Part::bytes(audio).file_name("dictation.wav").mime_str("audio/wav")?;+ let form=reqwest::multipart::Form::new().text("model",s.dictation_model.clone()).text("response_format","json").part("file",part);+ let mut req=client()?.post(api(&s.dictation_url,"audio/transcriptions")?).multipart(form);+ if !s.dictation_key.trim().is_empty(){req=req.bearer_auth(s.dictation_key.trim());}+ let request=async {let value=json_response(req.send().await?).await?;let text=value["text"].as_str().context("Transcription response has no text")?.trim().to_owned();anyhow::ensure!(!text.is_empty(),"Remote dictation returned no recognizable speech");Ok(text)};+ let cancellation=async{while !cancel.load(Ordering::Acquire){tokio::time::sleep(Duration::from_millis(25)).await;}};+ tokio::select!{biased;_ = cancellation => anyhow::bail!("Dictation cancelled"), result=request => result}+ })+}+#[cfg(test)]+mod tests {+ use super::*;+ #[test]+ fn normalized_api() {+ assert_eq!(+ api("https://example.test/v1/", "models").unwrap(),+ "https://example.test/v1/models"+ );+ assert_eq!(+ api("http://localhost:8080", "embeddings").unwrap(),+ "http://localhost:8080/v1/embeddings"+ );+ assert!(api("http://secret@host/v1", "models").is_err());+ }+}++#[cfg(test)]+mod request_tests {+ use super::*;+ #[test]+ fn embedding_probe_uses_selected_model_and_auth() {+ let server = tiny_http::Server::http("127.0.0.1:0").unwrap();+ let url = format!("http://{}/v1", server.server_addr());+ let task = std::thread::spawn(move || {+ for n in 0..2 {+ let mut req = server.recv().unwrap();+ assert!(req.headers().iter().any(+ |h| h.field.equiv("Authorization") && h.value.as_str() == "Bearer fixture"+ ));+ let response = if n == 0 {+ assert_eq!(req.url(), "/v1/models");+ json!({"data":[{"id":"EmbedCase"}]})+ } else {+ assert_eq!(req.url(), "/v1/embeddings");+ let mut body = String::new();+ req.as_reader().read_to_string(&mut body).unwrap();+ assert_eq!(+ serde_json::from_str::<Value>(&body).unwrap()["model"],+ "EmbedCase"+ );+ json!({"data":[{"embedding":[0.2,0.3]}]})+ };+ req.respond(+ tiny_http::Response::from_string(response.to_string()).with_header(+ tiny_http::Header::from_bytes("Content-Type", "application/json").unwrap(),+ ),+ )+ .unwrap();+ }+ });+ let result = catalog(&url, "fixture", "EmbedCase", true).unwrap();+ assert_eq!(result.models, vec!["EmbedCase"]);+ assert!(result.note.contains("2 dimensions"));+ task.join().unwrap();+ }+ #[test]+ fn remote_transcription_uploads_wav_and_keeps_model_case() {+ let server = tiny_http::Server::http("127.0.0.1:0").unwrap();+ let settings = crate::config::Settings {+ dictation_server: "Remote".into(),+ dictation_url: format!("http://{}/v1", server.server_addr()),+ dictation_key: "asr-key".into(),+ dictation_model: "ParakeetCase".into(),+ ..Default::default()+ };+ let task = std::thread::spawn(move || {+ let mut req = server.recv().unwrap();+ assert_eq!(req.url(), "/v1/audio/transcriptions");+ assert!(req.headers().iter().any(|h|h.field.equiv("Authorization")&&h.value.as_str()=="Bearer asr-key"));+ let mut body = vec![];+ req.as_reader().read_to_end(&mut body).unwrap();+ let body = String::from_utf8_lossy(&body);+ assert!(body.contains("name=\"model\""));+ assert!(body.contains("ParakeetCase"));+ assert!(body.contains("filename=\"dictation.wav\""));+ assert!(body.contains("RIFF"));+ req.respond(+ tiny_http::Response::from_string("{\"text\":\"Hello, world.\"}").with_header(+ tiny_http::Header::from_bytes("Content-Type", "application/json").unwrap(),+ ),+ )+ .unwrap();+ });+ let temp = tempfile::tempdir().unwrap();+ let wav = temp.path().join("test.wav");+ std::fs::write(&wav, b"RIFFtestWAVE").unwrap();+ assert_eq!(+ transcribe(&settings, &wav, &Arc::new(AtomicBool::new(false))).unwrap(),+ "Hello, world."+ );+ task.join().unwrap();+ }+ #[test]+ fn cancelled_transcription_does_not_wait_for_server() {+ let s = crate::config::Settings {+ dictation_url: "http://127.0.0.1:9/v1".into(),+ dictation_model: "model".into(),+ ..Default::default()+ };+ let temp = tempfile::tempdir().unwrap();+ let wav = temp.path().join("test.wav");+ std::fs::write(&wav, b"RIFFtest").unwrap();+ let start = std::time::Instant::now();+ let error = transcribe(&s, &wav, &Arc::new(AtomicBool::new(true))).unwrap_err();+ assert!(error.to_string().contains("cancelled"));+ assert!(start.elapsed() < Duration::from_secs(1));+ }+}diff --git a/native/src/scheduling.rs b/native/src/scheduling.rsindex c52ea3d..4a04c94 100644--- a/native/src/scheduling.rs+++ b/native/src/scheduling.rs@@ -27,7 +27,7 @@ pub fn resource_pause(s: &Settings, m: Metrics) -> Option<&'static str> {}}pub fn model_hold(s: &Settings, m: Metrics) -> Option<&'static str> {- if !s.remote_url.is_empty() {+ if s.remote_embeddings() {return None;}if let Some(reason) = resource_pause(s, m) {diff --git a/native/src/worker.rs b/native/src/worker.rsindex 2c3c89a..867f071 100644--- a/native/src/worker.rs+++ b/native/src/worker.rs@@ -48,6 +48,7 @@ pub fn visit(}let mut settings = s.clone();settings.remote_key.clear();+ settings.dictation_key.clear();settings.hf_token.clear();settings.github_token.clear();settings.mcp_token.clear();diff --git a/packaging/VectorDash-Rust.iss b/packaging/VectorDash-Rust.issindex ec7b03d..444fb51 100644--- a/packaging/VectorDash-Rust.iss+++ b/packaging/VectorDash-Rust.iss@@ -3,7 +3,7 @@ AppId={{C6AC1B4D-A119-4D73-B2C8-6C507DEFE923}AppName=VectorDashAppVerName=VectorDashUninstallDisplayName=VectorDash-AppVersion=0.3.17+AppVersion=0.3.18AppPublisher=VectorDash contributorsAppPublisherURL=https://github.com/ampersandru/VectorDashDefaultDirName={localappdata}\Programs\VectorDash@@ -13,7 +13,7 @@ ArchitecturesAllowed=x64compatibleArchitecturesInstallIn64BitMode=x64compatibleMinVersion=10.0.22000OutputDir=..\dist\installer-OutputBaseFilename=VectorDash-Rust-Setup-0.3.17-x64+OutputBaseFilename=VectorDash-Rust-Setup-0.3.18-x64SetupIconFile=VectorDash.icoUninstallDisplayIcon={app}\VectorDash.exeLicenseFile=..\LICENSE