mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 10:14:59 +00:00
refactor: extract platform info generation to separate method
This commit is contained in:
parent
fbb5d34888
commit
dd9f0494c1
1 changed files with 10 additions and 10 deletions
|
@ -868,17 +868,11 @@ class Coder:
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def fmt_system_prompt(self, prompt):
|
def get_platform_info(self):
|
||||||
lazy_prompt = self.gpt_prompts.lazy_prompt if self.main_model.lazy else ""
|
|
||||||
|
|
||||||
platform_text = f"- Platform: {platform.platform()}\n"
|
platform_text = f"- Platform: {platform.platform()}\n"
|
||||||
if os.name == "nt":
|
shell_var = "COMSPEC" if os.name == "nt" else "SHELL"
|
||||||
var = "COMSPEC"
|
shell_val = os.getenv(shell_var)
|
||||||
else:
|
platform_text += f"- Shell: {shell_var}={shell_val}\n"
|
||||||
var = "SHELL"
|
|
||||||
|
|
||||||
val = os.getenv(var)
|
|
||||||
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:
|
||||||
|
@ -890,6 +884,12 @@ class Coder:
|
||||||
if self.repo:
|
if self.repo:
|
||||||
platform_text += "- The user is operating inside a git repository\n"
|
platform_text += "- The user is operating inside a git repository\n"
|
||||||
|
|
||||||
|
return platform_text
|
||||||
|
|
||||||
|
def fmt_system_prompt(self, prompt):
|
||||||
|
lazy_prompt = self.gpt_prompts.lazy_prompt if self.main_model.lazy else ""
|
||||||
|
platform_text = self.get_platform_info()
|
||||||
|
|
||||||
prompt = prompt.format(
|
prompt = prompt.format(
|
||||||
fence=self.fence,
|
fence=self.fence,
|
||||||
lazy_prompt=lazy_prompt,
|
lazy_prompt=lazy_prompt,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue