From f88e5eed5092a5f5ce6e96a5576a2a02653059f9 Mon Sep 17 00:00:00 2001 From: Lucas Date: Fri, 6 Dec 2024 17:44:39 +0100 Subject: [PATCH] Fixed link, reordered feedbacks --- .../components/assistant/AssistantDetails.tsx | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/front/components/assistant/AssistantDetails.tsx b/front/components/assistant/AssistantDetails.tsx index cf3db700d00b..962c58f59e8b 100644 --- a/front/components/assistant/AssistantDetails.tsx +++ b/front/components/assistant/AssistantDetails.tsx @@ -20,7 +20,7 @@ import type { WorkspaceType, } from "@dust-tt/types"; import { ExternalLinkIcon } from "lucide-react"; -import { useCallback, useState } from "react"; +import { useCallback, useMemo, useState } from "react"; import { AssistantDetailsButtonBar } from "@app/components/assistant/AssistantDetailsButtonBar"; import { AssistantActionsSection } from "@app/components/assistant/details/AssistantActionsSection"; @@ -174,6 +174,16 @@ export function AssistantDetails({ agentConfigurationId: assistantId ?? "", }); + const sortedFeedbacks = useMemo(() => { + if (!agentConfigurationFeedbacks) { + return null; + } + return agentConfigurationFeedbacks.sort( + (a, b) => + new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime() + ); + }, [agentConfigurationFeedbacks]); + const { agentConfigurationHistory, isAgentConfigurationHistoryLoading } = useAgentConfigurationHistory({ workspaceId: owner.sId, @@ -186,9 +196,7 @@ export function AssistantDetails({ ) : (
- {!agentConfigurationFeedbacks || - agentConfigurationFeedbacks.length === 0 || - !assistantId ? ( + {!sortedFeedbacks || sortedFeedbacks.length === 0 || !assistantId ? (
No feedbacks.
) : (
@@ -197,12 +205,11 @@ export function AssistantDetails({ agentConfigurationVersion={agentConfiguration.version} isLatestVersion={true} /> - {agentConfigurationFeedbacks.map((feedback, index) => ( + {sortedFeedbacks.map((feedback, index) => (
{index > 0 && feedback.agentConfigurationVersion !== - agentConfigurationFeedbacks[index - 1] - .agentConfigurationVersion && ( + sortedFeedbacks[index - 1].agentConfigurationVersion && ( c.version === feedback.agentConfigurationVersion @@ -289,6 +296,12 @@ function FeedbackCard({ feedbackId: feedback.id.toString(), }); + const baseUrl = + process.env.NODE_ENV === "development" + ? "http://localhost:3000" + : "https://dust.tt"; + const conversationUrl = `${baseUrl}/w/${owner.sId}/assistant/${conversationId}`; + return (
@@ -331,7 +344,7 @@ function FeedbackCard({