[Router] Consolidate ConnectionMode enum to core module (#11937)
This commit is contained in:
@@ -9,7 +9,8 @@ use super::{
|
||||
RouterTrait,
|
||||
};
|
||||
use crate::{
|
||||
config::{ConnectionMode, PolicyConfig, RoutingMode},
|
||||
config::{PolicyConfig, RoutingMode},
|
||||
core::ConnectionMode,
|
||||
policies::PolicyFactory,
|
||||
server::AppContext,
|
||||
};
|
||||
@@ -21,7 +22,7 @@ impl RouterFactory {
|
||||
/// Create a router instance from application context
|
||||
pub async fn create_router(ctx: &Arc<AppContext>) -> Result<Box<dyn RouterTrait>, String> {
|
||||
match ctx.router_config.connection_mode {
|
||||
ConnectionMode::Grpc => match &ctx.router_config.mode {
|
||||
ConnectionMode::Grpc { .. } => match &ctx.router_config.mode {
|
||||
RoutingMode::Regular { .. } => Self::create_grpc_router(ctx).await,
|
||||
RoutingMode::PrefillDecode {
|
||||
prefill_policy,
|
||||
|
||||
@@ -18,8 +18,8 @@ use serde_json::Value;
|
||||
use tracing::{debug, info, warn};
|
||||
|
||||
use crate::{
|
||||
config::{ConnectionMode, RoutingMode},
|
||||
core::{WorkerRegistry, WorkerType},
|
||||
config::RoutingMode,
|
||||
core::{ConnectionMode, WorkerRegistry, WorkerType},
|
||||
protocols::{
|
||||
chat::ChatCompletionRequest,
|
||||
classify::ClassifyRequest,
|
||||
@@ -148,13 +148,13 @@ impl RouterManager {
|
||||
(ConnectionMode::Http, RoutingMode::OpenAI { .. }) => {
|
||||
RouterId::new("http-openai".to_string())
|
||||
}
|
||||
(ConnectionMode::Grpc, RoutingMode::Regular { .. }) => {
|
||||
(ConnectionMode::Grpc { .. }, RoutingMode::Regular { .. }) => {
|
||||
RouterId::new("grpc-regular".to_string())
|
||||
}
|
||||
(ConnectionMode::Grpc, RoutingMode::PrefillDecode { .. }) => {
|
||||
(ConnectionMode::Grpc { .. }, RoutingMode::PrefillDecode { .. }) => {
|
||||
RouterId::new("grpc-pd".to_string())
|
||||
}
|
||||
(ConnectionMode::Grpc, RoutingMode::OpenAI { .. }) => {
|
||||
(ConnectionMode::Grpc { .. }, RoutingMode::OpenAI { .. }) => {
|
||||
RouterId::new("grpc-regular".to_string())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user