Fix contextInfo handling in sendMessage.ts

This commit is contained in:
bobo.yang 2024-01-30 17:51:02 +08:00
parent 4acd769ee6
commit 165fafa7ba

View File

@ -35,6 +35,7 @@ export function deleteTempFiles(fileName: string): void {
function writeContextInfoToTempFiles(message : any) : string[] {
let tempFiles: string[] = [];
message.old_text = message.old_text || message.text;
message.text = message.old_text
// Handle the contextInfo field in the message
if (Array.isArray(message.contextInfo)) {
@ -53,7 +54,7 @@ function writeContextInfoToTempFiles(message : any) : string[] {
}
}
// Insert the file name into the text field
message.text = message.old_text + ` [context|${context.file}]`;
message.text = message.text + ` [context|${context.file}]`;
}
}
}