commit -3

This commit is contained in:
allinix 2025-02-17 20:10:24 +05:30
parent bdfe11f039
commit 33d251cec0
15 changed files with 34242 additions and 0 deletions

7
next/.dockerignore Normal file
View File

@ -0,0 +1,7 @@
**/.git
**/node_modules
**/idea
**/.next
**/aws
**/.husky
**/venv

73
next/.eslintrc.json Normal file
View File

@ -0,0 +1,73 @@
{
"overrides": [
{
"extends": [
"plugin:@typescript-eslint/recommended-requiring-type-checking"
],
"files": [
"*.ts",
"*.tsx"
],
"parserOptions": {
"project": "tsconfig.json"
}
}
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
"plugins": [
"@typescript-eslint", "import"
],
"extends": [
"next/core-web-vitals",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@typescript-eslint/consistent-type-imports": "warn",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-restricted-imports": [
"error",
{
"paths": [
{
"name": "react-i18next",
"importNames": [
"useTranslation"
],
"message": "Import useTranslation from next-i18next instead."
}
]
}
],
"import/no-unresolved": "error",
// "import/no-named-as-default-member": "off",
"import/order": [
"error",
{
"groups": [
"builtin", // Built-in imports (come from NodeJS native) go first
"external", // <- External imports
"internal", // <- Absolute imports
["sibling", "parent"], // <- Relative imports, the sibling and parent types they can be mingled together
"index", // <- index imports
"unknown" // <- unknown
],
"newlines-between": "always",
"alphabetize": {
/* sort in ascending order. Options: ["ignore", "asc", "desc"] */
"order": "asc",
/* ignore case. Options: [true, false] */
"caseInsensitive": true
}
}
]
}
}

53
next/.gitignore vendored Normal file
View File

@ -0,0 +1,53 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# database
/prisma/db.sqlite
/prisma/db.sqlite-journal
/db/db.sqlite
# next.js
/.next/
/out/
next-env.d.ts
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*
# local env files
# do not commit any .env files to git, except for the .env.example file. https://create.t3.gg/en/usage/env-variables#using-environment-variables
.env*
# vercel
.vercel
# typescript
*.tsbuildinfo
.idea
.swc
# extracted language files
/public/locales/$LOCALES
.eslintcache
# Sentry Auth Token
.sentryclirc
/volumes/

39
next/Dockerfile Normal file
View File

@ -0,0 +1,39 @@
# Use the official Node.js image as the base image
FROM node:19-alpine
ARG NODE_ENV
ENV NODE_ENV=$NODE_ENV
# Needed for the wait-for-db script
RUN apk add --no-cache netcat-openbsd
# Set the working directory
WORKDIR /next
# Copy package.json and package-lock.json to the working directory
COPY package*.json ./
# Install dependencies
RUN npm ci
# Copy the wait-for-db.sh script
COPY wait-for-db.sh /usr/local/bin/wait-for-db.sh
RUN chmod +x /usr/local/bin/wait-for-db.sh
# Copy the rest of the application code
COPY . .
COPY entrypoint.sh /
# Ensure correct line endings after these files are edited by windows
RUN apk add --no-cache dos2unix netcat-openbsd \
&& dos2unix /entrypoint.sh
# Expose the port the app will run on
EXPOSE 3000
ENTRYPOINT ["sh", "/entrypoint.sh"]
# Start the application
CMD ["npm", "run", "dev"]

28
next/entrypoint.sh Normal file
View File

@ -0,0 +1,28 @@
#!/usr/bin/env sh
cd /next
dos2unix wait-for-db.sh
# copy .env file if not exists
[ ! -f .env ] && [ -f .env.example ] && cp .env.example .env
cp .env .env.temp
dos2unix .env.temp
cat .env.temp > .env
rm .env.temp
source .env
# Ensure DB is available before running Prisma commands
./wait-for-db.sh agentgpt_db 3307
# Run Prisma commands
if [[ ! -f "/app/prisma/${DATABASE_URL:5}" ]]; then
npx prisma migrate deploy --name init
npx prisma db push
fi
# Generate Prisma client
npx prisma generate
# run cmd
exec "$@"

19
next/jest.config.cjs Normal file
View File

@ -0,0 +1,19 @@
const nextJest = require("next/jest");
const createJestConfig = nextJest({
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
dir: "./",
});
// Add any custom config to be passed to Jest
/** @type {import('jest').Config} */
const customJestConfig = {
// Add more setup options before each test is run
// setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
// if using TypeScript with a baseUrl set to the root directory then you need the below for alias' to work
moduleDirectories: ["node_modules", "<rootDir>/"],
testEnvironment: "jest-environment-jsdom",
};
// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
module.exports = createJestConfig(customJestConfig);

View File

@ -0,0 +1,36 @@
module.exports = {
i18n: {
defaultLocale: "en",
locales: [
"en",
"hu",
"fr",
"de",
"it",
"ja",
"lt",
"zh",
"zhtw",
"ko",
"pl",
"pt",
"ro",
"ru",
"uk",
"es",
"nl",
"sk",
"hr",
"tr",
],
},
localePath: typeof window === "undefined" ? "./public/locales" : "/locales",
debug: false,
reloadOnPrerender: process.env.NODE_ENV === "development",
defaultNS: "common",
ns: ["common", "help", "settings", "chat", "agent", "errors", "languages", "drawer", "indexPage"],
react: {
useSuspense: false,
},
saveMissing: true,
};

47
next/next.config.mjs Normal file
View File

@ -0,0 +1,47 @@
import nextI18NextConfig from "./next-i18next.config.js";
// @ts-check
/**
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation.
* This is especially useful for Docker builds.
*/
!process.env.SKIP_ENV_VALIDATION && (await import("./src/env/server.mjs"));
/** @type {import("next").NextConfig} */
const config = {
reactStrictMode: true,
/* If trying out the experimental appDir, comment the i18n config out
* @see https://github.com/vercel/next.js/issues/41980 */
i18n: nextI18NextConfig.i18n,
webpack: function(config, options) {
config.experiments = { asyncWebAssembly: true, layers: true };
config.watchOptions = {
poll: 1000,
aggregateTimeout: 300
};
config.module.rules.push({
test: /\.svg$/i,
issuer: /\.[jt]sx?$/,
use: ['@svgr/webpack'],
})
return config;
},
rewrites() {
return {
beforeFiles: [
{
source: '/:path*',
has: [
{
type: 'host',
value: 'reworkd.ai',
},
],
destination: '/landing-page',
},
]
}
}
};
export default config;

33492
next/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

107
next/package.json Normal file
View File

@ -0,0 +1,107 @@
{
"name": "agent-gpt",
"version": "1.0.0",
"private": true,
"engines": {
"node": ">=18.0.0 <19.0.0"
},
"scripts": {
"build": "next build --no-lint",
"dev": "next dev",
"postinstall": "prisma generate",
"lint": "cross-env SKIP_ENV_VALIDATION=1 next lint --fix",
"start": "next start",
"prepare": "cd .. && husky install next/.husky",
"test": "cross-env SKIP_ENV_VALIDATION=1 jest"
},
"dependencies": {
"@headlessui/react": "^1.7.14",
"@next-auth/prisma-adapter": "^1.0.5",
"@prisma/client": "^4.9.0",
"@privy-io/react-auth": "^2.0.8",
"@radix-ui/react-switch": "^1.0.2",
"@radix-ui/react-toast": "^1.1.4",
"@radix-ui/react-tooltip": "^1.0.5",
"@react-pdf/renderer": "^3.1.9",
"@sid-hq/sid": "^3.1.0",
"@splinetool/react-spline": "^2.2.6",
"@tailwindcss/forms": "^0.5.3",
"@tanstack/react-query": "^4.29.14",
"@trpc/client": "^10.21.1",
"@trpc/next": "^10.21.1",
"@trpc/react-query": "^10.21.1",
"@trpc/server": "^10.9.0",
"@types/lodash": "^4.14.194",
"@uiball/loaders": "^1.3.0",
"@vercel/analytics": "^1.0.1",
"@vercel/edge": "^0.3.4",
"axios": "^0.26.0",
"cheerio": "^1.0.0-rc.12",
"clsx": "^1.2.1",
"cobe": "^0.6.3",
"cookies-next": "^2.1.2",
"framer-motion": "^10.12.8",
"gray-matter": "^4.0.3",
"html-to-image": "^1.11.11",
"i18next": "^22.4.15",
"lodash": "^4.17.21",
"lucide-react": "^0.473.0",
"motion": "^12.0.1",
"next": "^13.5.6",
"next-auth": "4.20.1",
"next-i18next": "^13.2.2",
"nextjs-google-analytics": "^2.3.3",
"openai": "^4.14.2",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-i18next": "^12.3.1",
"react-icons": "^4.11.0",
"react-markdown": "^8.0.7",
"react-type-animation": "^3.1.0",
"rehype-highlight": "^6.0.0",
"remark-gfm": "^3.0.1",
"simplex-noise": "^4.0.3",
"superjson": "1.9.1",
"tailwind-merge": "^2.6.0",
"tailwindcss-radix": "^2.8.0",
"uuid": "^9.0.1",
"viem": "^2.23.2",
"zod": "^3.22.2",
"zustand": "^4.3.7"
},
"devDependencies": {
"@svgr/webpack": "^8.0.1",
"@tailwindcss/typography": "^0.5.9",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^14.0.0",
"@types/node": "^18.11.18",
"@types/prettier": "^2.7.3",
"@types/react": "^18.0.26",
"@types/react-dom": "^18.2.7",
"@types/uuid": "^9.0.5",
"@typescript-eslint/eslint-plugin": "^5.59.8",
"@typescript-eslint/parser": "^5.59.1",
"autoprefixer": "^10.4.7",
"cross-env": "^7.0.3",
"eslint": "^8.43.0",
"eslint-config-next": "13.4.1",
"eslint-plugin-import": "^2.27.5",
"husky": "^8.0.3",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.7.0",
"lint-staged": "^13.2.1",
"postcss": "^8.4.24",
"prettier": "^2.8.8",
"prettier-plugin-tailwindcss": "^0.2.8",
"prisma": "^4.9.0",
"tailwindcss": "^3.3.2",
"typescript": "^5.1.3"
},
"ct3aMetadata": {
"initVersion": "7.4.0"
},
"lint-staged": {
"*.js": "eslint --cache --fix",
"*.{js,css,md}": "prettier --write"
}
}

6
next/postcss.config.cjs Normal file
View File

@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};

