style: Apply linter formatting to base_coder.py

This commit is contained in:
Paul Gauthier (aider) 2025-03-07 15:54:00 -08:00
parent f3b9831a0c
commit 7a098ce740

View file

@ -1391,7 +1391,7 @@ class Coder:
self.multi_response_content = "" self.multi_response_content = ""
print() print()
print("="*20) print("=" * 20)
dump(self.partial_response_content) dump(self.partial_response_content)
self.io.tool_output() self.io.tool_output()
@ -1695,25 +1695,25 @@ class Coder:
def replace_reasoning_tags(self, text, tag_name): def replace_reasoning_tags(self, text, tag_name):
""" """
Replace opening and closing reasoning tags with standard formatting. Replace opening and closing reasoning tags with standard formatting.
Args: Args:
text (str): The text containing the tags text (str): The text containing the tags
tag_name (str): The name of the tag to replace tag_name (str): The name of the tag to replace
Returns: Returns:
str: Text with reasoning tags replaced with standard format str: Text with reasoning tags replaced with standard format
""" """
if not text: if not text:
return text return text
# Replace opening tag # Replace opening tag
text = re.sub(f"<{tag_name}>", REASONING_START, text) text = re.sub(f"<{tag_name}>", REASONING_START, text)
# Replace closing tag # Replace closing tag
text = re.sub(f"</{tag_name}>", REASONING_END, text) text = re.sub(f"</{tag_name}>", REASONING_END, text)
return text return text
def show_send_output(self, completion): def show_send_output(self, completion):
if self.verbose: if self.verbose:
print(completion) print(completion)
@ -1757,12 +1757,13 @@ class Coder:
show_resp = self.render_incremental_response(True) show_resp = self.render_incremental_response(True)
if reasoning_content: if reasoning_content:
formatted_reasoning = self.replace_reasoning_tags( formatted_reasoning = (
f"<{REASONING_TAG}>\n\n" self.replace_reasoning_tags(
+ reasoning_content f"<{REASONING_TAG}>\n\n" + reasoning_content + f"\n\n</{REASONING_TAG}>",
+ f"\n\n</{REASONING_TAG}>", REASONING_TAG,
REASONING_TAG )
) + "\n\n" + "\n\n"
)
show_resp = formatted_reasoning + show_resp show_resp = formatted_reasoning + show_resp
self.io.assistant_output(show_resp, pretty=self.show_pretty()) self.io.assistant_output(show_resp, pretty=self.show_pretty())