API support for Chat to have citations (#569)

This commit is contained in:
Yuhong Sun
2023-10-13 17:38:25 -07:00
committed by GitHub
parent f0337d2eba
commit af510cc965
13 changed files with 127 additions and 63 deletions

View File

@@ -149,11 +149,9 @@ export const searchRequestStreamed = async ({
// These all come together
if (Object.hasOwn(chunk, "top_documents")) {
const topDocuments = chunk.top_documents as any[] | null;
const topDocuments = chunk.top_documents as DanswerDocument[] | null;
if (topDocuments) {
relevantDocuments = topDocuments.map(
(doc) => JSON.parse(doc) as DanswerDocument
);
relevantDocuments = topDocuments;
updateDocs(relevantDocuments);
}