-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Make Apply Streaming Cancelable #5694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
RomneyDa
wants to merge
16
commits into
main
Choose a base branch
from
dallin/cancelable-apply
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
b072c5f
WIP: message abort controllers
RomneyDa d93d665
cancelable apply
RomneyDa 1a47f96
catch client abort errors
RomneyDa 88d2bf2
empty chat completion for custom non things
RomneyDa 7ad5587
bump fetch
RomneyDa 07313a0
bump openai-adapters
RomneyDa 8f3ee86
cleanup
RomneyDa 35958b2
use fetch package for streaming utils
RomneyDa b8b893d
merge main
RomneyDa 9d2037c
fetch updates - move tests to fetch package
RomneyDa 2d23065
fetch package updates from #5715
RomneyDa c496986
bump fetch version
RomneyDa 960990b
bump fetch for other sources
RomneyDa 05dafeb
bump openai-adapters
RomneyDa eea5e81
lockfile updates
RomneyDa 10e3ae3
fix syntax error
RomneyDa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ import { streamDiff } from "../diff/streamDiff"; | |
import { streamLines } from "../diff/util"; | ||
import { getSystemMessageWithRules } from "../llm/rules/getSystemMessageWithRules"; | ||
import { gptEditPrompt } from "../llm/templates/edit"; | ||
import { StreamAbortManager } from "../util/abortManager"; | ||
import { findLast } from "../util/findLast"; | ||
import { Telemetry } from "../util/posthog"; | ||
import { recursiveStream } from "./recursiveStream"; | ||
|
@@ -63,6 +64,7 @@ export async function* streamDiffLines({ | |
highlighted, | ||
suffix, | ||
llm, | ||
abortControllerId, | ||
input, | ||
language, | ||
onlyOneInsertion, | ||
|
@@ -73,12 +75,15 @@ export async function* streamDiffLines({ | |
highlighted: string; | ||
suffix: string; | ||
llm: ILLM; | ||
abortControllerId: string; | ||
input: string; | ||
language: string | undefined; | ||
onlyOneInsertion: boolean; | ||
overridePrompt: ChatMessage[] | undefined; | ||
rulesToInclude: RuleWithSource[] | undefined; | ||
}): AsyncGenerator<DiffLine> { | ||
const abortManager = StreamAbortManager.getInstance(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Took the singleton approach so that functional stream diff lines function (also used in vscode-only code) can have persisted abort controllers that can be cancelled with core messaging |
||
const abortController = abortManager.get(abortControllerId); | ||
void Telemetry.capture( | ||
"inlineEdit", | ||
{ | ||
|
@@ -157,7 +162,7 @@ export async function* streamDiffLines({ | |
content: highlighted, | ||
}; | ||
|
||
const completion = recursiveStream(llm, prompt, prediction); | ||
const completion = recursiveStream(llm, abortController, prompt, prediction); | ||
|
||
let lines = streamLines(completion); | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed streamDiffLinesGenerator/moved logic inline because point of it was to account for aborted message ids which wasn't being used, made ~1/2 the lines duplicate, and is now defunct