summaryrefslogtreecommitdiff
path: root/continuedev/src/continuedev/server
diff options
context:
space:
mode:
authorNate Sesti <sestinj@gmail.com>2023-06-12 21:30:49 -0700
committerNate Sesti <sestinj@gmail.com>2023-06-12 21:30:49 -0700
commitf48854157efed4275ecc23152a7e3027fec9105c (patch)
tree9dfc45c8b420a5737ca1fb40d4c8253cfa092c58 /continuedev/src/continuedev/server
parentccbf9d5c66d5a255d1cfeaee6b07df92186baa61 (diff)
downloadsncontinue-f48854157efed4275ecc23152a7e3027fec9105c.tar.gz
sncontinue-f48854157efed4275ecc23152a7e3027fec9105c.tar.bz2
sncontinue-f48854157efed4275ecc23152a7e3027fec9105c.zip
slash commands dropdown!
Diffstat (limited to 'continuedev/src/continuedev/server')
-rw-r--r--continuedev/src/continuedev/server/gui.py7
-rw-r--r--continuedev/src/continuedev/server/gui_protocol.py6
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"""