Spaces:
Sleeping
Sleeping
File size: 1,085 Bytes
5a864f6 0ba4268 5a864f6 a64787d 5a864f6 a64787d 5a864f6 a64787d 0ba4268 5a864f6 0ba4268 a64787d 0ba4268 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | from typing import List
from textual.widgets import Label, OptionList
from cli_textual.core.command import SlashCommand
class ModeCommand(SlashCommand):
"""Command to toggle the agent orchestration mode."""
@property
def name(self) -> str:
return "/mode"
@property
def description(self) -> str:
return "Set chat mode"
async def execute(self, app, args: List[str]):
modes = ["manager"]
if args and args[0] in modes:
app.chat_mode = args[0]
app.add_to_history(f"Chat mode set to: **{app.chat_mode}**")
app.query_one(".mode-info").update(f"mode: {app.chat_mode}")
else:
# Show selection UI
interaction = app.query_one("#interaction-container")
interaction.add_class("visible")
interaction.query("*").remove()
interaction.mount(Label("Select Chat Orchestration Mode:"))
options = OptionList(*modes, id="mode-select-list")
interaction.mount(options)
app.call_after_refresh(options.focus)
|