From fac295e722f158f13502b45b749aee30b900c7a7 Mon Sep 17 00:00:00 2001 From: Ty Dunn Date: Mon, 3 Jul 2023 21:45:17 -0700 Subject: adding config slash command --- continuedev/src/continuedev/core/config.py | 5 +++++ continuedev/src/continuedev/libs/util/step_name_to_steps.py | 2 ++ continuedev/src/continuedev/server/gui.py | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) (limited to 'continuedev/src') diff --git a/continuedev/src/continuedev/core/config.py b/continuedev/src/continuedev/core/config.py index ed5d785a..2972e4d1 100644 --- a/continuedev/src/continuedev/core/config.py +++ b/continuedev/src/continuedev/core/config.py @@ -43,6 +43,11 @@ class ContinueConfig(BaseModel): description="Reply to instructions or a question with previous steps and the highlighted code or current file as context", step_name="SimpleChatStep", ), + SlashCommand( + name="config", + description="Open the config file to create new and edit existing slash commands", + step_name="OpenConfigStep", + ), SlashCommand( name="comment", description="Write comments for the current file or highlighted code", diff --git a/continuedev/src/continuedev/libs/util/step_name_to_steps.py b/continuedev/src/continuedev/libs/util/step_name_to_steps.py index f431f317..d329e110 100644 --- a/continuedev/src/continuedev/libs/util/step_name_to_steps.py +++ b/continuedev/src/continuedev/libs/util/step_name_to_steps.py @@ -12,6 +12,7 @@ from ...recipes.DDtoBQRecipe.main import DDtoBQRecipe from ...recipes.DeployPipelineAirflowRecipe.main import DeployPipelineAirflowRecipe from ...steps.on_traceback import DefaultOnTracebackStep from ...steps.clear_history import ClearHistoryStep +from ...steps.open_config import OpenConfigStep # This mapping is used to convert from string in ContinueConfig json to corresponding Step class. # Used for example in slash_commands and steps_on_startup @@ -27,6 +28,7 @@ step_name_to_step_class = { "DeployPipelineAirflowRecipe": DeployPipelineAirflowRecipe, "DefaultOnTracebackStep": DefaultOnTracebackStep, "ClearHistoryStep": ClearHistoryStep, + "OpenConfigStep": OpenConfigStep } diff --git a/continuedev/src/continuedev/server/gui.py b/continuedev/src/continuedev/server/gui.py index 9a33fb6c..85458c09 100644 --- a/continuedev/src/continuedev/server/gui.py +++ b/continuedev/src/continuedev/server/gui.py @@ -148,7 +148,7 @@ async def websocket_endpoint(websocket: WebSocket, session: Session = Depends(we # Update any history that may have happened before connection await protocol.send_available_slash_commands() - # await protocol.send_state_update() THIS WAS CAUSING A LOT OF ISSUES. Don't uncomment. + await protocol.send_state_update() while AppStatus.should_exit is False: message = await websocket.receive_text() -- cgit v1.2.3-70-g09d2 From bbeea6ab78b14fa735962dbf4970be1230877097 Mon Sep 17 00:00:00 2001 From: Ty Dunn Date: Mon, 3 Jul 2023 21:46:01 -0700 Subject: config too --- continuedev/src/continuedev/steps/open_config.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 continuedev/src/continuedev/steps/open_config.py (limited to 'continuedev/src') diff --git a/continuedev/src/continuedev/steps/open_config.py b/continuedev/src/continuedev/steps/open_config.py new file mode 100644 index 00000000..43c1b7ce --- /dev/null +++ b/continuedev/src/continuedev/steps/open_config.py @@ -0,0 +1,13 @@ +from ..core.main import Step +from ..core.sdk import ContinueSDK +import os + + +class OpenConfigStep(Step): + name: str = "Open config" + + async def run(self, sdk: ContinueSDK): + global_dir = os.path.expanduser('~/.continue') + config_path = os.path.join(global_dir, 'config.json') + print(config_path) + await sdk.ide.setFileOpen(config_path) \ No newline at end of file -- cgit v1.2.3-70-g09d2