Skip to content

Commit

Permalink
TMP
Browse files Browse the repository at this point in the history
  • Loading branch information
fontanierh committed Sep 6, 2023
1 parent 91d17ad commit 2362a3a
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 1 deletion.
16 changes: 15 additions & 1 deletion front/components/sparkle/navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
FolderOpenIcon,
KeyIcon,
PaperAirplaneIcon,
RobotStrokeIcon,
Square3Stack3DIcon,
TestTubeIcon,
} from "@dust-tt/sparkle";
Expand All @@ -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"
Expand Down Expand Up @@ -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;
Expand Down
85 changes: 85 additions & 0 deletions front/pages/w/[wId]/builder/assistants/index.tsx
Original file line number Diff line number Diff line change
@@ -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<typeof getServerSideProps>) {
const router = useRouter();

return (
<AppLayout
user={user}
owner={owner}
gaTrackingId={gaTrackingId}
topNavigationCurrent="settings"
subNavigation={subNavigationAdmin({ owner, current: "assistants" })}
>
<PageHeader
title="Assistants Builder"
icon={RobotStrokeIcon}
description="Build an assistant."
/>
<div>
<SectionHeader
title="Custom Assistants"
description="Build your own Assistant, use specific instructions and specific data sources to get better answers."
action={{
label: "Create a new Assistant",
type: "secondary",
icon: PlusIcon,
size: "sm",
}}
/>
</div>
</AppLayout>
);
}

0 comments on commit 2362a3a

Please sign in to comment.