Skip to content

Commit

Permalink
🐛 fix continuedev#1237
Browse files Browse the repository at this point in the history
  • Loading branch information
5eqn committed May 6, 2024
1 parent 3c954dd commit ae180c6
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions core/commands/slash/edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import {
} from "../../autocomplete/lineStream";
import { streamLines } from "../../diff/util";
import { stripImages } from "../../llm/countTokens";
import { dedentAndGetCommonWhitespace, getMarkdownLanguageTagForFile } from "../../util";
import {
dedentAndGetCommonWhitespace,
getMarkdownLanguageTagForFile,
} from "../../util";
import {
RangeInFileWithContents,
contextItemToRangeInFileWithContents,
Expand Down Expand Up @@ -231,14 +234,7 @@ const EditSlashCommand: SlashCommand = {
}

// Strip unecessary parts of the input (the fact that you have to do this is suboptimal, should be refactored away)
let content = history[history.length - 1].content;
if (typeof content !== "string") {
content.forEach((part) => {
if (part.text && part.text.startsWith("/edit")) {
part.text = part.text.replace("/edit", "").trimStart();
}
});
}
let content = input.replace("/edit", "").trimStart();
let userInput = stripImages(content).replace(
`\`\`\`${contextItemToEdit.name}\n${contextItemToEdit.content}\n\`\`\`\n`,
"",
Expand Down

0 comments on commit ae180c6

Please sign in to comment.