Spaces:
Runtime error
Runtime error
Upload 10 files
Browse files- ui/README.md +55 -0
- ui/next-env.d.ts +5 -0
- ui/next.config.ts +15 -0
- ui/package-lock.json +0 -0
- ui/package.json +51 -0
- ui/postcss.config.mjs +8 -0
- ui/tailwind.config.ts +31 -0
- ui/text.txt +0 -0
- ui/tsconfig.json +27 -0
- ui/tsconfig.worker.json +15 -0
ui/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
|
| 2 |
+
|
| 3 |
+
## Getting Started
|
| 4 |
+
|
| 5 |
+
First, run the development server:
|
| 6 |
+
|
| 7 |
+
```bash
|
| 8 |
+
npm run dev
|
| 9 |
+
# or
|
| 10 |
+
yarn dev
|
| 11 |
+
# or
|
| 12 |
+
pnpm dev
|
| 13 |
+
# or
|
| 14 |
+
bun dev
|
| 15 |
+
```
|
| 16 |
+
|
| 17 |
+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
| 18 |
+
|
| 19 |
+
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
|
| 20 |
+
|
| 21 |
+
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
|
| 22 |
+
|
| 23 |
+
## Database Modes
|
| 24 |
+
|
| 25 |
+
Use the `NEXT_PUBLIC_DB_MODE` environment variable to control how UI data is persisted:
|
| 26 |
+
|
| 27 |
+
- `server` (default): interacts with the shared SQLite database through Prisma. Supports local job orchestration.
|
| 28 |
+
- `browser`: stores jobs and settings in the user's browser (localStorage). This mode only supports Hugging Face Jobs workflows; local GPU training controls are disabled and the GPU monitor shows a cloud-mode status banner.
|
| 29 |
+
|
| 30 |
+
When running in browser mode every visitor sees only their own jobs, settings, and dataset catalog (all stored in their browser), making the UI safe to host for multiple users without sharing the SQLite file.
|
| 31 |
+
|
| 32 |
+
## Hugging Face Authentication
|
| 33 |
+
|
| 34 |
+
Users can authenticate either by pasting a personal access token or via the Hugging Face OAuth flow. To enable OAuth set the following environment variables for the UI:
|
| 35 |
+
|
| 36 |
+
- `HF_OAUTH_CLIENT_ID` – the application client ID
|
| 37 |
+
- `HF_OAUTH_CLIENT_SECRET` – the application secret (server-side only)
|
| 38 |
+
- `NEXT_PUBLIC_HF_OAUTH_CLIENT_ID` – the client ID exposed to the browser (usually the same as `HF_OAUTH_CLIENT_ID`)
|
| 39 |
+
|
| 40 |
+
If these values are not provided the UI falls back to manual token entry. In multi-user/browser mode the authenticated token and namespace are stored per browser session.
|
| 41 |
+
|
| 42 |
+
## Learn More
|
| 43 |
+
|
| 44 |
+
To learn more about Next.js, take a look at the following resources:
|
| 45 |
+
|
| 46 |
+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
| 47 |
+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
| 48 |
+
|
| 49 |
+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
|
| 50 |
+
|
| 51 |
+
## Deploy on Vercel
|
| 52 |
+
|
| 53 |
+
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
| 54 |
+
|
| 55 |
+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
|
ui/next-env.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/// <reference types="next" />
|
| 2 |
+
/// <reference types="next/image-types/global" />
|
| 3 |
+
|
| 4 |
+
// NOTE: This file should not be edited
|
| 5 |
+
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
ui/next.config.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { NextConfig } from 'next';
|
| 2 |
+
|
| 3 |
+
const nextConfig: NextConfig = {
|
| 4 |
+
typescript: {
|
| 5 |
+
// Remove this. Build fails because of route types
|
| 6 |
+
ignoreBuildErrors: true,
|
| 7 |
+
},
|
| 8 |
+
experimental: {
|
| 9 |
+
serverActions: {
|
| 10 |
+
bodySizeLimit: '100mb',
|
| 11 |
+
},
|
| 12 |
+
},
|
| 13 |
+
};
|
| 14 |
+
|
| 15 |
+
export default nextConfig;
|
ui/package-lock.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
ui/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "ai-toolkit-ui",
|
| 3 |
+
"version": "0.1.0",
|
| 4 |
+
"private": true,
|
| 5 |
+
"scripts": {
|
| 6 |
+
"dev": "concurrently -k -n WORKER,UI \"ts-node-dev --respawn --watch cron --transpile-only cron/worker.ts\" \"next dev --turbopack\"",
|
| 7 |
+
"build": "tsc -p tsconfig.worker.json && next build",
|
| 8 |
+
"start": "concurrently --restart-tries -1 --restart-after 1000 -n WORKER,UI \"node dist/worker.js\" \"next start --port 8675\"",
|
| 9 |
+
"build_and_start": "npm install && npm run update_db && npm run build && npm run start",
|
| 10 |
+
"lint": "next lint",
|
| 11 |
+
"update_db": "npx prisma generate && npx prisma db push",
|
| 12 |
+
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,css,scss}\""
|
| 13 |
+
},
|
| 14 |
+
"dependencies": {
|
| 15 |
+
"@headlessui/react": "^2.2.0",
|
| 16 |
+
"@huggingface/hub": "^2.5.2",
|
| 17 |
+
"@monaco-editor/react": "^4.7.0",
|
| 18 |
+
"@prisma/client": "^6.3.1",
|
| 19 |
+
"archiver": "^7.0.1",
|
| 20 |
+
"axios": "^1.7.9",
|
| 21 |
+
"classnames": "^2.5.1",
|
| 22 |
+
"form-data": "^4.0.4",
|
| 23 |
+
"lucide-react": "^0.475.0",
|
| 24 |
+
"next": "15.1.7",
|
| 25 |
+
"node-cache": "^5.1.2",
|
| 26 |
+
"prisma": "^6.3.1",
|
| 27 |
+
"react": "^19.0.0",
|
| 28 |
+
"react-dom": "^19.0.0",
|
| 29 |
+
"react-dropzone": "^14.3.5",
|
| 30 |
+
"react-global-hooks": "^1.3.5",
|
| 31 |
+
"react-icons": "^5.5.0",
|
| 32 |
+
"react-select": "^5.10.1",
|
| 33 |
+
"sqlite3": "^5.1.7",
|
| 34 |
+
"uuid": "^11.1.0",
|
| 35 |
+
"yaml": "^2.7.0"
|
| 36 |
+
},
|
| 37 |
+
"devDependencies": {
|
| 38 |
+
"@types/archiver": "^6.0.3",
|
| 39 |
+
"@types/node": "^20",
|
| 40 |
+
"@types/react": "^19",
|
| 41 |
+
"@types/react-dom": "^19",
|
| 42 |
+
"concurrently": "^9.1.2",
|
| 43 |
+
"postcss": "^8",
|
| 44 |
+
"prettier": "^3.5.1",
|
| 45 |
+
"prettier-basic": "^1.0.0",
|
| 46 |
+
"tailwindcss": "^3.4.1",
|
| 47 |
+
"ts-node-dev": "^2.0.0",
|
| 48 |
+
"typescript": "^5"
|
| 49 |
+
},
|
| 50 |
+
"prettier": "prettier-basic"
|
| 51 |
+
}
|
ui/postcss.config.mjs
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/** @type {import('postcss-load-config').Config} */
|
| 2 |
+
const config = {
|
| 3 |
+
plugins: {
|
| 4 |
+
tailwindcss: {},
|
| 5 |
+
},
|
| 6 |
+
};
|
| 7 |
+
|
| 8 |
+
export default config;
|
ui/tailwind.config.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { Config } from 'tailwindcss';
|
| 2 |
+
|
| 3 |
+
const config: Config = {
|
| 4 |
+
content: [
|
| 5 |
+
'./src/pages/**/*.{js,ts,jsx,tsx,mdx}',
|
| 6 |
+
'./src/components/**/*.{js,ts,jsx,tsx,mdx}',
|
| 7 |
+
'./src/app/**/*.{js,ts,jsx,tsx,mdx}',
|
| 8 |
+
],
|
| 9 |
+
darkMode: 'class',
|
| 10 |
+
theme: {
|
| 11 |
+
extend: {
|
| 12 |
+
colors: {
|
| 13 |
+
gray: {
|
| 14 |
+
950: '#0a0a0a',
|
| 15 |
+
900: '#171717',
|
| 16 |
+
800: '#262626',
|
| 17 |
+
700: '#404040',
|
| 18 |
+
600: '#525252',
|
| 19 |
+
500: '#737373',
|
| 20 |
+
400: '#a3a3a3',
|
| 21 |
+
300: '#d4d4d4',
|
| 22 |
+
200: '#e5e5e5',
|
| 23 |
+
100: '#f5f5f5',
|
| 24 |
+
},
|
| 25 |
+
},
|
| 26 |
+
},
|
| 27 |
+
},
|
| 28 |
+
plugins: [],
|
| 29 |
+
};
|
| 30 |
+
|
| 31 |
+
export default config;
|
ui/text.txt
ADDED
|
File without changes
|
ui/tsconfig.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"compilerOptions": {
|
| 3 |
+
"target": "ES2017",
|
| 4 |
+
"lib": ["dom", "dom.iterable", "esnext"],
|
| 5 |
+
"allowJs": true,
|
| 6 |
+
"skipLibCheck": true,
|
| 7 |
+
"strict": true,
|
| 8 |
+
"noEmit": true,
|
| 9 |
+
"esModuleInterop": true,
|
| 10 |
+
"module": "esnext",
|
| 11 |
+
"moduleResolution": "bundler",
|
| 12 |
+
"resolveJsonModule": true,
|
| 13 |
+
"isolatedModules": true,
|
| 14 |
+
"jsx": "preserve",
|
| 15 |
+
"incremental": true,
|
| 16 |
+
"plugins": [
|
| 17 |
+
{
|
| 18 |
+
"name": "next"
|
| 19 |
+
}
|
| 20 |
+
],
|
| 21 |
+
"paths": {
|
| 22 |
+
"@/*": ["./src/*"]
|
| 23 |
+
}
|
| 24 |
+
},
|
| 25 |
+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
| 26 |
+
"exclude": ["node_modules"]
|
| 27 |
+
}
|
ui/tsconfig.worker.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
// tsconfig.worker.json
|
| 3 |
+
"compilerOptions": {
|
| 4 |
+
"module": "commonjs",
|
| 5 |
+
"target": "es2020",
|
| 6 |
+
"outDir": "dist",
|
| 7 |
+
"moduleResolution": "node",
|
| 8 |
+
"types": [
|
| 9 |
+
"node"
|
| 10 |
+
]
|
| 11 |
+
},
|
| 12 |
+
"include": [
|
| 13 |
+
"cron/**/*.ts"
|
| 14 |
+
]
|
| 15 |
+
}
|