diff --git a/README.md b/README.md index 0974021..a957117 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ For technical details and a complete evaluation, see our arXiv paper, [_ChatDBG: > **Note** > -> ChatDBG needs to be connected to an [OpenAI account](https://openai.com/api/). _Your account will need to have a positive balance for this to work_ ([check your balance](https://platform.openai.com/account/usage)). If you have never purchased credits, you will need to purchase at least $1 in credits (if your API account was created before August 13, 2023) or $0.50 (if you have a newer API account) in order to have access to GPT-4, which ChatDBG uses. [Get a key here.](https://platform.openai.com/account/api-keys) +> ChatDBG needs to be connected to an [OpenAI account](https://openai.com/api/). _Your account will need to have a positive balance for this to work_ ([check your balance](https://platform.openai.com/account/usage)). If you have never purchased credits, you will need to purchase at least \$1 in credits (if your API account was created before August 13, 2023) or \$0.50 (if you have a newer API account) in order to have access to GPT-4, which ChatDBG uses. [Get a key here.](https://platform.openai.com/account/api-keys) > > Once you have an API key, set it as an environment variable called `OPENAI_API_KEY`. > diff --git a/pyproject.toml b/pyproject.toml index 23f0b1f..c1bd4ed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,6 +35,7 @@ classifiers = [ [project.scripts] chatdbg = "chatdbg.__main__:main" +print_chatdbg_log = "chatdbg.util.plog:main" [project.urls] "Homepage" = "https://github.com/plasma-umass/ChatDBG" diff --git a/src/chatdbg/chatdbg_pdb.py b/src/chatdbg/chatdbg_pdb.py index 47d6a0a..1ee0956 100644 --- a/src/chatdbg/chatdbg_pdb.py +++ b/src/chatdbg/chatdbg_pdb.py @@ -47,22 +47,23 @@ def load_ipython_extension(ipython): from IPython.terminal.debugger import TerminalPdb ChatDBGSuper = TerminalPdb - _user_file_prefixes = [os.getcwd(), "": return False - for prefix in _user_file_prefixes: - if file_name.startswith(prefix): - return True + for path in self._library_paths: + if os.path.commonpath([file_name, path]) == path: + return False - return False + return True def enriched_stack_trace(self, context=None): old_stdout = self.stdout diff --git a/src/chatdbg/util/printer.py b/src/chatdbg/util/printer.py index fdcee6c..051f9f2 100644 --- a/src/chatdbg/util/printer.py +++ b/src/chatdbg/util/printer.py @@ -10,7 +10,11 @@ def __init__(self, out, debugger_prompt, chat_prefix, width, stream=False): self._out = out self._debugger_prompt = debugger_prompt self._chat_prefix = chat_prefix - self._width = min(width, os.get_terminal_size().columns - len(chat_prefix)) + try: + self._width = min(width, os.get_terminal_size().columns - len(chat_prefix)) + except: + # get_terminal_size() may file in notebooks + self._width = width self._stream = stream # Call backs