collab: Remove LLM service (#28728)
This PR removes the LLM service from collab, as it has been moved to Cloudflare. Release Notes: - N/A
This commit is contained in:
parent
12b012eab3
commit
fc1252b0cd
17 changed files with 8 additions and 2315 deletions
|
@ -9,14 +9,14 @@ use axum::{
|
|||
|
||||
use collab::api::CloudflareIpCountryHeader;
|
||||
use collab::api::billing::sync_llm_usage_with_stripe_periodically;
|
||||
use collab::llm::{db::LlmDatabase, log_usage_periodically};
|
||||
use collab::llm::db::LlmDatabase;
|
||||
use collab::migrations::run_database_migrations;
|
||||
use collab::user_backfiller::spawn_user_backfiller;
|
||||
use collab::{
|
||||
AppState, Config, RateLimiter, Result, api::fetch_extensions_from_blob_store_periodically, db,
|
||||
env, executor::Executor, rpc::ResultExt,
|
||||
};
|
||||
use collab::{ServiceMode, api::billing::poll_stripe_events_periodically, llm::LlmState};
|
||||
use collab::{ServiceMode, api::billing::poll_stripe_events_periodically};
|
||||
use db::Database;
|
||||
use std::{
|
||||
env::args,
|
||||
|
@ -74,11 +74,10 @@ async fn main() -> Result<()> {
|
|||
let mode = match args.next().as_deref() {
|
||||
Some("collab") => ServiceMode::Collab,
|
||||
Some("api") => ServiceMode::Api,
|
||||
Some("llm") => ServiceMode::Llm,
|
||||
Some("all") => ServiceMode::All,
|
||||
_ => {
|
||||
return Err(anyhow!(
|
||||
"usage: collab <version | migrate | seed | serve <api|collab|llm|all>>"
|
||||
"usage: collab <version | migrate | seed | serve <api|collab|all>>"
|
||||
))?;
|
||||
}
|
||||
};
|
||||
|
@ -97,20 +96,9 @@ async fn main() -> Result<()> {
|
|||
|
||||
let mut on_shutdown = None;
|
||||
|
||||
if mode.is_llm() {
|
||||
setup_llm_database(&config).await?;
|
||||
|
||||
let state = LlmState::new(config.clone(), Executor::Production).await?;
|
||||
|
||||
log_usage_periodically(state.clone());
|
||||
|
||||
app = app
|
||||
.merge(collab::llm::routes())
|
||||
.layer(Extension(state.clone()));
|
||||
}
|
||||
|
||||
if mode.is_collab() || mode.is_api() {
|
||||
setup_app_database(&config).await?;
|
||||
setup_llm_database(&config).await?;
|
||||
|
||||
let state = AppState::new(config, Executor::Production).await?;
|
||||
|
||||
|
@ -336,18 +324,11 @@ async fn handle_root(Extension(mode): Extension<ServiceMode>) -> String {
|
|||
format!("zed:{mode} v{VERSION} ({})", REVISION.unwrap_or("unknown"))
|
||||
}
|
||||
|
||||
async fn handle_liveness_probe(
|
||||
app_state: Option<Extension<Arc<AppState>>>,
|
||||
llm_state: Option<Extension<Arc<LlmState>>>,
|
||||
) -> Result<String> {
|
||||
async fn handle_liveness_probe(app_state: Option<Extension<Arc<AppState>>>) -> Result<String> {
|
||||
if let Some(state) = app_state {
|
||||
state.db.get_all_users(0, 1).await?;
|
||||
}
|
||||
|
||||
if let Some(llm_state) = llm_state {
|
||||
llm_state.db.list_providers().await?;
|
||||
}
|
||||
|
||||
Ok("ok".to_string())
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue