fix: move db path, fix compile error (#820)

release-fix-intellij-update-support-version-range
Eric 2023-11-18 10:08:07 +08:00 committed by GitHub
parent 33e817e1bc
commit fcfa13136a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -14,7 +14,7 @@ pub async fn load_text_generation(
parallelism: u8,
) -> (Arc<dyn TextGeneration>, 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,

View File

@ -21,8 +21,10 @@ lazy_static! {
),]);
}
fn db_file() -> PathBuf {
tabby_root().join("db.sqlite3")
async fn db_path() -> Result<PathBuf> {
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<Self> {
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
}