diff --git a/Cargo.toml b/Cargo.toml index 612a64f3..fe1451da 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,7 @@ members = [ ] [workspace.package] -version = "0.3.21" +version = "0.3.22" edition = "2021" license = "Apache-2.0 OR MIT" repository = "https://github.com/RightNow-AI/openfang" diff --git a/crates/openfang-api/src/routes.rs b/crates/openfang-api/src/routes.rs index 57b28842..b6f7dde8 100644 --- a/crates/openfang-api/src/routes.rs +++ b/crates/openfang-api/src/routes.rs @@ -2241,7 +2241,7 @@ pub async fn whatsapp_qr_start() -> impl IntoResponse { return Json(serde_json::json!({ "available": false, "message": "WhatsApp Web gateway not running. Start the gateway or use Business API mode.", - "help": "Run: npx openfang-whatsapp-gateway (or set WHATSAPP_WEB_GATEWAY_URL)" + "help": "The WhatsApp Web gateway auto-starts with the daemon when configured. Ensure Node.js >= 18 is installed and WhatsApp is configured in config.toml. Set WHATSAPP_WEB_GATEWAY_URL to use an external gateway." })); } @@ -5360,7 +5360,7 @@ pub async fn add_custom_model( if !catalog.add_custom_model(entry) { return ( StatusCode::CONFLICT, - Json(serde_json::json!({"error": format!("Model '{}' already exists", id)})), + Json(serde_json::json!({"error": format!("Model '{}' already exists for provider '{}'", id, provider)})), ); } diff --git a/crates/openfang-runtime/src/model_catalog.rs b/crates/openfang-runtime/src/model_catalog.rs index 8013fe20..a2dc6b0a 100644 --- a/crates/openfang-runtime/src/model_catalog.rs +++ b/crates/openfang-runtime/src/model_catalog.rs @@ -253,11 +253,16 @@ impl ModelCatalog { /// Add a custom model at runtime. /// - /// Returns `true` if the model was added, `false` if a model with that ID - /// already exists (case-insensitive). + /// Returns `true` if the model was added, `false` if a model with the same + /// ID **and** provider already exists (case-insensitive). pub fn add_custom_model(&mut self, entry: ModelCatalogEntry) -> bool { - let lower = entry.id.to_lowercase(); - if self.models.iter().any(|m| m.id.to_lowercase() == lower) { + let lower_id = entry.id.to_lowercase(); + let lower_provider = entry.provider.to_lowercase(); + if self + .models + .iter() + .any(|m| m.id.to_lowercase() == lower_id && m.provider.to_lowercase() == lower_provider) + { return false; } let provider = entry.provider.clone();