summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--continuedev/src/continuedev/core/main.py8
-rw-r--r--continuedev/src/continuedev/core/sdk.py4
-rw-r--r--continuedev/src/continuedev/libs/llm/openai.py2
-rw-r--r--continuedev/src/continuedev/recipes/CreatePipelineRecipe/steps.py4
-rw-r--r--continuedev/src/continuedev/steps/core/core.py3
5 files changed, 10 insertions, 11 deletions
diff --git a/continuedev/src/continuedev/core/main.py b/continuedev/src/continuedev/core/main.py
index 19b36a6a..3053e5a1 100644
--- a/continuedev/src/continuedev/core/main.py
+++ b/continuedev/src/continuedev/core/main.py
@@ -3,7 +3,6 @@ from typing import Callable, Coroutine, Dict, Generator, List, Literal, Tuple, U
from ..models.main import ContinueBaseModel
from pydantic import validator
-from ..libs.llm import LLM
from .observation import Observation
ChatMessageRole = Literal["assistant", "user", "system"]
@@ -21,6 +20,8 @@ class HistoryNode(ContinueBaseModel):
depth: int
def to_chat_messages(self) -> List[ChatMessage]:
+ if self.step.description is None:
+ return self.step.chat_context
return self.step.chat_context + [ChatMessage(role="assistant", content=self.step.description)]
@@ -33,10 +34,7 @@ class History(ContinueBaseModel):
msgs = []
for node in self.timeline:
if not node.step.hide:
- msgs += [
- ChatMessage(role="assistant", content=msg)
- for msg in node.to_chat_messages()
- ]
+ msgs += node.to_chat_messages()
return msgs
def add_node(self, node: HistoryNode):
diff --git a/continuedev/src/continuedev/core/sdk.py b/continuedev/src/continuedev/core/sdk.py
index 11127361..59bfc0f2 100644
--- a/continuedev/src/continuedev/core/sdk.py
+++ b/continuedev/src/continuedev/core/sdk.py
@@ -77,9 +77,9 @@ class ContinueSDK(AbstractContinueSDK):
async def wait_for_user_confirmation(self, prompt: str):
return await self.run_step(WaitForUserConfirmationStep(prompt=prompt))
- async def run(self, commands: Union[List[str], str], cwd: str = None, name: str = None, description: str = None) -> Coroutine[str, None, None]:
+ async def run(self, commands: Union[List[str], str], cwd: str = None, name: str = None, description: str = None, handle_error: bool = True) -> Coroutine[str, None, None]:
commands = commands if isinstance(commands, List) else [commands]
- return (await self.run_step(ShellCommandsStep(cmds=commands, cwd=cwd, description=description, **({'name': name} if name else {})))).text
+ return (await self.run_step(ShellCommandsStep(cmds=commands, cwd=cwd, description=description, handle_error=handle_error, **({'name': name} if name else {})))).text
async def edit_file(self, filename: str, prompt: str, name: str = None, description: str = None, range: Range = None):
filepath = await self._ensure_absolute_path(filename)
diff --git a/continuedev/src/continuedev/libs/llm/openai.py b/continuedev/src/continuedev/libs/llm/openai.py
index da8c5caf..6a537afd 100644
--- a/continuedev/src/continuedev/libs/llm/openai.py
+++ b/continuedev/src/continuedev/libs/llm/openai.py
@@ -77,7 +77,7 @@ class OpenAI(LLM):
"role": "system",
"content": self.system_message
})
- message += [msg.dict() for msg in with_history]
+ messages += [msg.dict() for msg in with_history]
messages.append({
"role": "user",
"content": prompt
diff --git a/continuedev/src/continuedev/recipes/CreatePipelineRecipe/steps.py b/continuedev/src/continuedev/recipes/CreatePipelineRecipe/steps.py
index ea40a058..e59cc51c 100644
--- a/continuedev/src/continuedev/recipes/CreatePipelineRecipe/steps.py
+++ b/continuedev/src/continuedev/recipes/CreatePipelineRecipe/steps.py
@@ -86,7 +86,7 @@ class ValidatePipelineStep(Step):
# """)))
# test that the API call works
- output = await sdk.run(f'python3 {filename}', name="Test the pipeline", description=f"Running `python3 {filename}` to test loading data from the API")
+ output = await sdk.run(f'python3 {filename}', name="Test the pipeline", description=f"Running `python3 {filename}` to test loading data from the API", handle_error=False)
# If it fails, return the error
if "Traceback" in output or "SyntaxError" in output:
@@ -157,7 +157,7 @@ class RunQueryStep(Step):
hide: bool = True
async def run(self, sdk: ContinueSDK):
- output = await sdk.run('env/bin/python3 query.py', name="Run test query", description="Running `env/bin/python3 query.py` to test that the data was loaded into DuckDB as expected")
+ output = await sdk.run('env/bin/python3 query.py', name="Run test query", description="Running `env/bin/python3 query.py` to test that the data was loaded into DuckDB as expected", handle_error=False)
if "Traceback" in output or "SyntaxError" in output:
suggestion = sdk.models.gpt35.complete(dedent(f"""\
diff --git a/continuedev/src/continuedev/steps/core/core.py b/continuedev/src/continuedev/steps/core/core.py
index 5117d479..40e992e7 100644
--- a/continuedev/src/continuedev/steps/core/core.py
+++ b/continuedev/src/continuedev/steps/core/core.py
@@ -61,6 +61,7 @@ class ShellCommandsStep(Step):
cmds: List[str]
cwd: Union[str, None] = None
name: str = "Run Shell Commands"
+ handle_error: bool = True
_err_text: Union[str, None] = None
@@ -76,7 +77,7 @@ class ShellCommandsStep(Step):
for cmd in self.cmds:
output = await sdk.ide.runCommand(cmd)
- if output is not None and output_contains_error(output):
+ if self.handle_error and output is not None and output_contains_error(output):
suggestion = sdk.models.gpt35.complete(dedent(f"""\
While running the command `{cmd}`, the following error occurred: