Skip to content

Local, full Windows search replacement, clipboard manager, and launcher: files, apps, settings and semantic media search with Google's EmbeddingGemma 2.

Fix toolbar alignment and model-specific voices; add AI response lengths

ampersandru33d5e692c994
diff --git a/Build-Rust.ps1 b/Build-Rust.ps1
index b15fee0..5d3b8e5 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-Null
Get-ChildItem -LiteralPath $taskBundle | Copy-Item -Destination $taskPortable -Recurse -Force
Set-Content -LiteralPath (Join-Path $taskPortable 'portable.flag') -Value '' -Encoding ascii
-Compress-Archive -Path (Join-Path $taskPortable '*') -DestinationPath 'dist/installer/VectorDash-Rust-0.3.15-x64.zip' -Force
-$taskInstaller='dist/installer/VectorDash-Rust-Setup-0.3.15-x64.exe'
-$taskZip='dist/installer/VectorDash-Rust-0.3.15-x64.zip'
+Compress-Archive -Path (Join-Path $taskPortable '*') -DestinationPath 'dist/installer/VectorDash-Rust-0.3.16-x64.zip' -Force
+$taskInstaller='dist/installer/VectorDash-Rust-Setup-0.3.16-x64.exe'
+$taskZip='dist/installer/VectorDash-Rust-0.3.16-x64.zip'
@($taskInstaller,$taskZip) | ForEach-Object {((Get-FileHash -LiteralPath $_ -Algorithm SHA256).Hash.ToLowerInvariant()+' '+(Split-Path $_ -Leaf))} | Set-Content 'dist/installer/RUST-SHA256SUMS.txt' -Encoding ascii
Write-Output "Native installer and portable ZIP ready."
diff --git a/README.md b/README.md
index c1a5f6e..9f488bd 100644
--- a/README.md
+++ b/README.md
@@ -35,7 +35,7 @@ Search by name or exact words, or describe what you remember. Google's **Embeddi
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.
-Enable **AI chat** and select a model to show the AI tab; disabled AI and clipboard modes stay hidden and are skipped by Tab. 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**.
+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** (4–6) 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**.
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.lock
index 2f8fb3d..34d6987 100644
--- a/native/Cargo.lock
+++ b/native/Cargo.lock
@@ -5705,7 +5705,7 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]]
name = "vectordash"
-version = "0.3.15"
+version = "0.3.16"
dependencies = [
"anyhow",
"arboard",
diff --git a/native/Cargo.toml b/native/Cargo.toml
index 708f008..75b58c9 100644
--- a/native/Cargo.toml
+++ b/native/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "vectordash"
-version = "0.3.15"
+version = "0.3.16"
edition = "2024"
license = "MIT"
[dependencies]
diff --git a/native/docs/0.3.16.md b/native/docs/0.3.16.md
new file mode 100644
index 0000000..eeb855a
--- /dev/null
+++ b/native/docs/0.3.16.md
@@ -0,0 +1,7 @@
+# VectorDash 0.3.16 preview
+
+- Regular search’s right-side mode/filter/saved-search controls stay on the same line as Search, Clipboard and AI, including with the sidebar collapsed.
+- TTS voice discovery sends the selected model ID, supporting audio.cpp servers hosting several models. Changing a model refreshes its voices automatically, with debouncing for typed IDs and stale-response checks. Voice discovery notices stay in TTS settings and clear when appropriate; they no longer appear in the search footer. See the [audio.cpp voice-list API](https://github.com/0xShug0/audio.cpp/blob/main/app/server/README.md#get-v1audiovoicesmodelid).
+- AI’s response dropdown sits immediately right of Screenshot. Brief asks for 3–4 focused sentences; Medium asks for 4–6; Full sends no length instruction or max_tokens override, allowing the server’s defaults. Instruction cost is included in the context budget, and changing length does not leave stale instructions in conversation history.
+
+Validation: 112 automated tests passed. Native main/popup fixtures verified aligned toolbar positions, the response dropdown, actual request payloads for all three lengths, and separate voice lists for two models on an audio.cpp-compatible local fixture server. Setup and portable packages were built and checked.
diff --git a/native/src/ai.rs b/native/src/ai.rs
index 5bab78d..c95a101 100644
--- a/native/src/ai.rs
+++ b/native/src/ai.rs
@@ -93,6 +93,9 @@ pub fn prepare(s: &Settings, history: &[Message], prompt: &str) -> Result<Vec<Me
);
let context = s.llm_context.clamp(256, 1048576) as usize;
let output = (context / 4).min(2048);
+ let style_cost = response_instruction(&s.llm_response)
+ .map(|v| v.len().div_ceil(3) + 24)
+ .unwrap_or(0);
let mut messages = history.to_vec();
messages.push(Message {
role: "user".into(),
@@ -100,7 +103,7 @@ pub fn prepare(s: &Settings, history: &[Message], prompt: &str) -> Result<Vec<Me
images: vec![],
});
while messages.len() > 1
- && (estimate(&messages) + output > context
+ && (estimate(&messages) + output + style_cost > context
|| messages.iter().map(|m| m.content.len()).sum::<usize>() > 128 * 1024
|| messages
.iter()
@@ -113,7 +116,7 @@ pub fn prepare(s: &Settings, history: &[Message], prompt: &str) -> Result<Vec<Me
messages.drain(..2.min(messages.len() - 1));
}
anyhow::ensure!(
- estimate(&messages) + output <= context,
+ estimate(&messages) + output + style_cost <= context,
"Question exceeds the context budget. Increase Max context or shorten it."
);
Ok(messages)
@@ -150,8 +153,11 @@ pub fn attach(s: &Settings, messages: &mut Vec<Message>, images: Vec<String>) ->
last.images = images;
wire_messages(messages)?;
let context = s.llm_context.clamp(256, 1048576) as usize;
+ let style_cost = response_instruction(&s.llm_response)
+ .map(|v| v.len().div_ceil(3) + 24)
+ .unwrap_or(0);
while messages.len() > 1
- && (estimate(messages) + (context / 4).min(2048) > context
+ && (estimate(messages) + (context / 4).min(2048) + style_cost > context
|| messages
.iter()
.flat_map(|m| m.images.iter())
@@ -162,7 +168,7 @@ pub fn attach(s: &Settings, messages: &mut Vec<Message>, images: Vec<String>) ->
messages.drain(..2.min(messages.len() - 1));
}
anyhow::ensure!(
- estimate(messages) + (context / 4).min(2048) <= context,
+ estimate(messages) + (context / 4).min(2048) + style_cost <= context,
"Increase Max context to fit the screenshot"
);
Ok(())
@@ -183,9 +189,19 @@ pub fn body(s: &Settings, messages: &[Message]) -> Result<Value> {
estimate(messages) + output <= context,
"Conversation exceeds the context budget"
);
- Ok(
- json!({"model":s.llm_model,"messages":wire_messages(messages)?,"max_tokens":output,"stream":true,"stream_options":{"include_usage":true}}),
- )
+ let mut wire = wire_messages(messages)?;
+ if let Some(instruction) = response_instruction(&s.llm_response) {
+ anyhow::ensure!(
+ estimate(messages) + instruction.len().div_ceil(3) + 24 + output <= context,
+ "Conversation exceeds the context budget"
+ );
+ wire.insert(0, json!({"role":"system","content":instruction}));
+ }
+ let mut request = json!({"model":s.llm_model,"messages":wire,"stream":true,"stream_options":{"include_usage":true}});
+ if response_instruction(&s.llm_response).is_some() {
+ request["max_tokens"] = json!(output);
+ }
+ Ok(request)
}
pub fn ask(
s: &Settings,
@@ -502,3 +518,70 @@ 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.",
+ ),
+ "Medium" => Some(
+ "Answer in 4–6 clear sentences. Include the useful explanation and key details without unnecessary repetition.",
+ ),
+ _ => None,
+ }
+}
+#[cfg(test)]
+mod response_style_tests {
+ use super::*;
+ #[test]
+ fn requested_length_is_current_and_full_keeps_server_default() {
+ for (style, target) in [
+ ("Brief", Some("3–4")),
+ ("Medium", Some("4–6")),
+ ("Full", None),
+ ] {
+ let s = Settings {
+ llm_model: "fixture".into(),
+ llm_response: style.into(),
+ ..Default::default()
+ };
+ let body = request_body(&s, "hello").unwrap();
+ let messages = body["messages"].as_array().unwrap();
+ if let Some(target) = target {
+ assert_eq!(messages[0]["role"], "system");
+ assert!(messages[0]["content"].as_str().unwrap().contains(target));
+ assert!(body.get("max_tokens").is_some());
+ } else {
+ assert_eq!(messages.len(), 1);
+ assert_eq!(messages[0]["role"], "user");
+ assert!(body.get("max_tokens").is_none());
+ }
+ }
+ }
+}
+
+#[cfg(test)]
+mod response_budget_tests {
+ use super::*;
+ #[test]
+ fn brief_history_is_trimmed_to_fit_the_instruction() {
+ let s = Settings {
+ llm_model: "fixture".into(),
+ llm_response: "Brief".into(),
+ llm_context: 256,
+ ..Default::default()
+ };
+ let history = (0..20)
+ .map(|i| Message {
+ role: if i % 2 == 0 { "user" } else { "assistant" }.into(),
+ content: "A prior conversation message with useful context.".into(),
+ images: vec![],
+ })
+ .collect::<Vec<_>>();
+ let messages = prepare(&s, &history, "Explain this").unwrap();
+ assert!(messages.len() < history.len());
+ let request = body(&s, &messages).unwrap();
+ assert_eq!(request["messages"][0]["role"], "system");
+ assert_eq!(messages.last().unwrap().content, "Explain this");
+ }
+}
diff --git a/native/src/app.rs b/native/src/app.rs
index f790223..b70f673 100644
--- a/native/src/app.rs
+++ b/native/src/app.rs
@@ -206,6 +206,13 @@ pub struct App {
tts_models: Vec<String>,
tts_voices: Vec<String>,
tts_catalog_busy: bool,
+ tts_notice: String,
+ tts_voice_job: u64,
+ tts_voice_busy: bool,
+ tts_voice_due: Option<Instant>,
+ response_length: String,
+ qa_toolbar_top: f32,
+ qa_filter_top: Option<f32>,
tts_status: String,
tts_busy: bool,
tts_job: u64,
@@ -296,6 +303,7 @@ impl App {
let saved_start_hidden = s.start_hidden;
let window_state = crate::config::WindowState::load(&home);
let read_aloud = s.tts_auto;
+ let response_length = s.llm_response.clone();
let mut app = Self {
home,
collapsed: s.sidebar_collapsed,
@@ -478,6 +486,13 @@ impl App {
tts_models: vec![],
tts_voices: vec![],
tts_catalog_busy: false,
+ tts_notice: String::new(),
+ tts_voice_job: 0,
+ tts_voice_busy: false,
+ tts_voice_due: None,
+ response_length,
+ qa_toolbar_top: 0.0,
+ qa_filter_top: None,
tts_status: String::new(),
tts_busy: false,
tts_job: 0,
@@ -536,6 +551,12 @@ impl App {
if let Some(status) = get("--smoke-status") {
app.status = status;
}
+ if let Some(style) = get("--smoke-response") {
+ app.response_length = style;
+ }
+ if std::env::args().any(|a| a == "--smoke-tts-voices") {
+ app.tts_voice_due = Some(Instant::now());
+ }
if let Some(tool) = get("--smoke-tool") {
app.switch_tool(&tool);
}
@@ -913,16 +934,33 @@ impl App {
}
}
- Event::TtsCatalog(url, result) => {
+ Event::TtsCatalog(url, model, result) => {
self.tts_catalog_busy = false;
if url == self.s.tts_url {
match result {
Ok((models, voices, notice)) => {
self.tts_models = models;
+ if model == self.s.tts_model {
+ self.tts_voices = voices;
+ self.tts_notice = notice;
+ }
+ }
+ Err(e) => self.tts_notice = e,
+ }
+ }
+ }
+ Event::TtsVoices(job, url, model, result) => {
+ if job == self.tts_voice_job
+ && url == self.s.tts_url
+ && model == self.s.tts_model
+ {
+ self.tts_voice_busy = false;
+ match result {
+ Ok((voices, notice)) => {
self.tts_voices = voices;
- self.tts_status = notice;
+ self.tts_notice = notice;
}
- Err(e) => self.tts_status = e,
+ Err(e) => self.tts_notice = e,
}
}
}
@@ -1937,6 +1975,8 @@ impl App {
self.scope.clone(),
self.exclude_types.clone(),
);
+ self.qa_toolbar_top = ui.cursor().min.y;
+ self.qa_filter_top = None;
ui.horizontal_top(|ui| {
for label in self.saved_settings.search_tools() {
if ui
@@ -2003,6 +2043,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 (4–6), Full (model default)");
if ui
.add_enabled(
!self.ai_busy && self.saved_settings.llm_vision,
@@ -2036,13 +2077,14 @@ impl App {
if self.tool != "Search" {
return;
}
- ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
- combo(
+ ui.with_layout(egui::Layout::right_to_left(egui::Align::Min), |ui| {
+ let mode=combo(
ui,
"search_mode",
&mut self.mode,
&["Both", "Names", "Semantic"],
);
+ self.qa_filter_top=Some(mode.rect.top());
let filtered = self.category != "All files"
|| !self.scope.is_empty()
|| !self.exclude_types.trim().is_empty();
@@ -3658,10 +3700,12 @@ impl App {
self.stop_read_aloud();
self.markdown = egui_commonmark::CommonMarkCache::default();
self.ai_question = self.query.trim().into();
- match crate::ai::prepare(&self.saved_settings, &self.ai_messages, &self.ai_question) {
+ let mut selected_settings = self.saved_settings.clone();
+ selected_settings.llm_response = self.response_length.clone();
+ match crate::ai::prepare(&selected_settings, &self.ai_messages, &self.ai_question) {
Ok(mut messages) => {
if let Err(e) =
- crate::ai::attach(&self.saved_settings, &mut messages, self.ai_images.clone())
+ crate::ai::attach(&selected_settings, &mut messages, self.ai_images.clone())
{
self.ai_error = Some(e.to_string());
return;
@@ -3681,7 +3725,7 @@ impl App {
self.ai_cancel = Arc::new(AtomicBool::new(false));
self.ai_busy = true;
let cancel = self.ai_cancel.clone();
- let s = self.saved_settings.clone();
+ let s = selected_settings;
let messages = self.ai_messages.clone();
let tx = self.engine.tx.clone();
std::thread::spawn(move || {
@@ -4232,6 +4276,8 @@ 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");
+ let previous_tts = (self.s.tts_url.clone(), self.s.tts_model.clone());
+ let previous_voice = self.s.tts_voice.clone();
ui.label("API base URL");
ui.text_edit_singleline(&mut self.s.tts_url);
ui.weak("Example: http://localhost:8880/v1 (include /v1)");
@@ -4244,11 +4290,12 @@ impl App {
.clicked()
{
self.tts_catalog_busy = true;
+ self.tts_notice.clear();
let s = self.s.clone();
let tx = self.engine.tx.clone();
std::thread::spawn(move || {
let result = crate::tts::catalog(&s).map_err(|e| e.to_string());
- let _ = tx.send(Event::TtsCatalog(s.tts_url, result));
+ let _ = tx.send(Event::TtsCatalog(s.tts_url, s.tts_model, result));
});
}
if self.tts_catalog_busy {
@@ -4282,8 +4329,25 @@ 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 !self.tts_status.is_empty() {
- ui.label(&self.tts_status);
+ if previous_tts != (self.s.tts_url.clone(), self.s.tts_model.clone()) {
+ self.tts_voice_job += 1;
+ self.tts_voice_busy = false;
+ self.tts_voices.clear();
+ self.tts_notice.clear();
+ if previous_tts.1 != self.s.tts_model {
+ self.s.tts_voice.clear();
+ }
+ self.tts_voice_due = Some(Instant::now() + Duration::from_millis(350));
+ ctx.request_repaint_after(Duration::from_millis(350));
+ } else if previous_voice != self.s.tts_voice && !self.s.tts_voice.trim().is_empty() {
+ self.tts_notice.clear();
+ }
+ if self.tts_voice_busy {
+ ui.spinner();
+ ui.weak("Refreshing voices…");
+ }
+ if !self.tts_notice.is_empty() && self.s.tts_voice.trim().is_empty() {
+ ui.weak(&self.tts_notice);
}
ui.separator();
ui.heading("MCP server");
@@ -4856,6 +4920,20 @@ impl eframe::App for App {
{
self.install_update(ctx);
}
+ if self.tts_voice_due.is_some_and(|t| Instant::now() >= t) {
+ self.tts_voice_due = None;
+ self.tts_voice_job += 1;
+ let job = self.tts_voice_job;
+ if !self.s.tts_model.trim().is_empty() && !self.s.tts_url.trim().is_empty() {
+ self.tts_voice_busy = true;
+ let s = self.s.clone();
+ let tx = self.engine.tx.clone();
+ std::thread::spawn(move || {
+ let result = crate::tts::voices(&s).map_err(|e| e.to_string());
+ let _ = tx.send(Event::TtsVoices(job, s.tts_url, s.tts_model, result));
+ });
+ }
+ }
self.events(ctx);
if !self.saved_settings.tool_available(&self.tool) {
if self.tool == "AI" {
@@ -5696,7 +5774,7 @@ 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,"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,"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 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,"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 _ = 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.rs
index 01f278e..45bdd74 100644
--- a/native/src/config.rs
+++ b/native/src/config.rs
@@ -124,6 +124,7 @@ pub struct Settings {
pub tts_auto: bool,
pub llm_model: String,
pub llm_context: u32,
+ pub llm_response: String,
pub llm_hotkey: String,
pub clipboard_enabled: bool,
pub clipboard_image_embeddings: bool,
@@ -242,6 +243,7 @@ impl Default for Settings {
tts_voice: String::new(),
tts_auto: false,
llm_model: String::new(),
+ llm_response: "Full".into(),
llm_context: 4096,
llm_hotkey: "Tab".into(),
clipboard_enabled: false,
diff --git a/native/src/engine.rs b/native/src/engine.rs
index db546e9..e90608c 100644
--- a/native/src/engine.rs
+++ b/native/src/engine.rs
@@ -136,7 +136,12 @@ pub enum Event {
Update(crate::updates::Update),
AiChunk(u64, String),
AiMetrics(u64, crate::ai::Metrics),
- TtsCatalog(String, Result<(Vec<String>, Vec<String>, String), String>),
+ TtsCatalog(
+ String,
+ String,
+ Result<(Vec<String>, Vec<String>, String), String>,
+ ),
+ TtsVoices(u64, String, String, Result<(Vec<String>, String), String>),
TtsDone(u64, Result<(), String>),
AiDone(u64, Result<(), String>),
AiModels(String, Result<Vec<String>, String>),
diff --git a/native/src/tts.rs b/native/src/tts.rs
index 84f4542..b6d79c3 100644
--- a/native/src/tts.rs
+++ b/native/src/tts.rs
@@ -35,6 +35,10 @@ pub fn catalog(s: &Settings) -> Result<(Vec<String>, Vec<String>, String)> {
config.llm_url = s.tts_url.clone();
config.llm_key = s.tts_key.clone();
let models = crate::ai::models(&config)?;
+ let (voices, notice) = voices(s).unwrap_or_else(|e| (vec![], format!("Voice refresh: {e}")));
+ Ok((models, voices, notice))
+}
+pub fn voices(s: &Settings) -> Result<(Vec<String>, String)> {
let agent: ureq::Agent = ureq::Agent::config_builder()
.timeout_global(Some(Duration::from_secs(15)))
.max_redirects(0)
@@ -42,7 +46,12 @@ pub fn catalog(s: &Settings) -> Result<(Vec<String>, Vec<String>, String)> {
.build()
.into();
for path in ["audio/voices", "voices"] {
- let mut req = agent.get(crate::ai::endpoint(&s.tts_url, path)?);
+ let mut url = reqwest::Url::parse(&crate::ai::endpoint(&s.tts_url, path)?)?;
+ if !s.tts_model.trim().is_empty() {
+ url.query_pairs_mut()
+ .append_pair("model", s.tts_model.trim());
+ }
+ let mut req = agent.get(url.as_str());
if !s.tts_key.trim().is_empty() {
req = req.header("Authorization", format!("Bearer {}", s.tts_key.trim()));
}
@@ -62,13 +71,16 @@ pub fn catalog(s: &Settings) -> Result<(Vec<String>, Vec<String>, String)> {
.read_json()?;
let voices = voice_ids(&data);
if !voices.is_empty() {
- return Ok((models, voices, String::new()));
+ return Ok((voices, String::new()));
}
}
Ok((
- models,
vec![],
- "This server does not publish a voice list. Enter its voice ID below.".into(),
+ if s.tts_model.trim().is_empty() {
+ "Choose a TTS model to list its voices.".into()
+ } else {
+ "No voices were returned for this model. You can enter a voice ID manually.".into()
+ },
))
}
pub fn speech_parts(markdown: &str) -> Vec<String> {
@@ -273,3 +285,69 @@ mod catalog_tests {
);
}
}
+
+#[cfg(test)]
+mod model_voice_tests {
+ use super::*;
+ #[test]
+ fn audio_cpp_multiple_models_have_separate_voice_lists() {
+ let server = tiny_http::Server::http("127.0.0.1:0").unwrap();
+ let url = format!("http://{}/v1", server.server_addr());
+ let worker = std::thread::spawn(move || {
+ for (expected, body) in [
+ (
+ "/v1/audio/voices?model=pocket-tts",
+ r#"{"voices":["alba","cosette"]}"#,
+ ),
+ (
+ "/v1/audio/voices?model=kokoro%2F8bit",
+ r#"{"voices":["af_heart"]}"#,
+ ),
+ ] {
+ let req = server.recv().unwrap();
+ assert_eq!(req.url(), expected);
+ req.respond(tiny_http::Response::from_string(body)).unwrap();
+ }
+ });
+ let mut s = Settings {
+ tts_url: url,
+ tts_model: "pocket-tts".into(),
+ ..Default::default()
+ };
+ assert_eq!(voices(&s).unwrap().0, vec!["alba", "cosette"]);
+ s.tts_model = "kokoro/8bit".into();
+ assert_eq!(voices(&s).unwrap().0, vec!["af_heart"]);
+ worker.join().unwrap();
+ }
+}
+
+#[cfg(test)]
+mod catalog_model_error_tests {
+ use super::*;
+ #[test]
+ fn model_list_survives_an_invalid_saved_voice_model() {
+ let server = tiny_http::Server::http("127.0.0.1:0").unwrap();
+ let s = Settings {
+ tts_url: format!("http://{}/v1", server.server_addr()),
+ tts_model: "missing".into(),
+ ..Default::default()
+ };
+ let worker = std::thread::spawn(move || {
+ let req = server.recv().unwrap();
+ assert_eq!(req.url(), "/v1/models");
+ req.respond(tiny_http::Response::from_string(
+ r#"{"data":[{"id":"pocket-tts"},{"id":"kokoro"}]}"#,
+ ))
+ .unwrap();
+ let req = server.recv().unwrap();
+ assert_eq!(req.url(), "/v1/audio/voices?model=missing");
+ req.respond(tiny_http::Response::from_string("{}").with_status_code(400))
+ .unwrap();
+ });
+ let (models, voices, notice) = catalog(&s).unwrap();
+ assert_eq!(models, vec!["kokoro", "pocket-tts"]);
+ assert!(voices.is_empty());
+ assert!(notice.contains("400"));
+ worker.join().unwrap();
+ }
+}
diff --git a/packaging/VectorDash-Rust.iss b/packaging/VectorDash-Rust.iss
index 0c0d20f..9f9cfd7 100644
--- a/packaging/VectorDash-Rust.iss
+++ b/packaging/VectorDash-Rust.iss
@@ -3,7 +3,7 @@ AppId={{C6AC1B4D-A119-4D73-B2C8-6C507DEFE923}
AppName=VectorDash
AppVerName=VectorDash
UninstallDisplayName=VectorDash
-AppVersion=0.3.15
+AppVersion=0.3.16
AppPublisher=VectorDash contributors
AppPublisherURL=https://github.com/ampersandru/VectorDash
DefaultDirName={localappdata}\Programs\VectorDash
@@ -13,7 +13,7 @@ ArchitecturesAllowed=x64compatible
ArchitecturesInstallIn64BitMode=x64compatible
MinVersion=10.0.22000
OutputDir=..\dist\installer
-OutputBaseFilename=VectorDash-Rust-Setup-0.3.15-x64
+OutputBaseFilename=VectorDash-Rust-Setup-0.3.16-x64
SetupIconFile=VectorDash.ico
UninstallDisplayIcon={app}\VectorDash.exe
LicenseFile=..\LICENSE