mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-11-18 20:20:11 +01:00
appeded metaData object to chatHisory array
This commit is contained in:
parent
3cb8a80e8d
commit
25662abeaf
@ -19,9 +19,20 @@ export default function WorkspaceChat({ loading, workspace }) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const chatHistory = threadSlug
|
let chatHistory = threadSlug
|
||||||
? await Workspace.threads.chatHistory(workspace.slug, threadSlug)
|
? await Workspace.threads.chatHistory(workspace.slug, threadSlug)
|
||||||
: await Workspace.chatHistory(workspace.slug);
|
: await Workspace.chatHistory(workspace.slug);
|
||||||
|
|
||||||
|
// TODO: add conditional if dynamic input is enabled in the workspace by default is false
|
||||||
|
// Append metadata to the chat history
|
||||||
|
chatHistory = chatHistory.map((message) => {
|
||||||
|
if (message.role === "assistant") {
|
||||||
|
const { remainingText, metaData } = extractMetaData(message.content);
|
||||||
|
return { ...message, content: remainingText, metaData };
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
});
|
||||||
|
|
||||||
setHistory(chatHistory);
|
setHistory(chatHistory);
|
||||||
setLoadingHistory(false);
|
setLoadingHistory(false);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user