ContinueStepStep
This commit is contained in:
parent
73b249132d
commit
33027dab00
3 changed files with 41 additions and 0 deletions
|
|
@ -1,5 +1,6 @@
|
|||
from typing import List, Tuple, Type
|
||||
|
||||
|
||||
from ..models.main import ContinueBaseModel
|
||||
|
||||
from ..libs.steps.ty import CreatePipelineStep
|
||||
|
|
@ -8,6 +9,7 @@ from .observation import Observation, TracebackObservation, UserInputObservation
|
|||
from ..libs.steps.main import EditHighlightedCodeStep, SolveTracebackStep, RunCodeStep
|
||||
from ..libs.steps.nate import WritePytestsStep, CreateTableStep
|
||||
from ..libs.steps.chroma import AnswerQuestionChroma, EditFileChroma
|
||||
from ..libs.steps.continue_step import ContinueStepStep
|
||||
|
||||
|
||||
class DemoPolicy(Policy):
|
||||
|
|
@ -28,6 +30,8 @@ class DemoPolicy(Policy):
|
|||
return AnswerQuestionChroma(question=" ".join(observation.user_input.split(" ")[1:]))
|
||||
elif "/edit" in observation.user_input:
|
||||
return EditFileChroma(request=" ".join(observation.user_input.split(" ")[1:]))
|
||||
elif "/step" in observation.user_input:
|
||||
return ContinueStepStep(prompt=" ".join(observation.user_input.split(" ")[1:]))
|
||||
return EditHighlightedCodeStep(user_input=observation.user_input)
|
||||
|
||||
state = history.get_current()
|
||||
|
|
|
|||
37
continuedev/src/continuedev/libs/steps/continue_step.py
Normal file
37
continuedev/src/continuedev/libs/steps/continue_step.py
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
from textwrap import dedent
|
||||
from ...models.filesystem import RangeInFile
|
||||
from .main import EditHighlightedCodeStep
|
||||
from ...core.main import Step
|
||||
from ...core.sdk import ContinueSDK
|
||||
|
||||
|
||||
class ContinueStepStep(Step):
|
||||
name: str = "Write your own Continue Step."
|
||||
prompt: str
|
||||
|
||||
async def run(self, sdk: ContinueSDK):
|
||||
await sdk.run_step(EditHighlightedCodeStep(user_input=dedent(f"""\
|
||||
Here is an example of a Step that runs a command and then edits a file.
|
||||
|
||||
```python
|
||||
from ...core.main import Step
|
||||
from ...core.sdk import ContinueSDK
|
||||
|
||||
class RunCommandAndEditFileStep(Step):
|
||||
name: str = "Run a command and then edit a file."
|
||||
command: str
|
||||
file_path: str
|
||||
prompt: str
|
||||
|
||||
async def run(self, sdk: ContinueSDK):
|
||||
await sdk.run([command])
|
||||
await sdk.edit_file(filename=self.file_path, prompt=self.prompt)
|
||||
```
|
||||
|
||||
Please edit the code to write your own Step that does the following:
|
||||
|
||||
{self.prommpt}
|
||||
|
||||
It should be a subclass of Step as above, implementing the `run` method, and using pydantic attributes to define the parameters.
|
||||
|
||||
""")))
|
||||
0
continuedev/src/continuedev/libs/steps/react_posthog.py
Normal file
0
continuedev/src/continuedev/libs/steps/react_posthog.py
Normal file
Loading…
Add table
Reference in a new issue