Fixed model name mapping for openrouter

This commit is contained in:
Fahad
2025-06-14 19:19:59 +04:00
parent b405aaf8bd
commit b41b874e31
3 changed files with 18 additions and 25 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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)