mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-06 22:00:40 +08:00
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:
@ -144,12 +144,12 @@ class TokenHandler:
|
||||
"""
|
||||
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'):
|
||||
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)
|
||||
|
||||
def count_tokens(self, patch: str, force_accurate: bool = False) -> int:
|
||||
|
Reference in New Issue
Block a user