Skip to content

Commit

Permalink
#35 Basic onboarding workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
santthosh committed May 27, 2024
1 parent 193317f commit c869710
Show file tree
Hide file tree
Showing 21 changed files with 400 additions and 62 deletions.
48 changes: 0 additions & 48 deletions .env.docker
Original file line number Diff line number Diff line change
Expand Up @@ -3,51 +3,3 @@ NEXTAUTH_URL=http://localhost:3000/
NEXTAUTH_SECRET=c60f1bcb46db934646424129387359d5
# Linux: `openssl rand -hex 32` or go to https://generate-secret.vercel.app/32

# Providers
ENABLE_CREDENTIALS_PROVIDER=true
ENABLE_EMAIL_PROVIDER=false
ENABLE_GITHUB_PROVIDER=false
ENABLE_GOOGLE_PROVIDER=false

# Credentials Provider Parameters
CREDENTIALS_APPROVED_USERNAME=jsmith
CREDENTIALS_APPROVED_PASSWORD=localhost@

# Email Server Parameters
EMAIL_SERVER_USER=resend
EMAIL_SERVER_PASSWORD=
EMAIL_SERVER_HOST=smtp.resend.com
EMAIL_SERVER_PORT=465
EMAIL_FROM=no-reply@assistantshub.ai

# GitHub OAuth Parameters
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=

# Google OAuth Parameters
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=

# AWS Parameters
AWS_S3_BUCKET=
AWS_REGION=us-west-2
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=

# OpenAI API Key for Assistants Hub
OPENAI_API_KEY=
# Google AI Studio API Key for Assistants Hub
GOOGLE_AI_STUDIO_API_KEY=
# Groq Cloud API Key for Assistants Hub
GROQ_CLOUD_API_KEY=
# Anthropic API Key for Assistants Hub
ANTHROPIC_API_KEY=


# Environment variables declared in this file are automatically made available to Prisma.
# See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema

# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings
POSTGRES_PRISMA_URL="postgresql://.."
BLOB_READ_WRITE_TOKEN="vercel_blob_rw_..."
4 changes: 2 additions & 2 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ ENABLE_GITHUB_PROVIDER=false
ENABLE_GOOGLE_PROVIDER=false

# Credentials Provider Parameters
CREDENTIALS_APPROVED_USERNAME=jsmith
CREDENTIALS_APPROVED_PASSWORD=localhost@
CREDENTIALS_APPROVED_USERNAME=admin
CREDENTIALS_APPROVED_PASSWORD=admin

# Email Server Parameters
EMAIL_SERVER_USER=resend
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ The gemini-1.5-pro-latest model is a large-scale language model developed by Goo
All models that support [Anthropic API](https://docs.anthropic.com/en/docs/models-overview) are supported by [Assistants Hub](https://assistantshub.ai).

| Model Name | Provider | Streaming <br/>Responses | Documents | Functions |
|-----------------|-----------| ------------------------ | ------------------------ | ------------------------ |
| --------------- | --------- | ------------------------ | ------------------------ | ------------------------ |
| Claude 3 Opus | Anthropic | :white_check_mark: | :heavy_multiplication_x: | :heavy_multiplication_x: |
| Claude 3 Sonnet | Anthropic | :white_check_mark: | :heavy_multiplication_x: | :heavy_multiplication_x: |
| Claude 3 Haiku | Anthropic | :white_check_mark: | :heavy_multiplication_x: | :heavy_multiplication_x: |
Expand Down
11 changes: 5 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
version: '3.8'
services:
nextjs:
platform:
linux/arm64
platform: linux/arm64
build:
context: .
dockerfile: Dockerfile
image: assistantshub
ports:
- "3000:3000"
- '3000:3000'
volumes:
- .:/app
environment:
Expand All @@ -34,15 +33,15 @@ services:
POSTGRES_PASSWORD: password
POSTGRES_DB: assistantshub
ports:
- "5432:5432"
- '5432:5432'
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U postgres" ]
test: ['CMD-SHELL', 'pg_isready -U postgres']
interval: 10s
timeout: 8s
retries: 5
start_period: 10s

volumes:
pgdata:
pgdata:
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"build": "next build",
"generate": "prisma generate",
"migrate": "prisma migrate deploy",
"migrate:dev": "prisma migrate dev",
"seed": "prisma db seed",
"start": "next start",
"lint": "next lint",
Expand Down Expand Up @@ -46,6 +47,7 @@
"openai": "^4.42.0",
"react": "^18",
"react-apexcharts": "^1.4.1",
"react-confetti": "^6.1.0",
"react-dom": "^18",
"react-dropzone": "^14.2.3",
"react-highlight": "^0.15.0",
Expand Down
23 changes: 23 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions prisma/migrations/20240527172040_adding_settings/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-- AlterTable
ALTER TABLE "User" ADD COLUMN "role" TEXT;

-- CreateTable
CREATE TABLE "System" (
"id" TEXT NOT NULL,
"adminUserCreated" BOOLEAN NOT NULL,
"authProviders" JSONB,
"modelProviders" JSONB,
"emailServer" JSONB,
"blobStorage" JSONB,
"agreeToTerms" BOOLEAN NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,

CONSTRAINT "System_pkey" PRIMARY KEY ("id")
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "System" ADD COLUMN "currentStep" INTEGER NOT NULL DEFAULT 0;
14 changes: 14 additions & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ model User {
image String?
accounts Account[]
sessions Session[]
role String?
// Optional for WebAuthn support
Authenticator Authenticator[]
Expand Down Expand Up @@ -194,3 +195,16 @@ model Authenticator {
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
}

model System {
id String @id @default(cuid())
currentStep Int @default(0)
adminUserCreated Boolean
authProviders Json?
modelProviders Json?
emailServer Json?
blobStorage Json?
agreeToTerms Boolean
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
5 changes: 2 additions & 3 deletions src/app/api/auth/[...nextauth]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ if (process.env.ENABLE_CREDENTIALS_PROVIDER === 'true') {
) {
return {
id: 1,
name: 'J Smith',
name: 'Admin User',
email:
process.env.CREDENTIALS_APPROVED_USERNAME + '@assistantshub.ai',
role: 'admin',
};
}
return null;
Expand Down Expand Up @@ -77,8 +78,6 @@ if (process.env.ENABLE_GOOGLE_PROVIDER === 'true') {
providers.push(googleProvider);
}



export const authOptions = {
adapter: PrismaAdapter(prisma),
providers: providers,
Expand Down
4 changes: 3 additions & 1 deletion src/app/assistants/[id]/customize/DebounceInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ export interface DebouncedInputProps {
onDebounceTextChange?: (text: string) => void;
}

export const DebouncedInput: React.FC<DebouncedInputProps> = (props: DebouncedInputProps) => {
export const DebouncedInput: React.FC<DebouncedInputProps> = (
props: DebouncedInputProps
) => {
const [text, setText] = useState<string>(props.value ? props.value : '');
const [loading, setLoading] = useState<boolean>(false);
const debouncedText = useDebounce<string>(text, 300); // 300ms delay
Expand Down
4 changes: 4 additions & 0 deletions src/app/onboarding/StepProps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface StepProps {
currentStep: number;
onStepReady: (step: number, isReady: boolean) => any;
}
Loading

0 comments on commit c869710

Please sign in to comment.