diff --git a/src/interface/web/app/agents/page.tsx b/src/interface/web/app/agents/page.tsx index 6b38ccbd..06639e21 100644 --- a/src/interface/web/app/agents/page.tsx +++ b/src/interface/web/app/agents/page.tsx @@ -103,8 +103,10 @@ import { uploadDataForIndexing } from "../common/chatFunctions"; import { AlertDialog, AlertDialogAction, + AlertDialogCancel, AlertDialogContent, AlertDialogDescription, + AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "@/components/ui/alert-dialog"; @@ -156,7 +158,7 @@ function Badge(props: { icon: JSX.Element; text?: string; hoverText?: string })
{props.hoverText || displayBadgeText}
- +
{props.icon}
{displayBadgeText && displayBadgeText.length > 0 && ( @@ -436,6 +438,7 @@ function AgentCard(props: AgentCardProps) { modelOptions={props.modelOptions} slug={props.data.slug} inputToolOptions={props.inputToolOptions} + isSubscribed={props.isSubscribed} outputModeOptions={props.outputModeOptions} /> @@ -578,6 +581,7 @@ function AgentCard(props: AgentCardProps) { slug={props.data.slug} inputToolOptions={props.inputToolOptions} outputModeOptions={props.outputModeOptions} + isSubscribed={props.isSubscribed} /> ) : ( @@ -637,6 +641,7 @@ const EditAgentSchema = z.object({ interface AgentModificationFormProps { form: UseFormReturn>; onSubmit: (values: z.infer) => void; + userConfig?: UserConfig; create?: boolean; errors?: string | null; modelOptions: ModelOptions[]; @@ -644,6 +649,7 @@ interface AgentModificationFormProps { inputToolOptions: { [key: string]: string }; outputModeOptions: { [key: string]: string }; slug?: string; + isSubscribed: boolean; } function AgentModificationForm(props: AgentModificationFormProps) { @@ -659,7 +665,9 @@ function AgentModificationForm(props: AgentModificationFormProps) { const [uploading, setUploading] = useState(false); const [progressValue, setProgressValue] = useState(0); const [uploadedFiles, setUploadedFiles] = useState([]); - const [allFileOptions, setAllFileOptions] = useState(props.filesOptions); + const [allFileOptions, setAllFileOptions] = useState([]); + + const [showSubscribeDialog, setShowSubscribeDialog] = useState(true); const fileInputRef = useRef(null); @@ -680,6 +688,13 @@ function AgentModificationForm(props: AgentModificationFormProps) { } }, [uploading]); + useEffect(() => { + const currentFiles = props.form.getValues("files") || []; + const fileOptions = props.filesOptions || []; + const concatenatedFiles = [...currentFiles, ...fileOptions]; + setAllFileOptions((prev) => [...prev, ...concatenatedFiles]); + }, []); + useEffect(() => { if (uploadedFiles.length > 0) { handleAgentFileChange(uploadedFiles); @@ -740,6 +755,38 @@ function AgentModificationForm(props: AgentModificationFormProps) { const privacyOptions = ["public", "private", "protected"]; + if (!props.isSubscribed && showSubscribeDialog) { + return ( + + + + Upgrade to Futurist + + + You need to be a Futurist subscriber to create more agents.{" "} + Upgrade now. + + + { + setShowSubscribeDialog(false); + }} + > + Cancel + + { + window.location.href = "/settings"; + }} + > + Continue + + + + + ); + } + return (
( - + Name What should this agent be called? Pick something descriptive & @@ -771,7 +818,7 @@ function AgentModificationForm(props: AgentModificationFormProps) { control={props.form.control} name="persona" render={({ field }) => ( - + Personality What is the personality, thought process, or tuning of this agent? @@ -792,7 +839,7 @@ function AgentModificationForm(props: AgentModificationFormProps) { control={props.form.control} name="chat_model" render={({ field }) => ( - + Chat Model Which large language model should this agent use? @@ -821,7 +868,7 @@ function AgentModificationForm(props: AgentModificationFormProps) { control={props.form.control} name="privacy_level" render={({ field }) => ( - +
Privacy Level
@@ -950,7 +997,7 @@ function AgentModificationForm(props: AgentModificationFormProps) { control={props.form.control} name="files" render={({ field }) => ( - + Knowledge Base Which information should be part of its digital brain?{" "} @@ -1071,7 +1118,7 @@ function AgentModificationForm(props: AgentModificationFormProps) { control={props.form.control} name="input_tools" render={({ field }) => ( - + Restrict Input Tools Which knowledge retrieval tools should this agent be limited to? @@ -1140,7 +1187,7 @@ function AgentModificationForm(props: AgentModificationFormProps) { control={props.form.control} name="output_modes" render={({ field }) => ( - + Restrict Output Modes Which output modes should this agent be limited to? @@ -1220,7 +1267,7 @@ function AgentModificationForm(props: AgentModificationFormProps) {