feat: add SettingsPage with HuggingFace model search and fix flexbox layout

- Add SettingsPage component with macOS/Linear-style settings UI (sp-* classes)
- Fix HuggingFace results list squeeze: sp-card-row--full now has align-items: stretch
  overriding the inherited flex-start, ensuring children fill 100% horizontal width
- Fix sp-hf-file row layout: width 100%, grid columns for name/quant/size/download
- Fix sp-hf-name truncation: explicit overflow/ellipsis/white-space in CSS
- Add white-space: nowrap to sp-hf-size and sp-hf-quant-badge to protect secondary columns
- Add runtime-deps crate, Tailwind/PostCSS config, runtime-defaults, MessageBubble test
- Update Cargo workspace, inference-server, tauri runtime types and process handling
This commit is contained in:
Evandro Fonseca Junior committed 2026-03-30 23:35:08 -03:00
1 parent 9da25c3688
commit 01b629cb4a
41 files changed
+6864 -822

No files matched your search

+1 -1
View File
@@ -118,7 +118,7 @@ fn start_runtime_inner(
inner.config.clone()
};
let child = match spawn_localllm(&config) {
let child = match spawn_localllm(app, &config) {
Ok(child) => child,
Err(message) => {
let mut inner = state.0.lock().map_err(|e| e.to_string())?;
+36 -3
View File
@@ -1,7 +1,13 @@
use std::path::PathBuf;
use std::process::{Child, Command};
use tauri::{AppHandle, Manager};
use super::types::RuntimeConfig;
use runtime_deps::{
apply_runtime_to_command, ensure_llama_runtime, recommended_variant_override_hint,
EnsureRuntimeRequest,
};
pub fn find_localllm_binary() -> Option<PathBuf> {
let exe_name = if cfg!(target_os = "windows") {
@@ -52,7 +58,17 @@ pub fn find_localllm_binary() -> Option<PathBuf> {
None
}
pub fn spawn_localllm(config: &RuntimeConfig) -> Result<Child, String> {
fn runtime_cache_root(app: &AppHandle) -> Result<PathBuf, String> {
let app_data_dir = app
.path()
.app_data_dir()
.map_err(|error| format!("Cannot resolve app data dir: {error}"))?;
std::fs::create_dir_all(&app_data_dir)
.map_err(|error| format!("Cannot create app data dir: {error}"))?;
Ok(app_data_dir.join("runtime-cache"))
}
pub fn spawn_localllm(app: &AppHandle, config: &RuntimeConfig) -> Result<Child, String> {
let model_path = config
.model_path
.as_deref()
@@ -65,11 +81,28 @@ pub fn spawn_localllm(config: &RuntimeConfig) -> Result<Child, String> {
.to_string()
})?;
Command::new(&binary_path)
let runtime = ensure_llama_runtime(&EnsureRuntimeRequest {
cache_root: &runtime_cache_root(app)?,
gpu_layers: config.gpu_layers,
variant_override: None,
binary_path: Some(&binary_path),
})
.map_err(|error| {
format!(
"Failed to prepare llama runtime dependencies: {error}\n{}",
recommended_variant_override_hint()
)
})?;
let mut command = Command::new(&binary_path);
command
.env("LOCALLLM_MODEL", model_path)
.env("LOCALLLM_ADDR", &config.addr)
.env("LOCALLLM_GPU_LAYERS", config.gpu_layers.to_string())
.env("LOCALLLM_CTX", config.ctx_size.to_string())
.env("LOCALLLM_CTX", config.ctx_size.to_string());
apply_runtime_to_command(&mut command, &runtime);
command
.spawn()
.map_err(|e| format!("Failed to start server ({}): {e}", binary_path.display()))
}
+11 -2
View File
@@ -2,6 +2,8 @@ use serde::{Deserialize, Serialize};
use crate::model_library::types::RemotePreset;
pub const DEFAULT_CTX_SIZE: u32 = 4096;
#[derive(Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Default, Debug)]
#[serde(rename_all = "snake_case")]
pub enum ConnectionMode {
@@ -102,7 +104,7 @@ impl Default for RuntimeConfig {
models_dir: None,
addr: Self::default_addr(),
gpu_layers: 0,
ctx_size: 4096,
ctx_size: DEFAULT_CTX_SIZE,
extra_model_paths: Vec::new(),
selected_model_id: None,
remote_presets: Vec::new(),
@@ -113,7 +115,14 @@ impl Default for RuntimeConfig {
#[cfg(test)]
mod tests {
use super::{ConnectionMode, RuntimeConfig};
use super::{ConnectionMode, RuntimeConfig, DEFAULT_CTX_SIZE};
#[test]
fn runtime_config_defaults_to_safe_context_window() {
let config = RuntimeConfig::default();
assert_eq!(config.ctx_size, DEFAULT_CTX_SIZE);
}
#[test]
fn runtime_config_deserializes_old_shape_with_new_defaults() {