mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-03 04:10:49 +08:00
Add multi-model support for different reasoning tasks
This commit is contained in:
@ -102,7 +102,7 @@ def process_patch_lines(patch_str, original_file_str, patch_extra_lines_before,
|
||||
lines_before_original = file_original_lines[extended_start1 - 1:start1 - 1]
|
||||
lines_before_new = file_new_lines[extended_start2 - 1:start2 - 1]
|
||||
found_header = False
|
||||
for i, line, in enumerate(lines_before_original):
|
||||
for i, line in enumerate(lines_before_original):
|
||||
if section_header in line:
|
||||
# Update start and size in one line each
|
||||
extended_start1, extended_start2 = extended_start1 + i, extended_start2 + i
|
||||
@ -136,7 +136,9 @@ def process_patch_lines(patch_str, original_file_str, patch_extra_lines_before,
|
||||
delta_lines_original = delta_lines_original[i:]
|
||||
delta_lines_new = delta_lines_new[i:]
|
||||
extended_start1 += i
|
||||
extended_size1 -= i
|
||||
extended_start2 += i
|
||||
extended_size2 -= i
|
||||
found_mini_match = True
|
||||
break
|
||||
if not found_mini_match:
|
||||
|
@ -342,6 +342,8 @@ def _get_all_models(model_type: ModelType = ModelType.REGULAR) -> List[str]:
|
||||
model = get_model('model_weak')
|
||||
elif model_type == ModelType.REASONING:
|
||||
model = get_model('model_reasoning')
|
||||
elif model_type == ModelType.REGULAR:
|
||||
model = get_settings().config.model
|
||||
else:
|
||||
model = get_settings().config.model
|
||||
fallback_models = get_settings().config.fallback_models
|
||||
|
@ -417,8 +417,9 @@ class PRCodeSuggestions:
|
||||
|
||||
# self-reflect on suggestions (mandatory, since line numbers are generated now here)
|
||||
model_reflect_with_reasoning = get_model('model_reasoning')
|
||||
if model_reflect_with_reasoning == get_settings().config.model and model != get_settings().config.model and model == \
|
||||
get_settings().config.fallback_models[0]:
|
||||
fallbacks = get_settings().config.fallback_models
|
||||
if model_reflect_with_reasoning == get_settings().config.model and model != get_settings().config.model and fallbacks and model == \
|
||||
fallbacks[0]:
|
||||
# we are using a fallback model (should not happen on regular conditions)
|
||||
get_logger().warning(f"Using the same model for self-reflection as the one used for suggestions")
|
||||
model_reflect_with_reasoning = model
|
||||
|
Reference in New Issue
Block a user