Skip to content

Commit

Permalink
warning msgs
Browse files Browse the repository at this point in the history
  • Loading branch information
khlevin committed Sep 20, 2024
1 parent 2fa5818 commit 0c74c02
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/chatdbg/chatdbg_gdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,5 +281,6 @@ def llm_debug(self, command: str):
}
"""
if not chatdbg_config.unsafe and not command_is_safe(command):
self._unsafe_cmd = True
return command, f"Command `{command}` is not allowed."
return command, self._run_one_command(command)
1 change: 1 addition & 0 deletions src/chatdbg/chatdbg_lldb.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,5 +309,6 @@ def llm_debug(self, command: str):
}
"""
if not chatdbg_config.unsafe and not command_is_safe(command):
self._unsafe_cmd = True
return command, f"Command `{command}` is not allowed."
return command, self._run_one_command(command)
6 changes: 6 additions & 0 deletions src/chatdbg/native_util/dbg_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,18 @@ class DBGDialog:
def __init__(self, prompt) -> None:
self._prompt = prompt
self._history = CommandHistory(self._prompt)
self._unsafe_cmd = False

def query_and_print(self, assistant, user_text, is_followup):
prompt = self.build_prompt(user_text, is_followup)

self._history.clear()
print(assistant.query(prompt, user_text)["message"])
if self._unsafe_cmd:
self.warn(
f"Warning: One or more debugger commands were blocked as potentially unsafe.\nWarning: You can disable sanitizing with `config --unsafe` and try again at your own risk."
)
self._unsafe_cmd = False

def dialog(self, user_text):
assistant = self._make_assistant()
Expand Down

0 comments on commit 0c74c02

Please sign in to comment.