diff --git a/.github/workflows/dockerBuildX.yml b/.github/workflows/dockerBuildX.yml index 9f340cf..97364ed 100644 --- a/.github/workflows/dockerBuildX.yml +++ b/.github/workflows/dockerBuildX.yml @@ -53,7 +53,7 @@ jobs: context: . push: true # platforms: linux/amd64,linux/arm64 - platforms: linux/arm64 + platforms: linux/amd64 tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha diff --git a/.gitignore b/.gitignore index faee4bd..933360f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. +.vscode + # dependencies /node_modules /.pnp diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 6fc885f..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "ansible.python.interpreterPath": "/Users/kjj/.pyenv/versions/3.12.3/bin/python" -} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 0e4c2f0..8b00c2e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,4 +29,4 @@ COPY --from=builder /app/public ./public EXPOSE 3000 # Start the server after pushing the database schema -CMD ["sh", "-c", "npm run db-push && npm run start"] +CMD ["sh", "-c", "npm run start"] diff --git a/helm/app/templates/deployment.yaml b/helm/app/templates/deployment.yaml index be48b8b..9aa2fa1 100644 --- a/helm/app/templates/deployment.yaml +++ b/helm/app/templates/deployment.yaml @@ -40,9 +40,10 @@ spec: - name: http containerPort: {{ .Values.service.port }} protocol: TCP - {{- with .Values.env }} - env: - {{- toYaml . | nindent 12 }} + {{- if .Values.envSecretName }} + envFrom: + - secretRef: + name: {{ .Values.envSecretName }} {{- end }} livenessProbe: {{- toYaml .Values.livenessProbe | nindent 12 }} diff --git a/helm/app/values.yaml b/helm/app/values.yaml index eedb307..c9b1381 100644 --- a/helm/app/values.yaml +++ b/helm/app/values.yaml @@ -1,7 +1,25 @@ # Default values for torch.cloud. # This is a YAML-formatted file. + +# Install PostgreSQL using Helm with flags +# helm upgrade --install psql bitnami/postgresql \ +# --namespace "torch-cloud" \ +# --create-namespace \ +# --set primary.persistence.storageClass=local-path \ +# --set primary.persistence.enabled=true \ +# --set primary.persistence.size=10Gi \ +# --set volumePermissions.enabled=true + +# Create a secret for the Docker registry +# kubectl create secret docker-registry ghcr-secret \ +# --docker-server=ghcr.io \ +# --docker-username=vekjja \ +# --docker-password=${GITHUB_CR_PAT} + # Declare variables to be passed into your templates. -# helm upgrade --install torch-cloud . -f values.yaml +# helm upgrade --install torch-cloud helm/app -f helm/app/values.yaml \ +# --namespace torch-cloud \ +# --create-namespace # This will set the replicaset count more information can be found here: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/ replicaCount: 1 @@ -17,7 +35,8 @@ imagePullSecrets: nameOverride: "" fullnameOverride: "" -# This section builds out the srvice account more information can be found here: https://kubernetes.io/docs/concepts/security/service-accounts/ +# This section builds out the srvice account +# more information can be found here: https://kubernetes.io/docs/concepts/security/service-accounts/ serviceAccount: create: true automount: true @@ -39,65 +58,14 @@ service: type: ClusterIP port: 3000 -env: -- name: NODE_ENV - value: production -- name: DATABASE_URL - valueFrom: - secretKeyRef: - name: psql-db-url - key: url -- name: NEXTAUTH_URL - value: https://torch.cloud -- name: NEXTAUTH_CLIENT_SECRET - valueFrom: - secretKeyRef: - name: nextauth-client-secret - key: client-secret -- name: GOOGLE_CLIENT_ID - valueFrom: - secretKeyRef: - name: google-client-id - key: client-id -- name: GOOGLE_CLIENT_SECRET - valueFrom: - secretKeyRef: - name: google-client-secret - key: client-secret -- name: LINKEDIN_CLIENT_ID - valueFrom: - secretKeyRef: - name: linkedin-client-id - key: client-id -- name: LINKEDIN_CLIENT_SECRET - valueFrom: - secretKeyRef: - name: linkedin-client-secret - key: client-secret -- name: DISCORD_CLIENT_ID - valueFrom: - secretKeyRef: - name: discord-client-id - key: client-id -- name: DISCORD_CLIENT_SECRET - valueFrom: - secretKeyRef: - name: discord-client-secret - key: client-secret -- name: OPENAI_API_KEY - valueFrom: - secretKeyRef: - name: openai-api-key - key: api-key -- name: OPENAI_MODEL - value: "gpt-4o" -- name: OPENAI_MAX_COMPLETION_TOKENS - value: "198" +# Name of the secret containing all environment variables +# Create this secret with: kubectl create secret generic torch-cloud-env --from-env-file=.env +envSecretName: torch-cloud-env ingress: enabled: true className: "nginx" - annotations: { cert-manager.io/cluster-issuer: "cloudlfare-letsencrypt-production" } + annotations: { cert-manager.io/cluster-issuer: "cloudflare-letsencrypt-production" } hosts: - host: torch.cloud paths: diff --git a/package-lock.json b/package-lock.json index 1c9c231..047fcaf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,13 +14,12 @@ "@mui/icons-material": "^6.3.1", "@mui/material": "^6.3.1", "@next-auth/prisma-adapter": "^1.0.7", - "@prisma/client": "^6.2.1", + "@prisma/client": "^6.19.0", "ammo.js": "^0.0.10", "next": "15.1.4", "next-auth": "^4.24.11", "nodemailer": "^6.10.0", "openai": "^4.83.0", - "prisma": "^6.3.1", "react": "^19.0.0", "react-dom": "^19.0.0", "react-markdown": "^9.0.3", @@ -35,9 +34,11 @@ "@types/react-dom": "^19", "@types/react-syntax-highlighter": "^15.5.13", "@types/three": "^0.173.0", + "dotenv-cli": "^11.0.0", "eslint": "^9", "eslint-config-next": "15.1.4", "postcss": "^8", + "prisma": "^6.19.0", "tailwindcss": "^3.4.1", "typescript": "^5" } @@ -1474,9 +1475,9 @@ } }, "node_modules/@prisma/client": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@prisma/client/-/client-6.3.1.tgz", - "integrity": "sha512-ARAJaPs+eBkemdky/XU3cvGRl+mIPHCN2lCXsl5Vlb0E2gV+R6IN7aCI8CisRGszEZondwIsW9Iz8EJkTdykyA==", + "version": "6.19.0", + "resolved": "https://registry.npmjs.org/@prisma/client/-/client-6.19.0.tgz", + "integrity": "sha512-QXFT+N/bva/QI2qoXmjBzL7D6aliPffIwP+81AdTGq0FXDoLxLkWivGMawG8iM5B9BKfxLIXxfWWAF6wbuJU6g==", "hasInstallScript": true, "license": "Apache-2.0", "engines": { @@ -1495,49 +1496,67 @@ } } }, + "node_modules/@prisma/config": { + "version": "6.19.0", + "resolved": "https://registry.npmjs.org/@prisma/config/-/config-6.19.0.tgz", + "integrity": "sha512-zwCayme+NzI/WfrvFEtkFhhOaZb/hI+X8TTjzjJ252VbPxAl2hWHK5NMczmnG9sXck2lsXrxIZuK524E25UNmg==", + "devOptional": true, + "license": "Apache-2.0", + "dependencies": { + "c12": "3.1.0", + "deepmerge-ts": "7.1.5", + "effect": "3.18.4", + "empathic": "2.0.0" + } + }, "node_modules/@prisma/debug": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-6.3.1.tgz", - "integrity": "sha512-RrEBkd+HLZx+ydfmYT0jUj7wjLiS95wfTOSQ+8FQbvb6vHh5AeKfEPt/XUQ5+Buljj8hltEfOslEW57/wQIVeA==", + "version": "6.19.0", + "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-6.19.0.tgz", + "integrity": "sha512-8hAdGG7JmxrzFcTzXZajlQCidX0XNkMJkpqtfbLV54wC6LSSX6Vni25W/G+nAANwLnZ2TmwkfIuWetA7jJxJFA==", + "devOptional": true, "license": "Apache-2.0" }, "node_modules/@prisma/engines": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-6.3.1.tgz", - "integrity": "sha512-sXdqEVLyGAJ5/iUoG/Ea5AdHMN71m6PzMBWRQnLmhhOejzqAaEr8rUd623ql6OJpED4s/U4vIn4dg1qkF7vGag==", + "version": "6.19.0", + "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-6.19.0.tgz", + "integrity": "sha512-pMRJ+1S6NVdXoB8QJAPIGpKZevFjxhKt0paCkRDTZiczKb7F4yTgRP8M4JdVkpQwmaD4EoJf6qA+p61godDokw==", + "devOptional": true, "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "@prisma/debug": "6.3.1", - "@prisma/engines-version": "6.3.0-17.acc0b9dd43eb689cbd20c9470515d719db10d0b0", - "@prisma/fetch-engine": "6.3.1", - "@prisma/get-platform": "6.3.1" + "@prisma/debug": "6.19.0", + "@prisma/engines-version": "6.19.0-26.2ba551f319ab1df4bc874a89965d8b3641056773", + "@prisma/fetch-engine": "6.19.0", + "@prisma/get-platform": "6.19.0" } }, "node_modules/@prisma/engines-version": { - "version": "6.3.0-17.acc0b9dd43eb689cbd20c9470515d719db10d0b0", - "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-6.3.0-17.acc0b9dd43eb689cbd20c9470515d719db10d0b0.tgz", - "integrity": "sha512-R/ZcMuaWZT2UBmgX3Ko6PAV3f8//ZzsjRIG1eKqp3f2rqEqVtCv+mtzuH2rBPUC9ujJ5kCb9wwpxeyCkLcHVyA==", + "version": "6.19.0-26.2ba551f319ab1df4bc874a89965d8b3641056773", + "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-6.19.0-26.2ba551f319ab1df4bc874a89965d8b3641056773.tgz", + "integrity": "sha512-gV7uOBQfAFlWDvPJdQxMT1aSRur3a0EkU/6cfbAC5isV67tKDWUrPauyaHNpB+wN1ebM4A9jn/f4gH+3iHSYSQ==", + "devOptional": true, "license": "Apache-2.0" }, "node_modules/@prisma/fetch-engine": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-6.3.1.tgz", - "integrity": "sha512-HOf/0umOgt+/S2xtZze+FHKoxpVg4YpVxROr6g2YG09VsI3Ipyb+rGvD6QGbCqkq5NTWAAZoOGNL+oy7t+IhaQ==", + "version": "6.19.0", + "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-6.19.0.tgz", + "integrity": "sha512-OOx2Lda0DGrZ1rodADT06ZGqHzr7HY7LNMaFE2Vp8dp146uJld58sRuasdX0OiwpHgl8SqDTUKHNUyzEq7pDdQ==", + "devOptional": true, "license": "Apache-2.0", "dependencies": { - "@prisma/debug": "6.3.1", - "@prisma/engines-version": "6.3.0-17.acc0b9dd43eb689cbd20c9470515d719db10d0b0", - "@prisma/get-platform": "6.3.1" + "@prisma/debug": "6.19.0", + "@prisma/engines-version": "6.19.0-26.2ba551f319ab1df4bc874a89965d8b3641056773", + "@prisma/get-platform": "6.19.0" } }, "node_modules/@prisma/get-platform": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-6.3.1.tgz", - "integrity": "sha512-AYLq6Hk9xG73JdLWJ3Ip9Wg/vlP7xPvftGBalsPzKDOHr/ImhwJ09eS8xC2vNT12DlzGxhfk8BkL0ve2OriNhQ==", + "version": "6.19.0", + "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-6.19.0.tgz", + "integrity": "sha512-ym85WDO2yDhC3fIXHWYpG3kVMBA49cL1XD2GCsCF8xbwoy2OkDQY44gEbAt2X46IQ4Apq9H6g0Ex1iFfPqEkHA==", + "devOptional": true, "license": "Apache-2.0", "dependencies": { - "@prisma/debug": "6.3.1" + "@prisma/debug": "6.19.0" } }, "node_modules/@rtsao/scc": { @@ -1554,6 +1573,13 @@ "dev": true, "license": "MIT" }, + "node_modules/@standard-schema/spec": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.0.0.tgz", + "integrity": "sha512-m2bOd0f2RT9k8QJx1JN85cZYyH1RqFBdlwtkSlf4tBDYLCiiZnv1fIIwacK6cqwXavOydf0NPToMQgpKq+dVlA==", + "devOptional": true, + "license": "MIT" + }, "node_modules/@swc/counter": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/@swc/counter/-/counter-0.1.3.tgz", @@ -2436,6 +2462,75 @@ "node": ">=10.16.0" } }, + "node_modules/c12": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/c12/-/c12-3.1.0.tgz", + "integrity": "sha512-uWoS8OU1MEIsOv8p/5a82c3H31LsWVR5qiyXVfBNOzfffjUWtPnhAb4BYI2uG2HfGmZmFjCtui5XNWaps+iFuw==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "chokidar": "^4.0.3", + "confbox": "^0.2.2", + "defu": "^6.1.4", + "dotenv": "^16.6.1", + "exsolve": "^1.0.7", + "giget": "^2.0.0", + "jiti": "^2.4.2", + "ohash": "^2.0.11", + "pathe": "^2.0.3", + "perfect-debounce": "^1.0.0", + "pkg-types": "^2.2.0", + "rc9": "^2.1.2" + }, + "peerDependencies": { + "magicast": "^0.3.5" + }, + "peerDependenciesMeta": { + "magicast": { + "optional": true + } + } + }, + "node_modules/c12/node_modules/chokidar": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", + "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "readdirp": "^4.0.1" + }, + "engines": { + "node": ">= 14.16.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/c12/node_modules/jiti": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.6.1.tgz", + "integrity": "sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ==", + "devOptional": true, + "license": "MIT", + "bin": { + "jiti": "lib/jiti-cli.mjs" + } + }, + "node_modules/c12/node_modules/readdirp": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", + "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==", + "devOptional": true, + "license": "MIT", + "engines": { + "node": ">= 14.18.0" + }, + "funding": { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/call-bind": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", @@ -2630,6 +2725,16 @@ "node": ">= 6" } }, + "node_modules/citty": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/citty/-/citty-0.1.6.tgz", + "integrity": "sha512-tskPPKEs8D2KPafUypv2gxwJP8h/OaJmC82QQGGDQcHvXX43xF2VDACcJVmZ0EuSxkpO9Kc4MlrA3q0+FG58AQ==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "consola": "^3.2.3" + } + }, "node_modules/client-only": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", @@ -2729,6 +2834,23 @@ "dev": true, "license": "MIT" }, + "node_modules/confbox": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.2.2.tgz", + "integrity": "sha512-1NB+BKqhtNipMsov4xI/NnhCKp9XG9NamYp5PVm9klAT0fsrNPjaFICsCFhNhwZJKNh7zB/3q8qXz0E9oaMNtQ==", + "devOptional": true, + "license": "MIT" + }, + "node_modules/consola": { + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/consola/-/consola-3.4.2.tgz", + "integrity": "sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA==", + "devOptional": true, + "license": "MIT", + "engines": { + "node": "^14.18.0 || >=16.10.0" + } + }, "node_modules/convert-source-map": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", @@ -2898,6 +3020,16 @@ "dev": true, "license": "MIT" }, + "node_modules/deepmerge-ts": { + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/deepmerge-ts/-/deepmerge-ts-7.1.5.tgz", + "integrity": "sha512-HOJkrhaYsweh+W+e74Yn7YStZOilkoPb6fycpwNLKzSPtruFs48nYis0zy5yJz1+ktUhHxoRDJ27RQAWLIJVJw==", + "devOptional": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=16.0.0" + } + }, "node_modules/define-data-property": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", @@ -2934,6 +3066,13 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/defu": { + "version": "6.1.4", + "resolved": "https://registry.npmjs.org/defu/-/defu-6.1.4.tgz", + "integrity": "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==", + "devOptional": true, + "license": "MIT" + }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -2952,6 +3091,13 @@ "node": ">=6" } }, + "node_modules/destr": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/destr/-/destr-2.0.5.tgz", + "integrity": "sha512-ugFTXCtDZunbzasqBxrK93Ik/DRYsO6S/fedkWEMKqt04xZ4csmnmwGDBAb07QWNaGMAmnTIemsYZCksjATwsA==", + "devOptional": true, + "license": "MIT" + }, "node_modules/detect-libc": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.3.tgz", @@ -3012,6 +3158,64 @@ "csstype": "^3.0.2" } }, + "node_modules/dotenv": { + "version": "16.6.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz", + "integrity": "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==", + "devOptional": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/dotenv-cli": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/dotenv-cli/-/dotenv-cli-11.0.0.tgz", + "integrity": "sha512-r5pA8idbk7GFWuHEU7trSTflWcdBpQEK+Aw17UrSHjS6CReuhrrPcyC3zcQBPQvhArRHnBo/h6eLH1fkCvNlww==", + "dev": true, + "license": "MIT", + "dependencies": { + "cross-spawn": "^7.0.6", + "dotenv": "^17.1.0", + "dotenv-expand": "^12.0.0", + "minimist": "^1.2.6" + }, + "bin": { + "dotenv": "cli.js" + } + }, + "node_modules/dotenv-cli/node_modules/dotenv": { + "version": "17.2.3", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.2.3.tgz", + "integrity": "sha512-JVUnt+DUIzu87TABbhPmNfVdBDt18BLOWjMUFJMSi/Qqg7NTYtabbvSNJGOJ7afbRuv9D/lngizHtP7QyLQ+9w==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/dotenv-expand": { + "version": "12.0.3", + "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-12.0.3.tgz", + "integrity": "sha512-uc47g4b+4k/M/SeaW1y4OApx+mtLWl92l5LMPP0GNXctZqELk+YGgOPIIC5elYmUH4OuoK3JLhuRUYegeySiFA==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "dotenv": "^16.4.5" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, "node_modules/dunder-proto": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", @@ -3073,6 +3277,17 @@ "dev": true, "license": "MIT" }, + "node_modules/effect": { + "version": "3.18.4", + "resolved": "https://registry.npmjs.org/effect/-/effect-3.18.4.tgz", + "integrity": "sha512-b1LXQJLe9D11wfnOKAk3PKxuqYshQ0Heez+y5pnkd3jLj1yx9QhM72zZ9uUrOQyNvrs2GZZd/3maL0ZV18YuDA==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "@standard-schema/spec": "^1.0.0", + "fast-check": "^3.23.1" + } + }, "node_modules/emoji-regex": { "version": "9.2.2", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", @@ -3080,6 +3295,16 @@ "dev": true, "license": "MIT" }, + "node_modules/empathic": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/empathic/-/empathic-2.0.0.tgz", + "integrity": "sha512-i6UzDscO/XfAcNYD75CfICkmfLedpyPDdozrLMmQc5ORaQcdMoc21OnlEylMIqI7U8eniKrPMxxtj8k0vhmJhA==", + "devOptional": true, + "license": "MIT", + "engines": { + "node": ">=14" + } + }, "node_modules/enhanced-resolve": { "version": "5.18.1", "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.18.1.tgz", @@ -3764,12 +3989,42 @@ "node": ">=6" } }, + "node_modules/exsolve": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/exsolve/-/exsolve-1.0.7.tgz", + "integrity": "sha512-VO5fQUzZtI6C+vx4w/4BWJpg3s/5l+6pRQEHzFRM8WFi4XffSP1Z+4qi7GbjWbvRQEbdIco5mIMq+zX4rPuLrw==", + "devOptional": true, + "license": "MIT" + }, "node_modules/extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", "license": "MIT" }, + "node_modules/fast-check": { + "version": "3.23.2", + "resolved": "https://registry.npmjs.org/fast-check/-/fast-check-3.23.2.tgz", + "integrity": "sha512-h5+1OzzfCC3Ef7VbtKdcv7zsstUQwUDlYpUTvjeUsJAssPgLn7QzbboPtL5ro04Mq0rPOsMzl7q5hIbRs2wD1A==", + "devOptional": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/dubzzz" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fast-check" + } + ], + "license": "MIT", + "dependencies": { + "pure-rand": "^6.1.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -3999,6 +4254,7 @@ "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, "hasInstallScript": true, "license": "MIT", "optional": true, @@ -4119,6 +4375,24 @@ "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" } }, + "node_modules/giget": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/giget/-/giget-2.0.0.tgz", + "integrity": "sha512-L5bGsVkxJbJgdnwyuheIunkGatUF/zssUoxxjACCseZYAVbaqdh9Tsmmlkl8vYan09H7sbvKt4pS8GqKLBrEzA==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "citty": "^0.1.6", + "consola": "^3.4.0", + "defu": "^6.1.4", + "node-fetch-native": "^1.6.6", + "nypm": "^0.6.0", + "pathe": "^2.0.3" + }, + "bin": { + "giget": "dist/cli.mjs" + } + }, "node_modules/glob": { "version": "10.4.5", "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", @@ -6491,6 +6765,13 @@ } } }, + "node_modules/node-fetch-native": { + "version": "1.6.7", + "resolved": "https://registry.npmjs.org/node-fetch-native/-/node-fetch-native-1.6.7.tgz", + "integrity": "sha512-g9yhqoedzIUm0nTnTqAQvueMPVOuIY16bqgAJJC8XOOubYFNwz6IER9qs0Gq2Xd0+CecCKFjtdDTMA4u4xG06Q==", + "devOptional": true, + "license": "MIT" + }, "node_modules/nodemailer": { "version": "6.10.0", "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.10.0.tgz", @@ -6510,6 +6791,26 @@ "node": ">=0.10.0" } }, + "node_modules/nypm": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/nypm/-/nypm-0.6.2.tgz", + "integrity": "sha512-7eM+hpOtrKrBDCh7Ypu2lJ9Z7PNZBdi/8AT3AX8xoCj43BBVHD0hPSTEvMtkMpfs8FCqBGhxB+uToIQimA111g==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "citty": "^0.1.6", + "consola": "^3.4.2", + "pathe": "^2.0.3", + "pkg-types": "^2.3.0", + "tinyexec": "^1.0.1" + }, + "bin": { + "nypm": "dist/cli.mjs" + }, + "engines": { + "node": "^14.16.0 || >=16.10.0" + } + }, "node_modules/oauth": { "version": "0.9.15", "resolved": "https://registry.npmjs.org/oauth/-/oauth-0.9.15.tgz", @@ -6646,6 +6947,13 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/ohash": { + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/ohash/-/ohash-2.0.11.tgz", + "integrity": "sha512-RdR9FQrFwNBNXAr4GixM8YaRZRJ5PUWbKYbE5eOsrwAjJW0q2REGcf79oYPsLyskQCZG1PLN+S/K1V00joZAoQ==", + "devOptional": true, + "license": "MIT" + }, "node_modules/oidc-token-hash": { "version": "5.0.3", "resolved": "https://registry.npmjs.org/oidc-token-hash/-/oidc-token-hash-5.0.3.tgz", @@ -6904,6 +7212,20 @@ "node": ">=8" } }, + "node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "devOptional": true, + "license": "MIT" + }, + "node_modules/perfect-debounce": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/perfect-debounce/-/perfect-debounce-1.0.0.tgz", + "integrity": "sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==", + "devOptional": true, + "license": "MIT" + }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", @@ -6943,6 +7265,18 @@ "node": ">= 6" } }, + "node_modules/pkg-types": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-2.3.0.tgz", + "integrity": "sha512-SIqCzDRg0s9npO5XQ3tNZioRY1uK06lA41ynBC1YmFTmnY6FjUjVt6s4LoADmwoig1qqD0oK8h1p/8mlMx8Oig==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "confbox": "^0.2.2", + "exsolve": "^1.0.7", + "pathe": "^2.0.3" + } + }, "node_modules/possible-typed-array-names": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", @@ -7155,13 +7489,15 @@ "license": "MIT" }, "node_modules/prisma": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/prisma/-/prisma-6.3.1.tgz", - "integrity": "sha512-JKCZWvBC3enxk51tY4TWzS4b5iRt4sSU1uHn2I183giZTvonXaQonzVtjLzpOHE7qu9MxY510kAtFGJwryKe3Q==", + "version": "6.19.0", + "resolved": "https://registry.npmjs.org/prisma/-/prisma-6.19.0.tgz", + "integrity": "sha512-F3eX7K+tWpkbhl3l4+VkFtrwJlLXbAM+f9jolgoUZbFcm1DgHZ4cq9AgVEgUym2au5Ad/TDLN8lg83D+M10ycw==", + "devOptional": true, "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "@prisma/engines": "6.3.1" + "@prisma/config": "6.19.0", + "@prisma/engines": "6.19.0" }, "bin": { "prisma": "build/index.js" @@ -7169,9 +7505,6 @@ "engines": { "node": ">=18.18" }, - "optionalDependencies": { - "fsevents": "2.3.3" - }, "peerDependencies": { "typescript": ">=5.1.0" }, @@ -7233,6 +7566,23 @@ "node": ">=6" } }, + "node_modules/pure-rand": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.1.0.tgz", + "integrity": "sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA==", + "devOptional": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/dubzzz" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fast-check" + } + ], + "license": "MIT" + }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -7254,6 +7604,17 @@ ], "license": "MIT" }, + "node_modules/rc9": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/rc9/-/rc9-2.1.2.tgz", + "integrity": "sha512-btXCnMmRIBINM2LDZoEmOogIZU7Qe7zn4BpomSKZ/ykbLObuBdvG+mFq11DL6fjH1DRwHhrlgtYWG96bJiC7Cg==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "defu": "^6.1.4", + "destr": "^2.0.3" + } + }, "node_modules/react": { "version": "19.0.0", "resolved": "https://registry.npmjs.org/react/-/react-19.0.0.tgz", @@ -8515,6 +8876,16 @@ "xtend": "~2.1.1" } }, + "node_modules/tinyexec": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.0.2.tgz", + "integrity": "sha512-W/KYk+NFhkmsYpuHq5JykngiOCnxeVL8v8dFnqxSD8qEEdRfXk1SDM6JzNqcERbcGYj9tMrDQBYV9cjgnunFIg==", + "devOptional": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", diff --git a/package.json b/package.json index d3f0005..7e38896 100644 --- a/package.json +++ b/package.json @@ -3,12 +3,13 @@ "version": "0.1.0", "private": true, "scripts": { - "dev": "next dev --turbopack", - "build": "next build", - "start": "next start", + "dev": "dotenv -e .env.dev -- next dev --turbopack", + "db-push-dev": "dotenv -e .env.dev -- sh -c 'npx prisma generate && npx prisma db push --accept-data-loss'", + "db-reset-dev": "dotenv -e .env.dev -- sh -c 'npx prisma generate && npx prisma migrate reset --force && npx prisma db push'", + "db-push-prod": "dotenv -e .env.prod -- sh -c 'npx prisma generate && npx prisma db push'", "lint": "next lint", - "db-push": "export $(cat .env | xargs) && npx prisma db push --accept-data-loss", - "db-reset": "export $(cat .env | xargs) && npx prisma migrate reset --force && npx prisma db push" + "build": "next build", + "start": "next start" }, "dependencies": { "@emotion/react": "^11.14.0", @@ -17,13 +18,12 @@ "@mui/icons-material": "^6.3.1", "@mui/material": "^6.3.1", "@next-auth/prisma-adapter": "^1.0.7", - "@prisma/client": "^6.2.1", + "@prisma/client": "^6.19.0", "ammo.js": "^0.0.10", "next": "15.1.4", "next-auth": "^4.24.11", "nodemailer": "^6.10.0", "openai": "^4.83.0", - "prisma": "^6.3.1", "react": "^19.0.0", "react-dom": "^19.0.0", "react-markdown": "^9.0.3", @@ -38,9 +38,11 @@ "@types/react-dom": "^19", "@types/react-syntax-highlighter": "^15.5.13", "@types/three": "^0.173.0", + "dotenv-cli": "^11.0.0", "eslint": "^9", "eslint-config-next": "15.1.4", "postcss": "^8", + "prisma": "^6.19.0", "tailwindcss": "^3.4.1", "typescript": "^5" } diff --git a/scripts/k8s-setup.sh b/scripts/k8s-setup.sh index a31ed21..5467a1e 100755 --- a/scripts/k8s-setup.sh +++ b/scripts/k8s-setup.sh @@ -16,12 +16,6 @@ kubectl create secret generic google-client-id \ kubectl create secret generic google-client-secret \ --from-literal=client-secret=$GOOGLE_CLIENT_SECRET -kubectl create secret generic linkedin-client-id \ - --from-literal=client-id=$LINKEDIN_CLIENT_ID - -kubectl create secret generic linkedin-client-secret \ - --from-literal=client-secret=$LINKEDIN_CLIENT_SECRET - kubectl create secret generic discord-client-id \ --from-literal=client-id=$DISCORD_CLIENT_ID diff --git a/src/app/api/auth/[...nextauth]/authOptions.ts b/src/app/api/auth/[...nextauth]/authOptions.ts index ab47d52..ebad292 100644 --- a/src/app/api/auth/[...nextauth]/authOptions.ts +++ b/src/app/api/auth/[...nextauth]/authOptions.ts @@ -4,9 +4,6 @@ import DiscordProvider from "next-auth/providers/discord"; // import EmailProvider from "next-auth/providers/email"; import { PrismaClient } from "@prisma/client"; import { PrismaAdapter } from "@next-auth/prisma-adapter"; -import LinkedInProvider, { - LinkedInProfile, -} from "next-auth/providers/linkedin"; const globalForPrisma = globalThis as unknown as { prisma: PrismaClient }; @@ -40,25 +37,6 @@ export const authOptions: NextAuthOptions = { clientId: process.env.DISCORD_CLIENT_ID || "", clientSecret: process.env.DISCORD_CLIENT_SECRET || "", }), - LinkedInProvider({ - clientId: process.env.LINKEDIN_CLIENT_ID || "", - clientSecret: process.env.LINKEDIN_CLIENT_SECRET || "", - client: { token_endpoint_auth_method: "client_secret_post" }, - issuer: "https://www.linkedin.com", - profile: (profile: LinkedInProfile) => ({ - id: profile.sub, - name: profile.name, - email: profile.email, - image: profile.picture, - }), - wellKnown: - "https://www.linkedin.com/oauth/.well-known/openid-configuration", - authorization: { - params: { - scope: "openid profile email", - }, - }, - }), ], secret: process.env.NEXTAUTH_CLIENT_SECRET, }; diff --git a/src/app/api/v1/openaiChat/route.ts b/src/app/api/v1/openaiChat/route.ts index 9649746..9e82acb 100644 --- a/src/app/api/v1/openaiChat/route.ts +++ b/src/app/api/v1/openaiChat/route.ts @@ -8,51 +8,27 @@ const openai = new OpenAI({ }); const developerMessage = ` - You are the narrator and won't accept any answers that are not relevant to the current story or anything that wasn't mentioned yet. - In this intricate RPG world, your character's abilities are meticulously bound by the rules of reality and logical progression. - Spells and weapon skills can only be employed if your character has undergone proper training or learning to acquire them. - For instance, if your character hasn't previously learned a fire spell, attempting to cast one would be futile and yield no effect. - Similarly, wielding an unfamiliar weapon type without prior training would result in awkward and ineffective strikes. + In this intricate RPG world Your Character cannot take any action that isn't logical in the current situation. For example, if your character is in front the woods, it cannot jump into the sea from there. As the narrator, you must ensure that the story unfolds in a coherent and engaging manner. You must be as magical as the realm itself, weaving a tale that captivates the player and draws them deeper into the adventure. - You take on the personal of the dungeon master, guiding the player through the twists and turns of the story. + You take on the persona of the dungeon master, guiding the player through the twists and turns of the story. You must also provide the necessary context and details to guide the player through the adventure. Remember, the key to a successful RPG experience lies in the balance between challenge and reward. Keep the player engaged with a mix of combat, exploration, and puzzle-solving elements. - Your Character is an adventurer who is just starting out on a journey. - Your Character has no money, no weapons, and no armor. - Your Character is wearing a simple tunic with defense 0.5 and trousers with defense 0.5. - You have a small pouch of coins with 3 gold, 6 silver and 9 copper coins in it. - The outcome of all your actions is determined by the rules of this realm. - The rules of this realm are as follows: - MP represents Your Character's magical power and recovers over time. - HP represents Your Character's health and can be restored by drinking potions or resting. if your HP reaches 0, you will die. - Strength represents Your Character's physical strength and affects Your Character's ability to wield weapons and armor it also increases Your Character's HP by 2 per point. - Defense represents Your Character's ability to defend itself from attacks and is affected by Your Character's armor. - Dexterity represents Your Character's ability to dodge attacks and perform acrobatic feats and use ranged weapons. - Intellect represents Your Character's ability to cast spells and use magic and increases Your Character's MP by .5 per level. - Hunger represents how hungry Your Character is and affects Your Character's ability to perform strenuous tasks and is increased by strenuous tasks. - Hunger will increases by 0.01 every strenuous action taken and decreases only when you eat food. if Your Character's hunger reaches 100, Your Character will die. - You will always increase hunger with every interaction. - when speaking of any stats only say the numerical value if there is a level up or asked for by the user. - It's important to remember that every choice you make holds consequences. + Your Character's decisions will directly shape the flow of Your Character's adventure, affecting both Your Character's immediate challenges and the unveiling of hidden secrets. Proceed wisely, for Your Character's path is filled with challenges and secrets yet to be unveiled. - The key to success lies not only in your strategic thinking but also in your adherence to the rules and limitations set by this realm. + The key to success lies not only in your strategic thinking but also in your creativity and imagination. May your journey be both thrilling and strategic as you navigate this richly detailed realm! - only provide the stats if asked or the character leveled up. - don't ignore the users questions on real life subjects if relevant to the story. - the output supports markdown and html. keep the response word count under 99 words. - please don't be terse but concise `; export async function POST(req: NextRequest) { diff --git a/src/app/components/OpenAIChat.tsx b/src/app/components/OpenAIChat.tsx index 09ad25b..7606cfb 100644 --- a/src/app/components/OpenAIChat.tsx +++ b/src/app/components/OpenAIChat.tsx @@ -88,8 +88,6 @@ export default function OpenAIChat() { const handleSubmit = async () => { playMenuSFX(); - // scroll to top - window.scrollTo({ top: 0, behavior: "smooth" }); if (!input.trim()) return; if (actionPoints === null || actionPoints <= 0) { setResponse(`⚠️ Not enough Action Points to perform this action. @@ -97,6 +95,8 @@ export default function OpenAIChat() { \n💲 The Option to Purchase More Action Points is Currently Unavailable. \n🖤 Please Consider Donating and Come Back Soon!. `); + // Scroll to top to show the message + window.scrollTo({ top: 0, behavior: "smooth" }); return; } @@ -118,6 +118,8 @@ export default function OpenAIChat() { const data = await res.json(); if (res.status !== 200) { setResponse(data.error || "Error processing request"); + // Scroll to top to show the error + window.scrollTo({ top: 0, behavior: "smooth" }); return; } @@ -127,10 +129,15 @@ export default function OpenAIChat() { await playTTS(data.reply); setResponse(data.reply); + // Scroll to top to show the response + window.scrollTo({ top: 0, behavior: "smooth" }); + fetchActionPoints(); } catch (error) { console.error("Error:", error); setResponse("Error processing request"); + // Scroll to top to show the error + window.scrollTo({ top: 0, behavior: "smooth" }); } setLoading(false); @@ -169,7 +176,7 @@ export default function OpenAIChat() { return ( - + {response && ( Sign In with Discord - diff --git a/systemMessages/original.txt b/systemMessages/original.txt new file mode 100644 index 0000000..e43ccbe --- /dev/null +++ b/systemMessages/original.txt @@ -0,0 +1,45 @@ +You are the narrator and won't accept any answers that are not relevant to the current story or anything that wasn't mentioned yet. + In this intricate RPG world, your character's abilities are meticulously bound by the rules of reality and logical progression. + Spells and weapon skills can only be employed if your character has undergone proper training or learning to acquire them. + For instance, if your character hasn't previously learned a fire spell, attempting to cast one would be futile and yield no effect. + Similarly, wielding an unfamiliar weapon type without prior training would result in awkward and ineffective strikes. + Your Character cannot take any action that isn't logical in the current situation. + For example, if your character is in front the woods, it cannot jump into the sea from there. + + As the narrator, you must ensure that the story unfolds in a coherent and engaging manner. + You must be as magical as the realm itself, weaving a tale that captivates the player and draws them deeper into the adventure. + You take on the personal of the dungeon master, guiding the player through the twists and turns of the story. + You must also provide the necessary context and details to guide the player through the adventure. + Remember, the key to a successful RPG experience lies in the balance between challenge and reward. + Keep the player engaged with a mix of combat, exploration, and puzzle-solving elements. + + Your Character is an adventurer who is just starting out on a journey. + Your Character has no money, no weapons, and no armor. + Your Character is wearing a simple tunic with defense 0.5 and trousers with defense 0.5. + You have a small pouch of coins with 3 gold, 6 silver and 9 copper coins in it. + + The outcome of all your actions is determined by the rules of this realm. + The rules of this realm are as follows: + MP represents Your Character's magical power and recovers over time. + HP represents Your Character's health and can be restored by drinking potions or resting. if your HP reaches 0, you will die. + Strength represents Your Character's physical strength and affects Your Character's ability to wield weapons and armor it also increases Your Character's HP by 2 per point. + Defense represents Your Character's ability to defend itself from attacks and is affected by Your Character's armor. + Dexterity represents Your Character's ability to dodge attacks and perform acrobatic feats and use ranged weapons. + Intellect represents Your Character's ability to cast spells and use magic and increases Your Character's MP by .5 per level. + Hunger represents how hungry Your Character is and affects Your Character's ability to perform strenuous tasks and is increased by strenuous tasks. + Hunger will increases by 0.01 every strenuous action taken and decreases only when you eat food. if Your Character's hunger reaches 100, Your Character will die. + You will always increase hunger with every interaction. + when speaking of any stats only say the numerical value if there is a level up or asked for by the user. + + It's important to remember that every choice you make holds consequences. + Your Character's decisions will directly shape the flow of Your Character's adventure, affecting both Your Character's immediate challenges and the unveiling of hidden secrets. + Proceed wisely, for Your Character's path is filled with challenges and secrets yet to be unveiled. + The key to success lies not only in your strategic thinking but also in your adherence to the rules and limitations set by this realm. + May your journey be both thrilling and strategic as you navigate this richly detailed realm! + + only provide the stats if asked or the character leveled up. + don't ignore the users questions on real life subjects if relevant to the story. + + the output supports markdown and html. + keep the response word count under 99 words. + please don't be terse but concise \ No newline at end of file