add comments

This commit is contained in:
Adil Hafeez 2025-06-24 13:40:01 -07:00
parent 60b1bdca06
commit 80ce215293
No known key found for this signature in database
GPG key ID: 9B18EF7691369645
3 changed files with 4 additions and 3 deletions

View file

@ -802,7 +802,7 @@ static_resources:
- endpoint:
address:
socket_address:
address: host.docker.internal
address: 0.0.0.0
port_value: 9091
hostname: localhost

View file

@ -59,7 +59,6 @@ def docker_start_archgw_detached(
volume_mappings = [
f"{arch_config_file}:/app/arch_config.yaml:ro",
# "/Users/adilhafeez/src/intelligent-prompt-gateway/crates/target/wasm32-wasip1/release:/etc/envoy/proxy-wasm-plugins:ro",
]
volume_mappings_args = [
item for volume in volume_mappings for item in ("-v", volume)

View file

@ -17,6 +17,7 @@ pub async fn list_preferences(
llm_providers: Arc<tokio::sync::RwLock<Vec<LlmProvider>>>,
) -> Response<BoxBody<Bytes, hyper::Error>> {
let prov = llm_providers.read().await;
// select providers that have usage information
let providers_with_usage = prov
.iter()
.filter(|provider| provider.usage.is_some())
@ -56,7 +57,6 @@ pub async fn update_preferences(
request: Request<hyper::body::Incoming>,
llm_providers: Arc<tokio::sync::RwLock<Vec<LlmProvider>>>,
) -> Result<Response<BoxBody<Bytes, hyper::Error>>, hyper::Error> {
info!("Updating preferences...");
let request_body = request.collect().await?.to_bytes();
let usage: Vec<UsageBasedProvider> = match serde_json::from_slice(&request_body) {
@ -76,6 +76,8 @@ pub async fn update_preferences(
let usage_model_map: HashMap<String, UsageBasedProvider> =
usage.into_iter().map(|u| (u.model.clone(), u)).collect();
info!("Updating usage preferences for models: {:?}", usage_model_map.keys());
let mut llm_providers = llm_providers.write().await;
// ensure that models coming in the request are valid