more changes

This commit is contained in:
Adil Hafeez 2025-09-15 16:01:48 -07:00
parent a016212588
commit e57000000d
No known key found for this signature in database
GPG key ID: 9B18EF7691369645
7 changed files with 168 additions and 12 deletions

View file

@ -35,12 +35,20 @@ pub async fn agent_chat(
listeners: Arc<tokio::sync::RwLock<Vec<common::configuration::Listener>>>,
) -> Result<Response<BoxBody<Bytes, hyper::Error>>, hyper::Error> {
// find listener that is running at port 8001 for agents
let listener_name = request.headers().get("x-arch-agent-listener-name");
let listener = {
let listeners = listeners.read().await;
listeners.iter().find(|l| l.port == 8001).cloned()
listeners.iter().find(|l| {
listener_name
.and_then(|name| name.to_str().ok())
.map(|name| l.name == name)
.unwrap_or(false)
}).cloned()
}
.unwrap();
info!("Handling request for listener: {}", listener.name);
let request_path = request.uri().path().to_string();
let mut request_headers = request.headers().clone();
let chat_request_bytes = request.collect().await?.to_bytes();