Commit fec51342 authored by Timothy J. Baek's avatar Timothy J. Baek
Browse files

fix: filter outlet issue with many model chat

parent ef8d8429
...@@ -236,6 +236,15 @@ ...@@ -236,6 +236,15 @@
} }
}; };
const createMessagesList = (responseMessageId) => {
const message = history.messages[responseMessageId];
if (message.parentId) {
return [...createMessagesList(message.parentId), message];
} else {
return [message];
}
};
////////////////////////// //////////////////////////
// Ollama functions // Ollama functions
////////////////////////// //////////////////////////
...@@ -599,6 +608,7 @@ ...@@ -599,6 +608,7 @@
controller.abort('User: Stop Response'); controller.abort('User: Stop Response');
await cancelOllamaRequest(localStorage.token, currentRequestId); await cancelOllamaRequest(localStorage.token, currentRequestId);
} else { } else {
const messages = createMessagesList(responseMessageId);
const res = await chatCompleted(localStorage.token, { const res = await chatCompleted(localStorage.token, {
model: model, model: model,
messages: messages.map((m) => ({ messages: messages.map((m) => ({
...@@ -880,6 +890,8 @@ ...@@ -880,6 +890,8 @@
if (stopResponseFlag) { if (stopResponseFlag) {
controller.abort('User: Stop Response'); controller.abort('User: Stop Response');
} else { } else {
const messages = createMessagesList(responseMessageId);
const res = await chatCompleted(localStorage.token, { const res = await chatCompleted(localStorage.token, {
model: model, model: model,
messages: messages.map((m) => ({ messages: messages.map((m) => ({
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment