You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you can see after few messages older tool-result messages are not loading, on debugging I found the addToolMessageToChat isn't working properly as it kind of misses the tool-call messages or something. The issue could also be that in database the timestamp for message save is same and the ordering/ sorting doesn't work properly
The text was updated successfully, but these errors were encountered:
on further investigation it is happening because the following code in /api/chat/route.ts. In here when new Date() is being assigned, it is causing all assistant/ tool messages getting the same time stamp.
if (message.role === 'assistant') {
streamingData.appendMessageAnnotation({
messageIdFromServer: messageId,
});
}
return {
id: messageId,
chatId: id,
role: message.role,
content: message.content,
createdAt: new Date(),
};
},
),
});
} catch (error) {
console.error('Failed to save chat');
}
}`
if anyone is encountering this, you can fix it like. You can extract index in the responseMessagesWithoutIncompleteToolCalls.map const delay = index * 1000; createdAt: new Date(new Date().getTime() + delay),
As you can see after few messages older tool-result messages are not loading, on debugging I found the addToolMessageToChat isn't working properly as it kind of misses the tool-call messages or something. The issue could also be that in database the timestamp for message save is same and the ordering/ sorting doesn't work properly
The text was updated successfully, but these errors were encountered: