Linux port: first run, packaging, single instance, privacy and wiring
CI / test (push) Has been cancelled
CI / test (push) Has been cancelled
First run and backend - The companion opens without Ollama or a model (OFFLINE / SETUP REQUIRED), opens Settings > Language model and picks the model up once downloaded. - Model, provider and GPU changes apply without restarting (Ollama is restarted when launch settings change); no silent fallback from API mode. - Fatal startup errors are shown in a window; the fallback avatar loads again; the shipped Capri artwork is used when nothing was imported. Packaging and tooling - packaging/arch/PKGBUILD, capri.desktop (KWin ScreenShot2 key), icons, artwork under /usr/share/capri/assets, Gitea Actions CI. - xtask: `icons` and `release-check` (no private data or credentials). Runtime - One instance per data folder (flock + control socket): second launch shows the window; capri stop / restart / toggle / status (JSON, starts nothing) / doctor / setup / diagnostics export / purge. - A foreign program on the Ollama port is refused; an Ollama left behind by Capri is replaced. Privacy and security - No raw Ollama log on disk; API keys are never saved in plaintext (old ones move to the keyring); refused credential notes are stored as [Credentials omitted]; launched apps get an allow-listed environment. Fixes - Stop/Escape silence the voice; saved voice effects apply to replies; settings_control glitch settings apply; distinct KWin cursor scripts; KDE window capture authorized for source builds; Linux wording. - Voice pack references zipped with Windows separators are found. Wired features - Initiatives, request router, resource monitor, "clip that", questions about a snapshot, sleep mode, tap reactions, stopwatch, attachments, Internet mode button, voice-synced subtitles, wake visuals, dictation draft, tray switches, Spotify seek/shuffle/repeat; computer-control planner and classifier follow model switches and API mode. - Approval cards: one shown, 8 queued, deduplicated, cancelled on stop, failure, lock or pause; one Application access switch. Desktop - Compositor detection (no black overlay on i3 without picom), i3lock detection, unsupported desktops reported at startup, screenshot-only control without AT-SPI, fontconfig fallbacks, translatable feature pages with French translations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
73 files changed
+4834
-517
No files matched your search
@@ -16,6 +16,7 @@ use crate::catalog::{self, CHOICES, EMBEDDING_ALIAS, EMBEDDING_BASE};
|
||||
use crate::hardware::{self, Hardware};
|
||||
use crate::hf::{self, Hub, Library, Receipt, RepoInfo, SearchRow};
|
||||
use crate::manage::{self, Residency, ResidencyInfo};
|
||||
use capri_core::i18n::t;
|
||||
|
||||
const API_DISCLOSURE: &str = "Optional alternative to the local language model. Your messages, personality, relevant memory and tool results are sent to your chosen provider. Screen images are sent only when you enable vision and use screen features. Provider charges and privacy terms apply. Speech recognition and voice remain local.";
|
||||
const KEY_HELP: &str = "Each connection has its own encrypted key. Keys are never shown again or included in diagnostic reports.";
|
||||
@@ -146,7 +147,7 @@ impl ModelsHandle {
|
||||
st.task = None;
|
||||
st.message = Some(match result {
|
||||
Ok(text) => text,
|
||||
Err(e) => hf::scrub(&e.to_string()),
|
||||
Err(e) => hf::scrub(&format!("{e:#}")),
|
||||
});
|
||||
drop(st);
|
||||
Self::repaint(&ctx);
|
||||
@@ -222,6 +223,15 @@ impl ModelsHandle {
|
||||
manage::pull_model(&ollama, EMBEDDING_BASE, &mut progress).await?;
|
||||
}
|
||||
manage::ensure_embedding_alias(&ollama, &embedding).await?;
|
||||
// The request router (small talk without tools) uses a small embedding model too.
|
||||
let router: RouterSection = settings.section();
|
||||
if router.enabled && !manage::installed(&ollama.tags().await?, &router.base_model) {
|
||||
progress("Downloading the request router", 0, 0);
|
||||
manage::pull_model(&ollama, &router.base_model, &mut progress).await?;
|
||||
}
|
||||
if router.enabled {
|
||||
manage::ensure_router_alias(&ollama, &router).await?;
|
||||
}
|
||||
this.refresh();
|
||||
Ok(format!("{} is ready.", choice.alias))
|
||||
});
|
||||
@@ -480,7 +490,7 @@ pub fn settings_ui(ui: &mut egui::Ui, store: &SettingsStore, handle: &ModelsHand
|
||||
if let Some(task) = &st.task {
|
||||
ui.horizontal(|ui| {
|
||||
ui.label(format!("{}… {}", task.label, task.status));
|
||||
if ui.button("Cancel").clicked() {
|
||||
if ui.button(t("Cancel")).clicked() {
|
||||
actions.push(Action::Cancel);
|
||||
}
|
||||
});
|
||||
@@ -502,7 +512,7 @@ pub fn settings_ui(ui: &mut egui::Ui, store: &SettingsStore, handle: &ModelsHand
|
||||
if ui.button(confirm.label).clicked() {
|
||||
decided = Some(true);
|
||||
}
|
||||
if ui.button("Cancel").clicked() {
|
||||
if ui.button(t("Cancel")).clicked() {
|
||||
decided = Some(false);
|
||||
}
|
||||
});
|
||||
@@ -538,7 +548,7 @@ fn save(store: &SettingsStore, change: impl FnOnce(&mut Settings)) {
|
||||
fn language_model(ui: &mut egui::Ui, store: &SettingsStore, settings: &Settings, st: &mut State, busy: bool, actions: &mut Vec<Action>) {
|
||||
let api: ApiSection = settings.section();
|
||||
let inference: InferenceSection = settings.section();
|
||||
ui.heading("Language model");
|
||||
ui.heading(t("Language model"));
|
||||
ui.label(if api.enabled { "Active: external AI provider. The local model stays installed.".to_string() } else { format!("Active: Local · {}", settings.model) });
|
||||
if let Some(r) = st.residency {
|
||||
let place = match r.status {
|
||||
@@ -559,7 +569,7 @@ fn language_model(ui: &mut egui::Ui, store: &SettingsStore, settings: &Settings,
|
||||
let language = settings.language.conversation.clone();
|
||||
let for_language = st.hardware.as_ref().map(|hw| catalog::recommend_models_for_language(&language, hw)).unwrap_or_default();
|
||||
if st.inventory.is_none() {
|
||||
ui.colored_label(ui.visuals().warn_fg_color, "The local model list is unavailable. Is Ollama running?");
|
||||
ui.colored_label(ui.visuals().warn_fg_color, t("The local model list is unavailable. Is Ollama running?"));
|
||||
}
|
||||
let inventory = st.inventory.clone().unwrap_or_default();
|
||||
for choice in &CHOICES {
|
||||
@@ -570,41 +580,41 @@ fn language_model(ui: &mut egui::Ui, store: &SettingsStore, settings: &Settings,
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
ui.strong(format!("{} · {}", choice.family, choice.model));
|
||||
if choice.experimental {
|
||||
ui.label("BETA");
|
||||
ui.label(t("BETA"));
|
||||
}
|
||||
if recommendation.as_ref().and_then(|r| r.profile).is_some_and(|p| p.id == choice.id) {
|
||||
ui.label("Recommended");
|
||||
ui.label(t("Recommended"));
|
||||
}
|
||||
if for_language.contains(&choice.id) {
|
||||
ui.label("Good for your language");
|
||||
ui.label(t("Good for your language"));
|
||||
}
|
||||
if active {
|
||||
ui.label("Active");
|
||||
ui.label(t("Active"));
|
||||
}
|
||||
});
|
||||
ui.label(choice.description);
|
||||
let ram = st.hardware.as_ref().map(|hw| catalog::profile_ram_requirement(choice, hw)).unwrap_or(choice.ram_gib);
|
||||
ui.weak(format!("Needs {ram} GiB RAM{} · {}", if choice.recommended_vram_gib > 0.0 { format!(", {} GiB VRAM recommended", choice.recommended_vram_gib) } else { String::new() }, size.map_or("size unknown".into(), gb)));
|
||||
ui.horizontal(|ui| {
|
||||
if !installed && ui.add_enabled(!busy, egui::Button::new("Download")).clicked() {
|
||||
if !installed && ui.add_enabled(!busy, egui::Button::new(t("Download"))).clicked() {
|
||||
actions.push(Action::Download(choice.id));
|
||||
}
|
||||
if installed && !active && ui.add_enabled(!busy, egui::Button::new("Use this model")).clicked() {
|
||||
if installed && !active && ui.add_enabled(!busy, egui::Button::new(t("Use this model"))).clicked() {
|
||||
st.confirm = Some(Confirm { title: "Switch language model?", detail: KEPT.into(), label: "Switch model", action: Action::Apply(choice.id) });
|
||||
}
|
||||
if installed && !active && ui.add_enabled(!busy, egui::Button::new("Remove")).clicked() {
|
||||
if installed && !active && ui.add_enabled(!busy, egui::Button::new(t("Remove"))).clicked() {
|
||||
actions.push(Action::DeleteModel(choice.id));
|
||||
}
|
||||
if installed && choice.alias != choice.model && !manage::installed(&inventory, choice.alias) && ui.add_enabled(!busy, egui::Button::new("Repair")).clicked() {
|
||||
if installed && choice.alias != choice.model && !manage::installed(&inventory, choice.alias) && ui.add_enabled(!busy, egui::Button::new(t("Repair"))).clicked() {
|
||||
actions.push(Action::Download(choice.id));
|
||||
}
|
||||
});
|
||||
}
|
||||
ui.separator();
|
||||
ui.heading("Response");
|
||||
ui.heading(t("Response"));
|
||||
let choices = catalog::context_choices(&settings.model, inference.model_context_limit);
|
||||
let mut context = settings.context_tokens;
|
||||
egui::ComboBox::from_label("Context window").selected_text(format!("{} K tokens", context / 1024)).show_ui(ui, |ui| {
|
||||
egui::ComboBox::from_label(t("Context window")).selected_text(format!("{} K tokens", context / 1024)).show_ui(ui, |ui| {
|
||||
for c in &choices {
|
||||
ui.selectable_value(&mut context, *c, format!("{} K tokens", c / 1024));
|
||||
}
|
||||
@@ -613,26 +623,26 @@ fn language_model(ui: &mut egui::Ui, store: &SettingsStore, settings: &Settings,
|
||||
save(store, |s| s.context_tokens = context);
|
||||
}
|
||||
let (mut keep, mut temperature, mut repeat) = (settings.keep_alive, settings.temperature, settings.repeat_last_n);
|
||||
ui.add(egui::DragValue::new(&mut keep).range(-1..=86400).prefix("Keep loaded (s, -1 = always): "));
|
||||
ui.add(egui::Slider::new(&mut temperature, 0.0..=1.5).text("Temperature"));
|
||||
ui.add(egui::Slider::new(&mut repeat, 0..=2048).text("Repetition window (tokens)"));
|
||||
ui.add(egui::DragValue::new(&mut keep).range(-1..=86400).prefix(t("Keep loaded (s, -1 = always): ")));
|
||||
ui.add(egui::Slider::new(&mut temperature, 0.0..=1.5).text(t("Temperature")));
|
||||
ui.add(egui::Slider::new(&mut repeat, 0..=2048).text(t("Repetition window (tokens)")));
|
||||
if (keep, temperature, repeat) != (settings.keep_alive, settings.temperature, settings.repeat_last_n) {
|
||||
save(store, |s| (s.keep_alive, s.temperature, s.repeat_last_n) = (keep, temperature, repeat));
|
||||
}
|
||||
if ui.button("Refresh").clicked() {
|
||||
if ui.button(t("Refresh")).clicked() {
|
||||
actions.push(Action::Refresh);
|
||||
}
|
||||
}
|
||||
|
||||
fn external_provider(ui: &mut egui::Ui, settings: &Settings, st: &mut State, busy: bool, actions: &mut Vec<Action>) {
|
||||
let api: ApiSection = settings.section();
|
||||
ui.heading("External AI provider");
|
||||
ui.heading(t("External AI provider"));
|
||||
ui.label(API_DISCLOSURE);
|
||||
if !st.secure {
|
||||
ui.colored_label(ui.visuals().warn_fg_color, "No desktop keyring answered (KWallet or GNOME Keyring). Keys are kept in a private file readable only by you.");
|
||||
ui.colored_label(ui.visuals().warn_fg_color, capri_llm::secrets::NO_KEYRING);
|
||||
}
|
||||
ui.horizontal(|ui| {
|
||||
if ui.add_enabled(api.enabled && !busy, egui::Button::new("Use the local model")).clicked() {
|
||||
if ui.add_enabled(api.enabled && !busy, egui::Button::new(t("Use the local model"))).clicked() {
|
||||
st.confirm = Some(Confirm { title: "Change AI provider?", detail: "Capri will reconnect using your downloaded local language model.".into(), label: "Apply", action: Action::UseApi(None) });
|
||||
}
|
||||
ui.label(if api.enabled { api.active_connection().map_or("API · OFFLINE".into(), ApiConnection::label) } else { format!("Local · {}", settings.model) });
|
||||
@@ -645,7 +655,7 @@ fn external_provider(ui: &mut egui::Ui, settings: &Settings, st: &mut State, bus
|
||||
ui.horizontal(|ui| {
|
||||
let active = api.enabled && api.active.as_deref() == Some(&c.id);
|
||||
let can_connect = has_key || c.is_local();
|
||||
if !active && ui.add_enabled(can_connect && !busy, egui::Button::new("Use")).clicked() {
|
||||
if !active && ui.add_enabled(can_connect && !busy, egui::Button::new(t("Use"))).clicked() {
|
||||
let detail = if c.is_local() {
|
||||
"Capri will send requests to the selected server on this PC and reconnect.".into()
|
||||
} else {
|
||||
@@ -653,13 +663,13 @@ fn external_provider(ui: &mut egui::Ui, settings: &Settings, st: &mut State, bus
|
||||
};
|
||||
st.confirm = Some(Confirm { title: "Change AI provider?", detail, label: "Apply", action: Action::UseApi(Some(c.id.clone())) });
|
||||
}
|
||||
if ui.add_enabled(!busy, egui::Button::new("Edit")).clicked() {
|
||||
if ui.add_enabled(!busy, egui::Button::new(t("Edit"))).clicked() {
|
||||
(st.form, st.form_key, st.editing) = (c.clone(), String::new(), Some(c.id.clone()));
|
||||
}
|
||||
if ui.add_enabled(can_connect && !busy, egui::Button::new("Test")).clicked() {
|
||||
if ui.add_enabled(can_connect && !busy, egui::Button::new(t("Test"))).clicked() {
|
||||
actions.push(Action::TestConnection(c.id.clone()));
|
||||
}
|
||||
if !active && ui.add_enabled(!busy, egui::Button::new("Remove")).clicked() {
|
||||
if !active && ui.add_enabled(!busy, egui::Button::new(t("Remove"))).clicked() {
|
||||
st.confirm = Some(Confirm { title: "Remove API connection?", detail: "Its saved API key will be removed from this PC.".into(), label: "Remove", action: Action::RemoveConnection(c.id.clone()) });
|
||||
}
|
||||
});
|
||||
@@ -667,7 +677,7 @@ fn external_provider(ui: &mut egui::Ui, settings: &Settings, st: &mut State, bus
|
||||
ui.separator();
|
||||
ui.strong(if st.editing.is_some() { "Edit connection" } else { "New connection" });
|
||||
let form = &mut st.form;
|
||||
egui::ComboBox::from_label("Provider").selected_text(capri_llm::openai::PRESETS.iter().find(|(_, url)| *url == form.base_url).map_or("Custom", |(n, _)| n)).show_ui(ui, |ui| {
|
||||
egui::ComboBox::from_label(t("Provider")).selected_text(capri_llm::openai::PRESETS.iter().find(|(_, url)| *url == form.base_url).map_or("Custom", |(n, _)| n)).show_ui(ui, |ui| {
|
||||
for (name, url) in capri_llm::openai::PRESETS {
|
||||
if ui.selectable_label(form.base_url == *url, *name).clicked() {
|
||||
form.base_url = url.to_string();
|
||||
@@ -681,61 +691,61 @@ fn external_provider(ui: &mut egui::Ui, settings: &Settings, st: &mut State, bus
|
||||
}
|
||||
});
|
||||
ui.horizontal(|ui| {
|
||||
ui.label("Name");
|
||||
ui.label(t("Name"));
|
||||
ui.text_edit_singleline(&mut form.name);
|
||||
});
|
||||
ui.horizontal(|ui| {
|
||||
ui.label("Base URL");
|
||||
ui.label(t("Base URL"));
|
||||
ui.text_edit_singleline(&mut form.base_url);
|
||||
});
|
||||
ui.horizontal(|ui| {
|
||||
ui.label("Model ID");
|
||||
ui.label(t("Model ID"));
|
||||
ui.text_edit_singleline(&mut form.model);
|
||||
});
|
||||
ui.horizontal(|ui| {
|
||||
ui.label("API key");
|
||||
ui.label(t("API key"));
|
||||
ui.add(egui::TextEdit::singleline(&mut st.form_key).password(true).hint_text(if st.editing.is_some() { "unchanged" } else { "" }));
|
||||
});
|
||||
ui.weak(KEY_HELP);
|
||||
ui.weak(PASTE_HELP);
|
||||
let form = &mut st.form;
|
||||
ui.checkbox(&mut form.tools, "Tool calls");
|
||||
ui.checkbox(&mut form.vision, "Images (vision)");
|
||||
ui.checkbox(&mut form.thinking, "Reasoning control");
|
||||
ui.add(egui::DragValue::new(&mut form.context_tokens).range(8192..=262144).speed(1024).prefix("Context tokens: "));
|
||||
ui.checkbox(&mut form.tools, t("Tool calls"));
|
||||
ui.checkbox(&mut form.vision, t("Images (vision)"));
|
||||
ui.checkbox(&mut form.thinking, t("Reasoning control"));
|
||||
ui.add(egui::DragValue::new(&mut form.context_tokens).range(8192..=262144).speed(1024).prefix(t("Context tokens: ")));
|
||||
ui.weak(CAPABILITY_HELP);
|
||||
ui.horizontal(|ui| {
|
||||
if ui.add_enabled(!busy, egui::Button::new("Save connection")).clicked() {
|
||||
if ui.add_enabled(!busy, egui::Button::new(t("Save connection"))).clicked() {
|
||||
actions.push(Action::SaveConnection);
|
||||
}
|
||||
if st.editing.is_some() && ui.button("New").clicked() {
|
||||
if st.editing.is_some() && ui.button(t("New")).clicked() {
|
||||
(st.form, st.form_key, st.editing) = (ApiConnection::default(), String::new(), None);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
fn hugging_face(ui: &mut egui::Ui, settings: &Settings, st: &mut State, busy: bool, actions: &mut Vec<Action>) {
|
||||
ui.heading("Hugging Face");
|
||||
ui.heading(t("Hugging Face"));
|
||||
ui.horizontal(|ui| {
|
||||
ui.label(if st.hf_has_token { "Read token saved." } else { "No token: public models only." });
|
||||
ui.add(egui::TextEdit::singleline(&mut st.hf_token).password(true).hint_text("hf_…"));
|
||||
if ui.add_enabled(!busy && !st.hf_token.is_empty(), egui::Button::new("Save token")).clicked() {
|
||||
if ui.add_enabled(!busy && !st.hf_token.is_empty(), egui::Button::new(t("Save token"))).clicked() {
|
||||
actions.push(Action::HfSaveToken);
|
||||
}
|
||||
if st.hf_has_token && ui.add_enabled(!busy, egui::Button::new("Remove token")).clicked() {
|
||||
if st.hf_has_token && ui.add_enabled(!busy, egui::Button::new(t("Remove token"))).clicked() {
|
||||
actions.push(Action::HfRemoveToken);
|
||||
}
|
||||
});
|
||||
ui.horizontal(|ui| {
|
||||
ui.text_edit_singleline(&mut st.hf_query);
|
||||
if ui.add_enabled(!busy, egui::Button::new("Search GGUF")).clicked() {
|
||||
if ui.add_enabled(!busy, egui::Button::new(t("Search GGUF"))).clicked() {
|
||||
actions.push(Action::HfSearch);
|
||||
}
|
||||
});
|
||||
for row in &st.hf_results {
|
||||
ui.horizontal(|ui| {
|
||||
ui.label(format!("{} · {} downloads{}", row.repository, row.downloads, if row.gated { " · gated" } else { "" }));
|
||||
if ui.add_enabled(!busy, egui::Button::new("Inspect")).clicked() {
|
||||
if ui.add_enabled(!busy, egui::Button::new(t("Inspect"))).clicked() {
|
||||
actions.push(Action::HfInspect(row.repository.clone()));
|
||||
}
|
||||
});
|
||||
@@ -747,14 +757,14 @@ fn hugging_face(ui: &mut egui::Ui, settings: &Settings, st: &mut State, busy: bo
|
||||
ui.weak(format!("License: {license}"));
|
||||
}
|
||||
let size = |path: &str| info.files.iter().find(|f| f.path == path).and_then(|f| f.bytes).map_or("?".into(), gb);
|
||||
egui::ComboBox::from_label("Model file").selected_text(st.hf_file.clone().unwrap_or_default()).show_ui(ui, |ui| {
|
||||
egui::ComboBox::from_label(t("Model file")).selected_text(st.hf_file.clone().unwrap_or_default()).show_ui(ui, |ui| {
|
||||
for f in info.files.iter().filter(|f| f.kind == "gguf" && (!f.split || f.path.contains("-00001-of-"))) {
|
||||
ui.selectable_value(&mut st.hf_file, Some(f.path.clone()), format!("{} ({})", f.path, size(&f.path)));
|
||||
}
|
||||
});
|
||||
if info.files.iter().any(|f| f.kind == "projector") {
|
||||
egui::ComboBox::from_label("Vision projector").selected_text(st.hf_projector.clone().unwrap_or_else(|| "None".into())).show_ui(ui, |ui| {
|
||||
ui.selectable_value(&mut st.hf_projector, None, "None");
|
||||
egui::ComboBox::from_label(t("Vision projector")).selected_text(st.hf_projector.clone().unwrap_or_else(|| "None".into())).show_ui(ui, |ui| {
|
||||
ui.selectable_value(&mut st.hf_projector, None, t("None"));
|
||||
for f in info.files.iter().filter(|f| f.kind == "projector") {
|
||||
ui.selectable_value(&mut st.hf_projector, Some(f.path.clone()), format!("{} ({})", f.path, size(&f.path)));
|
||||
}
|
||||
@@ -764,7 +774,7 @@ fn hugging_face(ui: &mut egui::Ui, settings: &Settings, st: &mut State, busy: bo
|
||||
Some(Ok(plan)) => {
|
||||
let gib = plan.total_bytes as f64 / (1u64 << 30) as f64;
|
||||
ui.weak(format!("Download {} · about {:.0} GiB RAM on CPU, {:.0} GiB VRAM on GPU (estimate)", gb(plan.total_bytes), (gib * 1.3 + 4.0).ceil(), (gib + 2.0).ceil()));
|
||||
if ui.add_enabled(!busy, egui::Button::new("Download and import")).clicked() {
|
||||
if ui.add_enabled(!busy, egui::Button::new(t("Download and import"))).clicked() {
|
||||
actions.push(Action::HfInstall);
|
||||
}
|
||||
}
|
||||
@@ -781,10 +791,10 @@ fn hugging_face(ui: &mut egui::Ui, settings: &Settings, st: &mut State, busy: bo
|
||||
let alias = r.profile.as_ref().map(|p| p.alias.clone());
|
||||
ui.label(format!("{} · {}{}", r.plan.repository, gb(r.plan.total_bytes), if alias.as_deref() == Some(settings.model.as_str()) { " · Active" } else { "" }));
|
||||
if alias.as_deref() != Some(settings.model.as_str()) {
|
||||
if r.profile.is_some() && ui.add_enabled(!busy, egui::Button::new("Use")).clicked() {
|
||||
if r.profile.is_some() && ui.add_enabled(!busy, egui::Button::new(t("Use"))).clicked() {
|
||||
st.confirm = Some(Confirm { title: "Switch language model?", detail: KEPT.into(), label: "Switch model", action: Action::HfUse(r.plan.id.clone()) });
|
||||
}
|
||||
if ui.add_enabled(!busy, egui::Button::new("Remove")).clicked() {
|
||||
if ui.add_enabled(!busy, egui::Button::new(t("Remove"))).clicked() {
|
||||
st.confirm = Some(Confirm { title: "Remove downloaded model?", detail: "The selected Hugging Face package will be removed from this PC.".into(), label: "Remove", action: Action::HfRemove(r.plan.id.clone()) });
|
||||
}
|
||||
}
|
||||
@@ -794,9 +804,9 @@ fn hugging_face(ui: &mut egui::Ui, settings: &Settings, st: &mut State, busy: bo
|
||||
|
||||
fn model_device(ui: &mut egui::Ui, store: &SettingsStore, settings: &Settings, st: &mut State, actions: &mut Vec<Action>) {
|
||||
let inference: InferenceSection = settings.section();
|
||||
ui.heading("Model device");
|
||||
ui.heading(t("Model device"));
|
||||
let Some(hw) = &st.hardware else {
|
||||
ui.label("Checking hardware…");
|
||||
ui.label(t("Checking hardware…"));
|
||||
return;
|
||||
};
|
||||
ui.label(format!("{} · {} threads · {:.1} GiB RAM ({:.1} GiB available)", hw.cpu, hw.cpu_threads, hw.ram_gib(), hw.available_ram_bytes as f64 / (1u64 << 30) as f64));
|
||||
@@ -829,15 +839,15 @@ fn model_device(ui: &mut egui::Ui, store: &SettingsStore, settings: &Settings, s
|
||||
}
|
||||
let mut auto_threads = settings.cpu_threads.is_none();
|
||||
let mut threads = settings.cpu_threads.unwrap_or(4);
|
||||
ui.checkbox(&mut auto_threads, "Automatic CPU threads");
|
||||
ui.checkbox(&mut auto_threads, t("Automatic CPU threads"));
|
||||
if !auto_threads {
|
||||
ui.add(egui::DragValue::new(&mut threads).range(1..=16).prefix("CPU threads: "));
|
||||
ui.add(egui::DragValue::new(&mut threads).range(1..=16).prefix(t("CPU threads: ")));
|
||||
}
|
||||
let wanted = (!auto_threads).then_some(threads);
|
||||
if wanted != settings.cpu_threads {
|
||||
save(store, |s| s.cpu_threads = wanted);
|
||||
}
|
||||
if ui.button("Check hardware again").clicked() {
|
||||
if ui.button(t("Check hardware again")).clicked() {
|
||||
actions.push(Action::Refresh);
|
||||
}
|
||||
}
|
||||
@@ -845,15 +855,15 @@ fn model_device(ui: &mut egui::Ui, store: &SettingsStore, settings: &Settings, s
|
||||
fn startup(ui: &mut egui::Ui, store: &SettingsStore, settings: &Settings) {
|
||||
let mut inference: InferenceSection = settings.section();
|
||||
let mut router: RouterSection = settings.section();
|
||||
ui.heading("Startup");
|
||||
ui.checkbox(&mut inference.preload_models, "Load the models when Capri starts");
|
||||
ui.checkbox(&mut inference.skip_local_model_on_api, "With an external AI provider, do not load the local language model");
|
||||
ui.heading(t("Startup"));
|
||||
ui.checkbox(&mut inference.preload_models, t("Load the models when Capri starts"));
|
||||
ui.checkbox(&mut inference.skip_local_model_on_api, t("With an external AI provider, do not load the local language model"));
|
||||
ui.horizontal(|ui| {
|
||||
ui.label("Memory embedding model");
|
||||
ui.label(t("Memory embedding model"));
|
||||
ui.text_edit_singleline(&mut inference.embedding_model);
|
||||
});
|
||||
ui.checkbox(&mut router.enabled, "Fast replies for small talk (request router)");
|
||||
ui.add_enabled(router.enabled, egui::Slider::new(&mut router.timeout_ms, 25..=250).text("Router time budget (ms)"));
|
||||
ui.checkbox(&mut router.enabled, t("Fast replies for small talk (request router)"));
|
||||
ui.add_enabled(router.enabled, egui::Slider::new(&mut router.timeout_ms, 25..=250).text(t("Router time budget (ms)")));
|
||||
ui.weak(format!("Minimum Ollama version: {}", inference.min_ollama_version));
|
||||
if inference != settings.section::<InferenceSection>() || router != settings.section::<RouterSection>() {
|
||||
save(store, |s| {
|
||||
|
||||
Reference in new issue
Block a user