diff --git a/core/llm/templates/edit.ts b/core/llm/templates/edit.ts index 717d943cb..188ff0966 100644 --- a/core/llm/templates/edit.ts +++ b/core/llm/templates/edit.ts @@ -86,7 +86,7 @@ const osModelsEditPrompt: PromptTemplate = (history, otherData) => { } // Use a different prompt when there's neither prefix nor suffix - if (otherData.prefix.trim() === "" && otherData.suffix.trim() === "") { + if (otherData.prefix?.trim() === "" && otherData.suffix?.trim() === "") { return [ { role: "user",