Skip to content

Commit 3f577fc

Browse files
author
mmiscool
committed
build: Fix bug related to file contents not being added to messages to be passed to LLM
1 parent 8ed3886 commit 3f577fc

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

src/llmCall.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,21 +66,26 @@ export async function callLLM(inputMessages) {
6666
const llmToUse = await readSetting(`llmConfig/ai-service.txt`);
6767

6868

69-
const messages = inputMessages.map((message) => {
69+
70+
71+
// for each message in the array, check if it is a file path and if it is read the file and add the content to the messages array
72+
for (let i = 0; i < inputMessages.length; i++) {
73+
if (inputMessages[i].filePath) {
74+
console.log('file type message description:', inputMessages[i].description);
75+
inputMessages[i].content = inputMessages[i].description + "\n\n" + await readFile(inputMessages[i].filePath);
76+
}
77+
}
78+
79+
80+
const messages = await inputMessages.map((message) => {
7081
return {
7182
role: message.role,
7283
content: message.content
7384
};
7485
});
7586

76-
// for each message in the array, check if it is a file path and if it is read the file and add the content to the messages array
77-
for (let i = 0; i < messages.length; i++) {
78-
if (messages[i].filePath) {
79-
console.log('file type message description:', messages[i].description);
80-
messages[i].content = messages[i].description + "\n\n" + await readFile(messages[i].filePath);
81-
}
82-
}
83-
console.log('messages:', messages);
87+
88+
//console.log('messages:', messages);
8489

8590

8691
let response = '';

0 commit comments

Comments
 (0)