Context for chat is retained
This commit is contained in:
parent
eea1f255cd
commit
c1d4cd7578
|
@ -22,6 +22,7 @@
|
||||||
let generatedImagePath = '';
|
let generatedImagePath = '';
|
||||||
let fileTree = '';
|
let fileTree = '';
|
||||||
let fileContents = '';
|
let fileContents = '';
|
||||||
|
let context = '';
|
||||||
|
|
||||||
let urlInput = '';
|
let urlInput = '';
|
||||||
let urlContent = '';
|
let urlContent = '';
|
||||||
|
@ -41,6 +42,7 @@
|
||||||
ipcRenderer.on('response-chunk', (event, chunk) => {
|
ipcRenderer.on('response-chunk', (event, chunk) => {
|
||||||
currentStreamingMessage += chunk;
|
currentStreamingMessage += chunk;
|
||||||
messages = [...messages.slice(0, -1), { content: currentStreamingMessage, sender: 'ai' }];
|
messages = [...messages.slice(0, -1), { content: currentStreamingMessage, sender: 'ai' }];
|
||||||
|
context += chunk; // Move this line here
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcRenderer.on('response-end', () => {
|
ipcRenderer.on('response-end', () => {
|
||||||
|
@ -156,6 +158,7 @@
|
||||||
{ content: userMessage, sender: 'user' },
|
{ content: userMessage, sender: 'user' },
|
||||||
{ content: '', sender: 'ai' }
|
{ content: '', sender: 'ai' }
|
||||||
];
|
];
|
||||||
|
context += `User: ${newMessage}\n`; // Add this line here
|
||||||
const promptToSend = newMessage;
|
const promptToSend = newMessage;
|
||||||
newMessage = '';
|
newMessage = '';
|
||||||
const imagePathToSend = imagePath;
|
const imagePathToSend = imagePath;
|
||||||
|
@ -170,7 +173,7 @@
|
||||||
model: selectedModel,
|
model: selectedModel,
|
||||||
temperature,
|
temperature,
|
||||||
maxTokens,
|
maxTokens,
|
||||||
context: urlContent,
|
context: `${context}${urlContent}\n\nFile Tree:\n${fileTree}\n\nFile Contents:\n${fileContents}`,
|
||||||
fileTree,
|
fileTree,
|
||||||
fileContents
|
fileContents
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user