feat(tui): full keyboard support for config TUI and chat slash completion
Add Header/Footer with visible key hints, ctrl+right/ctrl+left tab navigation, ctrl+s save bindings for General and plugin config tabs, e/d bindings for plugin enable/disable in the Plugins tab. Extract shared _do_save() and _toggle_plugin() helpers so button and key paths share one code path. Add WordCompleter to the chat REPL so Tab completes slash commands. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@ from __future__ import annotations
|
||||
|
||||
import litellm
|
||||
from prompt_toolkit import PromptSession
|
||||
from prompt_toolkit.completion import WordCompleter
|
||||
from prompt_toolkit.history import FileHistory
|
||||
|
||||
from pyra.chat.history import ConversationHistory
|
||||
@@ -159,12 +160,15 @@ def start_chat() -> None:
|
||||
))
|
||||
|
||||
history = ConversationHistory(cfg, registry)
|
||||
session: PromptSession = PromptSession(
|
||||
history=FileHistory(str(_HISTORY_FILE)),
|
||||
multiline=False,
|
||||
)
|
||||
|
||||
plugin_slash = registry.get_slash_commands()
|
||||
all_commands = list(_STATIC_COMMANDS) + list(plugin_slash)
|
||||
session: PromptSession = PromptSession(
|
||||
history=FileHistory(str(_HISTORY_FILE)),
|
||||
completer=WordCompleter(all_commands, sentence=True),
|
||||
complete_while_typing=False,
|
||||
multiline=False,
|
||||
)
|
||||
|
||||
provider = get_provider(cfg.ai.provider_id)
|
||||
render_system(
|
||||
|
||||
Reference in New Issue
Block a user