From 2362a3ad0e0113c389054938b1a4d8da8eefc670 Mon Sep 17 00:00:00 2001 From: Henry Fontanier Date: Wed, 6 Sep 2023 18:27:33 +0200 Subject: [PATCH] TMP --- front/components/sparkle/navigation.tsx | 16 +++- .../w/[wId]/builder/assistants/index.tsx | 85 +++++++++++++++++++ 2 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 front/pages/w/[wId]/builder/assistants/index.tsx diff --git a/front/components/sparkle/navigation.tsx b/front/components/sparkle/navigation.tsx index 8054e3617d330..670ac4502e137 100644 --- a/front/components/sparkle/navigation.tsx +++ b/front/components/sparkle/navigation.tsx @@ -8,6 +8,7 @@ import { FolderOpenIcon, KeyIcon, PaperAirplaneIcon, + RobotStrokeIcon, Square3Stack3DIcon, TestTubeIcon, } from "@dust-tt/sparkle"; @@ -23,7 +24,11 @@ import { WorkspaceType } from "@app/types/user"; */ export type TopNavigationId = "assistant" | "lab" | "settings"; -export type SubNavigationAdminId = "data_sources" | "workspace" | "developers"; +export type SubNavigationAdminId = + | "data_sources" + | "workspace" + | "developers" + | "assistants"; export type SubNavigationDataSourceId = "documents" | "search" | "settings"; export type SubNavigationAppId = | "specification" @@ -139,6 +144,15 @@ export const subNavigationAdmin = ({ subMenuLabel: current === "developers" ? subMenuLabel : undefined, subMenu: current === "developers" ? subMenu : undefined, }); + nav.push({ + id: "assistants", + label: "Assistants Manager", + icon: RobotStrokeIcon, + href: `/w/${owner.sId}/builder/assistants`, + current: current === "assistants", + subMenuLabel: current === "assistants" ? subMenuLabel : undefined, + subMenu: current === "assistants" ? subMenu : undefined, + }); } return nav; diff --git a/front/pages/w/[wId]/builder/assistants/index.tsx b/front/pages/w/[wId]/builder/assistants/index.tsx new file mode 100644 index 0000000000000..a96a29f28b311 --- /dev/null +++ b/front/pages/w/[wId]/builder/assistants/index.tsx @@ -0,0 +1,85 @@ +import { + PageHeader, + PlusIcon, + RobotStrokeIcon, + SectionHeader, +} from "@dust-tt/sparkle"; +import { GetServerSideProps, InferGetServerSidePropsType } from "next"; +import { useRouter } from "next/router"; + +import AppLayout from "@app/components/sparkle/AppLayout"; +import { subNavigationAdmin } from "@app/components/sparkle/navigation"; +import { Authenticator, getSession, getUserFromSession } from "@app/lib/auth"; +import { UserType, WorkspaceType } from "@app/types/user"; + +const { GA_TRACKING_ID = "" } = process.env; + +export const getServerSideProps: GetServerSideProps<{ + user: UserType | null; + owner: WorkspaceType; + gaTrackingId: string; +}> = async (context) => { + const session = await getSession(context.req, context.res); + + const user = await getUserFromSession(session); + if (!user) { + return { + notFound: true, + }; + } + + const auth = await Authenticator.fromSession( + session, + context.params?.wId as string + ); + const owner = auth.workspace(); + if (!owner) { + return { + notFound: true, + }; + } + + return { + props: { + user, + owner, + gaTrackingId: GA_TRACKING_ID, + }, + }; +}; + +export default function AssistantsBuilder({ + user, + owner, + gaTrackingId, +}: InferGetServerSidePropsType) { + const router = useRouter(); + + return ( + + +
+ +
+
+ ); +}