Skip to content

Commit

Permalink
working on markdown in llvm...
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenfreund committed Apr 8, 2024
1 parent e74f24c commit 84cfc65
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/chatdbg/assistant/assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def _batch_query(self, prompt: str, user_text):

if response_message.content:
self._broadcast(
"on_response", "(Message) " + response_message.content
"on_response", response_message.content
)

if completion.choices[0].finish_reason == "tool_calls":
Expand Down Expand Up @@ -268,7 +268,7 @@ def _streamed_query(self, prompt: str, user_text):

if response_message.content != None:
self._broadcast(
"on_response", "(Message) " + response_message.content
"on_response", response_message.content
)

if completion.choices[0].finish_reason == "tool_calls":
Expand Down
2 changes: 1 addition & 1 deletion src/chatdbg/chatdbg_lldb.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

def __lldb_init_module(debugger: lldb.SBDebugger, internal_dict: dict) -> None:
debugger.HandleCommand(f"settings set prompt '{PROMPT}'")
chatdbg_config.format = "text"
# chatdbg_config.format = "text"


def code(command):
Expand Down
17 changes: 15 additions & 2 deletions src/chatdbg/util/markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@
}
)

_simple_box = Box = box.Box(
" \n"
" \n"
" \n"
" \n"
" \n"
" \n"
" \n"
" \n",
ascii=True
)


class ChatDBGMarkdownPrinter(BaseAssistantListener):

def __init__(
Expand Down Expand Up @@ -68,8 +81,8 @@ def _print(self, renderable, end=""):

def _wrap_in_panel(self, rich_element):

left_panel = Panel("", box=box.MINIMAL, style="on default")
right_panel = Panel(rich_element, box=box.MINIMAL, style="black on light_steel_blue1")
left_panel = Panel("", box=_simple_box, style="on default")
right_panel = Panel(rich_element, box=_simple_box, style="black on light_steel_blue1")

# Create a table to hold the panels side by side
table = Table.grid(padding=0)
Expand Down
1 change: 1 addition & 0 deletions src/chatdbg/util/printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def on_end_stream(self):

def on_response(self, text):
if self._at_start and text != None:
text = "(Message) " + text
text = word_wrap_except_code_blocks(
text, self._width - len(self._chat_prefix)
)
Expand Down

0 comments on commit 84cfc65

Please sign in to comment.