summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNate Sesti <sestinj@gmail.com>2023-06-01 19:03:10 -0400
committerNate Sesti <sestinj@gmail.com>2023-06-01 19:03:10 -0400
commit5ce90853586fcfaa7d795e2593aaaecce4bbed49 (patch)
treea685864b14c00a113bb3cfc4ed708ed6e4f7b3d3
parentda4647f2788a7b6d1e3b6ec76665052210311385 (diff)
downloadsncontinue-5ce90853586fcfaa7d795e2593aaaecce4bbed49.tar.gz
sncontinue-5ce90853586fcfaa7d795e2593aaaecce4bbed49.tar.bz2
sncontinue-5ce90853586fcfaa7d795e2593aaaecce4bbed49.zip
polishing dlt recipe
-rw-r--r--continuedev/src/continuedev/core/agent.py13
-rw-r--r--continuedev/src/continuedev/libs/steps/core/core.py3
-rw-r--r--continuedev/src/continuedev/libs/steps/draft/dlt.py24
-rw-r--r--continuedev/src/continuedev/libs/steps/main.py1
-rw-r--r--extension/react-app/src/components/StepContainer.tsx2
-rw-r--r--extension/react-app/src/components/index.ts2
-rw-r--r--extension/src/activation/environmentSetup.ts6
7 files changed, 40 insertions, 11 deletions
diff --git a/continuedev/src/continuedev/core/agent.py b/continuedev/src/continuedev/core/agent.py
index 0dba6122..cf5c9781 100644
--- a/continuedev/src/continuedev/core/agent.py
+++ b/continuedev/src/continuedev/core/agent.py
@@ -10,6 +10,7 @@ from ..models.main import ContinueBaseModel
from .main import Policy, History, FullState, Step, HistoryNode
from ..libs.steps.core.core import ReversibleStep, ManualEditStep, UserInputStep
from .sdk import ContinueSDK
+import asyncio
class Agent(ContinueBaseModel):
@@ -88,6 +89,9 @@ class Agent(ContinueBaseModel):
self.history.add_node(HistoryNode(
step=step, observation=None, depth=self._step_depth))
+ # Call all subscribed callbacks
+ await self.update_subscribers()
+
# Run step
self._step_depth += 1
observation = await step(ContinueSDK(self))
@@ -98,10 +102,11 @@ class Agent(ContinueBaseModel):
self._step_depth, include_current=True).observation = observation
# Update its description
- step._set_description(await step.describe(ContinueSDK(self).models))
-
- # Call all subscribed callbacks
- await self.update_subscribers()
+ async def update_description():
+ step._set_description(await step.describe(ContinueSDK(self).models))
+ # Update subscribers with new description
+ await self.update_subscribers()
+ asyncio.create_task(update_description())
return observation
diff --git a/continuedev/src/continuedev/libs/steps/core/core.py b/continuedev/src/continuedev/libs/steps/core/core.py
index 1761cbfd..9a5d54f0 100644
--- a/continuedev/src/continuedev/libs/steps/core/core.py
+++ b/continuedev/src/continuedev/libs/steps/core/core.py
@@ -44,7 +44,8 @@ class ShellCommandsStep(Step):
name: str = "Run Shell Commands"
async def describe(self, models: Models) -> Coroutine[str, None, None]:
- return "\n".join(self.cmds)
+ cmds_str = "\n".join(self.cmds)
+ return (await models.gpt35()).complete(f"{cmds_str}\n\nSummarize what was done in these shell commands, using markdown bullet points:")
async def run(self, sdk: ContinueSDK) -> Coroutine[Observation, None, None]:
cwd = await sdk.ide.getWorkspaceDirectory() if self.cwd is None else self.cwd
diff --git a/continuedev/src/continuedev/libs/steps/draft/dlt.py b/continuedev/src/continuedev/libs/steps/draft/dlt.py
index 94ca2323..73762327 100644
--- a/continuedev/src/continuedev/libs/steps/draft/dlt.py
+++ b/continuedev/src/continuedev/libs/steps/draft/dlt.py
@@ -1,16 +1,27 @@
from textwrap import dedent
+from ....core.sdk import Models
+
from ....core.observation import DictObservation
from ....models.filesystem_edit import AddFile
from ....core.main import Step
from ....core.sdk import ContinueSDK
from ..core.core import WaitForUserInputStep
+from ..main import MessageStep
class SetupPipelineStep(Step):
+ hide: bool = True
+ name: str = "Setup dlt Pipeline"
api_description: str # e.g. "I want to load data from the weatherapi.com API"
+ async def describe(self, models: Models):
+ return dedent(f"""\
+ This step will create a new dlt pipeline that loads data from an API, as per your request:
+ {self.api_description}
+ """)
+
async def run(self, sdk: ContinueSDK):
source_name = (await sdk.models.gpt35()).complete(
f"Write a snake_case name for the data source described by {self.api_description}: ").strip()
@@ -34,12 +45,11 @@ class SetupPipelineStep(Step):
# wait for user to put API key in secrets.toml
await sdk.ide.setFileOpen(await sdk.ide.getWorkspaceDirectory() + "/.dlt/secrets.toml")
- await sdk.wait_for_user_confirmation("Please add the API key to the `secrets.toml` file and then press `Continue`")
+ await sdk.wait_for_user_confirmation("If this service requires an API key, please add it to the `secrets.toml` file and then press `Continue`")
return DictObservation(values={"source_name": source_name})
class ValidatePipelineStep(Step):
-
async def run(self, sdk: ContinueSDK):
source_name = sdk.history.last_observation().values["source_name"]
filename = f'{source_name}.py'
@@ -77,9 +87,19 @@ class ValidatePipelineStep(Step):
class CreatePipelineStep(Step):
+ hide: bool = True
async def run(self, sdk: ContinueSDK):
await sdk.run_step(
+ MessageStep(message=dedent("""\
+ This recipe will walk you through the process of creating a dlt pipeline for your chosen data source. With the help of Continue, you will:
+ - Create a Python virtual environment with dlt installed
+ - Run `dlt init` to generate a pipeline template
+ - Write the code to call the API
+ - Add any required API keys to the `secrets.toml` file
+ - Test that the API call works
+ - Load the data into a local DuckDB instance
+ - Write a query to view the data""")) >>
WaitForUserInputStep(prompt="What API do you want to load data from?") >>
SetupPipelineStep(api_description="WeatherAPI.com API") >>
ValidatePipelineStep()
diff --git a/continuedev/src/continuedev/libs/steps/main.py b/continuedev/src/continuedev/libs/steps/main.py
index 6a7f14c7..c70d5c2c 100644
--- a/continuedev/src/continuedev/libs/steps/main.py
+++ b/continuedev/src/continuedev/libs/steps/main.py
@@ -334,6 +334,7 @@ class SolveTracebackStep(Step):
class MessageStep(Step):
+ name: str = "Message"
message: str
async def describe(self, models: Models) -> Coroutine[str, None, None]:
diff --git a/extension/react-app/src/components/StepContainer.tsx b/extension/react-app/src/components/StepContainer.tsx
index 36b3d99a..ec601ea7 100644
--- a/extension/react-app/src/components/StepContainer.tsx
+++ b/extension/react-app/src/components/StepContainer.tsx
@@ -36,6 +36,8 @@ const MainDiv = styled.div<{ stepDepth: number; inFuture: boolean }>`
animation: ${appear} 0.3s ease-in-out;
/* padding-left: ${(props) => props.stepDepth * 20}px; */
overflow: hidden;
+ margin-left: 0px;
+ margin-right: 0px;
`;
const StepContainerDiv = styled.div<{ open: boolean }>`
diff --git a/extension/react-app/src/components/index.ts b/extension/react-app/src/components/index.ts
index e37c97f3..7ba60467 100644
--- a/extension/react-app/src/components/index.ts
+++ b/extension/react-app/src/components/index.ts
@@ -45,7 +45,7 @@ export const Pre = styled.pre`
border-radius: ${defaultBorderRadius};
padding: 8px;
max-height: 150px;
- overflow: scroll;
+ overflow-y: scroll;
margin: 0;
background-color: ${secondaryDark};
border: none;
diff --git a/extension/src/activation/environmentSetup.ts b/extension/src/activation/environmentSetup.ts
index 419d32ed..170426e1 100644
--- a/extension/src/activation/environmentSetup.ts
+++ b/extension/src/activation/environmentSetup.ts
@@ -66,11 +66,11 @@ function checkEnvExists() {
getExtensionUri().fsPath,
"scripts",
"env",
- "bin"
+ process.platform == "win32" ? "Scripts" : "bin"
);
return (
- fs.existsSync(envBinPath + "/activate") &&
- fs.existsSync(envBinPath + "/pip")
+ fs.existsSync(path.join(envBinPath, "activate")) &&
+ fs.existsSync(path.join(envBinPath, "pip"))
);
}