🐛 add skipLines

This commit is contained in:
Nate Sesti 2024-04-29 00:09:47 -07:00
parent 80bc83b878
commit a7236e3320
2 changed files with 12 additions and 0 deletions

View file

@ -81,6 +81,16 @@ export async function* stopAtLines(stream: LineStream): LineStream {
}
}
const LINES_TO_SKIP = ["</START EDITING HERE>"];
export async function* skipLines(stream: LineStream): LineStream {
for await (const line of stream) {
if (!LINES_TO_SKIP.some((skipAt) => line.startsWith(skipAt))) {
yield line;
}
}
}
function shouldRemoveLineBeforeStart(line: string): boolean {
return (
line.trimStart().startsWith("```") ||

View file

@ -4,6 +4,7 @@ import {
filterEnglishLinesAtEnd,
filterEnglishLinesAtStart,
filterLeadingAndTrailingNewLineInsertion,
skipLines,
stopAtLines,
} from "../autocomplete/lineStream";
import { streamDiff } from "../diff/streamDiff";
@ -90,6 +91,7 @@ export async function* streamDiffLines(
lines = filterEnglishLinesAtStart(lines);
lines = filterCodeBlockLines(lines);
lines = stopAtLines(lines);
lines = skipLines(lines);
if (inept) {
// lines = fixCodeLlamaFirstLineIndentation(lines);
lines = filterEnglishLinesAtEnd(lines);