refactor: Extract reasoning content removal to helper method

This commit is contained in:
Paul Gauthier (aider) 2025-03-07 17:30:15 -08:00
parent 586af2a435
commit cddc67ad69

View file

@ -1382,12 +1382,10 @@ class Coder:
self.partial_response_content = self.get_multi_response_content_in_progress(True)
# ai: make a helper method...
self.partial_response_content = self.main_model.remove_reasoning_content(
self.partial_response_content = self.remove_reasoning_content(
self.partial_response_content,
self.reasoning_tag_name,
)
# ... ai!
self.multi_response_content = ""
###
@ -1835,6 +1833,10 @@ class Coder:
def render_incremental_response(self, final):
return self.get_multi_response_content_in_progress()
def remove_reasoning_content(self, content, reasoning_tag_name):
"""Remove reasoning content from the model's response."""
return self.main_model.remove_reasoning_content(content, reasoning_tag_name)
def calculate_and_show_tokens_and_cost(self, messages, completion=None):
prompt_tokens = 0
completion_tokens = 0