A local-first private AI assistant for everyday use. Runs on-device models with encrypted P2P sync, and supports sharing chats publicly on ATProto.
10
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: config + user folder creation preceeds ftue

- Since the streamlining of db connection, it needs to have
config, user dirs available. But we only creates then in FTUE.
So now we made these folder creations as part of core init

madclaws 16bf4ba3 f3554127

+28 -9
+20 -3
tiles/src/core/mod.rs
··· 3 3 //! The core runtime which different UI apps can leverage 4 4 //! Generally the core will be run as daemon and interact with other sub components 5 5 6 - use anyhow::Result; 6 + use anyhow::{Context, Result}; 7 7 8 - use crate::core::{accounts::save_root_account_db, storage::db::Dbconn}; 8 + use crate::{ 9 + core::{ 10 + accounts::save_root_account_db, 11 + storage::db::{Dbconn, init_db}, 12 + }, 13 + utils::config::{ConfigProvider, DefaultProvider}, 14 + }; 9 15 10 16 pub mod accounts; 11 17 pub mod chats; ··· 14 20 pub mod storage; 15 21 16 22 // Entrypoint of the core 17 - pub fn init(db_conn: &Dbconn) -> Result<()> { 23 + pub fn init() -> Result<Dbconn> { 24 + let config_provider = DefaultProvider; 25 + config_provider 26 + .get_or_create_config_dir() 27 + .context("Failed in creating config folder")?; 28 + config_provider 29 + .get_or_create_data_dir() 30 + .context("Failed to create data dir")?; 31 + init_db() 32 + } 33 + 34 + pub fn init_account(db_conn: &Dbconn) -> Result<()> { 18 35 save_root_account_db(db_conn) 19 36 }
+4 -5
tiles/src/main.rs
··· 7 7 core::{ 8 8 self, 9 9 network::{link, sync}, 10 - storage::db::init_db, 11 10 }, 12 11 daemon::{start_cmd, start_server, stop_cmd}, 13 12 runtime::{RunArgs, build_runtime}, ··· 189 188 build_logger(); 190 189 let cli = Cli::parse(); 191 190 let runtime = build_runtime(); 192 - let db_conn = init_db()?; 191 + let db_conn = core::init()?; 193 192 194 193 match cli.command { 195 194 None => { ··· 210 209 let _ = start_cmd(None).await; 211 210 }); 212 211 } 213 - core::init(&db_conn) 212 + core::init_account(&db_conn) 214 213 .inspect_err(|e| eprintln!("Tiles core init failed due to {:?}", e))?; 215 214 if !cli.flags.no_repl { 216 215 commands::run(&runtime, run_args, &db_conn) ··· 227 226 relay_count: flags.relay_count, 228 227 memory: flags.memory, 229 228 }; 230 - core::init(&db_conn) 229 + core::init_account(&db_conn) 231 230 .inspect_err(|e| eprintln!("Tiles core init failed due to {:?}", e))?; 232 231 commands::run(&runtime, run_args, &db_conn) 233 232 .await ··· 293 292 .init() 294 293 } else { 295 294 env_logger::Builder::from_env( 296 - env_logger::Env::default().default_filter_or("error,iroh=off"), 295 + env_logger::Env::default().default_filter_or("error,iroh=off,tracing=off"), 297 296 ) 298 297 .init() 299 298 }
+4 -1
tiles/src/utils/config.rs
··· 203 203 let tiles_config_dir = DefaultProvider.get_config_dir()?; 204 204 let config_toml_path = tiles_config_dir.join("config.toml"); 205 205 206 - if config_toml_path.try_exists()? { 206 + if config_toml_path 207 + .try_exists() 208 + .context("config.toml path doesn't exist")? 209 + { 207 210 let config_str = fs::read_to_string(config_toml_path)?; 208 211 Ok(config_str.parse::<Table>()?) 209 212 } else {