5
next/prettier.config.cjs Normal file
View File

@ -0,0 +1,5 @@
/** @type {import("prettier").Config} */
module.exports = {
plugins: [require.resolve("prettier-plugin-tailwindcss")],
printWidth: 100
};

290
next/tailwind.config.cjs Normal file
View File

@ -0,0 +1,290 @@
/** @type {import("tailwindcss").Config} */
const defaultTheme = require("tailwindcss/defaultTheme");
module.exports = {
content: [
"./src/**/*.{js,ts,jsx,tsx}",
"./node_modules/@tremor/**/*.{js,ts,jsx,tsx}",
],
darkMode: "class",
theme: {
transparent: "transparent",
current: "currentColor",
screens: {
"xs": "300px",
"xmd": "850px",
"sm-h": { "raw": "(min-height: 700px)" },
"md-h": { "raw": "(min-height: 800px)" },
"lg-h": { "raw": "(min-height: 1000px)" },
...defaultTheme.screens
},
extend: {
animation: {
ripple: "ripple var(--duration,2s) ease calc(var(--i, 0)*.2s) infinite",
},
keyframes: {
ripple: {
"0%, 100%": {
transform: "translate(-50%, -50%) scale(1)",
},
"50%": {
transform: "translate(-50%, -50%) scale(0.9)",
},
},
},
typography: (theme) => ({
DEFAULT: {
css: {
color: theme('colors.gray.900'), // Change color as per your need
a: {
color: theme('colors.blue.500'), // Change color as per your need
'&:hover': {
color: theme('colors.blue.600'), // Change color as per your need
},
},
'h1,h2,h3,h4': {
color: theme('colors.white'), // This is where you change your heading color
},
'b,strong': {
color: theme('colors.gray.500'), // This is where you change your bold text color
},
},
},
}),
backgroundImage: {
'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))', // Add bg-gradient-radial for radial gradients
},
boxShadow: {
"xs": "0px 0px 0px 0.75px rgba(0, 0, 0, 0.05), 0px 2px 4px rgba(0, 0, 0, 0.05)",
// light
"tremor-input": "0 1px 2px 0 rgb(0 0 0 / 0.05)",
"tremor-card": "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",
"tremor-dropdown": "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",
// dark
"dark-tremor-input": "0 1px 2px 0 rgb(0 0 0 / 0.05)",
"dark-tremor-card": "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",
"dark-tremor-dropdown": "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",
"depth-1": "0 2px 4px 0 rgba(0, 0, 0, 0.05), 0 0 0 0.75px rgba(0, 0, 0, 0.05), 0 0 12px -2px rgba(0, 0, 0, 0.05)",
"depth-2": "0 0 0 0.75px rgba(0, 0, 0, 0.05), 0 8px 32px 0 rgba(39, 40, 51, 0.05), 0 4px 16px 0 rgba(39, 40, 51, 0.05)",
"depth-3": "0 0 0 0.75px rgba(0, 0, 0, 0.05), 0 8px 32px 0 rgba(39, 40, 51, 0.05), 0 4px 16px 0 rgba(39, 40, 51, 0.05), 0 8px 24px -4px rgba(0, 0, 0, 0.20)"
},
borderRadius: {
"tremor-small": "0.375rem",
"tremor-default": "0.5rem",
"tremor-full": "9999px",
},
fontSize: {
"tremor-label": ["0.75rem"],
"tremor-default": ["0.875rem", { lineHeight: "1.25rem" }],
"tremor-title": ["1.125rem", { lineHeight: "1.75rem" }],
"tremor-metric": ["1.875rem", { lineHeight: "2.25rem" }],
},
fontFamily: {
inter: ["Inter", ...defaultTheme.fontFamily.sans]
},
colors: {
slate: {
1: "#FBFCFD",
2: "#F8F9FA",
3: "#F1F3F5",
4: "#ECEEF0",
5: "#E6E8EB",
6: "#DFE3E6",
7: "#D7DBDF",
8: "#C1C8CD",
9: "#889096",
10: "#7E868C",
11: "#687076",
12: "#11181C",
},
// light mode
tremor: {
brand: {
faint: "#eff6ff", // blue-50
muted: "#bfdbfe", // blue-200
subtle: "#60a5fa", // blue-400
DEFAULT: "#3b82f6", // blue-500
emphasis: "#1d4ed8", // blue-700
inverted: "#ffffff", // white
},
background: {
muted: "#f9fafb", // gray-50
subtle: "#f3f4f6", // gray-100
DEFAULT: "#ffffff", // white
emphasis: "#374151", // gray-700
},
border: {
DEFAULT: "#e5e7eb", // gray-200
},
ring: {
DEFAULT: "#e5e7eb", // gray-200
},
content: {
subtle: "#9ca3af", // gray-400
DEFAULT: "#6b7280", // gray-500
emphasis: "#374151", // gray-700
strong: "#111827", // gray-900
inverted: "#ffffff", // white
},
},
// dark mode
"dark-tremor": {
brand: {
faint: "#0B1229", // custom
muted: "#172554", // blue-950
subtle: "#1e40af", // blue-800
DEFAULT: "#3b82f6", // blue-500
emphasis: "#60a5fa", // blue-400
inverted: "#030712", // gray-950
},
background: {
muted: "#131A2B", // custom
subtle: "#1f2937", // gray-800
DEFAULT: "#111827", // gray-900
emphasis: "#d1d5db", // gray-300
},
border: {
DEFAULT: "#1f2937", // gray-800
},
ring: {
DEFAULT: "#1f2937", // gray-800
},
content: {
subtle: "#4b5563", // gray-600
DEFAULT: "#6b7280", // gray-600
emphasis: "#e5e7eb", // gray-200
strong: "#f9fafb", // gray-50
inverted: "#000000", // black
},
},
blue: {
base: {
dark: "hsl(199, 89%, 48%)",
light: "hsl(199, 89%, 48%)",
},
hover: {
dark: "hsl(199, 80%, 30%)",
light: "hsl(199, 90%, 40%)",
},
focusVisible: {
dark: "hsl(208, 79%, 51%)",
light: "hsl(208, 79%, 55%)",
},
},
amber: {
base: {
dark: "hsl(39, 100%, 50%)",
light: "hsl(45, 100%, 50%)",
},
hover: {
dark: "hsl(39, 100%, 40%)",
light: "hsl(45, 100%, 45%)",
},
focusVisible: {
dark: "hsl(39, 85%, 30%)",
light: "hsl(45, 85%, 35%)",
}
},
red: {
base: {
dark: "hsl(3, 100%, 61%)",
light: "hsl(3, 100%, 59%)",
},
hover: {
dark: "hsl(3, 100% 45%)",
light: "hsl(3, 100%, 40%)",
},
focusVisible: {
dark: "hsl(3, 85%, 40%)",
light: "hsl(3, 85%, 35%)",
}
},
green: {
base: {
dark: "hsl(143, 71%, 45%)",
light: "hsl(143, 71%, 40%)",
},
hover: {
dark: "hsl(143, 65%, 40%)",
light: "hsl(143, 71%, 33%)",
},
focusVisible: {
dark: "hsl(143, 65%, 35%)",
light: "hsl(143, 71%, 30%)",
}
},
shade: {
100: {
dark: "hsl(0, 0%, 100%)",
light: "hsl(0, 0%, 0%)",
},
200: {
dark: "hsl(240, 3%, 69%)",
light: "hsl(240, 2%, 30%)",
},
300: {
dark: "hsl(240, 2%, 49%)",
light: "hsl(240, 2%, 57%)",
},
400: {
dark: "hsl(240, 1%, 33%)",
light: "hsl(240, 3%, 69%)",
},
500: {
dark: "hsl(240, 1%, 27%)",
light: "hsl(240, 5%, 79%)",
},
600: {
dark: "hsl(240, 2%, 22%)",
light: "hsl(240, 6%, 83%)",
},
700: {
dark: "hsl(240, 3%, 15%)",
light: "hsl(240, 11%, 91%)",
},
800: {
dark: "hsl(240, 6%, 10%)",
light: "hsl(240, 24%, 96%)",
}
}
},
},
},
safelist: [
{
pattern:
/^(bg-(?:slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-(?:50|100|200|300|400|500|600|700|800|900|950))$/,
variants: ["hover", "ui-selected"],
},
{
pattern:
/^(text-(?:slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-(?:50|100|200|300|400|500|600|700|800|900|950))$/,
variants: ["hover", "ui-selected"],
},
{
pattern:
/^(border-(?:slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-(?:50|100|200|300|400|500|600|700|800|900|950))$/,
variants: ["hover", "ui-selected"],
},
{
pattern:
/^(ring-(?:slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-(?:50|100|200|300|400|500|600|700|800|900|950))$/,
},
{
pattern:
/^(stroke-(?:slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-(?:50|100|200|300|400|500|600|700|800|900|950))$/,
},
{
pattern:
/^(fill-(?:slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-(?:50|100|200|300|400|500|600|700|800|900|950))$/,
},
],
plugins: [
require('@tailwindcss/typography'),
require('@tailwindcss/forms'),
require("tailwindcss-radix"),
]
};

29
next/tsconfig.json Normal file
View File

@ -0,0 +1,29 @@
{
"compilerOptions": {
"noImplicitAny": false,
"target": "es2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"noUncheckedIndexedAccess": true
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
"**/*.cjs",
"**/*.mjs",
"**/*.js"
],
"exclude": ["node_modules", "venv"]
}

11
next/wait-for-db.sh Normal file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env sh
host="$1"
port="$2"
until echo "SELECT 1;" | nc "$host" "$port" > /dev/null 2>&1; do
>&2 echo "Database is unavailable - Sleeping..."
sleep 2
done
>&2 echo "Database is available! Continuing..."