Skip to content

Commit

Permalink
fix: correct BUILD_VERSION
Browse files Browse the repository at this point in the history
  • Loading branch information
0xbrayo committed Nov 1, 2024
1 parent 5ee0f2f commit f57e55a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion gptme/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def prompt_systeminfo() -> Generator[Message, None, None]:
"""Generate the system information prompt."""
if platform.system() == "Linux":
os_info = get_system_distro()
os_version = platform.uname().release
os_version = get_system_distro_version()
elif platform.system() == "Windows":
os_info = "Windows"
os_version = platform.version()
Expand Down Expand Up @@ -247,6 +247,18 @@ def get_system_distro() -> str:
return "Linux"


def get_system_distro_version() -> str:
"""Get the system distribution version."""
regex = re.compile(r"^BUILD_ID=\"?([^\"]+)\"?")
if os.path.exists("/etc/os-release"):
with open("/etc/os-release") as f:
for line in f:
matches = re.search(regex, line)
if matches:
return matches.string[matches.start(1) : matches.end(1)]
return ""


document_prompt_function(interactive=True)(prompt_gptme)
document_prompt_function()(prompt_user)
document_prompt_function()(prompt_project)
Expand Down

0 comments on commit f57e55a

Please sign in to comment.