Reorder model check: OpenAI before Anthropic

OpenAI is the default in most cases, so checking it first skips unnecessary Anthropic logic.
This commit is contained in:
kkan9ma
2025-05-22 13:12:04 +09:00
parent ead7491ca9
commit cc686ef26d

View File

@ -144,11 +144,11 @@ class TokenHandler:
""" """
model_name = get_settings().config.model.lower() model_name = get_settings().config.model.lower()
if self.model_validator.is_anthropic_model(model_name) and get_settings(use_context=False).get('anthropic.key'):
return self._calc_claude_tokens(patch)
if self.model_validator.is_openai_model(model_name) and get_settings(use_context=False).get('openai.key'): if self.model_validator.is_openai_model(model_name) and get_settings(use_context=False).get('openai.key'):
return default_estimate return default_estimate
if self.model_validator.is_anthropic_model(model_name) and get_settings(use_context=False).get('anthropic.key'):
return self._calc_claude_tokens(patch)
return self._apply_estimation_factor(model_name, default_estimate) return self._apply_estimation_factor(model_name, default_estimate)