diff options
author | Nate Sesti <sestinj@gmail.com> | 2023-06-12 21:30:49 -0700 |
---|---|---|
committer | Nate Sesti <sestinj@gmail.com> | 2023-06-12 21:30:49 -0700 |
commit | cc0d73c2c1351a08c95654f7792f56c1d3d0ab54 (patch) | |
tree | a94ed31d6024ca7faa3fb057ca5fcfd0792b393e /continuedev/src/continuedev/server | |
parent | b2cdc7edb0db303fa0e2f82bfa26729102a2f111 (diff) | |
download | sncontinue-cc0d73c2c1351a08c95654f7792f56c1d3d0ab54.tar.gz sncontinue-cc0d73c2c1351a08c95654f7792f56c1d3d0ab54.tar.bz2 sncontinue-cc0d73c2c1351a08c95654f7792f56c1d3d0ab54.zip |
slash commands dropdown!
Diffstat (limited to 'continuedev/src/continuedev/server')
-rw-r--r-- | continuedev/src/continuedev/server/gui.py | 7 | ||||
-rw-r--r-- | continuedev/src/continuedev/server/gui_protocol.py | 6 |
2 files changed, 12 insertions, 1 deletions
diff --git a/continuedev/src/continuedev/server/gui.py b/continuedev/src/continuedev/server/gui.py index e8b52004..cf046734 100644 --- a/continuedev/src/continuedev/server/gui.py +++ b/continuedev/src/continuedev/server/gui.py @@ -90,6 +90,12 @@ class GUIProtocolServer(AbstractGUIProtocolServer): "state": state }) + async def send_available_slash_commands(self): + commands = await self.session.autopilot.get_available_slash_commands() + await self._send_json("available_slash_commands", { + "commands": commands + }) + def on_main_input(self, input: str): # Do something with user input asyncio.create_task(self.session.autopilot.accept_user_input(input)) @@ -127,6 +133,7 @@ async def websocket_endpoint(websocket: WebSocket, session: Session = Depends(we protocol.websocket = websocket # Update any history that may have happened before connection + await protocol.send_available_slash_commands() await protocol.send_state_update() while AppStatus.should_exit is False: diff --git a/continuedev/src/continuedev/server/gui_protocol.py b/continuedev/src/continuedev/server/gui_protocol.py index 889c6761..d9506c6f 100644 --- a/continuedev/src/continuedev/server/gui_protocol.py +++ b/continuedev/src/continuedev/server/gui_protocol.py @@ -1,4 +1,4 @@ -from typing import Any +from typing import Any, Dict, List from abc import ABC, abstractmethod @@ -28,6 +28,10 @@ class AbstractGUIProtocolServer(ABC): """Send a state update to the client""" @abstractmethod + async def send_available_slash_commands(self, commands: List[Dict]): + """Send a list of available slash commands to the client""" + + @abstractmethod def on_retry_at_index(self, index: int): """Called when the user requests a retry at a previous index""" |