stop completion early, accept all improvements

This commit is contained in:
Nate Sesti 2023-06-27 11:03:44 -07:00
parent 96483ac8c7
commit d45ce41f64
5 changed files with 12 additions and 3 deletions

View file

@ -121,7 +121,7 @@ class Autopilot(ContinueBaseModel):
# If a parent step is deleted/cancelled, don't run this step
last_depth = self._step_depth
i = self.history.current_index
while i >= 0 and self.history.timeline[i].depth == last_depth + 1:
while i >= 0 and self.history.timeline[i].depth == last_depth - 1:
if self.history.timeline[i].deleted:
return None
last_depth = self.history.timeline[i].depth

View file

@ -207,3 +207,6 @@ class ContinueSDK(AbstractContinueSDK):
async def clear_history(self):
await self.__autopilot.clear_history()
def current_step_was_deleted(self):
return self.history.timeline[self.history.current_index].deleted

View file

@ -323,9 +323,11 @@ class DefaultModelEditCodeStep(Step):
current_block_lines.append(line)
async for chunk in model_to_use.stream_chat(prompt, with_history=await sdk.get_chat_context(), temperature=0):
# Stop early if it is repeating the file_suffix
# Stop early if it is repeating the file_suffix or the step was deleted
if repeating_file_suffix:
break
if sdk.current_step_was_deleted():
return
# Accumulate lines
chunk_lines = chunk.split("\n")

View file

@ -28,6 +28,10 @@ class SuggestionsCodeLensProvider implements vscode.CodeLensProvider {
title: "Reject ❌",
command: "continue.rejectSuggestion",
arguments: [suggestion],
}),
new vscode.CodeLens(range, {
title: "(⌘⇧↩/⌘⇧⌫ to accept/reject all)",
command: "",
})
);
}

View file

@ -246,7 +246,7 @@ function handleAllSuggestions(accept: boolean) {
if (!suggestions) return;
while (suggestions.length > 0) {
selectSuggestion(accept ? "new" : "old");
selectSuggestion(accept ? "new" : "old", suggestions[0]);
}
}