diff --git a/frontend/app/components/GeneratingQuestionsToolUI.tsx b/frontend/app/components/GeneratingQuestionsToolUI.tsx index 28506ca7..aff73dec 100644 --- a/frontend/app/components/GeneratingQuestionsToolUI.tsx +++ b/frontend/app/components/GeneratingQuestionsToolUI.tsx @@ -71,7 +71,7 @@ export const useGeneratingQuestionsUI = () =>

Research Plan & Sources

-
+
{(input.args.questions as Question[]).map( (question, questionIndex) => ( { diff --git a/frontend/app/components/SelectedDocumentsToolUI.tsx b/frontend/app/components/SelectedDocumentsToolUI.tsx index 21128322..5915d203 100644 --- a/frontend/app/components/SelectedDocumentsToolUI.tsx +++ b/frontend/app/components/SelectedDocumentsToolUI.tsx @@ -39,9 +39,23 @@ export const useSelectedDocumentsUI = () => return null; } - const documents = input.args.documents as Document[]; - const displayedDocuments = documents.slice(0, 3); - const remainingDocuments = documents.slice(3); + // Filter out duplicate documents + const uniqueDocuments = (input.args.documents as Document[]).reduce( + (acc, current) => { + const x = acc.find( + (item) => item.page_content === current.page_content, + ); + if (!x) { + return acc.concat([current]); + } else { + return acc; + } + }, + [] as Document[], + ); + + const displayedDocuments = uniqueDocuments.slice(0, 3); + const remainingDocuments = uniqueDocuments.slice(3); return (
@@ -73,7 +87,7 @@ export const useSelectedDocumentsUI = () => All Selected Documents
- {documents.map((document, docIndex) => ( + {uniqueDocuments.map((document, docIndex) => (