🐛 fix undefined prefix, suffix and language for /edit (#1216)

This commit is contained in:
小颚虫 2024-05-04 01:15:38 +08:00 • committed by GitHub
parent 6492263fb5
commit aa2ea26bbd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -9,7 +9,7 @@ import {
} from "../../autocomplete/lineStream";
import { streamLines } from "../../diff/util";
import { stripImages } from "../../llm/countTokens";
import { dedentAndGetCommonWhitespace } from "../../util";
import { dedentAndGetCommonWhitespace, getMarkdownLanguageTagForFile } from "../../util";
import {
RangeInFileWithContents,
contextItemToRangeInFileWithContents,
@ -456,6 +456,12 @@ const EditSlashCommand: SlashCommand = {
userInput,
filePrefix: filePrefix,
fileSuffix: fileSuffix,
// Some built-in templates use these instead of the above
prefix: filePrefix,
suffix: fileSuffix,
language: getMarkdownLanguageTagForFile(rif.filepath),
systemMessage: llm.systemMessage ?? "",
// "contextItems": (await sdk.getContextItemChatMessages()).map(x => x.content || "").join("\n\n"),
},