fix: axum middlewares only handles routes that are registered
parent
063678bfa6
commit
3bddd9fa64
|
|
@ -2,6 +2,7 @@ use std::{sync::Arc, time::Duration};
|
||||||
|
|
||||||
use axum::{routing, Router};
|
use axum::{routing, Router};
|
||||||
use clap::Args;
|
use clap::Args;
|
||||||
|
use hyper::StatusCode;
|
||||||
use tabby_common::{
|
use tabby_common::{
|
||||||
api,
|
api,
|
||||||
api::{code::CodeSearch, event::EventLogger},
|
api::{code::CodeSearch, event::EventLogger},
|
||||||
|
|
@ -192,6 +193,13 @@ async fn api_router(
|
||||||
config.server.completion_timeout,
|
config.server.completion_timeout,
|
||||||
)))
|
)))
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
routers.push({
|
||||||
|
Router::new().route(
|
||||||
|
"/v1/completions",
|
||||||
|
routing::post(StatusCode::NOT_IMPLEMENTED),
|
||||||
|
)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(chat_state) = chat_state {
|
if let Some(chat_state) = chat_state {
|
||||||
|
|
@ -201,6 +209,13 @@ async fn api_router(
|
||||||
routing::post(routes::chat_completions).with_state(chat_state),
|
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({
|
routers.push({
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue