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
|
paste_match = _re.match(r'\[Pasted text #\d+: \d+ lines → (.+)\]', user_input) if isinstance(user_input, str) else None
|
||||||
if paste_match:
|
if paste_match:
|
||||||
paste_path = Path(paste_match.group(1))
|
paste_path = Path(paste_match.group(1))
|
||||||
|
_user_bar = f"[{_accent_hex()}]{'─' * 40}[/]"
|
||||||
if paste_path.exists():
|
if paste_path.exists():
|
||||||
full_text = paste_path.read_text(encoding="utf-8")
|
full_text = paste_path.read_text(encoding="utf-8")
|
||||||
line_count = full_text.count('\n') + 1
|
line_count = full_text.count('\n') + 1
|
||||||
print()
|
print()
|
||||||
|
ChatConsole().print(_user_bar)
|
||||||
ChatConsole().print(
|
ChatConsole().print(
|
||||||
f"[bold {_accent_hex()}]●[/] [bold]{_escape(f'[Pasted text: {line_count} lines]')}[/]"
|
f"[bold {_accent_hex()}]●[/] [bold]{_escape(f'[Pasted text: {line_count} lines]')}[/]"
|
||||||
)
|
)
|
||||||
user_input = full_text
|
user_input = full_text
|
||||||
else:
|
else:
|
||||||
print()
|
print()
|
||||||
|
ChatConsole().print(_user_bar)
|
||||||
ChatConsole().print(f"[bold {_accent_hex()}]●[/] [bold]{_escape(user_input)}[/]")
|
ChatConsole().print(f"[bold {_accent_hex()}]●[/] [bold]{_escape(user_input)}[/]")
|
||||||
else:
|
else:
|
||||||
|
_user_bar = f"[{_accent_hex()}]{'─' * 40}[/]"
|
||||||
if '\n' in user_input:
|
if '\n' in user_input:
|
||||||
first_line = user_input.split('\n')[0]
|
first_line = user_input.split('\n')[0]
|
||||||
line_count = user_input.count('\n') + 1
|
line_count = user_input.count('\n') + 1
|
||||||
print()
|
print()
|
||||||
|
ChatConsole().print(_user_bar)
|
||||||
ChatConsole().print(
|
ChatConsole().print(
|
||||||
f"[bold {_accent_hex()}]●[/] [bold]{_escape(first_line)}[/] "
|
f"[bold {_accent_hex()}]●[/] [bold]{_escape(first_line)}[/] "
|
||||||
f"[dim](+{line_count - 1} lines)[/]"
|
f"[dim](+{line_count - 1} lines)[/]"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
print()
|
print()
|
||||||
|
ChatConsole().print(_user_bar)
|
||||||
ChatConsole().print(f"[bold {_accent_hex()}]●[/] [bold]{_escape(user_input)}[/]")
|
ChatConsole().print(f"[bold {_accent_hex()}]●[/] [bold]{_escape(user_input)}[/]")
|
||||||
|
|
||||||
# Show image attachment count
|
# Show image attachment count
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue