Skip to content

Commit

Permalink
fix(tabby): Do not log events to db if --webserver is not specified (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
boxbeam authored Mar 26, 2024
1 parent 0218e82 commit 07f13f5
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions crates/tabby/src/serve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use crate::{
chat::create_chat_service,
code::create_code_search,
completion::{self, create_completion_service},
event::create_logger,
health,
model::download_model_if_needed,
},
Expand Down Expand Up @@ -121,16 +122,23 @@ pub async fn main(config: &Config, args: &ServeArgs) {
info!("Starting server, this might take a few minutes...");

#[cfg(feature = "ee")]
let ws = tabby_webserver::public::WebserverHandle::new().await;
let ws = if args.webserver {
Some(tabby_webserver::public::WebserverHandle::new().await)
} else {
None
};

let logger: Arc<dyn EventLogger>;
#[cfg(feature = "ee")]
{
logger = ws.logger();
logger = ws
.as_ref()
.map(|ws| ws.logger())
.unwrap_or_else(|| Arc::new(create_logger()));
}
#[cfg(not(feature = "ee"))]
{
logger = Arc::new(crate::services::event::create_logger());
logger = Arc::new(create_logger());
}

let code = Arc::new(create_code_search());
Expand All @@ -141,6 +149,7 @@ pub async fn main(config: &Config, args: &ServeArgs) {
#[cfg(feature = "ee")]
let (api, ui) = if args.webserver {
let (api, ui) = ws
.unwrap()
.attach_webserver(api, ui, code, args.chat_model.is_some(), args.port)
.await;
(api, ui)
Expand Down

0 comments on commit 07f13f5

Please sign in to comment.