dlt demo work

This commit is contained in:
Nate Sesti 2023-06-16 11:40:36 -07:00
parent 06910ad84e
commit e2f604767d
10 changed files with 49 additions and 27 deletions

View file

@ -113,6 +113,10 @@ class Autopilot(ContinueBaseModel):
await self.update_subscribers()
async def _run_singular_step(self, step: "Step", is_future_step: bool = False) -> Coroutine[Observation, None, None]:
# Allow config to set disallowed steps
if step.__class__.__name__ in self.continue_sdk.config.disallowed_steps:
return None
# If a parent step is deleted/cancelled, don't run this step
last_depth = self._step_depth
i = self.history.current_index

View file

@ -22,6 +22,7 @@ class ContinueConfig(BaseModel):
A pydantic class for the continue config file.
"""
steps_on_startup: Optional[Dict[str, Dict]] = {}
disallowed_steps: Optional[List[str]] = []
server_url: Optional[str] = None
allow_anonymous_telemetry: Optional[bool] = True
default_model: Literal["gpt-3.5-turbo",

View file

@ -12,9 +12,14 @@ def get_python_traceback(output: str) -> str:
def get_javascript_traceback(output: str) -> str:
lines = output.splitlines()
if len(lines) > 0:
first_line = lines[0].split(": ")
if len(lines) > 1 and len(first_line) > 0 and len(first_line[0]) > 0 and "at" in lines[1].lstrip():
return output
first_line = None
for i in range(len(lines) - 1):
segs = lines[i].split(":")
if len(segs) > 1 and segs[0] != "" and segs[1].startswith(" ") and lines[i + 1].strip().startswith("at"):
first_line = lines[i]
break
if first_line is not None:
return "\n".join(lines[lines.index(first_line):])
else:
return None

View file

@ -27,5 +27,7 @@ class CreatePipelineRecipe(Step):
await sdk.run_step(
SetupPipelineStep(api_description=text_observation.text) >>
ValidatePipelineStep() >>
RunQueryStep()
RunQueryStep() >>
MessageStep(
name="Congrats!", message="You've successfully created your first dlt pipeline! 🎉")
)

View file

@ -64,7 +64,7 @@ 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("If this service requires an API key, please add it to the `secrets.toml` file and then press `Continue`. Otherwise, type '/edit this API does not require an API key'")
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`.")
sdk.context.set("source_name", source_name)
@ -172,5 +172,5 @@ class RunQueryStep(Step):
This is a brief summary of the error followed by a suggestion on how it can be fixed:"""))
sdk.raise_exception(
title="Error while running query", message=output, with_step=MessageStep(name=f"Suggestion to solve error {AI_ASSISTED_STRING}", message=suggestion)
title="Error while running query", message=output, with_step=MessageStep(name=f"Suggestion to solve error {AI_ASSISTED_STRING}", message=suggestion + "\n\nIt is also very likely that no duckdb table was created, which can happen if the resource function did not yield any data. Please make sure that it is yielding data and then rerun this step.")
)

View file

@ -22,6 +22,7 @@ html,
body,
#root {
height: 100%;
background-color: var(--vsc-background);
}
body {

View file

@ -194,7 +194,7 @@ function GUI(props: GUIProps) {
if (topGuiDivRef.current) {
const timeout = setTimeout(() => {
window.scrollTo({
top: window.outerHeight,
top: topGuiDivRef.current!.offsetHeight,
behavior: "smooth",
});
}, 200);
@ -206,7 +206,9 @@ function GUI(props: GUIProps) {
console.log("CLIENT ON STATE UPDATE: ", client, client?.onStateUpdate);
client?.onStateUpdate((state) => {
// Scroll only if user is at very bottom of the window.
const shouldScrollToBottom = window.outerHeight - window.scrollY < 200;
const shouldScrollToBottom =
topGuiDivRef.current &&
topGuiDivRef.current?.offsetHeight - window.scrollY < 100;
setWaitingForSteps(state.active);
setHistory(state.history);
setUserInputQueue(state.user_input_queue);
@ -347,12 +349,12 @@ function GUI(props: GUIProps) {
</div>
<ComboBox
disabled={
history?.timeline.length
? history.timeline[history.current_index].step.name ===
"Waiting for user confirmation"
: false
}
// disabled={
// history?.timeline.length
// ? history.timeline[history.current_index].step.name ===
// "Waiting for user confirmation"
// : false
// }
ref={mainTextInputRef}
onEnter={(e) => {
onMainTextInput();
@ -365,6 +367,14 @@ function GUI(props: GUIProps) {
<ContinueButton onClick={onMainTextInput} />
</TopGUIDiv>
<Footer>
<HeaderButtonWithText
onClick={() => {
client?.sendClear();
}}
text="Clear History"
>
<Trash size="1.6em" />
</HeaderButtonWithText>
<a href="https://continue.dev/docs" className="no-underline">
<HeaderButtonWithText text="Continue Docs">
<BookOpen size="1.6em" />
@ -379,14 +389,6 @@ function GUI(props: GUIProps) {
>
<ChatBubbleOvalLeftEllipsis size="1.6em" />
</HeaderButtonWithText>
<HeaderButtonWithText
onClick={() => {
client?.sendClear();
}}
text="Clear History"
>
<Trash size="1.6em" />
</HeaderButtonWithText>
</Footer>
</>
);

View file

@ -59,6 +59,9 @@ export function activateExtension(
name: "Continue",
});
terminal.dispose();
if (!ideProtocolClient.continueTerminal) {
ideProtocolClient.continueTerminal = capturedTerminal;
}
});
// If any terminals are open to start, replace them
@ -77,6 +80,9 @@ export function activateExtension(
}
);
terminal.dispose();
if (!ideProtocolClient.continueTerminal) {
ideProtocolClient.continueTerminal = capturedTerminal;
}
});
extensionContext = context;

View file

@ -323,7 +323,7 @@ class IdeProtocolClient {
return rangeInFiles;
}
private continueTerminal: CapturedTerminal | undefined;
public continueTerminal: CapturedTerminal | undefined;
async runCommand(command: string) {
if (!this.continueTerminal || this.continueTerminal.isClosed()) {

View file

@ -76,7 +76,8 @@ export class CapturedTerminal {
(lines.length > 0 &&
(last_line.includes("bash-") || last_line.includes(") $ ")) &&
last_line.includes("$")) ||
(last_line.includes("]> ") && last_line.includes(") ["))
(last_line.includes("]> ") && last_line.includes(") [")) ||
(last_line.includes(" (") && last_line.includes(")>"))
);
}
@ -98,7 +99,7 @@ export class CapturedTerminal {
if (!this.hasRunCommand) {
this.hasRunCommand = true;
// Let the first bash- prompt appear and let python env be opened
await this.waitForCommandToFinish();
// await this.waitForCommandToFinish();
}
if (this.commandQueue.length === 0) {
@ -154,7 +155,7 @@ export class CapturedTerminal {
// Create the pseudo terminal
this.ptyProcess = pty.spawn(this.shellCmd, [], {
name: "xterm-256color",
cols: 160, // TODO: Get size of vscode terminal, and change with resize
cols: 250, // No way to get the size of VS Code terminal, or listen to resize, so make it just bigger than most conceivable VS Code widths
rows: 26,
cwd: getRootDir(),
env,