Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore: files changed crates/openhuman-core/src/channels/routes.rs,crates/openhuman-core/src/channels

Steven Enamakel5a7cef041c9b
diff --git a/crates/openhuman-core/src/channels/routes.rs b/crates/openhuman-core/src/channels/routes.rs
index 687cc9c08f..c1dc6a1407 100644
--- a/crates/openhuman-core/src/channels/routes.rs
+++ b/crates/openhuman-core/src/channels/routes.rs
@@ -12,7 +12,6 @@ fn provider_descriptors(config: &crate::config::Config) -> Vec<ProviderDescripto
config
.cloud_providers
.iter()
- .into_iter()
.map(|provider| ProviderDescriptor {
name: provider.slug.clone(),
aliases: if provider.slug == crate::inference::provider::factory::PROVIDER_OPENHUMAN
diff --git a/crates/openhuman-core/src/channels/routes_tests.rs b/crates/openhuman-core/src/channels/routes_tests.rs
index 623f9e7b03..f54eb01ea9 100644
--- a/crates/openhuman-core/src/channels/routes_tests.rs
+++ b/crates/openhuman-core/src/channels/routes_tests.rs
@@ -337,6 +337,63 @@ async fn load_cached_model_preview_returns_empty_when_cache_json_is_invalid() {
assert!(response.contains("No cached model list found for `openai`"));
}
+#[tokio::test]
+async fn handle_runtime_command_routes_configured_provider_slug_and_alias() {
+ use crate::config::schema::{AuthStyle, CloudProviderCreds};
+
+ let mut ctx = runtime_context(PathBuf::from("/tmp"));
+ let config = crate::config::Config {
+ cloud_providers: vec![
+ CloudProviderCreds {
+ id: "p_custom_route_123".into(),
+ slug: "custom-route".into(),
+ label: "Human Friendly Name".into(),
+ endpoint: "https://provider.example.test/v1".into(),
+ auth_style: AuthStyle::Bearer,
+ default_model: None,
+ },
+ CloudProviderCreds {
+ id: "p_managed_123".into(),
+ slug: "openhuman".into(),
+ label: "Managed Backend".into(),
+ endpoint: "https://api.openhuman.ai/v1".into(),
+ auth_style: AuthStyle::OpenhumanJwt,
+ default_model: None,
+ },
+ ],
+ ..crate::config::Config::default()
+ };
+ ctx.config = Some(Arc::new(config));
+ let channel_impl = Arc::new(RecordingChannel::default());
+ let channel: Arc<dyn Channel> = channel_impl.clone();
+ let key = "telegram_alice_room";
+
+ for requested in ["custom-route", "backend"] {
+ let msg = ChannelMessage {
+ id: requested.into(),
+ sender: "alice".into(),
+ reply_target: "room".into(),
+ content: format!("/models {requested}"),
+ channel: "telegram".into(),
+ timestamp: 0,
+ thread_ts: None,
+ sender_name: None,
+ };
+ assert!(handle_runtime_command_if_needed(
+ &ctx,
+ &msg,
+ Some(&channel),
+ &conversation_history_key(&msg),
+ )
+ .await);
+ }
+
+ assert_eq!(get_route_selection(&ctx, key).provider, "openhuman");
+ let sent = channel_impl.sent.lock().unwrap();
+ assert_eq!(sent.len(), 1, "the configured slug should be accepted");
+ assert!(sent[0].content.contains("Provider switched to `custom-route`"));
+}
+
#[tokio::test]
async fn handle_runtime_command_unknown_provider_sends_helpful_error() {
let ctx = runtime_context(PathBuf::from("/tmp"));
diff --git a/crates/openhuman-core/src/inference/provider/ops/http_error.rs b/crates/openhuman-core/src/inference/provider/http_error.rs
similarity index 100%
rename from crates/openhuman-core/src/inference/provider/ops/http_error.rs
rename to crates/openhuman-core/src/inference/provider/http_error.rs
diff --git a/crates/openhuman-core/src/inference/provider/ops/http_error_tests.rs b/crates/openhuman-core/src/inference/provider/http_error_tests.rs
similarity index 100%
rename from crates/openhuman-core/src/inference/provider/ops/http_error_tests.rs
rename to crates/openhuman-core/src/inference/provider/http_error_tests.rs
diff --git a/crates/openhuman-core/src/inference/provider/ops/models/catalog_listing.rs b/crates/openhuman-core/src/inference/provider/models/catalog_listing.rs
similarity index 100%
rename from crates/openhuman-core/src/inference/provider/ops/models/catalog_listing.rs
rename to crates/openhuman-core/src/inference/provider/models/catalog_listing.rs
diff --git a/crates/openhuman-core/src/inference/provider/ops/models/local_runtime.rs b/crates/openhuman-core/src/inference/provider/models/local_runtime.rs
similarity index 100%
rename from crates/openhuman-core/src/inference/provider/ops/models/local_runtime.rs
rename to crates/openhuman-core/src/inference/provider/models/local_runtime.rs
diff --git a/crates/openhuman-core/src/inference/provider/ops/models.rs b/crates/openhuman-core/src/inference/provider/models/mod.rs
similarity index 100%
rename from crates/openhuman-core/src/inference/provider/ops/models.rs
rename to crates/openhuman-core/src/inference/provider/models/mod.rs
diff --git a/crates/openhuman-core/src/inference/provider/ops/models/openrouter.rs b/crates/openhuman-core/src/inference/provider/models/openrouter.rs
similarity index 100%
rename from crates/openhuman-core/src/inference/provider/ops/models/openrouter.rs
rename to crates/openhuman-core/src/inference/provider/models/openrouter.rs
diff --git a/crates/openhuman-core/src/inference/provider/ops/models_tests.rs b/crates/openhuman-core/src/inference/provider/models_tests.rs
similarity index 100%
rename from crates/openhuman-core/src/inference/provider/ops/models_tests.rs
rename to crates/openhuman-core/src/inference/provider/models_tests.rs