Skip to content

Commit c6b46cc

Browse files
committed
catalog composite
1 parent 9fc0fe7 commit c6b46cc

3 files changed

Lines changed: 12 additions & 7 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ members = [
1818
]
1919

2020
[workspace.package]
21-
version = "0.3.21"
21+
version = "0.3.22"
2222
edition = "2021"
2323
license = "Apache-2.0 OR MIT"
2424
repository = "https://github.com/RightNow-AI/openfang"

crates/openfang-api/src/routes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2241,7 +2241,7 @@ pub async fn whatsapp_qr_start() -> impl IntoResponse {
22412241
return Json(serde_json::json!({
22422242
"available": false,
22432243
"message": "WhatsApp Web gateway not running. Start the gateway or use Business API mode.",
2244-
"help": "Run: npx openfang-whatsapp-gateway (or set WHATSAPP_WEB_GATEWAY_URL)"
2244+
"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."
22452245
}));
22462246
}
22472247

@@ -5360,7 +5360,7 @@ pub async fn add_custom_model(
53605360
if !catalog.add_custom_model(entry) {
53615361
return (
53625362
StatusCode::CONFLICT,
5363-
Json(serde_json::json!({"error": format!("Model '{}' already exists", id)})),
5363+
Json(serde_json::json!({"error": format!("Model '{}' already exists for provider '{}'", id, provider)})),
53645364
);
53655365
}
53665366

crates/openfang-runtime/src/model_catalog.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,16 @@ impl ModelCatalog {
253253

254254
/// Add a custom model at runtime.
255255
///
256-
/// Returns `true` if the model was added, `false` if a model with that ID
257-
/// already exists (case-insensitive).
256+
/// Returns `true` if the model was added, `false` if a model with the same
257+
/// ID **and** provider already exists (case-insensitive).
258258
pub fn add_custom_model(&mut self, entry: ModelCatalogEntry) -> bool {
259-
let lower = entry.id.to_lowercase();
260-
if self.models.iter().any(|m| m.id.to_lowercase() == lower) {
259+
let lower_id = entry.id.to_lowercase();
260+
let lower_provider = entry.provider.to_lowercase();
261+
if self
262+
.models
263+
.iter()
264+
.any(|m| m.id.to_lowercase() == lower_id && m.provider.to_lowercase() == lower_provider)
265+
{
261266
return false;
262267
}
263268
let provider = entry.provider.clone();

0 commit comments

Comments
 (0)