diff --git a/elroy/cli/bug_report.py b/elroy/cli/bug_report.py deleted file mode 100644 index c7853147..00000000 --- a/elroy/cli/bug_report.py +++ /dev/null @@ -1,33 +0,0 @@ -import traceback -from concurrent.futures import ThreadPoolExecutor - -from ..core.ctx import ElroyContext -from ..io.cli import CliIO -from ..tools.developer import create_bug_report - - -def create_bug_report_from_exception_if_confirmed( - io: CliIO, ctx: ElroyContext, error: Exception, error_explanation: str = "An error occured." -) -> None: - """ - Prompt user to create a bug report from an exception and create it if confirmed. - - Args: - error: The exception that triggered this prompt - """ - if get_confirm(ctx.thread_pool, io, f"{error_explanation} Would you like to create a bug report? (y/n)"): - create_bug_report( - ctx, - f"Error: {error.__class__.__name__}", - f"Exception occurred: {str(error)}\n\nTraceback:\n{''.join(traceback.format_tb(error.__traceback__))}", - ) - raise error - - -def get_confirm(thread_pool: ThreadPoolExecutor, io: CliIO, prompt: str) -> bool: - """Prompt the user to confirm an action""" - try: - response = io.prompt_user(thread_pool, 0, prompt) - return response.lower().startswith("y") - except EOFError: - return False diff --git a/elroy/cli/main.py b/elroy/cli/main.py index 4fafd799..c488d53c 100644 --- a/elroy/cli/main.py +++ b/elroy/cli/main.py @@ -32,7 +32,6 @@ from ..tools.developer import do_print_config from ..utils.clock import utc_now from ..utils.utils import datetime_to_string -from .bug_report import create_bug_report_from_exception_if_confirmed from .chat import handle_chat, handle_message_stdio from .options import ElroyOption, get_resolved_params from .updater import check_latest_version, check_updates @@ -469,7 +468,8 @@ def chat(typer_ctx: typer.Context): f"Tool use not supported by model {ctx.chat_model.name}. Try starting with --inline-tool-calls" ) else: - create_bug_report_from_exception_if_confirmed(io, ctx, e) + # Re-raise the error instead of creating bug report + raise finally: shutdown_scheduler(wait=False) diff --git a/elroy/core/constants.py b/elroy/core/constants.py index b0177292..9fcf52a5 100644 --- a/elroy/core/constants.py +++ b/elroy/core/constants.py @@ -26,11 +26,6 @@ RESULT_SET_LIMIT_COUNT = 5 -REPO_ISSUES_URL = "https://github.com/elroy-bot/elroy/issues" - -BUG_REPORT_LOG_LINES = 15 - - MODEL_SELECTION_CONFIG_PANEL = "Model Selection and Configuration" EXIT = "exit" diff --git a/elroy/tools/developer.py b/elroy/tools/developer.py index 3d1f3236..f4803b64 100644 --- a/elroy/tools/developer.py +++ b/elroy/tools/developer.py @@ -1,19 +1,14 @@ -import os import platform import sys -import urllib.parse -import webbrowser -from typing import Optional from rich.table import Table from rich.text import Text from .. import __version__ from ..config.paths import get_home_dir, get_log_file_path -from ..core.constants import BUG_REPORT_LOG_LINES, REPO_ISSUES_URL, user_only_tool +from ..core.constants import user_only_tool from ..core.ctx import ElroyContext from ..core.logging import get_logger -from ..utils.clock import utc_now logger = get_logger() @@ -129,53 +124,3 @@ def do_print_config(ctx: ElroyContext, show_secrets=False) -> Table: ) return table - - -@user_only_tool -def create_bug_report( - ctx: ElroyContext, - title: str, - description: Optional[str], -) -> None: - """ - Generate a bug report and open it as a GitHub issue. - - Args: - title: The title for the bug report - description: Detailed description of the issue - """ - # Start building the report - report = [ - f"# Bug Report: {title}", - f"\nCreated: {utc_now().isoformat()}", - "\n## Description", - description if description else "", - ] - - # Add system information - report.extend( - [ - "\n## System Information", - f"OS: {platform.system()} {platform.release()}", - f"Python: {sys.version}", - f"Elroy Version: {__version__}", - ] - ) - - report.append(f"\n## Recent Logs (last {BUG_REPORT_LOG_LINES} lines)") - try: - logs = tail_elroy_logs(BUG_REPORT_LOG_LINES) - report.append("```") - report.append(logs) - report.append("```") - except Exception as e: - report.append(f"Error fetching logs: {str(e)}") - - # Combine the report - full_report = "\n".join(report) - - github_url = None - base_url = os.path.join(REPO_ISSUES_URL, "new") - params = {"title": title, "body": full_report} - github_url = f"{base_url}?{urllib.parse.urlencode(params)}" - webbrowser.open(github_url) diff --git a/elroy/tools/tools_and_commands.py b/elroy/tools/tools_and_commands.py index cc5086a1..04078abd 100644 --- a/elroy/tools/tools_and_commands.py +++ b/elroy/tools/tools_and_commands.py @@ -61,7 +61,7 @@ set_user_full_name, set_user_preferred_name, ) -from .developer import create_bug_report, print_config, tail_elroy_logs +from .developer import print_config, tail_elroy_logs from .time import get_current_date IN_CONTEXT_MEMORY_COMMANDS: Set[Callable] = { @@ -115,7 +115,6 @@ search_memories, print_active_reminders, print_inactive_reminders, - create_bug_report, set_assistant_name, } ASSISTANT_VISIBLE_COMMANDS: Set[Callable] = {