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
Reorganize model and hardware settings and detect remote capabilities
ampersandru02307e6009cd
diff --git a/Build-Rust.ps1 b/Build-Rust.ps1index f134f93..988274a 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.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'+Compress-Archive -Path (Join-Path $taskPortable '*') -DestinationPath 'dist/installer/VectorDash-Rust-0.3.19-x64.zip' -Force+$taskInstaller='dist/installer/VectorDash-Rust-Setup-0.3.19-x64.exe'+$taskZip='dist/installer/VectorDash-Rust-0.3.19-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 5c393b2..db4600d 100644--- a/README.md+++ b/README.md@@ -24,7 +24,7 @@ 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. 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.+- **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. Use **Models and AI** for embedding, dictation, LLM and voice models. Remote checks report readiness, vision/mmproj support, output dimensions and available context; manual context limits stay editable. **Hardware** shows combined local CPU/GPU, memory and storage usage. 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, 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.@@ -33,7 +33,7 @@ Search by name or exact words, or describe what you remember. Google's **Embeddi### AI and agent access-Switch 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.+Switch to **AI** to ask questions using your own local or remote **OpenAI-compatible server**. In **Models and AI**, 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** (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.@@ -46,7 +46,7 @@ The optional **MCP server**, on the same settings page, lets compatible agents s1. Download the latest **Windows x64 setup EXE** from [Releases](https://github.com/ampersandru/VectorDash/releases) (about **97 MB**), or the **portable ZIP**. Python is not required.2. Run the installer. **The EXE is not code-signed**, so Windows may show a SmartScreen or unknown-publisher warning. If you trust the release, choose **More info → Run anyway**, when available, to continue.-3. **Optional semantic search:** open **Models & hardware → Status** to install features, then choose hardware and model. Click **Start** when needed. **Q8_0** is the default. For names-only search, skip model setup and select Quick mode in Sources. The calculator and Windows settings shortcuts are ready immediately.+3. **Optional semantic search:** choose CPU/GPU settings in **Hardware**, then open **Models and AI → Embedding Model → Download/setup** to install the model, encoder and selected runtime. Click **Start** when needed. **Q8_0** is the default. For names-only search, skip model setup and select Quick mode in Sources. The calculator and Windows settings shortcuts are ready immediately.4. Add folders or drives in **Sources**, then click **Update index**. Start with a small folder to check results.**Upgrading:** setup installs as **VectorDash** and replaces the older Python installation in its existing folder. A separately registered Rust preview is removed after a successful upgrade. Settings, models and indexes are retained; older Python indexes can be imported as a copy through Sources.@@ -67,6 +67,7 @@ Semantic search needs the model and a compatible llama-server. Image/audio searc| **Enter** | Open a file, launch an app, open settings, or copy a calculator answer || **Ctrl+C** | Copy the selected file, calculator answer or settings link || **Tab / Shift+Tab** | Cycle enabled Search, Clipboard and AI modes forward/backward. Enter submits an AI question |+| **Ctrl+Tab** | Cycle file types; configurable in Settings. The current type appears inside the search field || **↑ / ↓** | Select results and scroll the list || **Ctrl+F** | Return to search from settings || **Double Ctrl** | Open quick search in Explorer or a standard Open/Save dialog when enabled |@@ -100,7 +101,7 @@ Parakeet provides **English speech-to-text**, independently of semantic search.Install only the runtime for your hardware. OCR is optional for image meaning searches; it helps with exact text. FFmpeg and the encoder are needed for media processing.-**Download trouble?** Setup caches official catalogs and retries temporary failures. Rate-limit messages identify GitHub (runtimes) or Hugging Face (models) and suggest when to retry. Optional **GitHub / Hugging Face download tokens** are in **Models & hardware → Download and set up**; save them before retrying. They are protected by your Windows account and sent only to their own service. Interrupted downloads retain partial files for resume, and checksums are still required. You can also select an existing runtime/model manually.+**Download trouble?** Setup caches official catalogs and retries temporary failures. Rate-limit messages identify GitHub (runtimes) or Hugging Face (models) and suggest when to retry. Optional **GitHub / Hugging Face download tokens** are in **Hardware → Optional download tokens**; save them before retrying. They are protected by your Windows account and sent only to their own service. Interrupted downloads retain partial files for resume, and checksums are still required. You can also select an existing runtime/model manually.## Performancediff --git a/native/Cargo.lock b/native/Cargo.lockindex 568a8b3..4362e9a 100644--- a/native/Cargo.lock+++ b/native/Cargo.lock@@ -5716,7 +5716,7 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"[[package]]name = "vectordash"-version = "0.3.18"+version = "0.3.19"dependencies = ["anyhow","arboard",diff --git a/native/Cargo.toml b/native/Cargo.tomlindex 88fb3f6..be17a65 100644--- a/native/Cargo.toml+++ b/native/Cargo.toml@@ -1,6 +1,6 @@[package]name = "vectordash"-version = "0.3.18"+version = "0.3.19"edition = "2024"license = "MIT"[dependencies]diff --git a/native/src/ai.rs b/native/src/ai.rsindex 4121b32..81aeae1 100644--- a/native/src/ai.rs+++ b/native/src/ai.rs@@ -84,7 +84,7 @@ fn estimate(messages: &[Message]) -> usize {pub fn prepare(s: &Settings, history: &[Message], prompt: &str) -> Result<Vec<Message>> {anyhow::ensure!(!s.llm_model.trim().is_empty(),- "Select an LLM model in AI settings"+ "Select an LLM model in Models and AI");anyhow::ensure!(!prompt.trim().is_empty(), "Enter a question first");anyhow::ensure!(@@ -147,7 +147,7 @@ pub fn attach(s: &Settings, messages: &mut Vec<Message>, images: Vec<String>) ->}anyhow::ensure!(s.llm_vision,- "Enable vision for a compatible model in AI settings first"+ "Enable vision for a compatible model in Models and AI first");let last = messages.last_mut().context("Missing question")?;last.images = images;@@ -181,7 +181,7 @@ pub fn body(s: &Settings, messages: &[Message]) -> Result<Value> {anyhow::ensure!(s.llm_enabled, "AI chat is disabled in settings");anyhow::ensure!(!s.llm_model.trim().is_empty(),- "Select an LLM model in AI settings"+ "Select an LLM model in Models and AI");let context = s.llm_context.clamp(256, 1048576) as usize;let output = (context / 4).min(2048);diff --git a/native/src/app.rs b/native/src/app.rsindex 95b183f..99637a7 100644--- a/native/src/app.rs+++ b/native/src/app.rs@@ -19,10 +19,10 @@ use std::{const PAGES: [&str; 8] = ["Search","Sources",- "Models & hardware",+ "Hardware","Scheduling","Settings",- "AI settings",+ "Models and AI","Logs","About",];@@ -42,6 +42,9 @@ struct RemoteState {note: String,error: bool,busy: bool,+ vision: Option<bool>,+ dimensions: Option<usize>,+ context: Option<u32>,}pub struct App {home: PathBuf,@@ -228,7 +231,11 @@ pub struct App {tts_paused: Arc<AtomicBool>,status_clocks: [Option<(String, Instant)>; 3],connections: [ConnectionState; 2],- remote_servers: [RemoteState; 2],+ remote_servers: [RemoteState; 4],+ hardware_open: bool,+ models_ai_open: bool,+ remote_due: [Option<Instant>; 4],+ type_hotkey_capture: bool,read_aloud: bool,clipboard_thumbs: HashMap<i64, egui::TextureHandle>,clipboard_thumb_pending: std::collections::HashSet<i64>,@@ -513,6 +520,10 @@ impl App {status_clocks: [None, None, None],connections: std::array::from_fn(|_| ConnectionState::default()),remote_servers: std::array::from_fn(|_| RemoteState::default()),+ hardware_open: false,+ models_ai_open: false,+ remote_due: [None; 4],+ type_hotkey_capture: false,read_aloud,clipboard_thumbs: HashMap::new(),clipboard_thumb_pending: std::collections::HashSet::new(),@@ -709,6 +720,7 @@ impl App {self.status = "Unsaved changes undone".into();}fn apply_settings(&mut self, ctx: &egui::Context) {+ crate::resources::invalidate_storage();let previous = self.saved_settings.clone();if previous.remote_embeddings() != self.s.remote_embeddings() {let models = self.engine.models.clone();@@ -848,13 +860,36 @@ impl App {state.busy = false;match result {Ok(catalog) => {+ state.vision = catalog.vision;+ state.dimensions = catalog.dimensions;+ state.context = catalog.context;+ if index == 0 && self.s.remote_context_auto {+ if let Some(context) = catalog.context {+ self.s.remote_context = context;+ }+ }+ if index == 2 {+ self.llm_models = catalog.models.clone();+ self.llm_models_busy = false;+ if self.s.llm_context_auto {+ if let Some(context) = catalog.context {+ self.s.llm_context = context;+ }+ }+ }state.models = catalog.models;state.note = catalog.note;state.error = false;}Err(error) => {state.note = error;+ state.vision = None;+ state.dimensions = None;+ state.context = None;state.error = true;+ if index == 2 {+ self.llm_models_busy = false;+ }}}}@@ -877,7 +912,15 @@ impl App {match result {Ok(()) => {self.status = format!("{key} uninstalled");- if key == "all" {+ if [+ "all",+ "models",+ "runtimes",+ "embedding-models",+ "dictation-model",+ ]+ .contains(&key.as_str())+ {for path in [&mut self.s.server,&mut self.s.model,@@ -928,6 +971,7 @@ impl App {}}Event::DictationInstalled(result) => {+ crate::resources::invalidate_storage();self.setup_busy = false;self.setup_progress = None;self.run(result.map_err(anyhow::Error::msg));@@ -1332,6 +1376,7 @@ impl App {}}Event::Setup(result) => {+ crate::resources::invalidate_storage();self.setup_progress = None;self.setup_busy = false;match result {@@ -1936,6 +1981,10 @@ impl App {42.0,],egui::TextEdit::singleline(&mut query)+ .margin(egui::Margin {+ right: if self.tool == "Search" { 92 } else { 8 },+ ..egui::Margin::symmetric(8, 8)+ }).lock_focus(true).interactive(!recording).text_color(if recording {@@ -1959,6 +2008,24 @@ impl App {if recording {self.paint_waveform(ui, response.rect);}+ if self.tool == "Search" {+ let label = match self.category.as_str() {+ "All files" => "All",+ "Audio / video" => "Audio/Video",+ other => other,+ };+ ui.painter().text(+ egui::pos2(response.rect.right() - 10.0, response.rect.center().y),+ egui::Align2::RIGHT_CENTER,+ label,+ egui::FontId::proportional(11.0),+ if ui.visuals().dark_mode {+ Color32::WHITE+ } else {+ Color32::BLACK+ },+ );+ }if self.select_query && !recording {self.select_query = false;let id = egui::Id::new("query");@@ -2049,7 +2116,7 @@ impl App {.on_hover_text(if self.dictation_busy {"Finish dictation"} else {- "Dictate · shortcut configurable in Models & hardware"+ "Dictate · shortcut configurable in Models and AI"}).clicked(){@@ -2143,7 +2210,7 @@ impl App {"Screenshot",),)- .on_hover_text("Requires a vision model enabled in AI settings")+ .on_hover_text("Requires a vision model enabled in Models and AI").clicked(){self.capture_open = true;@@ -3115,6 +3182,17 @@ impl App {});}+ fn cycle_file_type(&mut self) {+ let next = (CATEGORIES+ .iter()+ .position(|c| *c == self.category)+ .unwrap_or(0)+ + 1)+ % CATEGORIES.len();+ self.category = CATEGORIES[next].into();+ self.type_flash = Some(Instant::now());+ self.changed();+ }fn paint_waveform(&self, ui: &mut egui::Ui, input: egui::Rect) {let rect = input.shrink2(egui::vec2(12.0, 6.0));let mut wave = crate::dictation::waveform();@@ -3223,9 +3301,9 @@ impl App {} else {self.setup.install(self.s.clone(),- key == "runtime",- key == "embedding",- key == "encoder",+ key == "runtime" || key == "embedding-bundle",+ key == "embedding" || key == "embedding-bundle",+ key == "encoder" || key == "embedding-bundle",key == "ocr",);}@@ -3239,12 +3317,12 @@ impl App {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 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 state=if remote{let server=&self.remote_servers[usize::from(key=="dictation")];if server.busy{"Remote · checking…"}else if server.error{"Remote · not ready"}else if key=="encoder"{match server.vision{Some(true)=>"Remote · mmproj detected",Some(false)=>"Remote · mmproj not detected",None=>"Remote · vision not reported"}}else if server.note.is_empty(){"Remote · not checked"}else{"Remote · ready"}}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|{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 remote { ui.weak(if key=="encoder"{"Server managed · requires multimodal embedding support"}else{"Server managed · no local model loaded"}); }+ if remote {let server=&self.remote_servers[usize::from(key=="dictation")];if key=="embedding"||key=="dictation" {if server.dimensions.is_some_and(|d|d<768){ui.colored_label(Color32::from_rgb(225,145,35),&server.note);}else{ui.weak(&server.note);}}else{ui.weak("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)));}@@ -3267,47 +3345,52 @@ impl App {if self.setup_busy&&ui.button("Cancel setup").clicked(){self.setup.cancel.store(true,Ordering::Release);}});if self.setup_busy{if let Some((name,done,total))=&self.setup_progress{ui.label(name);if *total>0{ui.add(egui::ProgressBar::new(*done as f32/ *total as f32).show_percentage());}}}+ for(index,name)in [(2,"LLM Model"),(3,"Voice Model")]{if !self.remote_fields(index).2.is_empty(){let state=&self.remote_servers[index];ui.label(format!("{name} · Remote · {}",if state.busy{"Checking…"}else if state.error{"Not ready"}else if state.note.is_empty(){"Not checked"}else{"Ready"}));if !state.note.is_empty(){ui.weak(&state.note);}}}++ ui.separator();let totals=self.component_stats.get("total").cloned().unwrap_or_default();let metrics=crate::scheduling::metrics();let percent=|v:Option<f32>|v.map(|v|format!("{v:.1}%")).unwrap_or_else(||"Unavailable".into());+ ui.label(format!("VectorDash + loaded local models · CPU {} · GPU {} · System memory {} · GPU memory {} · Storage {}",percent(metrics.owned_cpu),percent(metrics.owned_gpu),crate::resources::format_bytes(totals.ram),totals.vram.map(crate::resources::format_bytes).unwrap_or_else(||"Unavailable".into()),crate::resources::format_bytes(totals.disk)));+ ui.weak("Remote server resource use is not included. Shared model memory is counted once.");+});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 {- (+ fn remote_fields(&self, index: usize) -> (&str, &str, &str) {+ match index {+ 0 => (&self.s.remote_url, &self.s.remote_key, &self.s.remote_model),+ 1 => (&self.s.dictation_url,&self.s.dictation_key,&self.s.dictation_model,- )- .hash(&mut hash);+ ),+ 2 => (&self.s.llm_url, &self.s.llm_key, &self.s.llm_model),+ _ => (&self.s.tts_url, &self.s.tts_key, &self.s.tts_model),}+ }+ fn remote_signature(&self, index: usize) -> String {+ use std::hash::{Hash, Hasher};+ let mut hash = std::collections::hash_map::DefaultHasher::new();+ self.remote_fields(index).hash(&mut hash);hash.finish().to_string()}fn refresh_remote(&mut self, index: usize, check: bool) {+ if self.remote_servers[index].busy+ && self.remote_servers[index].signature == self.remote_signature(index)+ {+ return;+ }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 (url, key, model) = self.remote_fields(index);+ let (url, key, model) = (url.to_owned(), key.to_owned(), model.to_owned());+ self.remote_servers[index] = RemoteState {+ signature: signature.clone(),+ busy: true,+ ..Default::default()};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());+ crate::remote::service_catalog(&url, &key, &model, check, index == 0 || index == 2)+ .map_err(|e| e.to_string());let _ = tx.send(Event::RemoteCatalog(index, signature, result));});}@@ -3315,24 +3398,22 @@ impl App {let signature = self.remote_signature(index);if self.remote_servers[index].signature != signature {self.remote_servers[index] = RemoteState {- signature,+ signature: signature.clone(),..Default::default()};}let busy = self.remote_servers[index].busy;- let (url, key, model, context) = if index == 0 {+ let (url, key, model) = 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);@@ -3359,12 +3440,28 @@ impl App {.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.checkbox(+ &mut self.s.remote_context_auto,+ "Detect maximum context automatically",+ );+ if ui+ .add(+ egui::DragValue::new(&mut self.s.remote_context)+ .range(128..=1048576)+ .prefix("Max context: "),+ )+ .changed()+ {+ self.s.remote_context_auto = false;+ }+ if self.s.remote_context_auto+ && !self.remote_servers[0].busy+ && !self.remote_servers[0].note.is_empty()+ && self.remote_servers[0].context.is_none()+ {+ ui.weak("Server did not report a context limit; enter it manually.");+ }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(@@ -3373,7 +3470,14 @@ impl App {).clicked();} else {- ui.weak("Context is informational; transcription servers manage their own context. Sends microphone audio to /v1/audio/transcriptions when you dictate.");+ ui.weak("Sends microphone audio to /v1/audio/transcriptions when you dictate.");+ }+ if index == 0+ && self.remote_servers[index]+ .dimensions+ .is_some_and(|d| d < 768)+ {+ ui.colored_label(Color32::from_rgb(225,145,35),"Warning: embedding output is below 768 dimensions. Search quality may be reduced; indexed and query vectors must use the same dimensions.");}if busy {ui.spinner();@@ -3386,11 +3490,32 @@ impl App {},));}+ if signature != self.remote_signature(index) {+ self.remote_due[index] = Some(Instant::now() + Duration::from_millis(500));+ ui.ctx().request_repaint_after(Duration::from_millis(500));+ }if refresh || check {- self.refresh_remote(index, check);+ self.refresh_remote(+ index,+ check || (index == 0 && !self.s.remote_model.is_empty()),+ );}}fn models(&mut self, ui: &mut egui::Ui) {+ if !self.hardware_open {+ self.hardware_open = true;+ for (index, enabled) in [+ (0, self.s.remote_embeddings()),+ (1, self.s.remote_dictation()),+ (2, self.s.llm_enabled),+ (3, self.s.tts_enabled),+ ] {+ if enabled && !self.remote_fields(index).2.is_empty() {+ self.refresh_remote(index, index == 0);+ }+ }+ }+if !self.component_stats_busy && self.component_stats_at.elapsed() > Duration::from_secs(3){self.component_stats_busy = true;@@ -3407,7 +3532,92 @@ impl App {}self.components_ui(ui);- ui.heading("Embedding Model Server");+ ui.heading("Hardware");+ 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" {+ 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 {+ 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");+ }+ }+ ui.collapsing("Advanced device identifier", |ui| {+ field(ui, "Device identifier", &mut self.s.device);+ });+ path_field(ui, "Local llama-server runtime", &mut self.s.server);+ if !Path::new(&self.s.server).is_file() && ui.button("Download/setup runtime").clicked() {+ self.install_component("runtime");+ }+ 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);+ });+ ui.add_space(12.0);+ ui.heading("OCR and media tools");+ ui.checkbox(+ &mut self.s.ocr_enabled,+ "Enable OCR text extraction for images and scanned PDF pages",+ );+ path_field(ui, "Tesseract OCR", &mut self.s.ocr);+ if self.s.ocr_enabled {+ field(ui, "OCR languages", &mut self.s.ocr_languages);+ }+ path_field(ui, "FFmpeg (bundled by default)", &mut self.s.ffmpeg);+ ui.add_space(12.0);+ self.uninstall_button(ui, "Uninstall all runtimes…", "runtimes");+ }+ fn embedding_settings(&mut self, ui: &mut egui::Ui) {+ ui.heading("Embedding Model");let mut server = if self.s.remote_embeddings() {"Remote"} else {@@ -3457,91 +3667,19 @@ impl App {);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" {- 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 {- 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");- }- }- 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);+ self.local_model_actions(ui, false);} else {self.remote_server_ui(ui, 0);}- 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);- });- ui.add_space(12.0);- ui.heading("OCR and media tools");- ui.checkbox(- &mut self.s.ocr_enabled,- "Enable OCR text extraction for images and scanned PDF pages",- );- path_field(ui, "Tesseract OCR", &mut self.s.ocr);- if self.s.ocr_enabled {- field(ui, "OCR languages", &mut self.s.ocr_languages);+ }+ fn dictation_settings(&mut self, ui: &mut egui::Ui) {+ let header = ui.heading("Dictation Model");+ if self.smoke.is_some() && std::env::args().any(|a| a == "--smoke-dictation-section") {+ ui.scroll_to_rect(header.rect, Some(egui::Align::TOP));}- path_field(ui, "FFmpeg (bundled by default)", &mut self.s.ffmpeg);- ui.add_space(12.0);- ui.heading("Dictation");combo(ui,"dictation-server",@@ -3573,31 +3711,63 @@ impl App {} else {ui.weak("Unloads immediately after each transcription.");}+ self.local_model_actions(ui, true);} else {self.remote_server_ui(ui, 1);}- ui.horizontal(|ui| {- ui.label("Text batch size");- ui.add(egui::Slider::new(&mut self.s.batch_size, 1..=16));- });- if crate::resources::has_downloads(&self.home, &self.s)+ }+ fn uninstall_button(&mut self, ui: &mut egui::Ui, label: &str, key: &str) {+ if ui+ .add_enabled(+ !self.setup_busy,+ egui::Button::new(label)+ .stroke(egui::Stroke::new(1.0, Color32::from_rgb(210, 55, 65))),+ )+ .clicked()+ {+ self.remove_component = Some(key.into());+ }+ }+ fn local_model_actions(&mut self, ui: &mut egui::Ui, dictation: bool) {+ let ready = if dictation {+ crate::dictation::ready(&self.home, &self.s)+ } else {+ Path::new(&self.s.model).is_file()+ && Path::new(&self.s.projector).is_file()+ && Path::new(&self.s.server).is_file()+ };+ if !ready&& ui- .add(- egui::Button::new("Uninstall all downloaded models and runtimes…").stroke(- egui::Stroke::new(- 1.0,- crate::appearance::component_color(- ui.visuals().dark_mode,- false,- false,- ),- ),- ),- )+ .add_enabled(!self.setup_busy, egui::Button::new("Download/setup")).clicked(){- self.uninstall_confirm = true;+ self.install_component(if dictation {+ "dictation"+ } else {+ "embedding-bundle"+ });}+ let owned = if dictation {+ crate::dictation::model_root(&self.home, &self.s).exists()+ } else {+ ["embedding", "encoder"].iter().any(|key| {+ crate::resources::managed(&self.home, &self.s, key)+ && crate::resources::paths(&self.home, &self.s, key)+ .iter()+ .any(|p| p.exists())+ })+ };+ ui.add_enabled_ui(owned, |ui| {+ self.uninstall_button(+ ui,+ "Uninstall local model…",+ if dictation {+ "dictation-model"+ } else {+ "embedding-models"+ },+ );+ });}fn settings(&mut self, ui: &mut egui::Ui, ctx: &egui::Context) {ui.heading("Settings");@@ -3617,6 +3787,19 @@ impl App {});ui.heading("Search and dictation");+ ui.horizontal(|ui| {+ ui.label("Cycle file types");+ if ui+ .button(if self.type_hotkey_capture {+ "Press shortcut…"+ } else {+ &self.s.type_hotkey+ })+ .clicked()+ {+ self.type_hotkey_capture = true;+ }+ });if !self.microphones_loaded && !self.microphones_busy {self.refresh_microphones();}@@ -3657,7 +3840,7 @@ impl App {"Read aloud AI answers started with the voice shortcut",),)- .on_hover_text("Enable text to speech in AI settings first");+ .on_hover_text("Enable text to speech in Models and AI first");if self.s.voice_popup_tool == "AI" {combo(ui,@@ -4501,6 +4684,7 @@ impl App {self.page = page;}fn start_connection_test(&mut self, index: usize) {+ self.refresh_remote(if index == 0 { 2 } else { 3 }, false);let signature = connection_signature(&self.s, index == 1);let state = &mut self.connections[index];state.signature = signature;@@ -4561,12 +4745,33 @@ impl App {});}fn llm(&mut self, ui: &mut egui::Ui, ctx: &egui::Context) {- ui.heading("AI settings");+ if !self.models_ai_open {+ self.models_ai_open = true;+ for (index, enabled) in [(0, self.s.remote_embeddings()), (2, self.s.llm_enabled)] {+ if enabled && !self.remote_fields(index).2.is_empty() {+ self.refresh_remote(index, index == 0);+ }+ }+ }+ let before_llm = self.remote_signature(2);++ ui.heading("Models and AI");+ self.embedding_settings(ui);+ ui.separator();+ self.dictation_settings(ui);+ ui.separator();+ let llm_header = ui.heading("LLM Model");+ if self.smoke.is_some() && std::env::args().any(|a| a == "--smoke-llm-section") {+ ui.scroll_to_rect(llm_header.rect, Some(egui::Align::TOP));+ }ui.checkbox(&mut self.s.llm_enabled, "Enable AI chat");ui.weak("Select a model and save settings to show AI in search. MCP works independently.");ui.label("Connect your own OpenAI-compatible server. AI requests run only when you submit a question.");ui.label("Base URL");self.connection_row(ui, false);+ if self.remote_servers[2].context.is_some() {+ ui.weak(&self.remote_servers[2].note);+ }ui.weak("Example: http://localhost:8080/v1 (include /v1)");secret(ui, "API key (optional)", &mut self.s.llm_key);ui.horizontal(|ui| {@@ -4587,12 +4792,7 @@ impl App {.clicked(){self.llm_models_busy = true;- let s = self.s.clone();- let tx = self.engine.tx.clone();- std::thread::spawn(move || {- let result = crate::ai::models(&s).map_err(|e| e.to_string());- let _ = tx.send(Event::AiModels(s.llm_url.clone(), result));- });+ self.refresh_remote(2, false);}if self.llm_models_busy {ui.spinner();@@ -4600,21 +4800,38 @@ impl App {});ui.label("Or enter a model ID");ui.text_edit_singleline(&mut self.s.llm_model);+ui.checkbox(&mut self.s.llm_vision,"Selected model supports vision (screenshots)",);ui.weak("Screenshots are attached only after capture and pressing Send / Enter. Your configured server receives the image.");- ui.add(- egui::DragValue::new(&mut self.s.llm_context)- .range(256..=1048576)- .prefix("Max context: ")- .suffix(" tokens"),+ ui.checkbox(+ &mut self.s.llm_context_auto,+ "Detect maximum context automatically",);+ if ui+ .add(+ egui::DragValue::new(&mut self.s.llm_context)+ .range(256..=1048576)+ .prefix("Max context: ")+ .suffix(" tokens"),+ )+ .changed()+ {+ self.s.llm_context_auto = false;+ }+ if self.s.llm_context_auto+ && !self.remote_servers[2].busy+ && !self.remote_servers[2].note.is_empty()+ && self.remote_servers[2].context.is_none()+ {+ ui.weak("Server did not report a context limit; enter it manually.");+ }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");+ ui.heading("Voice Model");if ui.checkbox(&mut self.s.tts_enabled, "Enable text to speech").changed()@@ -4699,7 +4916,7 @@ impl App {ui.weak(&self.tts_notice);}ui.separator();- ui.heading("MCP server");+ ui.heading("MCP");ui.checkbox(&mut self.s.mcp_enabled, "Enable read-only agent access");ui.checkbox(&mut self.s.mcp_lan, "Allow local-network access");ui.checkbox(&mut self.s.mcp_auth, "Require HTTP bearer authentication");@@ -4725,7 +4942,13 @@ impl App {}ctx.copy_text(v.to_string());}+ if before_llm != self.remote_signature(2) {+ self.remote_due[2] = Some(Instant::now() + Duration::from_millis(500));+ ctx.request_repaint_after(Duration::from_millis(500));+ }ui.label("LAN HTTP is unencrypted. Use trusted clients and keep authentication enabled.");+ ui.separator();+ self.uninstall_button(ui, "Uninstall all local models…", "models");}fn about(&mut self, ui: &mut egui::Ui) {@@ -5071,6 +5294,7 @@ impl eframe::App for App {&& !self.hotkey_capture&& !self.llm_hotkey_capture&& !self.voice_hotkey_capture+ && !self.type_hotkey_capture&& !self.global_voice_capture&& !self.filter_open&& !self.save_search_open@@ -5092,6 +5316,54 @@ impl eframe::App for App {});}}+ if self.type_hotkey_capture {+ let key = ctx.input_mut(|i| {+ let key = i.events.iter().find_map(|e| {+ if let egui::Event::Key {+ key,+ pressed: true,+ modifiers,+ ..+ } = e+ {+ Some((*key, *modifiers))+ } else {+ None+ }+ });+ if key.is_some() {+ i.events.retain(|e| !matches!(e, egui::Event::Key { .. }));+ }+ key+ });+ if let Some((key, modifiers)) = key {+ if key != egui::Key::Escape {+ self.s.type_hotkey = crate::ai::shortcut(key, modifiers);+ }+ self.type_hotkey_capture = false;+ }+ }+ if self.frames == 2+ && self.smoke.is_some()+ && std::env::args().any(|a| a == "--smoke-cycle-file-type")+ {+ ctx.input_mut(|i| {+ i.events.push(egui::Event::Key {+ key: egui::Key::Tab,+ physical_key: Some(egui::Key::Tab),+ pressed: true,+ repeat: false,+ modifiers: egui::Modifiers::CTRL,+ })+ });+ }+ if self.page == 0 && self.tool == "Search" && !self.type_hotkey_capture {+ let cycle=ctx.input_mut(|i|{let found=i.events.iter().any(|e|matches!(e,egui::Event::Key{key,pressed:true,modifiers,..} if crate::ai::shortcut(*key,*modifiers)==self.saved_settings.type_hotkey));if found{i.events.retain(|e|!matches!(e,egui::Event::Key{key,modifiers,..} if crate::ai::shortcut(*key,*modifiers)==self.saved_settings.type_hotkey));}found});+ if cycle {+ self.cycle_file_type();+ ctx.memory_mut(|m| m.request_focus(egui::Id::new("query")));+ }+ }if self.page == 0 && !self.voice_hotkey_capture {let invoke=ctx.input_mut(|i|{let found=i.events.iter().any(|e|matches!(e,egui::Event::Key{key,pressed:true,modifiers,..} if crate::ai::shortcut(*key,*modifiers)==self.saved_settings.dictation_hotkey));@@ -5254,12 +5526,27 @@ impl eframe::App for App {.max(now.duration_since(self.last_frame).as_secs_f64() * 1000.0);self.last_frame = now;self.frames += 1;+ if self.page != 2 {+ self.hardware_open = false;+ }+ if self.page != 5 {+ self.models_ai_open = false;+ }+ for index in 0..4 {+ if self.remote_due[index].is_some_and(|t| Instant::now() >= t) {+ self.remote_due[index] = None;+ if !self.remote_fields(index).2.is_empty() {+ self.refresh_remote(index, index == 0);+ }+ }+ }if self.smoke.is_some()&& self.frames == 3&& std::env::args().any(|a| a == "--smoke-voice-summon"){let _ = self.engine.tx.send(Event::VoiceSummon(0));}+if self.frames == 2&& self.smoke.is_none()&& (self.s.auto_check_updates || self.s.auto_update)@@ -5580,7 +5867,8 @@ impl eframe::App for App {.max(100.0),).show(ui, |ui| {- for (i, label) in PAGES.iter().enumerate() {+ for i in [0, 1, 2, 3, 5, 4, 6, 7] {+ let label = &PAGES[i];let icon = [crate::icons::Icon::Search,crate::icons::Icon::Sources,@@ -6166,6 +6454,11 @@ impl eframe::App for App {&& (self.qa_screenshot.is_none() || self.qa_captured){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["category"] = serde_json::json!(self.category);+ data["remote_context"] = serde_json::json!(self.s.remote_context);+ data["llm_context"] = serde_json::json!(self.s.llm_context);+ data["remote_vision"] = serde_json::json!(self.remote_servers[0].vision);+ data["remote_dimensions"] = serde_json::json!(self.remote_servers[0].dimensions);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!(diff --git a/native/src/config.rs b/native/src/config.rsindex 0e9ad44..f7cefbc 100644--- a/native/src/config.rs+++ b/native/src/config.rs@@ -36,6 +36,7 @@ pub struct Settings {pub embedding_server: String,pub remote_model: String,pub remote_context: u32,+ pub remote_context_auto: bool,pub remote_url: String,pub remote_key: String,pub server: String,@@ -111,7 +112,6 @@ pub struct Settings {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,@@ -136,6 +136,8 @@ pub struct Settings {pub tts_auto: bool,pub llm_model: String,pub llm_context: u32,+ pub llm_context_auto: bool,+ pub type_hotkey: String,pub llm_response: String,pub llm_hotkey: String,pub clipboard_enabled: bool,@@ -168,6 +170,7 @@ impl Default for Settings {embedding_server: String::new(),remote_model: String::new(),remote_context: 2048,+ remote_context_auto: true,remote_url: String::new(),remote_key: String::new(),server: String::new(),@@ -243,7 +246,6 @@ impl Default for Settings {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(),@@ -269,6 +271,8 @@ impl Default for Settings {llm_model: String::new(),llm_response: "Full".into(),llm_context: 4096,+ llm_context_auto: true,+ type_hotkey: "Ctrl+Tab".into(),llm_hotkey: "Tab".into(),clipboard_enabled: false,clipboard_image_embeddings: false,diff --git a/native/src/dictation.rs b/native/src/dictation.rsindex a2b02f6..154126f 100644--- a/native/src/dictation.rs+++ b/native/src/dictation.rs@@ -354,11 +354,11 @@ pub fn run() -> Result<String> {anyhow::ensure!(s.remote_dictation() || ready(home, s),- "Download Parakeet dictation in Models & hardware first"+ "Download Parakeet dictation in Models and AI first");anyhow::ensure!(!s.remote_dictation() || !s.dictation_model.trim().is_empty(),- "Select a remote dictation model in Models & hardware"+ "Select a remote dictation model in Models and AI");let _activity = Activity::new();let host = cpal::default_host();diff --git a/native/src/models.rs b/native/src/models.rsindex 1fbb8b8..b3b1799 100644--- a/native/src/models.rs+++ b/native/src/models.rs@@ -221,7 +221,7 @@ impl Models {state.marker = None;anyhow::ensure!(!s.server.is_empty() && !s.model.is_empty(),- "Set up or select llama-server and EmbeddingGemma 2 in Models & hardware. Names search does not need a model."+ "Set up or select llama-server and EmbeddingGemma 2 in Models and AI. Names search does not need a model.");self.loaded.store(false, Ordering::Release);self.loading.store(true, Ordering::Release);diff --git a/native/src/remote.rs b/native/src/remote.rsindex dcda2a1..c5fc759 100644--- a/native/src/remote.rs+++ b/native/src/remote.rs@@ -12,6 +12,9 @@ use std::{pub struct Catalog {pub models: Vec<String>,pub note: String,+ pub context: Option<u32>,+ pub vision: Option<bool>,+ pub dimensions: Option<usize>,}pub fn api(base: &str, path: &str) -> Result<String> {let base = base.trim().trim_end_matches('/');@@ -52,7 +55,101 @@ async fn json_response(response: reqwest::Response) -> Result<Value> {);Ok(value)}+pub fn context_limit(value: &Value) -> Option<u32> {+ if let Some(args) = value.pointer("/status/args").and_then(Value::as_array) {+ for (index, arg) in args.iter().enumerate() {+ if let Some(arg) = arg.as_str() {+ if ["--ctx-size", "-c", "-ctx"].contains(&arg) {+ if let Some(n) = args+ .get(index + 1)+ .and_then(Value::as_str)+ .and_then(|v| v.parse::<u32>().ok())+ .filter(|n| *n >= 128)+ {+ return Some(n);+ }+ }+ if let Some(v) = arg+ .strip_prefix("--ctx-size=")+ .and_then(|v| v.parse::<u32>().ok())+ .filter(|n| *n >= 128)+ {+ return Some(v);+ }+ }+ }+ }++ for key in [+ "n_ctx",+ "context_length",+ "max_model_len",+ "max_context_length",+ "context_window",+ "max_context",+ ] {+ if let Some(n) = value+ .get(key)+ .and_then(Value::as_u64)+ .filter(|n| *n >= 128 && *n <= u32::MAX as u64)+ {+ return Some(n as u32);+ }+ }+ for key in [+ "default_generation_settings",+ "meta",+ "metadata",+ "config",+ "model_info",+ ] {+ if let Some(n) = value.get(key).and_then(context_limit) {+ return Some(n);+ }+ }+ None+}+fn vision_support(value: &Value) -> Option<bool> {+ if let Some(inputs) = value+ .pointer("/architecture/input_modalities")+ .and_then(Value::as_array)+ {+ return Some(inputs.iter().any(|v| v == "image" || v == "video"));+ }++ value+ .pointer("/modalities/vision")+ .and_then(Value::as_bool)+ .or_else(|| {+ value+ .get("mmproj")+ .and_then(|v| v.as_bool().or_else(|| v.as_str().map(|s| !s.is_empty())))+ })+ .or_else(|| {+ value+ .pointer("/capabilities/vision")+ .and_then(Value::as_bool)+ })+}pub fn catalog(base: &str, key: &str, model: &str, check_embeddings: bool) -> Result<Catalog> {+ catalog_inner(base, key, model, check_embeddings, true)+}+pub fn service_catalog(+ base: &str,+ key: &str,+ model: &str,+ embedding: bool,+ contextual: bool,+) -> Result<Catalog> {+ catalog_inner(base, key, model, embedding, contextual)+}+fn catalog_inner(+ base: &str,+ key: &str,+ model: &str,+ check_embeddings: bool,+ contextual: bool,+) -> Result<Catalog> {let runtime = tokio::runtime::Builder::new_current_thread().enable_all().build()?;@@ -73,7 +170,8 @@ pub fn catalog(base: &str, key: &str, model: &str, check_embeddings: bool) -> Re.collect::<Vec<_>>();models.sort();models.dedup();- let note = if check_embeddings {+ let mut dimensions = None;+ let mut note = if check_embeddings {anyhow::ensure!(!model.trim().is_empty(), "Select an embedding model first");let mut req = client.post(api(base, "embeddings")?)@@ -92,11 +190,61 @@ pub fn catalog(base: &str, key: &str, model: &str, check_embeddings: bool) -> Re.all(|v| v.as_f64().is_some_and(f64::is_finite)),"Invalid embedding vector");+ dimensions = Some(vector.len());format!("Embeddings enabled · {} dimensions", vector.len())} else {"Connection Successful".into()};- Ok(Catalog { models, note })+ let selected = value["data"].as_array().and_then(|a| {+ a.iter()+ .find(|v| v["id"].as_str() == Some(model))+ .or_else(|| if a.len() == 1 { a.first() } else { None })+ });+ anyhow::ensure!(selected.is_some() || model.is_empty(),"Selected model is not listed by the remote server; refresh models and select its exact ID");+ let mut context = if contextual{selected.and_then(context_limit)}else{None};+ let mut vision = selected.and_then(vision_support);+ let root = base+ .trim()+ .trim_end_matches('/')+ .strip_suffix("/v1")+ .unwrap_or(base.trim().trim_end_matches('/'));+ let mut url = reqwest::Url::parse(&crate::ai::endpoint(root, "props")?)?;+ if !model.is_empty() {+ url.query_pairs_mut().append_pair("model", model).append_pair("autoload","false");+ }+ let mut props = client.get(url).timeout(Duration::from_secs(5));+ if !key.trim().is_empty() {+ props = props.bearer_auth(key.trim());+ }+ if contextual { if let Ok(response) = props.send().await {+ if let Ok(props) = json_response(response).await {+ context = context_limit(&props).or(context);+ vision = vision_support(&props).or(vision);+ }+ }+ }+ if check_embeddings {+ note.push_str(match vision {+ Some(true) => " · mmproj detected (vision ready)",+ Some(false) => " · mmproj not detected (vision unavailable)",+ None => " · mmproj not detected: server did not report vision support",+ });+ if dimensions.is_some_and(|d| d < 768) {+ note.push_str(+ " · Warning: fewer than 768 dimensions; retrieval quality may be reduced",+ );+ }+ }+ if let Some(context) = context {+ note.push_str(&format!(" · Context {context} tokens"));+ }+ Ok(Catalog {+ models,+ note,+ context,+ vision,+ dimensions,+ })})}pub fn transcribe(@@ -106,7 +254,7 @@ pub fn transcribe() -> Result<String> {anyhow::ensure!(!s.dictation_model.trim().is_empty(),- "Select a remote dictation model in Models & hardware"+ "Select a remote dictation model in Models and AI");let audio = std::fs::read(wav)?;anyhow::ensure!(@@ -235,3 +383,67 @@ mod request_tests {assert!(start.elapsed() < Duration::from_secs(1));}}++#[cfg(test)]+mod capability_tests {+ use super::*;+ #[test]+ fn runtime_context_and_explicit_vision_are_detected() {+ assert_eq!(+ context_limit(&json!({"default_generation_settings":{"n_ctx":32768}})),+ Some(32768)+ );+ assert_eq!(+ context_limit(&json!({"meta":{"n_ctx_train":8192},"max_context_length":4096})),+ Some(4096)+ );+ assert_eq!(+ vision_support(&json!({"modalities":{"vision":true}})),+ Some(true)+ );+ assert_eq!(+ vision_support(+ &json!({"modalities":{"vision":false},"media_marker":"exists even without projector"})+ ),+ Some(false)+ );+ assert_eq!(vision_support(&json!({"media_marker":"not proof"})), None);+ }+ #[test]+ fn probe_reports_projector_context_and_low_dimensions() {+ for vision in [true, false] {+ 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..3 {+ let mut req = server.recv().unwrap();+ let value = match n {+ 0 => json!({"data":[{"id":"embedding","max_context_length":8192}]}),+ 1 => json!({"data":[{"embedding":[0.1,0.2]}]}),+ _ => {+ assert_eq!(req.url(), "/props?model=embedding&autoload=false");+ json!({"default_generation_settings":{"n_ctx":2048},"modalities":{"vision":vision}})+ }+ };+ req.respond(+ tiny_http::Response::from_string(value.to_string()).with_header(+ tiny_http::Header::from_bytes("Content-Type", "application/json")+ .unwrap(),+ ),+ )+ .unwrap();+ }+ });+ let result = catalog(&url, "", "embedding", true).unwrap();+ assert_eq!(result.context, Some(2048));+ assert_eq!(result.vision, Some(vision));+ assert!(result.note.contains("Warning"));+ assert!(result.note.contains(if vision {+ "mmproj detected"+ } else {+ "mmproj not detected"+ }));+ task.join().unwrap();+ }+ }+}diff --git a/native/src/resources.rs b/native/src/resources.rsindex db4d789..a38ce8d 100644--- a/native/src/resources.rs+++ b/native/src/resources.rs@@ -3,6 +3,13 @@ use std::{collections::HashMap,path::{Path, PathBuf},};+static DISK: std::sync::OnceLock<std::sync::Mutex<Option<(PathBuf, std::time::Instant, u64)>>> =+ std::sync::OnceLock::new();+pub fn invalidate_storage() {+ if let Some(cache) = DISK.get() {+ *cache.lock().unwrap() = None;+ }+}#[derive(Clone, Default, Debug)]pub struct Usage {pub ram: u64,@@ -139,6 +146,59 @@ pub fn sample(home: &Path, s: &Settings, inference_pid: u32) -> HashMap<String,}result.insert(key.into(), item);}+ let mut summary = Usage {+ ram: pids.iter().map(|p| ram(*p)).sum(),+ vram: gpu+ .as_ref()+ .map(|g| pids.iter().map(|p| g.get(p).copied().unwrap_or(0)).sum()),+ ..Default::default()+ };+ // Cache disk totals: hardware polling must not traverse the entire index folder every few seconds.+ let mut cache = DISK.get_or_init(Default::default).lock().unwrap();+ if let Some((path, at, size)) = &*cache {+ if path == home && at.elapsed() < std::time::Duration::from_secs(60) {+ summary.disk = *size;+ }+ }+ if summary.disk == 0 {+ let mut roots = vec![home.to_path_buf()];+ if let Ok(exe) = std::env::current_exe() {+ if let Some(dir) = exe.parent() {+ if !crate::config::under(&exe.to_string_lossy(), &home.to_string_lossy()) {+ for file in [+ "VectorDash.exe",+ "vectordash.exe",+ "ffmpeg.exe",+ "ffplay.exe",+ "ffprobe.exe",+ "pdfium.dll",+ ] {+ let path = dir.join(file);+ if path.exists() {+ roots.push(path);+ }+ }+ }+ }+ }+ if inference_pid != 0 {+ for key in ["embedding", "encoder", "runtime"] {+ for path in paths(home, s, key) {+ if !crate::config::under(&path.to_string_lossy(), &home.to_string_lossy()) {+ roots.push(path);+ }+ }+ }+ }+ let mut seen = std::collections::HashSet::new();+ summary.disk = roots+ .iter()+ .filter(|p| seen.insert(crate::config::fold(p)))+ .map(|p| bytes(p))+ .sum();+ *cache = Some((home.into(), std::time::Instant::now(), summary.disk));+ }+ result.insert("total".into(), summary);result}#[cfg(windows)]@@ -310,6 +370,9 @@ pub fn has_downloads(home: &Path, s: &Settings) -> bool {.iter().any(|key| managed(home, s, key) && paths(home, s, key).iter().any(|p| p.exists()))}+fn model_root_parent(home: &Path) -> PathBuf {+ home.join("models/parakeet")+}pub fn uninstall_all(home: &Path) -> anyhow::Result<()> {let targets = owned_roots(home).into_iter()@@ -330,6 +393,55 @@ pub fn uninstall_all(home: &Path) -> anyhow::Result<()> {Ok(())}pub fn uninstall(home: &Path, s: &Settings, key: &str) -> anyhow::Result<()> {+ invalidate_storage();+ if key == "models" || key == "runtimes" {+ let folder = if key == "models" {+ "models"+ } else {+ "runtimes"+ };+ let targets = owned_roots(home)+ .into_iter()+ .map(|r| r.join(folder))+ .filter(|p| p.exists())+ .collect::<Vec<_>>();+ for target in &targets {+ let parent = target.parent().unwrap().canonicalize()?;+ let resolved = target.canonicalize()?;+ anyhow::ensure!(+ resolved == parent.join(folder),+ "Managed folder resolves outside its expected location"+ );+ }+ for target in targets {+ std::fs::remove_dir_all(target)?;+ }+ return Ok(());+ }+ if key == "embedding-models" {+ for item in ["embedding", "encoder"] {+ if managed(home, s, item) {+ uninstall(home, s, item)?;+ }+ }+ return Ok(());+ }+ if key == "dictation-model" {+ let targets = vec![model_root_parent(home)];+ for target in targets {+ if target.exists() {+ let root = home.canonicalize()?.join("models");+ let resolved = target.canonicalize()?;+ anyhow::ensure!(+ resolved.starts_with(&root) && resolved != root,+ "Model path escapes managed directory"+ );+ std::fs::remove_dir_all(target)?;+ }+ }+ return Ok(());+ }+let targets = paths(home, s, key);anyhow::ensure!(!targets.is_empty(), "No managed installation found");for path in &targets {@@ -405,3 +517,22 @@ mod tests {assert!(!model.exists());}}++#[cfg(test)]+mod removal_group_tests {+ use super::*;+ #[test]+ fn models_and_runtimes_are_removed_independently() {+ let home = tempfile::tempdir().unwrap();+ for dir in ["models/parakeet", "runtimes/parakeet", "tools"] {+ std::fs::create_dir_all(home.path().join(dir)).unwrap();+ std::fs::write(home.path().join(dir).join("keep.bin"), b"fixture").unwrap();+ }+ uninstall(home.path(), &Settings::default(), "models").unwrap();+ assert!(!home.path().join("models").exists());+ assert!(home.path().join("runtimes/parakeet/keep.bin").exists());+ uninstall(home.path(), &Settings::default(), "runtimes").unwrap();+ assert!(!home.path().join("runtimes").exists());+ assert!(home.path().join("tools/keep.bin").exists());+ }+}diff --git a/native/src/scheduling.rs b/native/src/scheduling.rsindex 4a04c94..bbfccc8 100644--- a/native/src/scheduling.rs+++ b/native/src/scheduling.rs@@ -5,6 +5,8 @@ use std::sync::{Mutex, OnceLock};pub struct Metrics {pub cpu: Option<f32>,pub gpu: Option<f32>,+ pub owned_cpu: Option<f32>,+ pub owned_gpu: Option<f32>,pub idle: u64,pub on_ac: Option<bool>,pub game: bool,@@ -208,6 +210,10 @@ impl Sampler {if total > 0 {let busy = total.saturating_sub(pair.0.saturating_sub(old.0));m.cpu = Some(external_cpu(total, busy, pair.2.saturating_sub(old.2)));+ m.owned_cpu = Some(+ (100.0 * pair.2.saturating_sub(old.2) as f64 / total as f64)+ .clamp(0.0, 100.0) as f32,+ );}}self.previous = Some(pair);@@ -253,6 +259,18 @@ impl Sampler {.map(|x| x.FmtValue.Anonymous.doubleValue.max(0.0)).sum();m.gpu = Some(value.clamp(0.0, 100.0) as f32);+ m.owned_gpu = Some(+ items+ .iter()+ .filter(|x| x.FmtValue.CStatus <= 1)+ .filter(|x| {+ gpu_pid(&x.szName.to_string().unwrap_or_default())+ .is_some_and(|pid| owned_pids.contains(&pid))+ })+ .map(|x| x.FmtValue.Anonymous.doubleValue.max(0.0))+ .sum::<f64>()+ .clamp(0.0, 100.0) as f32,+ );}}}diff --git a/native/src/setup.rs b/native/src/setup.rsindex 4402576..8b9c131 100644--- a/native/src/setup.rs+++ b/native/src/setup.rs@@ -101,7 +101,7 @@ impl Setup {"Hugging Face"};anyhow::bail!(- "{provider} HTTP {status}. {} Optional download tokens are in Models & hardware. Partial downloads are retained.",+ "{provider} HTTP {status}. {} Optional download tokens are in Hardware. Partial downloads are retained.",if rate {"Rate limit reached; retry later."} else {diff --git a/native/src/tts.rs b/native/src/tts.rsindex 03aadc0..abfdbf8 100644--- a/native/src/tts.rs+++ b/native/src/tts.rs@@ -115,7 +115,7 @@ pub fn speech_parts(markdown: &str) -> Vec<String> {pub fn synthesize(s: &Settings, text: &str, cancel: &Arc<AtomicBool>) -> Result<Vec<u8>> {anyhow::ensure!(!s.tts_model.trim().is_empty() && !s.tts_voice.trim().is_empty(),- "Select a TTS model and voice in AI settings"+ "Select a TTS model and voice in Models and AI");let url = crate::ai::endpoint(&s.tts_url, "audio/speech")?;let runtime = tokio::runtime::Builder::new_current_thread()@@ -491,7 +491,7 @@ pub fn receive_audio(use base64::Engine;anyhow::ensure!(!s.tts_model.trim().is_empty() && !s.tts_voice.trim().is_empty(),- "Select a TTS model and voice in AI settings"+ "Select a TTS model and voice in Models and AI");let url = crate::ai::endpoint(&s.tts_url, "audio/speech")?;let key = format!("{}|{}", s.tts_url, s.tts_model);diff --git a/packaging/VectorDash-Rust.iss b/packaging/VectorDash-Rust.issindex 444fb51..c041b9d 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.18+AppVersion=0.3.19AppPublisher=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.18-x64+OutputBaseFilename=VectorDash-Rust-Setup-0.3.19-x64SetupIconFile=VectorDash.icoUninstallDisplayIcon={app}\VectorDash.exeLicenseFile=..\LICENSE