Skip to content

Commit

Permalink
fix: axum middlewares only handles routes that are registered
Browse files Browse the repository at this point in the history
  • Loading branch information
wsxiaoys committed Nov 23, 2023
1 parent b8e0a63 commit 212f194
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions crates/tabby/src/serve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::{sync::Arc, time::Duration};

use axum::{routing, Router};
use clap::Args;
use hyper::StatusCode;
use tabby_common::{
api,
api::{code::CodeSearch, event::EventLogger},
Expand Down Expand Up @@ -192,6 +193,13 @@ async fn api_router(
config.server.completion_timeout,
)))
});
} else {
routers.push({
Router::new().route(
"/v1/completions",
routing::post(StatusCode::NOT_IMPLEMENTED),
)
})
}

if let Some(chat_state) = chat_state {
Expand All @@ -201,6 +209,13 @@ async fn api_router(
routing::post(routes::chat_completions).with_state(chat_state),
)
})
} else {
routers.push({
Router::new().route(
"/v1beta/chat/completions",
routing::post(StatusCode::NOT_IMPLEMENTED),
)
})
}

routers.push({
Expand Down

0 comments on commit 212f194

Please sign in to comment.