Fix critical integration issues for end-to-end functionality
- Rewrite SidecarManager as singleton with OnceLock, reusing one Python process across all commands instead of spawning per call - Separate stdin/stdout ownership with dedicated BufReader to prevent data corruption between wait_for_ready and send_and_receive - Add ensure_running() for auto-start on first command - Fix asset protocol URL: use convertFileSrc() instead of manual encodeURIComponent which broke file paths with slashes - Add +layout.svelte with global dark theme, CSS reset, and custom scrollbar styling to prevent white flash on startup - Register AppState with Tauri .manage(), initialize SQLite database on app startup at ~/.voicetonotes/voice_to_notes.db - Wire project commands (create/get/list) to real database queries instead of placeholder stubs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,17 +3,28 @@ use std::sync::Mutex;
|
||||
|
||||
use rusqlite::Connection;
|
||||
|
||||
use crate::db;
|
||||
use crate::llama::LlamaManager;
|
||||
|
||||
/// Shared application state managed by Tauri.
|
||||
pub struct AppState {
|
||||
pub db: Mutex<Option<Connection>>,
|
||||
pub db: Mutex<Connection>,
|
||||
pub data_dir: PathBuf,
|
||||
}
|
||||
|
||||
impl AppState {
|
||||
pub fn new(data_dir: PathBuf) -> Self {
|
||||
Self {
|
||||
db: Mutex::new(None),
|
||||
pub fn new() -> Result<Self, String> {
|
||||
let data_dir = LlamaManager::data_dir();
|
||||
std::fs::create_dir_all(&data_dir)
|
||||
.map_err(|e| format!("Cannot create data dir: {e}"))?;
|
||||
|
||||
let db_path = data_dir.join("voice_to_notes.db");
|
||||
let conn = db::open_database(&db_path)
|
||||
.map_err(|e| format!("Cannot open database: {e}"))?;
|
||||
|
||||
Ok(Self {
|
||||
db: Mutex::new(conn),
|
||||
data_dir,
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user