mirror of
https://github.com/RightNow-AI/openfang.git
synced 2026-07-30 23:05:08 +00:00
catalog composite
This commit is contained in:
+1
-1
@@ -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"
|
||||
|
||||
@@ -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)})),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user