-
-
-
{
- setAssistantSearch(s);
- }}
- />
+
+
+
+
+
+
+ {
+ setAssistantSearch(s);
+ }}
+ />
+
+
+
+
+
+ {view !== "workspace" && viewAssistants.length > 0 && (
+
+
+
+
+
+ )}
+
-
-
-
-
-
-
-
-
-
-
- {filtered.map((agent) => (
- } size={"sm"} />
- }
- action={
- agent.scope !== "global" && (
- {
- setShowRemovalModal(agent);
- }}
- size="xs"
- />
- )
- }
+
+ {view === "workspace" || viewAssistants.length > 0 ? (
+
+ {filtered.map((agent) => (
+ }
+ size={"sm"}
+ />
+ }
+ action={
+ agent.scope !== "global" && (
+
+
+
+
+
+ {
+ agent.scope === "private"
+ ? setShowDeletionModal(agent)
+ : setShowRemovalModal(agent);
+ }}
+ size="xs"
+ />
+
+ )
+ }
+ >
+
+
+ {agent.description}
+
+
+
+ ))}
+
+ ) : (
+
-
- {agent.description}
-
-
- ))}
-
-
+
+
+
+
+ )}
+
+
);
diff --git a/front/pages/w/[wId]/assistant/gallery.tsx b/front/pages/w/[wId]/assistant/gallery.tsx
index 405ef565010e..28059441590a 100644
--- a/front/pages/w/[wId]/assistant/gallery.tsx
+++ b/front/pages/w/[wId]/assistant/gallery.tsx
@@ -110,16 +110,16 @@ export default function AssistantsGallery({
href: `/w/${owner.sId}/assistant/gallery?view=all&flow=` + flow,
current: agentsGetView === "all",
},
+ {
+ label: "Published",
+ href: `/w/${owner.sId}/assistant/gallery?view=published&flow=` + flow,
+ current: agentsGetView === "published",
+ },
{
label: "From Workspace",
href: `/w/${owner.sId}/assistant/gallery?view=workspace&flow=` + flow,
current: agentsGetView === "workspace",
},
- {
- label: "From Teammates",
- href: `/w/${owner.sId}/assistant/gallery?view=published&flow=` + flow,
- current: agentsGetView === "published",
- },
{
label: "From Dust",
href: `/w/${owner.sId}/assistant/gallery?view=global&flow=` + flow,
diff --git a/front/pages/w/[wId]/builder/assistants/[aId]/index.tsx b/front/pages/w/[wId]/builder/assistants/[aId]/index.tsx
index 0369193c12cc..267ad708c523 100644
--- a/front/pages/w/[wId]/builder/assistants/[aId]/index.tsx
+++ b/front/pages/w/[wId]/builder/assistants/[aId]/index.tsx
@@ -15,6 +15,8 @@ import { GetServerSideProps, InferGetServerSidePropsType } from "next";
import AssistantBuilder, {
AssistantBuilderInitialState,
+ BUILDER_FLOWS,
+ BuilderFlow,
} from "@app/components/assistant_builder/AssistantBuilder";
import { getApps } from "@app/lib/api/app";
import { getAgentConfiguration } from "@app/lib/api/assistant/configuration";
@@ -40,6 +42,7 @@ export const getServerSideProps: GetServerSideProps<{
dustAppConfiguration: AssistantBuilderInitialState["dustAppConfiguration"];
databaseQueryConfiguration: AssistantBuilderInitialState["databaseQueryConfiguration"];
agentConfiguration: AgentConfigurationType;
+ flow: BuilderFlow;
}> = async (context) => {
const session = await getSession(context.req, context.res);
const user = await getUserFromSession(session);
@@ -56,7 +59,7 @@ export const getServerSideProps: GetServerSideProps<{
!plan ||
!user ||
!subscription ||
- !auth.isBuilder() ||
+ !auth.isUser() ||
!context.params?.aId
) {
return {
@@ -75,6 +78,11 @@ export const getServerSideProps: GetServerSideProps<{
auth,
context.params?.aId as string
);
+ if (config?.scope === "workspace" && !auth.isBuilder()) {
+ return {
+ notFound: true,
+ };
+ }
if (!config) {
return {
@@ -177,6 +185,11 @@ export const getServerSideProps: GetServerSideProps<{
};
}
}
+ const flow: BuilderFlow = BUILDER_FLOWS.includes(
+ context.query.flow as BuilderFlow
+ )
+ ? (context.query.flow as BuilderFlow)
+ : "my_assistants";
return {
props: {
@@ -191,6 +204,7 @@ export const getServerSideProps: GetServerSideProps<{
dustAppConfiguration,
databaseQueryConfiguration: databaseQueryConfiguration,
agentConfiguration: config,
+ flow,
},
};
};
@@ -207,6 +221,7 @@ export default function EditAssistant({
dustAppConfiguration,
databaseQueryConfiguration,
agentConfiguration,
+ flow,
}: InferGetServerSidePropsType
) {
let actionMode: AssistantBuilderInitialState["actionMode"] = "GENERIC";
@@ -241,6 +256,9 @@ export default function EditAssistant({
if (isDatabaseQueryConfiguration(agentConfiguration.action)) {
actionMode = "DATABASE_QUERY";
}
+ if (agentConfiguration.scope === "global") {
+ throw new Error("Cannot edit global assistant");
+ }
return (
-
+
@@ -208,7 +208,9 @@ export default function WorkspaceAssistants({
/>
{workspaceAgents.length > 0 && (
-
+
)}
@@ -229,6 +231,17 @@ export default function WorkspaceAssistants({
}
action={
+
+
+
-
-
-
-
}
>
@@ -285,7 +286,9 @@ export default function WorkspaceAssistants({
"relative mt-4 flex h-full min-h-48 items-center justify-center rounded-lg bg-structure-50"
)}
>
-
+
)}
-
+
= async (context) => {
const session = await getSession(context.req, context.res);
const user = await getUserFromSession(session);
@@ -30,7 +34,7 @@ export const getServerSideProps: GetServerSideProps<{
const owner = auth.workspace();
const plan = auth.plan();
const subscription = auth.subscription();
- if (!owner || !plan || !user || !auth.isBuilder() || !subscription) {
+ if (!owner || !plan || !user || !auth.isUser() || !subscription) {
return {
notFound: true,
};
@@ -39,6 +43,12 @@ export const getServerSideProps: GetServerSideProps<{
const allDataSources = await getDataSources(auth);
const allDustApps = await getApps(auth);
+ const flow: BuilderFlow = BUILDER_FLOWS.includes(
+ context.query.flow as BuilderFlow
+ )
+ ? (context.query.flow as BuilderFlow)
+ : "my_assistants";
+
return {
props: {
user,
@@ -48,6 +58,7 @@ export const getServerSideProps: GetServerSideProps<{
gaTrackingId: GA_TRACKING_ID,
dataSources: allDataSources,
dustApps: allDustApps,
+ flow,
},
};
};
@@ -60,6 +71,7 @@ export default function CreateAssistant({
gaTrackingId,
dataSources,
dustApps,
+ flow,
}: InferGetServerSidePropsType) {
return (
);