Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bracesproul committed Oct 17, 2024
1 parent 950268b commit 7bd96a7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion frontend/app/components/GeneratingQuestionsToolUI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const useGeneratingQuestionsUI = () =>
<p className="text-xl">Research Plan & Sources</p>
</span>
<div className="mb-10">
<div className="flex flex-wrap items-center justify-start gap-2">
<div className="flex flex-wrap items-start justify-start gap-2">
{(input.args.questions as Question[]).map(
(question, questionIndex) => (
<QuestionCard
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/components/Primitives.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const MyThreadScrollToBottom: FC = () => {
<TooltipIconButton
tooltip="Scroll to bottom"
variant="outline"
className="absolute top-4 left-1/2 transform -translate-x-1/2 rounded-full disabled:invisible bg-white bg-opacity-75"
className="absolute bottom-4 left-1/2 transform -translate-x-1/2 rounded-full disabled:invisible bg-white bg-opacity-75"
>
<ArrowDownIcon className="text-gray-600 hover:text-gray-800 transition-colors ease-in-out" />
</TooltipIconButton>
Expand Down
22 changes: 18 additions & 4 deletions frontend/app/components/SelectedDocumentsToolUI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div className="flex flex-col mb-4">
Expand Down Expand Up @@ -73,7 +87,7 @@ export const useSelectedDocumentsUI = () =>
All Selected Documents
</h2>
<div className="flex flex-wrap gap-2">
{documents.map((document, docIndex) => (
{uniqueDocuments.map((document, docIndex) => (
<DocumentDialog
key={`all-documents-${docIndex}`}
document={document}
Expand Down

0 comments on commit 7bd96a7

Please sign in to comment.