Merge pull request #422 from devchat-ai/fix_context_error

Fix contextInfo handling in sendMessage.ts
This commit is contained in:
boob.yang 2024-01-30 17:54:03 +08:00 committed by GitHub
commit b0729ecff9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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}]`;
}
}
}