From b41b874e312fff01a7d926386174847f75e52378 Mon Sep 17 00:00:00 2001 From: Fahad Date: Sat, 14 Jun 2025 19:19:59 +0400 Subject: [PATCH] Fixed model name mapping for openrouter --- config.py | 2 +- providers/custom.py | 21 ++++--------------- .../test_conversation_chain_validation.py | 20 +++++++++++------- 3 files changed, 18 insertions(+), 25 deletions(-) diff --git a/config.py b/config.py index 81e16e1..be576a6 100644 --- a/config.py +++ b/config.py @@ -14,7 +14,7 @@ import os # These values are used in server responses and for tracking releases # IMPORTANT: This is the single source of truth for version and author info # Semantic versioning: MAJOR.MINOR.PATCH -__version__ = "4.4.1" +__version__ = "4.4.2" # Last update date in ISO format __updated__ = "2025-06-14" # Primary maintainer diff --git a/providers/custom.py b/providers/custom.py index c551311..53d63c9 100644 --- a/providers/custom.py +++ b/providers/custom.py @@ -201,23 +201,10 @@ class CustomProvider(OpenAICompatibleProvider): logging.debug(f"Model '{model_name}' -> '{model_id}' validated via registry (custom model)") return True else: - # This is a cloud/OpenRouter model - check restrictions if available - if openrouter_available: - # Check if OpenRouter model is allowed by restrictions - from utils.model_restrictions import get_restriction_service - - restriction_service = get_restriction_service() - if not restriction_service.is_allowed(ProviderType.OPENROUTER, model_id, model_name): - logging.debug(f"Model '{model_name}' -> '{model_id}' blocked by OpenRouter restrictions") - return False - - logging.debug( - f"Model '{model_name}' -> '{model_id}' validated via OpenRouter (passes restrictions)" - ) - return True - else: - logging.debug(f"Model '{model_name}' -> '{model_id}' rejected (cloud model, no OpenRouter)") - return False + # This is a cloud/OpenRouter model - CustomProvider should NOT handle these + # Let OpenRouter provider handle them instead + logging.debug(f"Model '{model_name}' -> '{model_id}' rejected (cloud model, defer to OpenRouter)") + return False # Handle version tags for unknown models (e.g., "my-model:latest") clean_model_name = model_name diff --git a/simulator_tests/test_conversation_chain_validation.py b/simulator_tests/test_conversation_chain_validation.py index 639e753..579c595 100644 --- a/simulator_tests/test_conversation_chain_validation.py +++ b/simulator_tests/test_conversation_chain_validation.py @@ -315,22 +315,28 @@ class TestClass: is_valid_length = chain_length >= 2 # Try to identify which thread this is for better validation - thread_description = "Unknown thread" - if thread_id == continuation_id_a2: - thread_description = "A2 (should be 2-thread chain)" + thread_description = f"Thread {thread_id[:8]}" + if thread_id == continuation_id_a1: + thread_description = "A1 (original thread)" + is_valid_length = chain_length == 1 + elif thread_id == continuation_id_a2: + thread_description = "A2 (2-thread chain)" is_valid_length = chain_length == 2 elif thread_id == continuation_id_a3: - thread_description = "A3 (should be 3-thread chain)" + thread_description = "A3 (3-thread chain)" is_valid_length = chain_length == 3 + elif thread_id == continuation_id_b1: + thread_description = "B1 (original thread)" + is_valid_length = chain_length == 1 elif thread_id == continuation_id_b2: - thread_description = "B2 (should be 2-thread chain)" + thread_description = "B2 (2-thread chain)" is_valid_length = chain_length == 2 elif thread_id == continuation_id_a1_branch: - thread_description = "A1-Branch (should be 2-thread chain)" + thread_description = "A1-Branch (2-thread chain)" is_valid_length = chain_length == 2 traversal_validations.append( - (f"{thread_description[:8]}... has valid chain length", is_valid_length) + (f"{thread_description} has valid chain length", is_valid_length) ) # Also validate we found at least one traversal (shows the system is working)