diff --git a/front/components/assistant/conversation/RetrievalAction.tsx b/front/components/assistant/conversation/RetrievalAction.tsx
index 8a93b4e0f7a4..cb3bad8d0587 100644
--- a/front/components/assistant/conversation/RetrievalAction.tsx
+++ b/front/components/assistant/conversation/RetrievalAction.tsx
@@ -1,9 +1,14 @@
import {
+ ChevronDownIcon,
+ ChevronRightIcon,
Chip,
DocumentDuplicateStrokeIcon,
+ Icon,
Spinner,
Tooltip,
} from "@dust-tt/sparkle";
+import { Transition } from "@headlessui/react";
+import { useState } from "react";
import { classNames } from "@app/lib/utils";
import {
@@ -24,65 +29,115 @@ export default function RetrievalAction({
retrievalAction: RetrievalActionType;
}) {
const { query, relativeTimeFrame } = retrievalAction.params;
+ const [docListVisible, setDocListVisible] = useState(false);
+
function shortText(text: string, maxLength = 20) {
return text.length > maxLength
? text.substring(0, maxLength) + "..."
: text;
}
+
return (
-
-
- Searching for:
-
-
-
- 1
- ? `${relativeTimeFrame.duration} ${relativeTimeFrame.unit}s`
- : `${relativeTimeFrame.unit}`)
- : "All time"
- }
- />
-
-
-
-
-
-
+ <>
+
+
Searching for:
+
+
+ 1
+ ? `${relativeTimeFrame.duration} ${relativeTimeFrame.unit}s`
+ : `${relativeTimeFrame.unit}`)
+ : "All time"
+ }
+ />
+
+
+
+
+
- {!retrievalAction.documents ? (
-
-
- Retrieving...
-
-
+
+
+ {!retrievalAction.documents ? (
+
+ ) : (
+
+ Retrieved:
+
+ )}
- ) : (
-
- Retrieved:
-
- {retrievalAction.documents.length > 0
- ? RetrievedDocumentsInfo(retrievalAction.documents)
- : "No documents found"}
-
+
+ {retrievalAction.documents && (
+
setDocListVisible(!docListVisible)}>
+
+ {retrievalAction.documents.length > 0
+ ? RetrievedDocumentsInfo(retrievalAction.documents)
+ : "No documents found"}
+
+
+
+ )}
- )}
-
+
+ {!!retrievalAction.documents?.length && (
+
+
+
+ )}
+
+
+ >
);
}
function RetrievedDocumentsInfo(documents: RetrievalDocumentType[]) {
const summary = documentsSummary(documents);
return (
- <>
-
{documents.length} results
+
+
{documents.length} results
{Object.keys(summary).map((k) => {
return (
@@ -97,7 +152,7 @@ function RetrievedDocumentsInfo(documents: RetrievalDocumentType[]) {
);
})}
- >
+
);
}