From 50ec0cb13d79eb1cf343612a531f683c83e30d45 Mon Sep 17 00:00:00 2001 From: filou Date: Fri, 22 Dec 2023 15:17:02 +0100 Subject: [PATCH] [Ahuna] Test assistants in side modal from gallery --- .../components/assistant/AssistantPreview.tsx | 26 ++- .../assistant/TryAssistantModal.tsx | 166 ++++++++++++++++++ front/components/sparkle/Notification.tsx | 2 +- front/lib/conversation.ts | 131 ++++++++++++++ front/pages/w/[wId]/assistant/[cId]/index.tsx | 110 +++--------- front/pages/w/[wId]/assistant/gallery.tsx | 12 ++ 6 files changed, 359 insertions(+), 88 deletions(-) create mode 100644 front/components/assistant/TryAssistantModal.tsx create mode 100644 front/lib/conversation.ts diff --git a/front/components/assistant/AssistantPreview.tsx b/front/components/assistant/AssistantPreview.tsx index 11c7e0516a58..8b7a6d29aae3 100644 --- a/front/components/assistant/AssistantPreview.tsx +++ b/front/components/assistant/AssistantPreview.tsx @@ -4,6 +4,7 @@ import { Chip, DashIcon, MoreIcon, + PlayIcon, PlusIcon, } from "@dust-tt/sparkle"; import { @@ -28,6 +29,7 @@ interface AssistantPreviewProps { onUpdate: () => void; variant: AssistantPreviewVariant; flow: AssistantPreviewFlow; + setTestModalAssistant?: (agentConfiguration: AgentConfigurationType) => void; } function getDescriptionClassName(variant: AssistantPreviewVariant): string { @@ -55,6 +57,7 @@ export function AssistantPreview({ onUpdate, variant, flow, + setTestModalAssistant, }: AssistantPreviewProps) { const [isUpdatingList, setIsUpdatingList] = useState(false); // TODO(flav) Move notification logic to the caller. This maintains the purity of the component by @@ -200,7 +203,24 @@ export function AssistantPreview({ default: assertNever(flow); } - + let testButton = null; + if ( + setTestModalAssistant && + ((flow === "workspace" && agentConfiguration.scope === "published") || + (flow === "personal" && + agentConfiguration.userListStatus === "not-in-list")) + ) { + testButton = ( +