mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
feat(cli): enhance user input display with consistent formatting
- Added a user bar separator for improved visual clarity when displaying pasted text and user input in the HermesCLI. - Ensured consistent formatting for both multi-line and single-line user inputs, enhancing the overall user experience in the command-line interface. These changes contribute to a more organized and visually appealing output during interactions.
This commit is contained in:
parent
6d7f3dbbb7
commit
3585019831
1 changed files with 6 additions and 0 deletions
6
cli.py
6
cli.py
|
|
@ -6877,28 +6877,34 @@ class HermesCLI:
|
|||
paste_match = _re.match(r'\[Pasted text #\d+: \d+ lines → (.+)\]', user_input) if isinstance(user_input, str) else None
|
||||
if paste_match:
|
||||
paste_path = Path(paste_match.group(1))
|
||||
_user_bar = f"[{_accent_hex()}]{'─' * 40}[/]"
|
||||
if paste_path.exists():
|
||||
full_text = paste_path.read_text(encoding="utf-8")
|
||||
line_count = full_text.count('\n') + 1
|
||||
print()
|
||||
ChatConsole().print(_user_bar)
|
||||
ChatConsole().print(
|
||||
f"[bold {_accent_hex()}]●[/] [bold]{_escape(f'[Pasted text: {line_count} lines]')}[/]"
|
||||
)
|
||||
user_input = full_text
|
||||
else:
|
||||
print()
|
||||
ChatConsole().print(_user_bar)
|
||||
ChatConsole().print(f"[bold {_accent_hex()}]●[/] [bold]{_escape(user_input)}[/]")
|
||||
else:
|
||||
_user_bar = f"[{_accent_hex()}]{'─' * 40}[/]"
|
||||
if '\n' in user_input:
|
||||
first_line = user_input.split('\n')[0]
|
||||
line_count = user_input.count('\n') + 1
|
||||
print()
|
||||
ChatConsole().print(_user_bar)
|
||||
ChatConsole().print(
|
||||
f"[bold {_accent_hex()}]●[/] [bold]{_escape(first_line)}[/] "
|
||||
f"[dim](+{line_count - 1} lines)[/]"
|
||||
)
|
||||
else:
|
||||
print()
|
||||
ChatConsole().print(_user_bar)
|
||||
ChatConsole().print(f"[bold {_accent_hex()}]●[/] [bold]{_escape(user_input)}[/]")
|
||||
|
||||
# Show image attachment count
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue