docs and welcome step

This commit is contained in:
Nate Sesti 2023-06-18 13:19:51 -07:00
parent c3f0b21350
commit 33b3bbed4c
2 changed files with 35 additions and 1 deletions

View file

@ -1,5 +1,7 @@
from textwrap import dedent
from typing import List, Tuple, Type
from ..steps.welcome import WelcomeStep
from .config import ContinueConfig
from ..steps.chroma import AnswerQuestionChroma, EditFileChroma, CreateCodebaseIndexChroma
from ..steps.steps_on_startup import StepsOnStartupStep
@ -26,7 +28,9 @@ class DemoPolicy(Policy):
# At the very start, run initial Steps spcecified in the config
if history.get_current() is None:
return (
MessageStep(name="Welcome to Continue!", message="Type '/' to see the list of available slash commands. If you highlight code, edits and explanations will be localized to the highlighted range. Otherwise, the currently open file is used. In both cases, the code is combined with the previous steps to construct the context.") >>
MessageStep(name="Welcome to Continue!", message=dedent("""\
Type '/' to see the list of available slash commands. If you highlight code, edits and explanations will be localized to the highlighted range. Otherwise, the currently open file is used. In both cases, the code is combined with the previous steps to construct the context.""")) >>
WelcomeStep() >>
# SetupContinueWorkspaceStep() >>
# CreateCodebaseIndexChroma() >>
StepsOnStartupStep())

View file

@ -0,0 +1,30 @@
from textwrap import dedent
from ..models.filesystem_edit import AddFile
from ..core.main import Step
from ..core.sdk import ContinueSDK, Models
import os
class WelcomeStep(Step):
name: str = "Welcome to Continue!"
hide: bool = True
async def describe(self, models: Models):
return "Welcome to Continue!"
async def run(self, sdk: ContinueSDK):
continue_dir = os.path.expanduser("~/.continue")
filepath = os.path.join(continue_dir, "calculator.py")
if os.path.exists(filepath):
return
if not os.path.exists(continue_dir):
os.mkdir(continue_dir)
await sdk.ide.applyFileSystemEdit(AddFile(filepath=filepath, content=dedent("""\
\"\"\"
Welcome to Continue! To get acquainted, delete this comment and try to use Continue for the following:
- "Write me a calculator class"
- Ask for a new method, maybe "exp" or "mod" or sqrt"
- Type /comment to write comments for the entire class
- Ask about how the class works, how to write it in another language, or anything else you can think of
\"\"\"""")))