fix(Library): Returns metadata back to original format so sources continue to work.
This commit is contained in:
parent
a71e4ae10d
commit
c8def1989a
5 changed files with 34 additions and 27 deletions
|
|
@ -112,7 +112,7 @@ const handleEmitterEvents = async (
|
|||
stream.on('end', () => {
|
||||
const endTime = Date.now();
|
||||
const duration = endTime - startTime;
|
||||
|
||||
|
||||
modelStats = {
|
||||
...modelStats,
|
||||
responseTime: duration,
|
||||
|
|
@ -135,9 +135,11 @@ const handleEmitterEvents = async (
|
|||
chatId: chatId,
|
||||
messageId: aiMessageId,
|
||||
role: 'assistant',
|
||||
metadata: {
|
||||
metadata: JSON.stringify({
|
||||
createdAt: new Date(),
|
||||
...(sources && sources.length > 0 && { sources }),
|
||||
modelStats: modelStats,
|
||||
},
|
||||
}),
|
||||
})
|
||||
.execute();
|
||||
});
|
||||
|
|
@ -319,7 +321,14 @@ export const POST = async (req: Request) => {
|
|||
const writer = responseStream.writable.getWriter();
|
||||
const encoder = new TextEncoder();
|
||||
|
||||
handleEmitterEvents(stream, writer, encoder, aiMessageId, message.chatId, startTime);
|
||||
handleEmitterEvents(
|
||||
stream,
|
||||
writer,
|
||||
encoder,
|
||||
aiMessageId,
|
||||
message.chatId,
|
||||
startTime,
|
||||
);
|
||||
handleHistorySave(message, humanMessageId, body.focusMode, body.files);
|
||||
|
||||
return new Response(responseStream.readable, {
|
||||
|
|
|
|||
|
|
@ -546,8 +546,7 @@ const Page = () => {
|
|||
Automatic Suggestions
|
||||
</p>
|
||||
<p className="text-xs text-black/60 dark:text-white/60 mt-0.5">
|
||||
Automatically show related suggestions after
|
||||
responses
|
||||
Automatically show related suggestions after responses
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue