fix: Improve formatting of system information in prompt

This commit is contained in:
Paul Gauthier 2024-08-06 09:55:31 -03:00 committed by Paul Gauthier (aider)
parent d0096773bf
commit 535fdfff35
2 changed files with 4 additions and 5 deletions

View file

@ -760,21 +760,21 @@ class Coder:
def fmt_system_prompt(self, prompt): def fmt_system_prompt(self, prompt):
lazy_prompt = self.gpt_prompts.lazy_prompt if self.main_model.lazy else "" lazy_prompt = self.gpt_prompts.lazy_prompt if self.main_model.lazy else ""
platform_text = f"- The user's system: {platform.platform()}\n" platform_text = f"- Platform: {platform.platform()}\n"
if os.name == "nt": if os.name == "nt":
var = "COMSPEC" var = "COMSPEC"
else: else:
var = "SHELL" var = "SHELL"
val = os.getenv(var) val = os.getenv(var)
platform_text += f"- The user's shell: {var}={val}\n" platform_text += f"- Shell: {var}={val}\n"
user_lang = self.get_user_language() user_lang = self.get_user_language()
if user_lang: if user_lang:
platform_text += f"- The user's language: {user_lang}\n" platform_text += f"- Language: {user_lang}\n"
dt = datetime.now().astimezone().strftime("%Y-%m-%dT%H:%M:%S%z") dt = datetime.now().astimezone().strftime("%Y-%m-%dT%H:%M:%S%z")
platform_text += f"- The current date/time: {dt}" platform_text += f"- Current date/time: {dt}"
prompt = prompt.format( prompt = prompt.format(
fence=self.fence, fence=self.fence,

View file

@ -22,7 +22,6 @@ All changes to files must use the *SEARCH/REPLACE block* format.
Keep this info about the user's system in mind: Keep this info about the user's system in mind:
{platform} {platform}
""" """
example_messages = [ example_messages = [