mirror of
https://github.com/katanemo/plano.git
synced 2026-06-17 15:25:17 +02:00
more changes
This commit is contained in:
parent
a016212588
commit
e57000000d
7 changed files with 168 additions and 12 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue