-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
91d17ad
commit 2362a3a
Showing
2 changed files
with
100 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
} |