mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
Fix chat parser to process messages individually
Instead of concatenating all messages into a single text block, this change processes each message individually through the parser with appropriate role information.
This commit is contained in:
@@ -35,7 +35,7 @@
|
||||
chatWidth = resizerLeftPosition - resizerLeftOffset;
|
||||
});
|
||||
|
||||
let isResizing = false;
|
||||
let isResizing = $state(false);
|
||||
|
||||
function startResize() {
|
||||
isResizing = true;
|
||||
@@ -121,10 +121,14 @@
|
||||
convo.data.artifactId,
|
||||
convo.data.$id
|
||||
);
|
||||
const text = messages.reduce((curr, next) => {
|
||||
return curr + next.content;
|
||||
}, '');
|
||||
parser.init(text);
|
||||
|
||||
for (const message of messages) {
|
||||
const from = message.role === 'assistant' ? 'system' : 'user';
|
||||
parser.chunk(message.content, from, {
|
||||
silent: true
|
||||
});
|
||||
parser.end();
|
||||
}
|
||||
});
|
||||
|
||||
parser.on('complete', async (action) => {
|
||||
|
||||
Reference in New Issue
Block a user