Refactor dynamic prompt and layout in HermesCLI
- Updated the dynamic prompt to display the Hermes symbol when the agent is active, enhancing user feedback. - Introduced a spacer line in the layout to prevent spinner output from overlapping the input cursor, improving usability. - Adjusted the overall layout to maintain a clean interface while accommodating dynamic elements.
This commit is contained in:
parent
dfa3c6265c
commit
54cbf30c14
1 changed files with 12 additions and 4 deletions
16
cli.py
16
cli.py
|
|
@ -1562,8 +1562,8 @@ class HermesCLI:
|
||||||
self._should_exit = True
|
self._should_exit = True
|
||||||
event.app.exit()
|
event.app.exit()
|
||||||
|
|
||||||
# Dynamic prompt: changes to show agent status
|
# Dynamic prompt: shows Hermes symbol when agent is working
|
||||||
cli_ref = self # capture for closure
|
cli_ref = self
|
||||||
|
|
||||||
def get_prompt():
|
def get_prompt():
|
||||||
if cli_ref._agent_running:
|
if cli_ref._agent_running:
|
||||||
|
|
@ -1579,11 +1579,19 @@ class HermesCLI:
|
||||||
wrap_lines=False,
|
wrap_lines=False,
|
||||||
history=FileHistory(str(self._history_file)),
|
history=FileHistory(str(self._history_file)),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Spacer line above input that absorbs spinner output so it
|
||||||
|
# doesn't overlap the prompt_toolkit cursor
|
||||||
|
def get_spacer_height():
|
||||||
|
return 1 if cli_ref._agent_running else 0
|
||||||
|
|
||||||
|
spacer = Window(height=get_spacer_height)
|
||||||
|
|
||||||
# Layout: just the input area, no extra status line
|
# Layout with dynamic spacer and input at bottom
|
||||||
layout = Layout(
|
layout = Layout(
|
||||||
HSplit([
|
HSplit([
|
||||||
Window(height=0), # Spacer that expands
|
Window(height=0), # Expands to push everything to bottom
|
||||||
|
spacer,
|
||||||
input_area,
|
input_area,
|
||||||
])
|
])
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue