feat: enhance CLI output formatting with dynamic borders
- Added dynamic top and bottom borders to the response output in the HermesCLI, improving visual structure and readability. - Implemented width adjustments for the borders based on console size, ensuring consistent appearance across different terminal environments. - This change enhances the overall user experience by providing a clearer separation of messages in the CLI.
This commit is contained in:
parent
8e4d013154
commit
21c3e9973a
1 changed files with 10 additions and 1 deletions
11
cli.py
11
cli.py
|
|
@ -1465,6 +1465,8 @@ class HermesCLI:
|
||||||
# Add user message to history
|
# Add user message to history
|
||||||
self.conversation_history.append({"role": "user", "content": message})
|
self.conversation_history.append({"role": "user", "content": message})
|
||||||
|
|
||||||
|
w = min(self.console.width, 80)
|
||||||
|
_cprint(f"{_GOLD}{'─' * w}{_RST}")
|
||||||
print(flush=True)
|
print(flush=True)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
@ -1522,11 +1524,18 @@ class HermesCLI:
|
||||||
response = response + "\n\n---\n_[Interrupted - processing new message]_"
|
response = response + "\n\n---\n_[Interrupted - processing new message]_"
|
||||||
|
|
||||||
if response:
|
if response:
|
||||||
|
w = min(self.console.width, 80)
|
||||||
|
label = " ⚕ Hermes "
|
||||||
|
fill = w - 2 - len(label) # 2 for ╭ and ╮
|
||||||
|
top = f"╭─{label}{'─' * max(fill - 1, 0)}╮"
|
||||||
|
bot = f"╰{'─' * (w - 2)}╯"
|
||||||
|
|
||||||
print()
|
print()
|
||||||
_cprint(f"{_GOLD}⚕ Hermes{_RST}")
|
_cprint(f"{_GOLD}{top}{_RST}")
|
||||||
print()
|
print()
|
||||||
print(response)
|
print(response)
|
||||||
print()
|
print()
|
||||||
|
_cprint(f"{_GOLD}{bot}{_RST}")
|
||||||
|
|
||||||
# If we have a pending message from interrupt, re-queue it for process_loop
|
# If we have a pending message from interrupt, re-queue it for process_loop
|
||||||
# instead of recursing (avoids unbounded recursion from rapid interrupts)
|
# instead of recursing (avoids unbounded recursion from rapid interrupts)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue