Unverified Commit 42017d82 authored by Sylvain Gugger's avatar Sylvain Gugger Committed by GitHub
Browse files

Fix new line bug in chat mode for agents (#23267)

parent f93509b1
...@@ -264,9 +264,7 @@ class Agent: ...@@ -264,9 +264,7 @@ class Agent:
""" """
prompt = self.format_prompt(task, chat_mode=True) prompt = self.format_prompt(task, chat_mode=True)
result = self.generate_one(prompt, stop=["Human:", "====="]) result = self.generate_one(prompt, stop=["Human:", "====="])
self.chat_history = prompt + result self.chat_history = prompt + result.strip() + "\n"
if not self.chat_history.endswith("\n"):
self.chat_history += "\n"
explanation, code = clean_code_for_chat(result) explanation, code = clean_code_for_chat(result)
print(f"==Explanation from the agent==\n{explanation}") print(f"==Explanation from the agent==\n{explanation}")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment