From fcfa13136a0badac1f359d81e45570e519b8e5dd Mon Sep 17 00:00:00 2001 From: Eric Date: Sat, 18 Nov 2023 10:08:07 +0800 Subject: [PATCH] fix: move db path, fix compile error (#820) --- crates/tabby/src/services/model.rs | 2 +- ee/tabby-webserver/src/db.rs | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/crates/tabby/src/services/model.rs b/crates/tabby/src/services/model.rs index 8b35681..8c5bd48 100644 --- a/crates/tabby/src/services/model.rs +++ b/crates/tabby/src/services/model.rs @@ -14,7 +14,7 @@ pub async fn load_text_generation( parallelism: u8, ) -> (Arc, PromptInfo) { #[cfg(feature = "experimental-http")] - if args.device == crate::serve::Device::ExperimentalHttp { + if device == &Device::ExperimentalHttp { let (engine, prompt_template) = http_api_bindings::create(model_id); return ( engine, diff --git a/ee/tabby-webserver/src/db.rs b/ee/tabby-webserver/src/db.rs index 46c61ae..57d820c 100644 --- a/ee/tabby-webserver/src/db.rs +++ b/ee/tabby-webserver/src/db.rs @@ -21,8 +21,10 @@ lazy_static! { ),]); } -fn db_file() -> PathBuf { - tabby_root().join("db.sqlite3") +async fn db_path() -> Result { + let db_dir = tabby_root().join("ee"); + tokio::fs::create_dir_all(db_dir.clone()).await?; + Ok(db_dir.join("db.sqlite")) } pub struct DbConn { @@ -31,7 +33,8 @@ pub struct DbConn { impl DbConn { pub async fn new() -> Result { - let conn = Connection::open(db_file()).await?; + let db_path = db_path().await?; + let conn = Connection::open(db_path).await?; Self::init_db(conn).await }