summaryrefslogtreecommitdiff
path: root/continuedev
diff options
context:
space:
mode:
Diffstat (limited to 'continuedev')
-rw-r--r--continuedev/src/continuedev/core/autopilot.py11
-rw-r--r--continuedev/src/continuedev/core/config.py6
-rw-r--r--continuedev/src/continuedev/core/main.py5
-rw-r--r--continuedev/src/continuedev/server/gui.py9
-rw-r--r--continuedev/src/continuedev/steps/chat.py4
-rw-r--r--continuedev/src/continuedev/steps/core/core.py4
6 files changed, 24 insertions, 15 deletions
diff --git a/continuedev/src/continuedev/core/autopilot.py b/continuedev/src/continuedev/core/autopilot.py
index 1a77ca64..b3b98b8b 100644
--- a/continuedev/src/continuedev/core/autopilot.py
+++ b/continuedev/src/continuedev/core/autopilot.py
@@ -66,11 +66,16 @@ class Autopilot(ContinueBaseModel):
active=self._active,
user_input_queue=self._main_user_input_queue,
default_model=self.continue_sdk.config.default_model,
- highlighted_ranges=self._highlighted_ranges
+ highlighted_ranges=self._highlighted_ranges,
+ slash_commands=self.get_available_slash_commands()
)
- async def get_available_slash_commands(self) -> List[Dict]:
- return list(map(lambda x: {"name": x.name, "description": x.description}, self.continue_sdk.config.slash_commands)) or []
+ def get_available_slash_commands(self) -> List[Dict]:
+ custom_commands = list(map(lambda x: {
+ "name": x.name, "description": x.prompt}, self.continue_sdk.config.custom_commands)) or []
+ slash_commands = list(map(lambda x: {
+ "name": x.name, "description": x.description}, self.continue_sdk.config.slash_commands)) or []
+ return custom_commands + slash_commands
async def change_default_model(self, model: str):
self.continue_sdk.update_default_model(model)
diff --git a/continuedev/src/continuedev/core/config.py b/continuedev/src/continuedev/core/config.py
index ed5d785a..d268d247 100644
--- a/continuedev/src/continuedev/core/config.py
+++ b/continuedev/src/continuedev/core/config.py
@@ -12,6 +12,11 @@ class SlashCommand(BaseModel):
params: Optional[Dict] = {}
+class CustomCommand(BaseModel):
+ name: str
+ prompt: str
+
+
class OnTracebackSteps(BaseModel):
step_name: str
params: Optional[Dict] = {}
@@ -27,6 +32,7 @@ class ContinueConfig(BaseModel):
allow_anonymous_telemetry: Optional[bool] = True
default_model: Literal["gpt-3.5-turbo", "gpt-3.5-turbo-16k",
"gpt-4"] = 'gpt-4'
+ custom_commands: Optional[List[CustomCommand]] = []
slash_commands: Optional[List[SlashCommand]] = [
# SlashCommand(
# name="pytest",
diff --git a/continuedev/src/continuedev/core/main.py b/continuedev/src/continuedev/core/main.py
index 7dff6f53..9a6617f4 100644
--- a/continuedev/src/continuedev/core/main.py
+++ b/continuedev/src/continuedev/core/main.py
@@ -196,6 +196,10 @@ class History(ContinueBaseModel):
return cls(timeline=[], current_index=-1)
+class SlashCommandDescription(ContinueBaseModel):
+ name: str
+ description: str
+
class FullState(ContinueBaseModel):
"""A full state of the program, including the history"""
history: History
@@ -203,6 +207,7 @@ class FullState(ContinueBaseModel):
user_input_queue: List[str]
default_model: str
highlighted_ranges: List[RangeInFileWithContents]
+ slash_commands: List[SlashCommandDescription]
class ContinueSDK:
diff --git a/continuedev/src/continuedev/server/gui.py b/continuedev/src/continuedev/server/gui.py
index 9a33fb6c..b2f23bac 100644
--- a/continuedev/src/continuedev/server/gui.py
+++ b/continuedev/src/continuedev/server/gui.py
@@ -94,12 +94,6 @@ 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))
@@ -147,8 +141,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() 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()
diff --git a/continuedev/src/continuedev/steps/chat.py b/continuedev/src/continuedev/steps/chat.py
index 013cb578..49dd98e4 100644
--- a/continuedev/src/continuedev/steps/chat.py
+++ b/continuedev/src/continuedev/steps/chat.py
@@ -22,9 +22,9 @@ class SimpleChatStep(Step):
user_input: str
name: str = "Chat"
manage_own_chat_context: bool = True
+ description: str = ""
async def run(self, sdk: ContinueSDK):
- self.description = f"`{self.user_input}`\n\n"
if self.user_input.strip() == "":
self.user_input = "Explain this code's function is a concise list of markdown bullets."
self.description = ""
@@ -148,9 +148,9 @@ class ChatWithFunctions(Step):
DeleteFileStep(filename=""), RunTerminalCommandStep(command="")]
name: str = "Input"
manage_own_chat_context: bool = True
+ description: str = ""
async def run(self, sdk: ContinueSDK):
- self.description = f"```{self.user_input}```"
await sdk.update_ui()
step_name_step_class_map = {
diff --git a/continuedev/src/continuedev/steps/core/core.py b/continuedev/src/continuedev/steps/core/core.py
index 4eb2445c..4ad47689 100644
--- a/continuedev/src/continuedev/steps/core/core.py
+++ b/continuedev/src/continuedev/steps/core/core.py
@@ -116,6 +116,7 @@ class DefaultModelEditCodeStep(Step):
range_in_files: List[RangeInFile]
name: str = "Editing Code"
hide = False
+ description: str = ""
_prompt: str = dedent("""\
Take the file prefix and suffix into account, but only rewrite the code_to_edit as specified in the user_request. The code you write in modified_code_to_edit will replace the code between the code_to_edit tags. Do NOT preface your answer or write anything other than code. The </modified_code_to_edit> tag should be written to indicate the end of the modified code section. Do not ever use nested tags.
@@ -508,7 +509,6 @@ class DefaultModelEditCodeStep(Step):
self._prompt_and_completion += prompt + completion
async def run(self, sdk: ContinueSDK) -> Coroutine[Observation, None, None]:
- self.description = f"`{self.user_input}`"
await sdk.update_ui()
rif_with_contents = []
@@ -589,7 +589,7 @@ class ManualEditStep(ReversibleStep):
class UserInputStep(Step):
user_input: str
name: str = "User Input"
- hide: bool = True
+ hide: bool = False
manage_own_chat_context: bool = True