mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 09:14:59 +00:00
feat: enhance error reporting with detailed system information
This commit is contained in:
parent
e99f935bb5
commit
b50b28c815
1 changed files with 39 additions and 5 deletions
|
@ -3,12 +3,39 @@ import sys
|
|||
import traceback
|
||||
import urllib.parse
|
||||
import webbrowser
|
||||
import platform
|
||||
import subprocess
|
||||
import pkg_resources
|
||||
|
||||
from aider import __version__
|
||||
from aider.urls import github_issues
|
||||
|
||||
FENCE = "`" * 3
|
||||
|
||||
def get_python_info():
|
||||
implementation = platform.python_implementation()
|
||||
is_venv = sys.prefix != sys.base_prefix
|
||||
return f"Python implementation: {implementation}\nVirtual environment: {'Yes' if is_venv else 'No'}"
|
||||
|
||||
def get_os_info():
|
||||
return f"OS: {platform.system()} {platform.release()} ({platform.architecture()[0]})"
|
||||
|
||||
def get_git_info():
|
||||
try:
|
||||
git_version = subprocess.check_output(["git", "--version"]).decode().strip()
|
||||
branch = subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"]).decode().strip()
|
||||
commit = subprocess.check_output(["git", "rev-parse", "HEAD"]).decode().strip()
|
||||
return f"Git version: {git_version}\nBranch: {branch}\nCommit: {commit}"
|
||||
except:
|
||||
return "Git information unavailable"
|
||||
|
||||
def get_dependencies():
|
||||
deps = [
|
||||
f"{pkg.key}=={pkg.version}"
|
||||
for pkg in pkg_resources.working_set
|
||||
if pkg.key.lower() in ['openai', 'tiktoken', 'litellm'] # Add other relevant packages
|
||||
]
|
||||
return "Relevant installed packages:\n" + "\n".join(deps)
|
||||
|
||||
def report_github_issue(issue_text, title=None):
|
||||
"""
|
||||
|
@ -19,13 +46,20 @@ def report_github_issue(issue_text, title=None):
|
|||
:param title: The title of the issue (optional)
|
||||
:return: None
|
||||
"""
|
||||
import platform
|
||||
import sys
|
||||
|
||||
version_info = f"Aider version: {__version__}\n"
|
||||
python_version = f"Python version: {sys.version.split()[0]}\n"
|
||||
platform_info = f"Platform: {platform.platform()}\n\n"
|
||||
issue_text = version_info + python_version + platform_info + issue_text
|
||||
platform_info = f"Platform: {platform.platform()}\n"
|
||||
python_info = get_python_info() + "\n"
|
||||
os_info = get_os_info() + "\n"
|
||||
git_info = get_git_info() + "\n"
|
||||
dependencies = get_dependencies() + "\n"
|
||||
|
||||
system_info = (
|
||||
version_info + python_version + platform_info +
|
||||
python_info + os_info + git_info + dependencies + "\n"
|
||||
)
|
||||
|
||||
issue_text = system_info + issue_text
|
||||
params = {"body": issue_text}
|
||||
if title is None:
|
||||
title = "Bug report"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue