From 593bbf5f0ad9e76c9bd27a6f4238d94ced44b1ef Mon Sep 17 00:00:00 2001
From: "adam.watkins"
🔗 Short link • @@ -19,18 +18,19 @@ --- -AgentGPT allows you to configure and deploy Autonomous AI agents. Name your own custom AI and have it embark on any goal imaginable. It will attempt to reach the goal by thinking of tasks to do, executing them, and learning from the results 🚀. +AgentGPT allows you to configure and deploy Autonomous AI agents. +Name your own custom AI and have it embark on any goal imaginable. +It will attempt to reach the goal by thinking of tasks to do, executing them, and learning from the results 🚀. +## 🎉 Features This platform is currently in beta, we are currently working on: + - Long term memory 🧠 - Web browsing 🌐 - Interaction with websites and people 👨👩👦 - -## 🎉 Features - -Coming soon... +More Coming soon... ## 🚀 Tech Stack @@ -68,19 +68,19 @@ npm install > 🚧 The environment variables must match the following [schema](https://github.com/reworkd/AgentGPT/blob/main/src/env/schema.mjs). ```bash -# Next Auth Secrets -NODE_ENV=production -NEXTAUTH_SECRET= -NEXTAUTH_URL=http://localhost:3000 +# Deployment Environment: +NODE_ENV=development # Next Auth config: -NEXTAUTH_SECRET= -NEXTAUTH_URL= +# Generate a secret with `openssl rand -base64 32` +NEXTAUTH_SECRET=changeme +NEXTAUTH_URL=http://localhost:3000 -# Database URLs: -DATABASE_URL= -NEXT_PUBLIC_SUPABASE_URL= -NEXT_PUBLIC_SUPABASE_ANON_KEY= +# Prisma +DATABASE_URL=file:./db.sqlite + +# External APIs: +OPENAI_API_KEY=changeme ``` 5. Ready 🥳, now run: diff --git a/src/env/schema.mjs b/src/env/schema.mjs index 6292334..36f2978 100644 --- a/src/env/schema.mjs +++ b/src/env/schema.mjs @@ -1,6 +1,10 @@ // @ts-check import { z } from "zod"; +const requiredForProduction = () => process.env.NODE_ENV === "production" + ? z.string().min(1).trim() + : z.string().min(1).trim().optional() + /** * Specify your server-side environment variables schema here. * This way you can ensure the app isn't built with invalid env vars. @@ -8,10 +12,7 @@ import { z } from "zod"; export const serverSchema = z.object({ DATABASE_URL: z.string().url(), NODE_ENV: z.enum(["development", "test", "production"]), - NEXTAUTH_SECRET: - process.env.NODE_ENV === "production" - ? z.string().min(1) - : z.string().min(1).optional(), + NEXTAUTH_SECRET: requiredForProduction(), NEXTAUTH_URL: z.preprocess( // This makes Vercel deployments not fail if you don't set NEXTAUTH_URL // Since NextAuth.js automatically uses the VERCEL_URL if present. @@ -19,8 +20,6 @@ export const serverSchema = z.object({ // VERCEL_URL doesn't include `https` so it cant be validated as a URL process.env.VERCEL ? z.string() : z.string().url(), ), - DISCORD_CLIENT_ID: z.string(), - DISCORD_CLIENT_SECRET: z.string(), OPENAI_API_KEY: z.string() }); @@ -34,8 +33,6 @@ export const serverEnv = { NODE_ENV: process.env.NODE_ENV, NEXTAUTH_SECRET: process.env.NEXTAUTH_SECRET, NEXTAUTH_URL: process.env.NEXTAUTH_URL, - DISCORD_CLIENT_ID: process.env.DISCORD_CLIENT_ID, - DISCORD_CLIENT_SECRET: process.env.DISCORD_CLIENT_SECRET, OPENAI_API_KEY: process.env.OPENAI_API_KEY, }; diff --git a/src/server/auth.ts b/src/server/auth.ts index f127672..2027358 100644 --- a/src/server/auth.ts +++ b/src/server/auth.ts @@ -4,9 +4,7 @@ import { type NextAuthOptions, type DefaultSession, } from "next-auth"; -import DiscordProvider from "next-auth/providers/discord"; import { PrismaAdapter } from "@next-auth/prisma-adapter"; -import { env } from "../env/server.mjs"; import { prisma } from "./db"; /** @@ -47,10 +45,6 @@ export const authOptions: NextAuthOptions = { }, adapter: PrismaAdapter(prisma), providers: [ - DiscordProvider({ - clientId: env.DISCORD_CLIENT_ID, - clientSecret: env.DISCORD_CLIENT_SECRET, - }), /** * ...add more providers here *