diff --git a/README.md b/README.md index 0152d13..e20fa17 100644 --- a/README.md +++ b/README.md @@ -2,20 +2,30 @@ [![CI](https://github.com/EasyIndie/EasyAI/actions/workflows/ci.yml/badge.svg)](https://github.com/EasyIndie/EasyAI/actions/workflows/ci.yml) -EasyAI 是一个可本地运行的统一 LLM 网关平台,包含: -- OneAPI Gateway(统一 `/v1/*` 入口、鉴权、限流、缓存、审计) -- LiteLLM Service(模型别名与上游适配) +EasyAI 是一个可本地运行、免费自部署的统一 LLM 接入层:一份 YAML 配置,屏蔽不同厂商的协议差异。 +- OneAPI Gateway(统一 `/v1/*` 入口、鉴权、限流、Batch API、首页导航,约 750 行) +- LiteLLM Proxy(官方镜像,模型接入面:provider 适配、别名、重试/故障转移、缓存、护栏、密钥/预算/用量控制台) - Batch Worker(异步批处理消费) -- Dashboard / Chat UI +- 控制台:LiteLLM Admin UI(支持中文) +- 可选聊天界面:Open WebUI(`--profile chat`) +- 镜像默认 `ghcr.io/berriai/litellm:main-latest`;可用 `LITELLM_IMAGE` 环境变量固定版本 ## 快速启动(开发环境) ```bash docker compose up -d --build -curl -sS http://localhost:3004/healthz docker compose exec -T ollama ollama pull qwen2.5:0.5b +curl -sS http://localhost:3004/healthz +``` + +可选:中文聊天界面(Open WebUI) + +```bash +docker compose --profile chat up -d ``` +打开:`http://localhost:3004/`(首页)· `http://localhost:3005/ui`(控制台)· `http://localhost:3006`(聊天,可选)。 + 发起一次请求(默认开发 key: `dev-key`): ```bash @@ -48,14 +58,21 @@ BASE_URL=http://localhost:3003 CONFIG_FILE=config/easyai.production.local.yaml . - 首页:`/` - API 文档:`/docs` - OpenAPI JSON:`/openapi.json` -- Dashboard:`/dashboard` -- Chat:`/chat` +- 控制台(LiteLLM Admin UI,右上角可切换中文):`http://localhost:3005/ui`,用户名 `admin`,密码为 `secrets.master_key` +- 聊天:`/chat` → Open WebUI(可选组件) +- `/dashboard` 会 302 到控制台 + +## 升级 LiteLLM + +```bash +LITELLM_IMAGE=ghcr.io/berriai/litellm@sha256: docker compose up -d litellm +./scripts/smoke-compose.sh +``` ## 文档导航 - [用户手册](docs/user-manual.md) - [部署指南](docs/deployment.md) -- [运行手册](docs/operations.md) - [开发与测试](docs/development.md) - [架构说明](docs/architecture.md) - [YAML 密钥管理](docs/yaml-secret-management.md) diff --git a/batch-worker/package-lock.json b/batch-worker/package-lock.json index e450ac7..e68d63c 100644 --- a/batch-worker/package-lock.json +++ b/batch-worker/package-lock.json @@ -8,16 +8,15 @@ "name": "easyai-batch-worker", "version": "0.1.0", "dependencies": { - "js-yaml": "^4.1.1", - "pg": "^8.21.0", - "redis": "^5.12.1" + "js-yaml": "^5.5.0", + "pg": "^8.23.1", + "redis": "^6.3.1" }, "devDependencies": { - "@types/js-yaml": "^4.0.9", - "@types/node": "^25.9.1", - "@types/pg": "^8.20.0", - "tsx": "^4.22.3", - "typescript": "^6.0.3" + "@types/node": "^26.6.6", + "@types/pg": "^8.23.1", + "tsx": "^4.23.15", + "typescript": "^7.0.2" } }, "node_modules/@esbuild/aix-ppc64": { @@ -463,27 +462,24 @@ } }, "node_modules/@redis/bloom": { - "version": "5.12.1", - "resolved": "https://registry.npmjs.org/@redis/bloom/-/bloom-5.12.1.tgz", - "integrity": "sha512-PUUfv+ms7jgPSBVoo/DN4AkPHj4D5TZSd6SbJX7egzBplkYUcKmHRE8RKia7UtZ8bSQbLguLvxVO+asKtQfZWA==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/@redis/bloom/-/bloom-6.3.1.tgz", + "integrity": "sha512-dpF9j2yJDoPzSCaZn0MSB3xzmnXQVJeTSAWJcQVcgbmluwhpFeemmII0cF1t+WYfoVS+shEFq79+MmUItgzJLg==", "license": "MIT", "engines": { - "node": ">= 18.19.0" + "node": ">= 20.0.0" }, "peerDependencies": { - "@redis/client": "^5.12.1" + "@redis/client": "^6.3.1" } }, "node_modules/@redis/client": { - "version": "5.12.1", - "resolved": "https://registry.npmjs.org/@redis/client/-/client-5.12.1.tgz", - "integrity": "sha512-7aPGWeqA3uFm43o19umzdl16CEjK/JQGtSXVPevplTaOU3VJA/rseBC1QvYUz9lLDIMBimc4SW/zrW4S89BaCA==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/@redis/client/-/client-6.3.1.tgz", + "integrity": "sha512-masbfVKULdoAofwddepZxRhWa4w6zvBHn6TRn90TRPrRkVIlGCur3pFqwWaCbMxtYI9twepkz63e/T/tEH8GjA==", "license": "MIT", - "dependencies": { - "cluster-key-slot": "1.1.2" - }, "engines": { - "node": ">= 18.19.0" + "node": ">= 20.0.0" }, "peerDependencies": { "@node-rs/xxhash": "^1.1.0", @@ -499,62 +495,55 @@ } }, "node_modules/@redis/json": { - "version": "5.12.1", - "resolved": "https://registry.npmjs.org/@redis/json/-/json-5.12.1.tgz", - "integrity": "sha512-eOze75esLve4vfqDel7aMX08CNaiLLQS2fV8mpRN9NxPe1rVR4vQyYiW/OgtGUysF6QOr9ANhfxABKNOJfXdKg==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/@redis/json/-/json-6.3.1.tgz", + "integrity": "sha512-fMz4kUwJzEftcU9EMaqsjZcUwzpTQLOYRqhQsAD6uKvZWeamblK13ZhgO5SzVSZVk31jmwLeTRpU5GAl5egfUw==", "license": "MIT", "engines": { - "node": ">= 18.19.0" + "node": ">= 20.0.0" }, "peerDependencies": { - "@redis/client": "^5.12.1" + "@redis/client": "^6.3.1" } }, "node_modules/@redis/search": { - "version": "5.12.1", - "resolved": "https://registry.npmjs.org/@redis/search/-/search-5.12.1.tgz", - "integrity": "sha512-ItlxbxC9cKI6IU1TLWoczwJCRb6TdmkEpWv05UrPawqaAnWGRu3rcIqsc5vN483T2fSociuyV1UkWIL5I4//2w==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/@redis/search/-/search-6.3.1.tgz", + "integrity": "sha512-T67pvPUpW82VrZLvihO8O2DFMC7eY2oMAzMzapCbiPZn7mdWqHMEIlohYim12gIawT5kn6qT/Cvmm4WulKB+kQ==", "license": "MIT", "engines": { - "node": ">= 18.19.0" + "node": ">= 20.0.0" }, "peerDependencies": { - "@redis/client": "^5.12.1" + "@redis/client": "^6.3.1" } }, "node_modules/@redis/time-series": { - "version": "5.12.1", - "resolved": "https://registry.npmjs.org/@redis/time-series/-/time-series-5.12.1.tgz", - "integrity": "sha512-c6JL6E3EcZJuNqKFz+KM+l9l5mpcQiKvTwgA3blt5glWJ8hjDk0yeHN3beE/MpqYIQ8UEX44ItQzgkE/gCBELQ==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/@redis/time-series/-/time-series-6.3.1.tgz", + "integrity": "sha512-MNDgrm+i63M/1a+XA+HcDsScwt4uBh/fGGJ84swTQZTFK5K5wMmxdlTRa4ZgmNJzjxMaszW/ipPScMUGV3aAMg==", "license": "MIT", "engines": { - "node": ">= 18.19.0" + "node": ">= 20.0.0" }, "peerDependencies": { - "@redis/client": "^5.12.1" + "@redis/client": "^6.3.1" } }, - "node_modules/@types/js-yaml": { - "version": "4.0.9", - "resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.9.tgz", - "integrity": "sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==", - "dev": true, - "license": "MIT" - }, "node_modules/@types/node": { - "version": "25.9.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-25.9.1.tgz", - "integrity": "sha512-xfrlY7UD5rMJk3ZVJP8BNzS28J36YJg+xp+LPXV1TdWxr8uMH5A860QNxYDGQe/ylDSgjxE52Q9VnO7p75tJxg==", + "version": "26.6.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-26.6.6.tgz", + "integrity": "sha512-MzQj+8Kx3XI40OmUAE6Qoh58ZMNstNNMwn2nfd3qWsfe7nDNSqJNzes4njhz6AHwrSHOffSLwXU6yb474Q4aog==", "dev": true, "license": "MIT", "dependencies": { - "undici-types": ">=7.24.0 <7.24.7" + "undici-types": "~8.9.0" } }, "node_modules/@types/pg": { - "version": "8.20.0", - "resolved": "https://registry.npmjs.org/@types/pg/-/pg-8.20.0.tgz", - "integrity": "sha512-bEPFOaMAHTEP1EzpvHTbmwR8UsFyHSKsRisLIHVMXnpNefSbGA1bD6CVy+qKjGSqmZqNqBDV2azOBo8TgkcVow==", + "version": "8.23.1", + "resolved": "https://registry.npmjs.org/@types/pg/-/pg-8.23.1.tgz", + "integrity": "sha512-fKVHpikPdg4GKks3JuLEhvwSyvwzF23hnabPy6DD8ljVbC7+6J5dQzdv4arV6jqq57djnMgs1HKBxX4P8aBI3A==", "dev": true, "license": "MIT", "dependencies": { @@ -563,21 +552,362 @@ "pg-types": "^2.2.0" } }, - "node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "license": "Python-2.0" - }, - "node_modules/cluster-key-slot": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/cluster-key-slot/-/cluster-key-slot-1.1.2.tgz", - "integrity": "sha512-RMr0FhtfXemyinomL4hrWcYJxmX6deFdCxpJzhDttxgO1+bcCnkk+9drydLVDmAMG7NE6aN/fl4F7ucU/90gAA==", + "node_modules/@typescript/typescript-aix-ppc64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-aix-ppc64/-/typescript-aix-ppc64-7.0.2.tgz", + "integrity": "sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ==", + "cpu": [ + "ppc64" + ], + "dev": true, "license": "Apache-2.0", + "optional": true, + "os": [ + "aix" + ], "engines": { - "node": ">=0.10.0" + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-darwin-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-arm64/-/typescript-darwin-arm64-7.0.2.tgz", + "integrity": "sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-darwin-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-x64/-/typescript-darwin-x64-7.0.2.tgz", + "integrity": "sha512-SZ9xZInqApNlNGc9s0W1VSsktYSOe9cFqNOIqmN1Gs8SmkjKZYFt017G4VwPxASInODuAdbTW7sXiFUf893RgA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-freebsd-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-freebsd-arm64/-/typescript-freebsd-arm64-7.0.2.tgz", + "integrity": "sha512-W5NH4y/J0plIIS5b2xvTEkU7JFxyqdMAOgf+Ilhl0vHQXKO5dZoxd+C/jEtq56c4F3wk71RB4BMRQ2XdI+bwYQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-freebsd-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-freebsd-x64/-/typescript-freebsd-x64-7.0.2.tgz", + "integrity": "sha512-UMGDx5sTpzNw3WiPebH7l90IWfJggEd+egHt/q6p7/Cm3zqoV7VxkGXt+3DxPIw8CcmvAB0j3sVVfbhX+M4Tpw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=16.20.0" } }, + "node_modules/@typescript/typescript-linux-arm": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-arm/-/typescript-linux-arm-7.0.2.tgz", + "integrity": "sha512-gffT3xPz9sR7j/YJExkyPntrI0P2EP9XbOyWzth2/Gs0RstK+90RBcO0ncXoXy/beYll1SXw846Nf2zdnEz0QQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-arm64/-/typescript-linux-arm64-7.0.2.tgz", + "integrity": "sha512-Qh4eU4/y3yDjnfjjyPYihMj5/ODIlmt+Bzu17OI+fiSRDW57QmU5SiN63exPRNJPKUzcc1INa1NXdrJ+MqHjUQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-loong64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-loong64/-/typescript-linux-loong64-7.0.2.tgz", + "integrity": "sha512-uEHck9i8hoAzXPiYRib1O7miOnz23SxIeVl6F4LXox+qov1K35jHcEW6VHKvZI+pyvl7fZEP4MCU5LYvIq1GuQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-mips64el": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-mips64el/-/typescript-linux-mips64el-7.0.2.tgz", + "integrity": "sha512-R4KvAMnE43W5Qeqb0Ly56O3mWMWIAgsMyz36DCaycd5nbg/9kzm0liw3JocfRqyJY0KPmzFjbswozXyW0DnIYA==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-ppc64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-ppc64/-/typescript-linux-ppc64-7.0.2.tgz", + "integrity": "sha512-DORx5b3sd/4S7eayxm4FQv+A7CrkUIGRaHiwI8oiHTAI1fAPWhF4J0vAlkC8biAlHSVVwxMQ3tjZ2/DVbnQiiA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-riscv64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-riscv64/-/typescript-linux-riscv64-7.0.2.tgz", + "integrity": "sha512-wf0jqEDOjrPRnKwYRyyJDRo11KMbvMFrU+q4zqKyChODBzvlkbhNQfKvLxQCcwTpdDaXSHZTVuh0JoCrKCUMHQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-s390x": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-s390x/-/typescript-linux-s390x-7.0.2.tgz", + "integrity": "sha512-IkwJc3L7yhytWd/ewjyxNDfOmswCm9GWMJT/ue/dU4aZNbwZeYAetq42VyLmsmSjvoX7z74X6ZaYCtzAr0EuGw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-x64/-/typescript-linux-x64-7.0.2.tgz", + "integrity": "sha512-EYdf2cNg7rgCWJnxCdJ+F3V39O8ihb37eHAu1LK8oAFizgTQbPOK7zHHXbPt8rX24COqODXeI3sIf0fCXG7H/A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-netbsd-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-netbsd-arm64/-/typescript-netbsd-arm64-7.0.2.tgz", + "integrity": "sha512-+polYF4MF04aPpO5FTkHran9yUQDSXqy5GiSDKpsll5jy3l3+g9QLhpf39T+ePtefhXLOGrLl0QIjkQP6VnelA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-netbsd-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-netbsd-x64/-/typescript-netbsd-x64-7.0.2.tgz", + "integrity": "sha512-8YIT0EHM/3dq10ZOVF/A7pc/YSMtbcecct4rWtexrnSCHOPcpC2KTLXfTCR6vDpnSiY12heNb1GiN/wu+T/FyA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-openbsd-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-openbsd-arm64/-/typescript-openbsd-arm64-7.0.2.tgz", + "integrity": "sha512-APT8+ClYnuYm1u9+kgGXoMj2VzWzcymwh2gNSQVySHfkRDGOTVkoWLjCmOQSaO+PoqQ57B0flRp9SA+7GnnkzQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-openbsd-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-openbsd-x64/-/typescript-openbsd-x64-7.0.2.tgz", + "integrity": "sha512-yX7s+Q0Dln0Dt9tEzZsAjXXR/+ytBM7AlglaqyeMPxQszJ1JhlJdZ6jLA+IzldHtflX81em7lDao1xXu+aRRkg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-sunos-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-sunos-x64/-/typescript-sunos-x64-7.0.2.tgz", + "integrity": "sha512-dLJDGaLZ1D4HPQn62u1n8mBDkJREwMsAkCdkwd4Ieqw+x3TUyTsqY0YiBCtE6H6OzzgGk3iuZ3vFWRS+E8/d1g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-win32-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-win32-arm64/-/typescript-win32-arm64-7.0.2.tgz", + "integrity": "sha512-Gyl1Vy6OsWesLzmq+EP0Fb7b4Nid5232AvcA2SFcdYreldpNtYFFofPjnt62y9hQy7VTaZp65ICJjuAQRaVcIQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-win32-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-win32-x64/-/typescript-win32-x64-7.0.2.tgz", + "integrity": "sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/argparse": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-3.0.4.tgz", + "integrity": "sha512-fwWK3Zq22l4XJJjx5mcBHGikIk+hJqO+32dPm0Jur7+rtG5x1scOjSfdT9ZKeWHPpsya/l0HHK4tDImBkTrtvA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], + "license": "PSF-2.0" + }, "node_modules/esbuild": { "version": "0.28.0", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.0.tgz", @@ -636,26 +966,36 @@ } }, "node_modules/js-yaml": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", - "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-5.5.0.tgz", + "integrity": "sha512-paNr4LFIFPjeeSmwNYdrb8FafLLG/Cr2Af3GjbsHJ5CxIjH4r0c2emlmRdAtpPAieP1gRVzk6buBbVP5gBMGAg==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], "license": "MIT", "dependencies": { - "argparse": "^2.0.1" + "argparse": "^3.0.3" }, "bin": { - "js-yaml": "bin/js-yaml.js" + "js-yaml": "bin/js-yaml.mjs" } }, "node_modules/pg": { - "version": "8.21.0", - "resolved": "https://registry.npmjs.org/pg/-/pg-8.21.0.tgz", - "integrity": "sha512-AUP1EYJuHraQGsVoCQVIcM7TEJVGtDzxWtGFZd8rds9d+CCXlU5Js1rYgfLNvxy9iJrpHjGrRjoi/3BT9fRyiA==", + "version": "8.23.1", + "resolved": "https://registry.npmjs.org/pg/-/pg-8.23.1.tgz", + "integrity": "sha512-aL96AHANtWjPLDOLqnhx+ngp9+UK7ETEU8VJrDCGvsSSi/mGLcWYsS6Herg7lmaBJe4uwrfqsa7gTEFaSizDoQ==", "license": "MIT", "dependencies": { - "pg-connection-string": "^2.13.0", + "pg-connection-string": "^2.14.1", "pg-pool": "^3.14.0", - "pg-protocol": "^1.14.0", + "pg-protocol": "^1.16.1", "pg-types": "2.2.0", "pgpass": "1.0.5" }, @@ -663,7 +1003,7 @@ "node": ">= 16.0.0" }, "optionalDependencies": { - "pg-cloudflare": "^1.4.0" + "pg-cloudflare": "^1.4.1" }, "peerDependencies": { "pg-native": ">=3.0.1" @@ -675,16 +1015,16 @@ } }, "node_modules/pg-cloudflare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/pg-cloudflare/-/pg-cloudflare-1.4.0.tgz", - "integrity": "sha512-Vo7z/6rrQYxpNRylp4Tlob2elzbh+N/MOQbxFVWCxS7oEx6jF53GTJFxK2WWpKuBRkmiin4Mt+xofFDjx09R0A==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/pg-cloudflare/-/pg-cloudflare-1.4.1.tgz", + "integrity": "sha512-6PQbsFWZcp9EmJEwy5cGQ2La+AMWpP46lgbb8X+U/XsHIUweYDNCpeuKck5RxL2MdVFi7krbbEi5nX4Zh7JhrQ==", "license": "MIT", "optional": true }, "node_modules/pg-connection-string": { - "version": "2.13.0", - "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.13.0.tgz", - "integrity": "sha512-EMnU9E2fSULdsbErBbMaXJvFeD9B4+nPcM3f+4lsiCR0BHLPrLVjv3DbyM2hgQQviKJaTWIRRTjKjWlHg3p2ig==", + "version": "2.14.1", + "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.14.1.tgz", + "integrity": "sha512-qR3kGNPBLpCNtz0evbKA0Y/MRFXwSSdT+pTJvYp/bXTcReZbvX1kzF0IyTc1QnxqF7AZbOeBhNL8R5mYQZV/MA==", "license": "MIT" }, "node_modules/pg-int8": { @@ -706,9 +1046,9 @@ } }, "node_modules/pg-protocol": { - "version": "1.14.0", - "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.14.0.tgz", - "integrity": "sha512-n5taZ1kO3s9ngDTVxsEznOqCyToTgz0FLuPq0B33COy5pPpuWJpY3/2oRBVETuOgzdqRXfWpM9HIhp2LBBT1BA==", + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.16.1.tgz", + "integrity": "sha512-p9VOFMiHB/ZbJATetbg+99PxssTVSQRnyuPSQ67mN1+1KBOjZaZ83ZQzltnxPhJwSsC3nwVjJ10DVJlerbFzLg==", "license": "MIT" }, "node_modules/pg-types": { @@ -776,19 +1116,19 @@ } }, "node_modules/redis": { - "version": "5.12.1", - "resolved": "https://registry.npmjs.org/redis/-/redis-5.12.1.tgz", - "integrity": "sha512-LDsoVvb/CpoV9EN3FXvgvSHNJWuCIzl9MiO3ppOevuGLpSGJhwfQjpEwfFJcQvNSddHADDdZaWx0HnmMxRXG7g==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/redis/-/redis-6.3.1.tgz", + "integrity": "sha512-mV96ZKxQ4CGn3SyEGaY0Lb9YA443mdVey3c+mdr0NAUaBxiOZGoYCWX8PoM55kictSOmxlJRtZJxIsmZm3jL+w==", "license": "MIT", "dependencies": { - "@redis/bloom": "5.12.1", - "@redis/client": "5.12.1", - "@redis/json": "5.12.1", - "@redis/search": "5.12.1", - "@redis/time-series": "5.12.1" + "@redis/bloom": "6.3.1", + "@redis/client": "6.3.1", + "@redis/json": "6.3.1", + "@redis/search": "6.3.1", + "@redis/time-series": "6.3.1" }, "engines": { - "node": ">= 18.19.0" + "node": ">= 20.0.0" } }, "node_modules/split2": { @@ -801,9 +1141,9 @@ } }, "node_modules/tsx": { - "version": "4.22.3", - "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.22.3.tgz", - "integrity": "sha512-mdoNxBC/cSQObGGVQ5Bpn5i+yv7j68gk3Nfm3wFjcJg3Z0Mix9jzAFfP12prmm5eVGmDKtp0yyArrs0Q+8gZHg==", + "version": "4.23.15", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.23.15.tgz", + "integrity": "sha512-Yiex1Ovn8z2xPpOWckIiysV1SSyRMY9BkLF++q0yKiDxCqRhosKfMg3janKkiLBwZ5c/YryloKwGZcrEmtwxKw==", "dev": true, "license": "MIT", "dependencies": { @@ -820,23 +1160,44 @@ } }, "node_modules/typescript": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz", - "integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-7.0.2.tgz", + "integrity": "sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA==", "dev": true, "license": "Apache-2.0", "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" + "tsc": "bin/tsc" }, "engines": { - "node": ">=14.17" + "node": ">=16.20.0" + }, + "optionalDependencies": { + "@typescript/typescript-aix-ppc64": "7.0.2", + "@typescript/typescript-darwin-arm64": "7.0.2", + "@typescript/typescript-darwin-x64": "7.0.2", + "@typescript/typescript-freebsd-arm64": "7.0.2", + "@typescript/typescript-freebsd-x64": "7.0.2", + "@typescript/typescript-linux-arm": "7.0.2", + "@typescript/typescript-linux-arm64": "7.0.2", + "@typescript/typescript-linux-loong64": "7.0.2", + "@typescript/typescript-linux-mips64el": "7.0.2", + "@typescript/typescript-linux-ppc64": "7.0.2", + "@typescript/typescript-linux-riscv64": "7.0.2", + "@typescript/typescript-linux-s390x": "7.0.2", + "@typescript/typescript-linux-x64": "7.0.2", + "@typescript/typescript-netbsd-arm64": "7.0.2", + "@typescript/typescript-netbsd-x64": "7.0.2", + "@typescript/typescript-openbsd-arm64": "7.0.2", + "@typescript/typescript-openbsd-x64": "7.0.2", + "@typescript/typescript-sunos-x64": "7.0.2", + "@typescript/typescript-win32-arm64": "7.0.2", + "@typescript/typescript-win32-x64": "7.0.2" } }, "node_modules/undici-types": { - "version": "7.24.6", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.24.6.tgz", - "integrity": "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==", + "version": "8.9.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.9.0.tgz", + "integrity": "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg==", "dev": true, "license": "MIT" }, diff --git a/batch-worker/package.json b/batch-worker/package.json index 31893dc..3d02c4f 100644 --- a/batch-worker/package.json +++ b/batch-worker/package.json @@ -9,15 +9,14 @@ "build": "tsc -p tsconfig.build.json" }, "dependencies": { - "js-yaml": "^4.1.1", - "pg": "^8.21.0", - "redis": "^5.12.1" + "js-yaml": "^5.5.0", + "pg": "^8.23.1", + "redis": "^6.3.1" }, "devDependencies": { - "@types/js-yaml": "^4.0.9", - "@types/node": "^25.9.1", - "@types/pg": "^8.20.0", - "tsx": "^4.22.3", - "typescript": "^6.0.3" + "@types/node": "^26.6.6", + "@types/pg": "^8.23.1", + "tsx": "^4.23.15", + "typescript": "^7.0.2" } } diff --git a/batch-worker/src/index.ts b/batch-worker/src/index.ts index a62c1f4..299d249 100644 --- a/batch-worker/src/index.ts +++ b/batch-worker/src/index.ts @@ -1,7 +1,7 @@ import pg from "pg"; import { createClient } from "redis"; import fs from "node:fs"; -import yaml from "js-yaml"; +import { load as loadYaml } from "js-yaml"; import process from "node:process"; type BatchRow = { @@ -22,7 +22,7 @@ function loadConfig() { throw new Error(`Configuration file not found: ${configPath}`); } const fileContents = fs.readFileSync(configPath, "utf8"); - const parsed = yaml.load(fileContents) as any; + const parsed = loadYaml(fileContents) as any; if (!parsed || typeof parsed !== "object") { throw new Error("Invalid YAML configuration"); } diff --git a/config/easyai.development.yaml b/config/easyai.development.yaml index 0b55e8e..739370f 100644 --- a/config/easyai.development.yaml +++ b/config/easyai.development.yaml @@ -2,33 +2,51 @@ app: env: "development" port: 3003 log_level: "info" + # 浏览器访问的地址:控制台(LiteLLM Admin UI)与聊天界面(Open WebUI) + console_url: "http://localhost:3005/ui" + chat_url: "http://localhost:3006" + # 网关简单限流:每个 key 每分钟请求数 + rate_limit_rpm: 120 + # 模型请求超时(毫秒),网关会比它多等 5 秒 + timeout_ms: 120000 + # 以下三项交给 LiteLLM 执行 + cache_enabled: true + cache_ttl_seconds: 60 + num_retries: 2 secrets: - admin_password: "admin" + # 控制台登录密码 + 网关访问 LiteLLM 的内部主密钥,不要发给 API 客户端 + master_key: "sk-dev-master" + # 客户端调用用的 key(可多个) api_keys: - "dev-key" + # Batch worker 内部鉴权 internal_token: "dev-internal" postgres_password: "oneapi" + # 可选:加密控制台里保存的厂商密钥,默认由 master_key 派生 + # salt_key: "sk-keep-it-stable" providers: ollama: api_base: "http://ollama:11434" - openai: - api_key: "" - deepseek: - api_base: "https://api.deepseek.com/v1" - api_key: "" models: + # 客户端请求时使用的模型名 -> 上游 provider + model chat: provider: ollama model: qwen2.5:0.5b - dsv4flash: - provider: deepseek - model: deepseek-v4-flash - dsv4pro: - provider: deepseek - model: deepseek-v4-pro - gpt: - provider: openai - model: gpt-5.5 + +# 接入云端厂商:取消注释并填入 api_key,模型名可自定义 +# providers: +# deepseek: +# api_base: "https://api.deepseek.com/v1" +# api_key: "sk-..." +# openai: +# api_key: "sk-..." +# models: +# deepseek-v4: +# provider: deepseek +# model: deepseek-v4-flash +# gpt: +# provider: openai +# model: gpt-5.5 diff --git a/config/easyai.production.example.yaml b/config/easyai.production.example.yaml index 0b95133..93feb9f 100644 --- a/config/easyai.production.example.yaml +++ b/config/easyai.production.example.yaml @@ -2,20 +2,26 @@ app: env: "production" port: 3003 log_level: "info" + # 浏览器访问地址(改成实际域名/IP):控制台(LiteLLM Admin UI)与聊天界面(Open WebUI) + console_url: "http://localhost:3005/ui" + chat_url: "http://localhost:3006" + rate_limit_rpm: 120 + timeout_ms: 120000 + cache_enabled: true + cache_ttl_seconds: 60 + num_retries: 2 secrets: - admin_password: "REPLACE_WITH_STRONG_ADMIN_PASSWORD" + # 控制台登录密码 + 网关访问 LiteLLM 的内部主密钥,不要发给 API 客户端 + master_key: "REPLACE_WITH_LITELLM_MASTER_KEY" + # 加密控制台保存的厂商密钥,一旦使用不要再改 + salt_key: "REPLACE_WITH_STABLE_SALT_KEY" api_keys: - "REPLACE_WITH_CLIENT_API_KEY" internal_token: "REPLACE_WITH_INTERNAL_TOKEN" postgres_password: "REPLACE_WITH_POSTGRES_PASSWORD" providers: - openai: - api_key: "REPLACE_WITH_OPENAI_API_KEY" - deepseek: - api_base: "https://api.deepseek.com/v1" - api_key: "REPLACE_WITH_DEEPSEEK_API_KEY" ollama: api_base: "http://ollama:11434" @@ -23,12 +29,30 @@ models: chat: provider: ollama model: qwen2.5:0.5b - dsv4flash: - provider: deepseek - model: deepseek-v4-flash - dsv4pro: - provider: deepseek - model: deepseek-v4-pro - gpt: - provider: openai - model: gpt-5.5 + +# 接入云端厂商:取消注释并填入 api_key +# providers: +# deepseek: +# api_base: "https://api.deepseek.com/v1" +# api_key: "REPLACE_WITH_DEEPSEEK_API_KEY" +# openai: +# api_key: "REPLACE_WITH_OPENAI_API_KEY" +# models: +# deepseek-v4: +# provider: deepseek +# model: deepseek-v4-flash +# # 可选:失败时自动切到别的模型别名 +# fallback: ["chat"] +# gpt: +# provider: openai +# model: gpt-5.5 + +# 可选:内容护栏(LiteLLM 内置 litellm_content_filter,无需外部依赖) +# guardrails: +# enabled: true +# blocked_keywords: +# - "ignore all previous instructions" +# - "jailbreak" +# mask_pii: +# - "email" +# - "us_ssn" diff --git a/docker-compose.yml b/docker-compose.yml index 2cc5c81..d47e50a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,15 +23,26 @@ services: volumes: - ollama_data:/root/.ollama + # Model access plane: official LiteLLM Proxy (provider adapters, routing, + # retries, caching, guardrails, virtual keys, budgets, spend logs and the + # Chinese-capable Admin UI at /ui). litellm: - build: - context: ./litellm-service + image: ${LITELLM_IMAGE:-ghcr.io/berriai/litellm:main-latest} restart: unless-stopped + entrypoint: ["/bin/sh", "/app/scripts/docker/litellm-entrypoint.sh"] + ports: + # Admin console only. Kept on localhost by default; put it behind your + # own proxy if you need remote access. + - "127.0.0.1:3005:4000" volumes: - ./config/easyai.development.yaml:/app/config/easyai.yaml:ro + - ./scripts:/app/scripts:ro depends_on: - ollama + - postgres + - redis + # EasyAI gateway: single entrypoint, chat UI, batch API. oneapi: build: context: ./oneapi-gateway @@ -45,6 +56,25 @@ services: - postgres - litellm + # Optional chat UI (中文,多用户/RAG/工具). Enable with: + # docker compose --profile chat up -d + openwebui: + image: ghcr.io/open-webui/open-webui:main + profiles: ["chat"] + restart: unless-stopped + ports: + - "3006:8080" + environment: + OPENAI_API_BASE_URL: "http://oneapi:3003/v1" + OPENAI_API_KEY: "dev-key" + ENABLE_OLLAMA_API: "false" + # 极速上手:默认免登录。生产请改为 true 并配置管理员账号。 + WEBUI_AUTH: "false" + volumes: + - openwebui_data:/app/backend/data + depends_on: + - oneapi + batch_worker: build: context: ./batch-worker @@ -57,6 +87,8 @@ services: - oneapi volumes: + openwebui_data: + name: easyai_dev_openwebui_data postgres_data: name: easyai_dev_postgres_data ollama_data: diff --git a/docs/architecture.md b/docs/architecture.md index c50ff73..b66e47a 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -2,22 +2,23 @@ ## 1. 组件 -- `oneapi-gateway`:统一入口,提供鉴权、限流、缓存、Batch API、Dashboard API、Chat API -- `litellm-service`:加载 YAML 中的 `models/providers`,执行模型调用与别名解析 +- `oneapi-gateway`:统一入口,提供鉴权、限流、`/v1/*` 透传、Batch API、首页与页面跳转(约 750 行) +- `litellm`:官方 LiteLLM Proxy 镜像,作为模型接入面,负责 100+ provider 协议适配、模型别名、重试/故障转移、Redis 缓存、内容过滤护栏与 `/docs` - `batch-worker`:消费 Redis 队列,调用网关执行批任务,并写回 Postgres -- `redis`:限流、缓存、Batch 队列 -- `postgres`:API Key、租户、会话、用量、Batch 结果 +- `redis`:限流、LiteLLM 响应缓存、Batch 队列 +- `postgres`:LiteLLM 的密钥/预算/用量日志 + EasyAI 的 Batch 记录 - `ollama`:本地模型后端(由 LiteLLM 调用) +- `openwebui`(可选,`--profile chat`):中文聊天界面,走网关 `/v1` 接口 ## 2. 主要请求链路 ### 2.1 Chat Completions 1. 客户端调用 `POST /v1/chat/completions` -2. 网关完成鉴权、限流、Guardrails、缓存判定 -3. 未命中缓存时转发到 LiteLLM -4. LiteLLM 根据 `models` 配置解析目标模型并调用上游 -5. 网关记录用量并返回结果 +2. 网关完成鉴权、限流,并以 `secrets.master_key` 转发到 LiteLLM +3. LiteLLM 按启动时生成的 `model_list` 解析模型别名并调用上游(含重试、fallback、缓存、护栏) +4. 网关返回结果;用量与请求日志由 LiteLLM 落库(控制台可查) +5. `/docs`、`/openapi.json` 由 LiteLLM 生成,网关仅做透传 ### 2.2 Batch @@ -32,14 +33,32 @@ - 首页:`/` - OpenAI 兼容接口:`/v1/*` - API 文档:`/docs`、`/openapi.json` -- Dashboard:`/dashboard`、`/admin/api/*` -- Chat:`/chat`、`/chat-api/*` -- 指标与健康:`/metrics`、`/healthz` +- 控制台:`/ui`、`/dashboard`(302 到 LiteLLM Admin UI) +- 聊天:`/chat`(302 到 Open WebUI,可选组件) +- 指标与健康:`/metrics`(透传 LiteLLM)、`/healthz` ## 4. 配置边界 -- 统一配置源:YAML(容器内挂载为 `/app/config/easyai.yaml`) -- 网关读取:`app.*`、`secrets.*` -- LiteLLM 读取:`app.*`、`providers.*`、`models.*` +- 统一配置源:一份 YAML(容器内挂载为 `/app/config/easyai.yaml`) +- 网关读取:`app.env`、`app.port`、`app.log_level`、`app.console_url`、`app.chat_url`、`app.rate_limit_rpm`、`app.timeout_ms`、`secrets.api_keys`、`secrets.internal_token`、`secrets.master_key`、`secrets.postgres_password` +- LiteLLM 配置在启动时由 `scripts/render-litellm-config.py` 从同一份 YAML 生成: + - `providers.*` + `models.*` → `model_list`(有 `fallback` 时额外生成 `router_settings.fallbacks`) + - `app.cache_*` / `app.num_retries` / `app.timeout_ms` → `litellm_settings` + - `guardrails.*`(可选)→ `guardrails`(内置 `litellm_content_filter`,默认对所有请求生效) +- 说明:不存在第二份 LiteLLM 配置文件;模型别名、fallback、缓存开关、护栏关键词都只在这一份 YAML 里维护 -说明:模型白名单与别名由 LiteLLM 按 `models` 配置生效。 +## 5. 自研边界(重要) + +只保留上游不做、且"轻量"的部分,其余一律交给 LiteLLM。 + +| 保留 | 行数 | 理由 | +|---|---|---| +| `scripts/render-litellm-config.py` | ~210 | 一份 YAML 的核心承诺 | +| 网关(`index/proxy/auth/config/rate_limit/redis/crypto`) | ~430 | 统一入口 + YAML key/虚拟 key 双轨 + RPM | +| `batch-worker` + `batch.ts` | ~260 | 上游空白:给无原生 Batch 的模型做离线批跑(冻结,不扩展) | +| `scripts/` + 中文文档 + smoke/CI | ~950 | 真正的交付体验差异 | +| 服务端渲染首页 `ui.ts` | ~95 | 入口导航 | + +**不再自研**:provider 适配、路由/重试/故障转移、缓存、护栏、密钥/预算/用量后台、API 文档、指标、聊天界面、会话存储。 + +判断新需求是否要写代码的唯一问题:**它只是在补文档,还是必须新增代码?** 后者先确认上游是否已经提供。 diff --git a/docs/deployment.md b/docs/deployment.md index dacdf6d..3a527cd 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -1,188 +1,150 @@ -# 部署指南(Deployment) +# 部署与运维 -本文档汇总本仓库支持的部署方式:完整模式(OneAPI 网关 + LiteLLM + 数据库组件 + Batch Worker + Ollama)。 +EasyAI 只有一份 YAML 配置和一组容器:`oneapi`(网关)+ `litellm`(模型接入面)+ `postgres` + `redis` + `batch_worker` + `ollama`,可选 `openwebui`(聊天界面)。 -## 1. 完整模式 - -此模式适合在生产环境中提供完整的 API 管理、鉴权、限流、审计、缓存以及异步任务(Batch)功能。 - -### 1.1 开发环境部署步骤(Docker Compose) - -开发环境直接使用入仓配置 [config/easyai.development.yaml](../config/easyai.development.yaml),Compose project 为 `easyai-dev`,数据卷为 `easyai_dev_*`,宿主机端口为 `3004`。 +--- -步骤 1:启动 +## 1. 开发环境(一条命令) ```bash docker compose up -d --build +docker compose exec -T ollama ollama pull qwen2.5:0.5b ``` -步骤 2:健康检查 +可选:想要开箱即用的中文聊天界面 ```bash -curl -sS http://localhost:3004/healthz -docker compose exec -T litellm python -c "import urllib.request; print(urllib.request.urlopen('http://localhost:4000/healthz').read().decode())" +docker compose --profile chat up -d ``` -步骤 2.5:准备本地 Ollama 模型(仅当 `models.chat` 指向 Ollama) +健康检查: ```bash -docker compose exec -T ollama ollama pull qwen2.5:0.5b +curl -sS http://localhost:3004/healthz +curl -sS http://localhost:3004/v1/models -H "Authorization: Bearer dev-key" ``` -步骤 3:接口验证(网关转发) +发起请求: ```bash curl -sS http://localhost:3004/v1/chat/completions \ + -H "Authorization: Bearer dev-key" \ -H "Content-Type: application/json" \ - -H "Authorization: Bearer " \ - -d '{ - "model":"chat", - "messages":[{"role":"user","content":"Say hello in one sentence."}], - "temperature":0 - }' + -d '{"model":"chat","messages":[{"role":"user","content":"hello"}],"temperature":0}' ``` -步骤 4:查看服务状态与日志(可选) - -```bash -docker compose ps -docker compose logs --tail=200 oneapi litellm batch_worker -``` - -### 1.2 生产环境部署步骤(Docker Compose + 本地私有配置) - -步骤 1:准备生产私有配置并渲染 override(不要把真实密钥写入入仓文件) +## 2. 生产环境(本地私有配置) ```bash cp config/easyai.production.example.yaml config/easyai.production.local.yaml -# 编辑 config/easyai.production.local.yaml,替换全部 REPLACE_WITH_* +# 编辑并替换所有 REPLACE_WITH_* python3 scripts/render-local-compose.py config/easyai.production.local.yaml > docker-compose.local.yml -``` - -步骤 2:启动生产栈(使用 override) - -```bash docker compose -f docker-compose.yml -f docker-compose.local.yml up -d --build +docker compose -f docker-compose.yml -f docker-compose.local.yml exec -T ollama ollama pull qwen2.5:0.5b ``` -步骤 3:健康检查 - -```bash -curl -sS http://localhost:3003/healthz -docker compose -f docker-compose.yml -f docker-compose.local.yml exec -T litellm \ - python -c "import urllib.request; print(urllib.request.urlopen('http://localhost:4000/healthz').read().decode())" -``` - -步骤 3.5:准备生产 Ollama 模型(仅当 `models.chat` 指向 Ollama) - -```bash -docker compose -f docker-compose.yml -f docker-compose.local.yml exec -T ollama \ - ollama pull qwen2.5:0.5b -``` - -步骤 4:接口验证(网关转发) - -```bash -curl -sS http://localhost:3003/v1/chat/completions \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer " \ - -d '{ - "model":"chat", - "messages":[{"role":"user","content":"Say hello in one sentence."}], - "temperature":0 - }' -``` - -步骤 5:查看服务状态与日志(可选) - -```bash -docker compose -f docker-compose.yml -f docker-compose.local.yml ps -docker compose -f docker-compose.yml -f docker-compose.local.yml logs --tail=200 oneapi litellm batch_worker -``` - -步骤 6:对外服务验收(建议) +验收: ```bash BASE_URL=http://localhost:3003 CONFIG_FILE=config/easyai.production.local.yaml ./scripts/smoke-compose.sh ``` -生产 override 使用 Compose project `easyai-prod`,数据卷为 `easyai_prod_*`,宿主机端口为 `3003`。开发与生产可在同机共存,不共享容器、网络和数据卷。 +生产 override 使用 Compose project `easyai-prod`、数据卷 `easyai_prod_*`,与开发环境互不影响。 -### 1.3 端口暴露与访问入口 +## 3. 端口与入口 -生产暴露面: +| 端口 | 用途 | 暴露范围 | +|---|---|---| +| `3004` / `3003` | 网关(开发 / 生产):`/v1/*`、`/docs`、`/healthz` | 对外 | +| `3005` | 控制台(LiteLLM Admin UI) | 默认只监听 `127.0.0.1` | +| `3006` | 聊天界面(Open WebUI,`--profile chat`) | 对外 | +| — | `postgres`、`redis`、`ollama` | 仅容器内网 | -- Compose 默认只向宿主机发布 OneAPI 网关端口 `3003`。 -- `postgres`、`redis`、`litellm`、`ollama` 只在 Docker 内网访问,不再映射宿主机端口。 -- 本次部署暂未包含 TLS 和反向代理;公网开放时请只放通 OneAPI 端口,并在前置网络层限制管理端来源。 +页面入口:`/` 首页、`/ui` 控制台、`/chat` 聊天、`/docs` API 文档、`/healthz` 健康检查、`/metrics` 指标(透传 LiteLLM)。 -管理入口: -- 开发首页导航:`http://localhost:3004/` -- 生产首页导航:`http://localhost:3003/` -- Dashboard:`/dashboard` -- 内置聊天界面:`/chat` -- Swagger API 文档:`/docs` +## 4. 控制台与中文界面 -### 1.4 停止与重启 +控制台就是 LiteLLM 自带的 Admin UI: -开发环境停止: +- 地址:`http://localhost:3005/ui`(网关 `/ui`、`/dashboard` 会 302 过来) +- 用户名:`admin`;密码:`secrets.master_key` +- 登录后在账户菜单把语言切换为「简体中文」(`zh-CN` 语言包内置,默认英文,选择存在浏览器) +- 密钥、预算、RPM/TPM、模型白名单、用量与请求日志都在这里管理 -```bash -docker compose down -``` +镜像版本: -生产环境停止(保留数据卷): +- 默认 `LITELLM_IMAGE=ghcr.io/berriai/litellm:main-latest`(含中文语言包) +- 保守选择:`ghcr.io/berriai/litellm:main-stable`(当前稳定版无 `zh-CN`,界面为英文),或固定到验证过的镜像 digest +- 升级流程:改 `LITELLM_IMAGE` → `docker compose up -d litellm` → 跑一遍 `./scripts/smoke-compose.sh` -```bash -docker compose -f docker-compose.yml -f docker-compose.local.yml down -``` - -如果已有旧版本 `postgres_data` 数据卷,PostgreSQL 主版本升级后不能直接复用旧数据目录;请先做数据库备份和迁移,或在开发环境中清理旧卷后重新初始化。 +## 5. 配置说明 -### 1.5 Batch 异步任务服务 - -- 默认在完整模式中已启用:`config/easyai.development.yaml` 包含 `secrets.internal_token` 且 compose 会自动启动 `batch_worker` 容器。 -- 若需关闭 Batch 功能:清空 YAML 配置中的 `secrets.internal_token`,并在 compose 中移除/停止 `batch_worker`。未配置 token 时访问 `/v1/batches` 会返回 503 错误。 - ---- +统一配置源是 `config/easyai.yaml`(容器内路径),开发/生产各挂各的文件。启动时 `scripts/render-litellm-config.py` 会把它翻译成 LiteLLM 配置,因此**不需要第二份配置文件**。 -## 2. 配置文件入口 +| 段 | 内容 | +|---|---| +| `app` | `port`、`log_level`、`console_url`、`chat_url`、`rate_limit_rpm`、`timeout_ms`、`cache_enabled`、`cache_ttl_seconds`、`num_retries` | +| `secrets` | `master_key`(控制台密码 + 内部主密钥)、`salt_key`(加密控制台保存的厂商 key)、`api_keys`、`internal_token`、`postgres_password` | +| `providers` | 各厂商 `api_base` / `api_key` / `api_version` | +| `models` | 对外模型别名 → `provider` + `model`,可加 `fallback: [其他别名]` | +| `guardrails` | 可选:`blocked_keywords`、`mask_pii`(交给 LiteLLM 内置内容过滤) | -系统的主要行为通过一个 YAML 文件集中控制,不依赖 `.env` 或运行时环境变量注入。开发环境使用入仓配置,生产环境使用本地私有配置并通过 Compose override 挂载到容器内同一路径: +`app.timeout_ms` 是模型请求超时;网关在转发时会多等 5 秒,避免网关先于 LiteLLM 超时。 -- **开发配置**:[config/easyai.development.yaml](../config/easyai.development.yaml) -- **生产配置示例**:[config/easyai.production.example.yaml](../config/easyai.production.example.yaml) -- **生产本地配置**:`config/easyai.production.local.yaml`(不入仓) +生产安全开关: -### 2.1 生产安全开关 +- `app.env: production` 时,占位值(`dev-key`、`dev-internal`、`REPLACE_WITH_*`)会让网关直接启动失败 +- `secrets.salt_key` 一旦使用就不要再改,否则控制台里保存的厂商凭据会失效 -- `app.env: production` 时会拒绝默认管理密码、`dev-key`、`dev-internal` 和默认数据库密码。 -- `secrets.admin_password`、`secrets.api_keys`、`secrets.internal_token`、`secrets.postgres_password` 是生产部署必须替换的敏感值。 -- `models` 下的键就是客户端请求时使用的模型名。 -- `providers` 配置 OpenAI、DeepSeek、Ollama 等上游凭据和地址。 +Batch: -### 2.2 备份恢复 +- 默认启用(`secrets.internal_token` 存在 + `batch_worker` 运行) +- 想关闭:清空 `secrets.internal_token`,停掉 `batch_worker`;此时 `/v1/batches` 返回 503 -备份: +## 6. 备份、恢复与重置 ```bash ./scripts/backup-postgres.sh +./scripts/restore-postgres.sh backups/postgres/oneapi_YYYYmmdd_HHMMSS.dump --yes +./scripts/reset-db.sh --with-redis --yes ``` -生产 override 备份请显式指定 Compose 文件,避免误备份开发库: +生产 override 需要显式指定 Compose 文件: ```bash COMPOSE_FILE="docker-compose.yml:docker-compose.local.yml" ./scripts/backup-postgres.sh +COMPOSE_FILE="docker-compose.yml:docker-compose.local.yml" ./scripts/restore-postgres.sh backups/postgres/oneapi_YYYYmmdd_HHMMSS.dump --yes ``` -恢复: +停止服务(保留数据): ```bash -./scripts/restore-postgres.sh backups/postgres/oneapi_YYYYmmdd_HHMMSS.dump --yes +docker compose down +docker compose -f docker-compose.yml -f docker-compose.local.yml down ``` -生产 override 恢复同样需要显式指定: +不要用 `docker compose down -v`,会删除模型卷和数据卷。 + +## 7. 故障排查 ```bash -COMPOSE_FILE="docker-compose.yml:docker-compose.local.yml" ./scripts/restore-postgres.sh backups/postgres/oneapi_YYYYmmdd_HHMMSS.dump --yes +docker compose logs --tail=200 oneapi litellm batch_worker +curl -sS http://localhost:3004/healthz +curl -sS http://localhost:3005/health/liveliness +``` + +| 现象 | 定位 | +|---|---| +| `401 unauthorized` | API Key 错误;虚拟密钥请在控制台确认状态/预算 | +| `429 rate limited` | 网关 `app.rate_limit_rpm` 或虚拟密钥的 RPM/预算 | +| `502 / 504` | LiteLLM 不可达或上游超时,看 `litellm` 日志 | +| 模型不存在 | `models` 里没有该别名,或 Ollama 未 `ollama pull` | +| Batch 503 | `secrets.internal_token` 未配置或 worker 未运行 | +| 控制台打不开 | 端口映射为 `127.0.0.1:3005`,只能从本机访问 | +| 控制台登录失败 | 用户名 `admin`,密码是 `secrets.master_key` | + +Redis 队列/缓存探查: + +```bash +docker compose exec -T redis redis-cli LLEN 'batch:q:v1' ``` diff --git a/docs/development.md b/docs/development.md index 19a5a2b..f6fd55e 100644 --- a/docs/development.md +++ b/docs/development.md @@ -23,24 +23,39 @@ npm install npm test ``` -前端构建: +LiteLLM 配置生成(改完 `config/*.yaml` 后可本地校验): ```bash -cd oneapi-gateway/admin-ui -npm ci && npm run build +python3 scripts/render-litellm-config.py config/easyai.development.yaml +``` + +## 3. 仓库结构 + +``` +oneapi-gateway/ 轻量网关(Fastify):鉴权、限流、/v1 透传、Batch、首页 +batch-worker/ Batch 队列消费者 +scripts/ YAML→LiteLLM 渲染、compose 渲染、smoke、备份恢复、密钥检查 +tools/doc-audit/ 文档与路由一致性门禁 +config/ 唯一的 YAML 配置 +docs/ 中文文档 +``` + +## 4. 提交前最小检查 -cd ../chat-ui -npm ci && npm run build +```bash +cd oneapi-gateway +npm run build && npm test && npm run doc-audit +cd ../batch-worker && npm run build ``` -## 3. 文档一致性校验 +## 5. 文档一致性校验 ```bash cd oneapi-gateway npm run doc-audit ``` -## 4. CI 对齐 +## 6. CI 对齐 仓库 CI 使用:`.github/workflows/ci.yml` -> `scripts/test-all.sh`。 @@ -56,13 +71,13 @@ bash scripts/test-all.sh ./scripts/smoke-compose.sh ``` -## 5. 安全基线(生产) +## 7. 安全基线(生产) - 生产配置从 `config/easyai.production.example.yaml` 复制到本地私有文件 - 必须替换 `REPLACE_WITH_*`、`dev-key`、`dev-internal` 等默认值 - 不要提交 `*.local.yaml`、`.env`、密钥文件 -## 6. 提交前密钥检查(必做) +## 8. 提交前密钥检查(必做) 首次在本仓库启用 hooks: diff --git a/docs/operations.md b/docs/operations.md deleted file mode 100644 index e2ead27..0000000 --- a/docs/operations.md +++ /dev/null @@ -1,100 +0,0 @@ -# 运行手册(Operations) - -## 1. 发布前检查 - -### 1.1 启动与健康 - -```bash -docker compose up -d --build -curl -sS http://localhost:3004/healthz -curl -sS http://localhost:3004/openapi.json | head -``` - -### 1.2 对外服务验收(smoke) - -```bash -./scripts/smoke-compose.sh -``` - -开发环境: - -```bash -BASE_URL=http://localhost:3004 ./scripts/smoke-compose.sh -``` - -生产环境: - -```bash -BASE_URL=http://localhost:3003 CONFIG_FILE=config/easyai.production.local.yaml ./scripts/smoke-compose.sh -``` - -### 1.3 生产前最小安全检查 - -```bash -grep -E 'REPLACE_WITH_|dev-key|dev-internal|postgres_password: "oneapi"' config/easyai.production.local.yaml -``` - -预期:不应命中默认值或占位符。 - -## 2. 常见故障排查 - -### 2.1 先看日志 - -```bash -docker compose logs --tail=200 oneapi litellm batch_worker -``` - -### 2.2 常见错误 - -- `401 unauthorized`:凭据错误或缺失 -- `429 rate limited`:触发限流 -- `400 model not allowed`:请求模型不在 `models` 配置中 -- `404 model not found`:上游声明了模型别名,但实际模型未就绪(例如 Ollama 未拉取) -- `503`(Batch):`internal_token` 未配置或 worker 不可用 -- `502/504`:上游模型服务不可达或超时 - -若 `chat` 映射到 Ollama,可先执行: - -```bash -docker compose exec -T ollama ollama pull qwen2.5:0.5b -# 生产 override: -docker compose -f docker-compose.yml -f docker-compose.local.yml exec -T ollama ollama pull qwen2.5:0.5b -``` - -### 2.3 Redis 快速检查(可选) - -```bash -docker compose exec -T redis redis-cli LLEN 'batch:q:v1' -docker compose exec -T redis redis-cli --raw KEYS 'cache:v1:*' | head -``` - -## 3. 备份与恢复 - -备份: - -```bash -./scripts/backup-postgres.sh -``` - -恢复: - -```bash -./scripts/restore-postgres.sh backups/postgres/oneapi_YYYYmmdd_HHMMSS.dump --yes -``` - -生产 override 需要显式传 Compose 文件: - -```bash -COMPOSE_FILE="docker-compose.yml:docker-compose.local.yml" ./scripts/backup-postgres.sh -COMPOSE_FILE="docker-compose.yml:docker-compose.local.yml" ./scripts/restore-postgres.sh backups/postgres/oneapi_YYYYmmdd_HHMMSS.dump --yes -``` - -## 4. 数据重置(开发场景) - -```bash -./scripts/reset-db.sh --usage-only -./scripts/reset-db.sh -./scripts/reset-db.sh --all --with-redis --yes -``` - -注意:不要直接使用 `docker compose down -v`,会删除模型卷。 diff --git a/docs/user-manual.md b/docs/user-manual.md index 1a8cc04..6669088 100644 --- a/docs/user-manual.md +++ b/docs/user-manual.md @@ -2,9 +2,10 @@ ## 1. 你能用它做什么 -- 用 OpenAI 兼容接口调用模型:`/v1/chat/completions`、`/v1/embeddings`、`/v1/models` -- 使用 Dashboard 管理 API Key、租户和用量 -- 使用 Chat UI 进行会话测试(`/chat`) +- 用 OpenAI 兼容接口调用不同厂商的模型:`/v1/chat/completions`、`/v1/responses`、`/v1/embeddings`、`/v1/models` 等 +- 用一份 YAML 定义模型别名,换厂商不用改客户端代码 +- 在控制台(LiteLLM Admin UI,支持中文)管理密钥、预算、限流、用量和请求日志 +- 使用可选的 Open WebUI 聊天界面(`docker compose --profile chat up -d`) - 使用 Batch API 提交异步任务(`/v1/batches`) ## 2. 快速开始 @@ -20,9 +21,9 @@ docker compose exec -T ollama ollama pull qwen2.5:0.5b ### 2.2 打开入口 - 首页:`http://localhost:3004/` +- 聊天:`http://localhost:3006`(需 `--profile chat` 启动 Open WebUI) - API 文档:`http://localhost:3004/docs` -- Dashboard:`http://localhost:3004/dashboard` -- Chat:`http://localhost:3004/chat` +- 控制台:`http://localhost:3005/ui`(也可从首页「控制台」按钮进入) ### 2.3 发起第一条请求 @@ -38,14 +39,16 @@ curl -sS http://localhost:3004/v1/chat/completions \ ### 3.1 API 调用鉴权 - 默认使用 API Key:`Authorization: Bearer ` 或 `x-api-key: ` -- 开发环境初始 key 来自 `config/easyai.development.yaml` 的 `secrets.api_keys` -- 所有 `/v1/*` 和 `/chat-api/*` 请求都要求鉴权 +- 两种 Key 都可用: + - YAML 里的 `secrets.api_keys`(最简单,适合个人/小团队) + - 控制台创建的 LiteLLM 虚拟密钥(带预算、模型白名单、RPM/TPM 限制) +- 所有 `/v1/*` 请求都要求鉴权(含 Batch 与透传的其他模型协议) -### 3.2 Dashboard 鉴权 +### 3.2 控制台鉴权 -- 用户名固定:`admin` -- 密码来自 `secrets.admin_password` -- `/admin/api/*` 写操作还需要:`x-oneapi-admin-action: 1` +- 用户名:`admin` +- 密码:`secrets.master_key`(可在控制台里再建 proxy_admin 账号并关闭环境变量登录) +- 界面右上角设置里可切换语言为「简体中文」 ## 4. 常用接口 @@ -55,6 +58,8 @@ curl -sS http://localhost:3004/v1/chat/completions \ - `POST /v1/embeddings` - `GET /v1/models` +除 `/v1/*` 之外的模型接入能力(Anthropic、Gemini、Responses、rerank、图像、音频)由 LiteLLM 提供,网关原样透传。 + ### 4.2 Batch - `POST /v1/batches` @@ -64,30 +69,23 @@ curl -sS http://localhost:3004/v1/chat/completions \ Batch 可用前提:`secrets.internal_token` 已配置且 `batch_worker` 正常运行。 `/v1/batches/:batchId/output` 返回 `application/jsonl`(每行一条结果)。 -### 4.3 Chat API(供 Chat UI 使用) - -- `GET /chat-api/models` -- `GET/POST/DELETE /chat-api/conversations` -- `GET /chat-api/conversations/:id/messages` -- `POST /chat-api/conversations/:id/chat` - ## 5. 配置约定(重要) -- 统一配置文件:`config/easyai.development.yaml` -- `models` 是对外可见模型名(客户端请求时填这里的 key) +- 统一配置文件:`config/easyai.development.yaml`(详见[部署与运维](./deployment.md)) +- `models` 是对外可见模型名(客户端请求时填这里的 key),启动时自动转成 LiteLLM 的 `model_list` +- `providers` 存放各厂商的 `api_base` / `api_key` - 生产部署请使用 `config/easyai.production.local.yaml`(不入仓) -- 如果 `models.chat` 映射到 Ollama,本地需先 `ollama pull` 对应模型,否则聊天会返回 `404 model not found` +- 如果 `models.chat` 映射到 Ollama,本地需先 `ollama pull` 对应模型,否则会返回模型不存在 ## 6. 常见问题 -- `401 unauthorized`:检查 API Key 或 Dashboard 账号密码 -- `429 rate limited`:触发 RPM/TPM 限流,需调整租户/Key 配额 +- `401 unauthorized`:检查 API Key;虚拟密钥请在控制台确认未过期/未吊销 +- `429 rate limited`:网关 `app.rate_limit_rpm` 或虚拟密钥的 RPM/预算限制 - `503 batch worker not configured`:未配置 `secrets.internal_token` 或 worker 未运行 -- `400 model not allowed`:模型名不在 `models` 配置中 -- `404 model not found`:上游模型未就绪(常见于 Ollama 未拉取模型) +- 模型名不存在:确认 `models` 里配置了该别名 +- 上游模型未就绪:常见于 Ollama 未拉取模型(`docker compose exec -T ollama ollama pull `) ## 7. 相关文档 - [部署指南](./deployment.md) -- [运行手册](./operations.md) - [YAML 密钥管理](./yaml-secret-management.md) diff --git a/docs/yaml-secret-management.md b/docs/yaml-secret-management.md index 1333190..fc73439 100644 --- a/docs/yaml-secret-management.md +++ b/docs/yaml-secret-management.md @@ -28,13 +28,14 @@ docker compose -f docker-compose.yml -f docker-compose.local.yml exec -T ollama ## 3. 必换敏感项 -- `secrets.admin_password` +- `secrets.master_key`(控制台登录密码 + 网关访问 LiteLLM 的内部主密钥,不对外) +- `secrets.salt_key`(加密控制台保存的厂商密钥,设置后不要再改) - `secrets.api_keys` - `secrets.internal_token` - `secrets.postgres_password` -- `providers..api_key`(如 OpenAI / DeepSeek) +- `providers..api_key`(接入云端厂商时) ## 4. 运行时保护 -- `app.env: production` 时,网关会拒绝默认/占位敏感值 -- LiteLLM 会拒绝生产环境下的占位 provider key +- `app.env: production` 时,网关会拒绝默认/占位敏感值(缺少 `secrets.master_key` 也会直接启动失败) +- LiteLLM 配置由 `scripts/render-litellm-config.py` 生成,生产环境请确保 `providers..api_key` 已替换 diff --git a/litellm-service/.dockerignore b/litellm-service/.dockerignore deleted file mode 100644 index acac04b..0000000 --- a/litellm-service/.dockerignore +++ /dev/null @@ -1,6 +0,0 @@ -__pycache__ -*.pyc -*.pyo -.git -*.md -.DS_Store diff --git a/litellm-service/Dockerfile b/litellm-service/Dockerfile deleted file mode 100644 index 982087a..0000000 --- a/litellm-service/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM python:3.12-slim - -RUN groupadd -r appgroup && useradd -r -g appgroup -d /app -s /sbin/nologin appuser - -WORKDIR /app - -ENV PYTHONDONTWRITEBYTECODE=1 -ENV PYTHONUNBUFFERED=1 - -COPY requirements.txt /app/requirements.txt -RUN pip install --no-cache-dir -r /app/requirements.txt - -COPY app /app/app - -USER appuser -EXPOSE 4000 -HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \ - CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:4000/healthz')" || exit 1 -CMD ["python", "-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "4000"] diff --git a/litellm-service/app/main.py b/litellm-service/app/main.py deleted file mode 100644 index a8aaf7b..0000000 --- a/litellm-service/app/main.py +++ /dev/null @@ -1,379 +0,0 @@ -import hashlib -import json -import time -from typing import Any, Dict, Optional, Tuple - -import yaml -from fastapi import Body, FastAPI, HTTPException, Request, Response, BackgroundTasks -from fastapi.responses import JSONResponse, PlainTextResponse, StreamingResponse -from litellm import acompletion, aembedding -from prometheus_client import CONTENT_TYPE_LATEST, Counter, Histogram, generate_latest -from pythonjsonlogger import jsonlogger - -import logging -from pathlib import Path - - -logger = logging.getLogger("litellm-service") -handler = logging.StreamHandler() -handler.setFormatter(jsonlogger.JsonFormatter("%(message)s %(levelname)s %(name)s %(asctime)s")) -logger.addHandler(handler) - - -REQUESTS_TOTAL = Counter( - "litellm_requests_total", - "Total requests", - ["endpoint", "status"], -) -REQUEST_LATENCY_SECONDS = Histogram( - "litellm_request_latency_seconds", - "Request latency in seconds", - ["endpoint"], - buckets=(0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2, 5, 10, 20), -) - - -def _load_config(path: str) -> Dict[str, Any]: - with open(path, "r", encoding="utf-8") as f: - return yaml.safe_load(f) or {} - -def _validate_config(cfg: Dict[str, Any]) -> None: - app_cfg = cfg.get("app") or {} - if not isinstance(app_cfg, dict): - raise ValueError("app must be a map") - env = str(app_cfg.get("env") or "development").lower() - models = cfg.get("models") or {} - if not isinstance(models, dict) or not models: - raise ValueError("models must be a non-empty map") - for name, alias in models.items(): - if not isinstance(name, str) or not name.strip(): - raise ValueError("models keys must be non-empty strings") - if not isinstance(alias, dict): - raise ValueError(f"models['{name}'] must be a map") - provider = alias.get("provider") - model = alias.get("model") - if not provider or not model: - raise ValueError(f"models['{name}'] must include provider and model") - if env == "production": - providers = cfg.get("providers") or {} - if not isinstance(providers, dict): - raise ValueError("providers must be a map") - placeholders = {"", "change-me", "changeme", "replace-me"} - referenced_providers = {str(alias.get("provider")) for alias in models.values() if isinstance(alias, dict) and alias.get("provider")} - for provider_name in referenced_providers: - if provider_name == "ollama": - continue - provider_cfg = providers.get(provider_name) or {} - if not isinstance(provider_cfg, dict): - provider_cfg = {} - api_key = provider_cfg.get("api_key") - api_key_value = str(api_key).strip().lower() - if api_key is None or api_key_value in placeholders or api_key_value.startswith("replace_with_"): - raise ValueError(f"providers.{provider_name}.api_key must not be a placeholder in production") - - -def _resolve_config_path(path: str) -> str: - if Path(path).exists(): - return path - for fallback in (Path("config/easyai.development.yaml"), Path("../config/easyai.development.yaml")): - if fallback.exists(): - return str(fallback) - return path - - -CONFIG_PATH = _resolve_config_path("/app/config/easyai.yaml") -CONFIG = _load_config(CONFIG_PATH) -_validate_config(CONFIG) -logger.setLevel(str((CONFIG.get("app") or {}).get("log_level", "info")).upper()) - - -def _provider_config(provider: str) -> dict: - providers = CONFIG.get("providers") or {} - cfg = providers.get(provider) or {} - return cfg if isinstance(cfg, dict) else {} - - -def _resolve_model(input_model: str, selector_key: Optional[str] = None) -> Tuple[str, Optional[str], Optional[str]]: - aliases = (CONFIG.get("models") or {}) - if input_model in aliases: - alias = aliases[input_model] or {} - provider = alias.get("provider") - model = alias.get("model") - provider_cfg = _provider_config(str(provider)) - api_base = alias.get("api_base") or provider_cfg.get("api_base") - api_key = alias.get("api_key") or provider_cfg.get("api_key") - if provider == "ollama": - if not api_base: - raise ValueError("providers.ollama.api_base is required for ollama provider") - return f"ollama/{model}", api_base, None - return f"{provider}/{model}", api_base, api_key - return input_model, None, None - - -def _models() -> list[str]: - return list((CONFIG.get("models") or {}).keys()) - - -app = FastAPI(title="LiteLLM Service", version="0.1.0") - - -@app.middleware("http") -async def metrics_middleware(request: Request, call_next): - endpoint = request.url.path - start = time.perf_counter() - status = "500" - try: - response = await call_next(request) - status = str(response.status_code) - return response - finally: - elapsed = time.perf_counter() - start - REQUESTS_TOTAL.labels(endpoint=endpoint, status=status).inc() - REQUEST_LATENCY_SECONDS.labels(endpoint=endpoint).observe(elapsed) - - -@app.get("/healthz") -async def healthz(): - return { - "ok": True, - "service": "litellm-service", - "models": _models(), - } - - -@app.get("/metrics") -async def metrics(): - return Response(generate_latest(), media_type=CONTENT_TYPE_LATEST) - - -@app.get("/v1/models") -async def list_models(): - return {"object": "list", "data": [{"id": m, "object": "model"} for m in _models()]} - - -def _validate_model(model: str): - allowed = set(_models()) - if allowed and model not in allowed: - return JSONResponse(status_code=400, content={"error": {"message": "model not allowed", "type": "invalid_request_error"}}) - return None - - -def _stable_hash(payload: Any) -> str: - raw = json.dumps(payload, sort_keys=True, ensure_ascii=False, separators=(",", ":")).encode("utf-8") - return hashlib.sha256(raw).hexdigest() - -def _safe_json(value: Any) -> Any: - if value is None: - return None - if hasattr(value, "model_dump"): - try: - return value.model_dump() - except Exception: - return str(value) - return value - - -def _parse_upstream_error(e: Exception) -> Tuple[int, str]: - err_str = str(e).lower() - if "cancel" in err_str or "disconnect" in err_str or "abort" in err_str: - return 499, f"Client Disconnected: The request was cancelled by the client before completion. (Details: {str(e)})" - if "connection timed out" in err_str or "timeout" in err_str: - return 504, f"Upstream timeout: The model took too long to respond. Please check if the model is loading or increase the timeout setting. (Details: {str(e)})" - if "connection refused" in err_str or "all connection attempts failed" in err_str or "errno -2" in err_str or "name or service not known" in err_str: - return 502, f"Upstream connection error: Failed to connect to upstream service. Please check if the upstream service is running. (Details: {str(e)})" - if "not found" in err_str: - return 404, f"Model not found: The requested model might not be pulled locally. Try running 'ollama pull '. (Details: {str(e)})" - if "system memory" in err_str or "out of memory" in err_str or "oom" in err_str or "allocation failed" in err_str: - return 507, f"Insufficient memory: The system does not have enough memory to run this model. (Details: {str(e)})" - if "internal server error" in err_str or "server error" in err_str: - return 500, f"Upstream internal error: The model service encountered an internal error during generation. (Details: {str(e)})" - return 502, f"Upstream error: {str(e)}" - - -async def _trigger_model_unload(model_name: str, api_base: Optional[str]) -> None: - import httpx - if not api_base: - return - logger.warning(f"Triggering auto-unload for model '{model_name}' due to OOM/Memory issue...") - try: - # According to Ollama API, setting keep_alive=0 will unload the model immediately - async with httpx.AsyncClient() as client: - payload = {"model": model_name.replace("ollama/", ""), "keep_alive": 0} - await client.post(f"{api_base}/api/generate", json=payload, timeout=5.0) - logger.info(f"Model '{model_name}' successfully unloaded to free up memory.") - except Exception as e: - logger.error(f"Failed to auto-unload model '{model_name}': {e}") - - -@app.post("/v1/chat/completions") -async def chat_completions(body: Dict[str, Any] = Body(...), background_tasks: BackgroundTasks = BackgroundTasks()): - model = body.get("model") - if not isinstance(model, str) or not model: - return JSONResponse(status_code=400, content={"error": {"message": "model is required", "type": "invalid_request_error"}}) - err_resp = _validate_model(model) - if err_resp: return err_resp - - selector_key = _stable_hash({"m": model, "p": {k: body.get(k) for k in ("messages", "temperature", "top_p", "max_tokens")}}) - resolved_model, api_base, api_key = _resolve_model(model, selector_key) - params = dict(body) - params["model"] = resolved_model - if api_base: - params["api_base"] = api_base - if api_key: - params["api_key"] = api_key - extra_headers: Dict[str, str] = {} - if api_base: - extra_headers["X-Backend-Base"] = str(api_base) - - timeout_ms = int(((CONFIG.get("app") or {}).get("default_timeout_ms") or 120000)) - params.setdefault("timeout", timeout_ms / 1000.0) - - req_id = selector_key - start = time.perf_counter() - is_stream = params.get("stream") is True - try: - out = await acompletion(**params) - latency_ms = int((time.perf_counter() - start) * 1000) - - if is_stream: - logger.info( - json.dumps( - { - "event": "chat_completion_stream_start", - "request_id": req_id, - "input_model": model, - "resolved_model": resolved_model, - "latency_ms": latency_ms, - }, - ensure_ascii=False, - ) - ) - - async def _stream_generator(): - try: - async for chunk in out: - yield f"data: {json.dumps(chunk.model_dump() if hasattr(chunk, 'model_dump') else chunk, ensure_ascii=False)}\n\n" - yield "data: [DONE]\n\n" - except Exception as stream_err: - logger.error( - json.dumps( - { - "event": "chat_completion_stream_error", - "request_id": req_id, - "input_model": model, - "resolved_model": resolved_model, - "error": str(stream_err), - }, - ensure_ascii=False, - ) - ) - status_code, msg = _parse_upstream_error(stream_err) - if status_code == 507: - background_tasks.add_task(_trigger_model_unload, resolved_model, api_base) - - yield f"data: {json.dumps({'error': {'message': msg, 'type': 'api_error'}})}\n\n" - yield "data: [DONE]\n\n" - - return StreamingResponse(_stream_generator(), media_type="text/event-stream", headers=extra_headers) - - logger.info( - json.dumps( - { - "event": "chat_completion", - "request_id": req_id, - "input_model": model, - "resolved_model": resolved_model, - "latency_ms": latency_ms, - "usage": _safe_json(getattr(out, "usage", None)), - }, - ensure_ascii=False, - ) - ) - return JSONResponse(content=out.model_dump() if hasattr(out, "model_dump") else out, headers=extra_headers) - except Exception as e: - latency_ms = int((time.perf_counter() - start) * 1000) - logger.error( - json.dumps( - { - "event": "chat_completion_error", - "request_id": req_id, - "input_model": model, - "resolved_model": resolved_model, - "latency_ms": latency_ms, - "error": str(e), - }, - ensure_ascii=False, - ) - ) - status_code, msg = _parse_upstream_error(e) - - # Self-healing logic: If OOM detected, trigger model unload in background - if status_code == 507: - background_tasks.add_task(_trigger_model_unload, resolved_model, api_base) - - return JSONResponse(status_code=status_code, content={"error": {"message": msg, "type": "api_error"}}) - - -@app.post("/v1/embeddings") -async def embeddings(body: Dict[str, Any] = Body(...), background_tasks: BackgroundTasks = BackgroundTasks()): - model = body.get("model") - if not isinstance(model, str) or not model: - return JSONResponse(status_code=400, content={"error": {"message": "model is required", "type": "invalid_request_error"}}) - err_resp = _validate_model(model) - if err_resp: return err_resp - - selector_key = _stable_hash({"m": model, "p": {k: body.get(k) for k in ("input", "encoding_format")}}) - resolved_model, api_base, api_key = _resolve_model(model, selector_key) - params = dict(body) - params["model"] = resolved_model - if api_base: - params["api_base"] = api_base - if api_key: - params["api_key"] = api_key - extra_headers: Dict[str, str] = {} - if api_base: - extra_headers["X-Backend-Base"] = str(api_base) - - timeout_ms = int(((CONFIG.get("app") or {}).get("default_timeout_ms") or 120000)) - params.setdefault("timeout", timeout_ms / 1000.0) - - req_id = selector_key - start = time.perf_counter() - try: - out = await aembedding(**params) - latency_ms = int((time.perf_counter() - start) * 1000) - logger.info( - json.dumps( - { - "event": "embedding", - "request_id": req_id, - "input_model": model, - "resolved_model": resolved_model, - "latency_ms": latency_ms, - }, - ensure_ascii=False, - ) - ) - return JSONResponse(content=out.model_dump() if hasattr(out, "model_dump") else out, headers=extra_headers) - except Exception as e: - latency_ms = int((time.perf_counter() - start) * 1000) - logger.error( - json.dumps( - { - "event": "embedding_error", - "request_id": req_id, - "input_model": model, - "resolved_model": resolved_model, - "latency_ms": latency_ms, - "error": str(e), - }, - ensure_ascii=False, - ) - ) - status_code, msg = _parse_upstream_error(e) - - # Self-healing logic: If OOM detected, trigger model unload in background - if status_code == 507: - background_tasks.add_task(_trigger_model_unload, resolved_model, api_base) - - return JSONResponse(status_code=status_code, content={"error": {"message": msg, "type": "api_error"}}) diff --git a/litellm-service/requirements.txt b/litellm-service/requirements.txt deleted file mode 100644 index b97e001..0000000 --- a/litellm-service/requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ -fastapi==0.136.3 -uvicorn[standard]==0.48.0 -litellm==1.83.7 -prometheus-client==0.25.0 -python-json-logger==4.1.0 -PyYAML==6.0.3 diff --git a/litellm-service/test/test_config.py b/litellm-service/test/test_config.py deleted file mode 100644 index a641c2e..0000000 --- a/litellm-service/test/test_config.py +++ /dev/null @@ -1,34 +0,0 @@ -import unittest -import pathlib - - -class TestConfig(unittest.TestCase): - def test_models_define_available_models(self): - here = pathlib.Path(__file__).resolve() - repo_root = here.parent.parent.parent - cfg_path = repo_root / "config" / "easyai.development.yaml" - self.assertTrue(cfg_path.exists()) - - lines = cfg_path.read_text(encoding="utf-8").splitlines() - models = set() - section = None - section_indent = 0 - - for line in lines: - if line.strip() == "models:": - section = "models" - section_indent = len(line) - len(line.lstrip(" ")) - continue - if section and line.strip(): - indent = len(line) - len(line.lstrip(" ")) - if indent <= section_indent: - section = None - continue - if section == "models" and indent == section_indent + 2 and line.rstrip().endswith(":"): - models.add(line.strip()[:-1]) - - self.assertGreater(len(models), 0) - - -if __name__ == "__main__": - unittest.main() diff --git a/load-tests/k6/multi_tenant.ts b/load-tests/k6/multi_tenant.ts deleted file mode 100644 index e2ced44..0000000 --- a/load-tests/k6/multi_tenant.ts +++ /dev/null @@ -1,37 +0,0 @@ -import http from "k6/http"; -import { check, sleep } from "k6"; - -export const options = { - vus: 20, - duration: "5m", - thresholds: { - http_req_duration: ["p(95)<500"], - http_req_failed: ["rate<0.01"], - }, -}; - -const BASE_URL = __ENV.BASE_URL || "http://localhost:8080"; -const API_KEYS = (__ENV.API_KEYS || "dev-key") - .split(",") - .map((s) => s.trim()) - .filter(Boolean); - -export default function () { - const key = API_KEYS[__VU % API_KEYS.length]; - const url = `${BASE_URL}/v1/chat/completions`; - const payload = JSON.stringify({ - model: "local/ollama:qwen2.5:0.5b", - messages: [{ role: "user", content: `Tenant ${__VU} hello` }], - temperature: 0, - }); - - const res = http.post(url, payload, { - headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${key}`, - }, - }); - - check(res, { "status 200": (r) => r.status === 200 }); - sleep(0.2); -} diff --git a/load-tests/k6/peak.ts b/load-tests/k6/peak.ts deleted file mode 100644 index 8760ff8..0000000 --- a/load-tests/k6/peak.ts +++ /dev/null @@ -1,36 +0,0 @@ -import http from "k6/http"; -import { check, sleep } from "k6"; - -export const options = { - stages: [ - { duration: "1m", target: 20 }, - { duration: "3m", target: 200 }, - { duration: "1m", target: 20 }, - { duration: "30s", target: 0 }, - ], - thresholds: { - http_req_duration: ["p(95)<500"], - http_req_failed: ["rate<0.02"], - }, -}; - -const BASE_URL = __ENV.BASE_URL || "http://localhost:8080"; -const API_KEY = __ENV.API_KEY || "dev-key"; - -export default function () { - const url = `${BASE_URL}/v1/embeddings`; - const payload = JSON.stringify({ - model: "local/ollama:qwen2.5:0.5b", - input: "Peak traffic test", - }); - - const res = http.post(url, payload, { - headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${API_KEY}`, - }, - }); - - check(res, { "status 200": (r) => r.status === 200 }); - sleep(0.05); -} diff --git a/load-tests/k6/single_user.ts b/load-tests/k6/single_user.ts deleted file mode 100644 index 44c2591..0000000 --- a/load-tests/k6/single_user.ts +++ /dev/null @@ -1,33 +0,0 @@ -import http from "k6/http"; -import { check, sleep } from "k6"; - -export const options = { - vus: 1, - duration: "2m", - thresholds: { - http_req_duration: ["p(95)<500"], - http_req_failed: ["rate<0.01"], - }, -}; - -const BASE_URL = __ENV.BASE_URL || "http://localhost:8080"; -const API_KEY = __ENV.API_KEY || "dev-key"; - -export default function () { - const url = `${BASE_URL}/v1/chat/completions`; - const payload = JSON.stringify({ - model: "local/ollama:qwen2.5:0.5b", - messages: [{ role: "user", content: "Ping" }], - temperature: 0, - }); - - const res = http.post(url, payload, { - headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${API_KEY}`, - }, - }); - - check(res, { "status 200": (r) => r.status === 200 }); - sleep(1); -} diff --git a/load-tests/package-lock.json b/load-tests/package-lock.json deleted file mode 100644 index d672dc8..0000000 --- a/load-tests/package-lock.json +++ /dev/null @@ -1,499 +0,0 @@ -{ - "name": "easyai-load-tests", - "version": "0.1.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "easyai-load-tests", - "version": "0.1.0", - "devDependencies": { - "esbuild": "^0.28.0" - } - }, - "node_modules/@esbuild/aix-ppc64": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.0.tgz", - "integrity": "sha512-lhRUCeuOyJQURhTxl4WkpFTjIsbDayJHih5kZC1giwE+MhIzAb7mEsQMqMf18rHLsrb5qI1tafG20mLxEWcWlA==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-arm": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.0.tgz", - "integrity": "sha512-wqh0ByljabXLKHeWXYLqoJ5jKC4XBaw6Hk08OfMrCRd2nP2ZQ5eleDZC41XHyCNgktBGYMbqnrJKq/K/lzPMSQ==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-arm64": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.0.tgz", - "integrity": "sha512-+WzIXQOSaGs33tLEgYPYe/yQHf0WTU0X42Jca3y8NWMbUVhp7rUnw+vAsRC/QiDrdD31IszMrZy+qwPOPjd+rw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-x64": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.0.tgz", - "integrity": "sha512-+VJggoaKhk2VNNqVL7f6S189UzShHC/mR9EE8rDdSkdpN0KflSwWY/gWjDrNxxisg8Fp1ZCD9jLMo4m0OUfeUA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/darwin-arm64": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.0.tgz", - "integrity": "sha512-0T+A9WZm+bZ84nZBtk1ckYsOvyA3x7e2Acj1KdVfV4/2tdG4fzUp91YHx+GArWLtwqp77pBXVCPn2We7Letr0Q==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.0.tgz", - "integrity": "sha512-fyzLm/DLDl/84OCfp2f/XQ4flmORsjU7VKt8HLjvIXChJoFFOIL6pLJPH4Yhd1n1gGFF9mPwtlN5Wf82DZs+LQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.0.tgz", - "integrity": "sha512-l9GeW5UZBT9k9brBYI+0WDffcRxgHQD8ShN2Ur4xWq/NFzUKm3k5lsH4PdaRgb2w7mI9u61nr2gI2mLI27Nh3Q==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.0.tgz", - "integrity": "sha512-BXoQai/A0wPO6Es3yFJ7APCiKGc1tdAEOgeTNy3SsB491S3aHn4S4r3e976eUnPdU+NbdtmBuLncYir2tMU9Nw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-arm": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.0.tgz", - "integrity": "sha512-CjaaREJagqJp7iTaNQjjidaNbCKYcd4IDkzbwwxtSvjI7NZm79qiHc8HqciMddQ6CKvJT6aBd8lO9kN/ZudLlw==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.0.tgz", - "integrity": "sha512-RVyzfb3FWsGA55n6WY0MEIEPURL1FcbhFE6BffZEMEekfCzCIMtB5yyDcFnVbTnwk+CLAgTujmV/Lgvih56W+A==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-ia32": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.0.tgz", - "integrity": "sha512-KBnSTt1kxl9x70q+ydterVdl+Cn0H18ngRMRCEQfrbqdUuntQQ0LoMZv47uB97NljZFzY6HcfqEZ2SAyIUTQBQ==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.0.tgz", - "integrity": "sha512-zpSlUce1mnxzgBADvxKXX5sl8aYQHo2ezvMNI8I0lbblJtp8V4odlm3Yzlj7gPyt3T8ReksE6bK+pT3WD+aJRg==", - "cpu": [ - "loong64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.0.tgz", - "integrity": "sha512-2jIfP6mmjkdmeTlsX/9vmdmhBmKADrWqN7zcdtHIeNSCH1SqIoNI63cYsjQR8J+wGa4Y5izRcSHSm8K3QWmk3w==", - "cpu": [ - "mips64el" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.0.tgz", - "integrity": "sha512-bc0FE9wWeC0WBm49IQMPSPILRocGTQt3j5KPCA8os6VprfuJ7KD+5PzESSrJ6GmPIPJK965ZJHTUlSA6GNYEhg==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.0.tgz", - "integrity": "sha512-SQPZOwoTTT/HXFXQJG/vBX8sOFagGqvZyXcgLA3NhIqcBv1BJU1d46c0rGcrij2B56Z2rNiSLaZOYW5cUk7yLQ==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.0.tgz", - "integrity": "sha512-SCfR0HN8CEEjnYnySJTd2cw0k9OHB/YFzt5zgJEwa+wL/T/raGWYMBqwDNAC6dqFKmJYZoQBRfHjgwLHGSrn3Q==", - "cpu": [ - "s390x" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-x64": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.0.tgz", - "integrity": "sha512-us0dSb9iFxIi8srnpl931Nvs65it/Jd2a2K3qs7fz2WfGPHqzfzZTfec7oxZJRNPXPnNYZtanmRc4AL/JwVzHQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/netbsd-arm64": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.0.tgz", - "integrity": "sha512-CR/RYotgtCKwtftMwJlUU7xCVNg3lMYZ0RzTmAHSfLCXw3NtZtNpswLEj/Kkf6kEL3Gw+BpOekRX0BYCtklhUw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.0.tgz", - "integrity": "sha512-nU1yhmYutL+fQ71Kxnhg8uEOdC0pwEW9entHykTgEbna2pw2dkbFSMeqjjyHZoCmt8SBkOSvV+yNmm94aUrrqw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-arm64": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.0.tgz", - "integrity": "sha512-cXb5vApOsRsxsEl4mcZ1XY3D4DzcoMxR/nnc4IyqYs0rTI8ZKmW6kyyg+11Z8yvgMfAEldKzP7AdP64HnSC/6g==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.0.tgz", - "integrity": "sha512-8wZM2qqtv9UP3mzy7HiGYNH/zjTA355mpeuA+859TyR+e+Tc08IHYpLJuMsfpDJwoLo1ikIJI8jC3GFjnRClzA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openharmony-arm64": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.0.tgz", - "integrity": "sha512-FLGfyizszcef5C3YtoyQDACyg95+dndv79i2EekILBofh5wpCa1KuBqOWKrEHZg3zrL3t5ouE5jgr94vA+Wb2w==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openharmony" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.0.tgz", - "integrity": "sha512-1ZgjUoEdHZZl/YlV76TSCz9Hqj9h9YmMGAgAPYd+q4SicWNX3G5GCyx9uhQWSLcbvPW8Ni7lj4gDa1T40akdlw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.0.tgz", - "integrity": "sha512-Q9StnDmQ/enxnpxCCLSg0oo4+34B9TdXpuyPeTedN/6+iXBJ4J+zwfQI28u/Jl40nOYAxGoNi7mFP40RUtkmUA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.0.tgz", - "integrity": "sha512-zF3ag/gfiCe6U2iczcRzSYJKH1DCI+ByzSENHlM2FcDbEeo5Zd2C86Aq0tKUYAJJ1obRP84ymxIAksZUcdztHA==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-x64": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.0.tgz", - "integrity": "sha512-pEl1bO9mfAmIC+tW5btTmrKaujg3zGtUmWNdCw/xs70FBjwAL3o9OEKNHvNmnyylD6ubxUERiEhdsL0xBQ9efw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/esbuild": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.0.tgz", - "integrity": "sha512-sNR9MHpXSUV/XB4zmsFKN+QgVG82Cc7+/aaxJ8Adi8hyOac+EXptIp45QBPaVyX3N70664wRbTcLTOemCAnyqw==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=18" - }, - "optionalDependencies": { - "@esbuild/aix-ppc64": "0.28.0", - "@esbuild/android-arm": "0.28.0", - "@esbuild/android-arm64": "0.28.0", - "@esbuild/android-x64": "0.28.0", - "@esbuild/darwin-arm64": "0.28.0", - "@esbuild/darwin-x64": "0.28.0", - "@esbuild/freebsd-arm64": "0.28.0", - "@esbuild/freebsd-x64": "0.28.0", - "@esbuild/linux-arm": "0.28.0", - "@esbuild/linux-arm64": "0.28.0", - "@esbuild/linux-ia32": "0.28.0", - "@esbuild/linux-loong64": "0.28.0", - "@esbuild/linux-mips64el": "0.28.0", - "@esbuild/linux-ppc64": "0.28.0", - "@esbuild/linux-riscv64": "0.28.0", - "@esbuild/linux-s390x": "0.28.0", - "@esbuild/linux-x64": "0.28.0", - "@esbuild/netbsd-arm64": "0.28.0", - "@esbuild/netbsd-x64": "0.28.0", - "@esbuild/openbsd-arm64": "0.28.0", - "@esbuild/openbsd-x64": "0.28.0", - "@esbuild/openharmony-arm64": "0.28.0", - "@esbuild/sunos-x64": "0.28.0", - "@esbuild/win32-arm64": "0.28.0", - "@esbuild/win32-ia32": "0.28.0", - "@esbuild/win32-x64": "0.28.0" - } - } - } -} diff --git a/load-tests/package.json b/load-tests/package.json deleted file mode 100644 index 3818287..0000000 --- a/load-tests/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "easyai-load-tests", - "version": "0.1.0", - "private": true, - "type": "module", - "scripts": { - "clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"", - "build": "npm run clean && npm run build:single && npm run build:multi && npm run build:peak", - "build:single": "esbuild k6/single_user.ts --bundle --platform=neutral --target=es2022 --external:k6 --external:k6/http --outfile=dist/single_user", - "build:multi": "esbuild k6/multi_tenant.ts --bundle --platform=neutral --target=es2022 --external:k6 --external:k6/http --outfile=dist/multi_tenant", - "build:peak": "esbuild k6/peak.ts --bundle --platform=neutral --target=es2022 --external:k6 --external:k6/http --outfile=dist/peak", - "run:single": "npm run build:single && k6 run dist/single_user", - "run:multi": "npm run build:multi && k6 run dist/multi_tenant", - "run:peak": "npm run build:peak && k6 run dist/peak" - }, - "devDependencies": { - "esbuild": "^0.28.0" - } -} diff --git a/oneapi-gateway/Dockerfile b/oneapi-gateway/Dockerfile index 0803b53..53e97f3 100644 --- a/oneapi-gateway/Dockerfile +++ b/oneapi-gateway/Dockerfile @@ -6,22 +6,6 @@ RUN npm ci --no-audit --no-fund COPY src /app/src RUN npx tsc -p tsconfig.build.json -FROM node:22-alpine AS build-admin-ui - -WORKDIR /app/admin-ui -COPY admin-ui/package.json admin-ui/package-lock.json admin-ui/tsconfig.json admin-ui/vite.config.ts admin-ui/index.html /app/admin-ui/ -COPY admin-ui/src /app/admin-ui/src -RUN npm ci --no-audit --no-fund -RUN npm run build - -FROM node:22-alpine AS build-chat-ui - -WORKDIR /app/chat-ui -COPY chat-ui/package.json chat-ui/package-lock.json chat-ui/tsconfig.json chat-ui/vite.config.ts chat-ui/index.html /app/chat-ui/ -COPY chat-ui/src /app/chat-ui/src -RUN npm ci --no-audit --no-fund -RUN npm run build - FROM node:22-alpine RUN addgroup -S appgroup && adduser -S appuser -G appgroup @@ -30,8 +14,6 @@ WORKDIR /app COPY --from=build-gateway /app/package.json /app/package.json COPY --from=build-gateway /app/node_modules /app/node_modules COPY --from=build-gateway /app/dist /app/dist -COPY --from=build-admin-ui /app/admin-ui/dist /app/admin-ui/dist -COPY --from=build-chat-ui /app/chat-ui/dist /app/chat-ui/dist USER appuser EXPOSE 3003 diff --git a/oneapi-gateway/admin-ui/index.html b/oneapi-gateway/admin-ui/index.html deleted file mode 100644 index b44e5e1..0000000 --- a/oneapi-gateway/admin-ui/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - OneAPI Admin - - -
- - - diff --git a/oneapi-gateway/admin-ui/package-lock.json b/oneapi-gateway/admin-ui/package-lock.json deleted file mode 100644 index 84a9b25..0000000 --- a/oneapi-gateway/admin-ui/package-lock.json +++ /dev/null @@ -1,1859 +0,0 @@ -{ - "name": "oneapi-admin-ui", - "version": "0.1.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "oneapi-admin-ui", - "version": "0.1.0", - "dependencies": { - "react": "^19.1.1", - "react-dom": "^19.1.1" - }, - "devDependencies": { - "@types/react": "^19.1.12", - "@types/react-dom": "^19.1.8", - "@vitejs/plugin-react": "^5.0.2", - "typescript": "^5.7.3", - "vite": "^7.1.3" - } - }, - "node_modules/@babel/code-frame": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.0.tgz", - "integrity": "sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-validator-identifier": "^7.28.5", - "js-tokens": "^4.0.0", - "picocolors": "^1.1.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/compat-data": { - "version": "7.29.3", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.3.tgz", - "integrity": "sha512-LIVqM46zQWZhj17qA8wb4nW/ixr2y1Nw+r1etiAWgRM6U1IqP+LNhL1yg440jYZR72jCWcWbLWzIosH+uP1fqg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/core": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.0.tgz", - "integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.29.0", - "@babel/generator": "^7.29.0", - "@babel/helper-compilation-targets": "^7.28.6", - "@babel/helper-module-transforms": "^7.28.6", - "@babel/helpers": "^7.28.6", - "@babel/parser": "^7.29.0", - "@babel/template": "^7.28.6", - "@babel/traverse": "^7.29.0", - "@babel/types": "^7.29.0", - "@jridgewell/remapping": "^2.3.5", - "convert-source-map": "^2.0.0", - "debug": "^4.1.0", - "gensync": "^1.0.0-beta.2", - "json5": "^2.2.3", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/babel" - } - }, - "node_modules/@babel/generator": { - "version": "7.29.1", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.1.tgz", - "integrity": "sha512-qsaF+9Qcm2Qv8SRIMMscAvG4O3lJ0F1GuMo5HR/Bp02LopNgnZBC/EkbevHFeGs4ls/oPz9v+Bsmzbkbe+0dUw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/parser": "^7.29.0", - "@babel/types": "^7.29.0", - "@jridgewell/gen-mapping": "^0.3.12", - "@jridgewell/trace-mapping": "^0.3.28", - "jsesc": "^3.0.2" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-compilation-targets": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.28.6.tgz", - "integrity": "sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/compat-data": "^7.28.6", - "@babel/helper-validator-option": "^7.27.1", - "browserslist": "^4.24.0", - "lru-cache": "^5.1.1", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-globals": { - "version": "7.28.0", - "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.28.0.tgz", - "integrity": "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-imports": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.28.6.tgz", - "integrity": "sha512-l5XkZK7r7wa9LucGw9LwZyyCUscb4x37JWTPz7swwFE/0FMQAGpiWUZn8u9DzkSBWEcK25jmvubfpw2dnAMdbw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/traverse": "^7.28.6", - "@babel/types": "^7.28.6" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-transforms": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.28.6.tgz", - "integrity": "sha512-67oXFAYr2cDLDVGLXTEABjdBJZ6drElUSI7WKp70NrpyISso3plG9SAGEF6y7zbha/wOzUByWWTJvEDVNIUGcA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-module-imports": "^7.28.6", - "@babel/helper-validator-identifier": "^7.28.5", - "@babel/traverse": "^7.28.6" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-plugin-utils": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.28.6.tgz", - "integrity": "sha512-S9gzZ/bz83GRysI7gAD4wPT/AI3uCnY+9xn+Mx/KPs2JwHJIz1W8PZkg2cqyt3RNOBM8ejcXhV6y8Og7ly/Dug==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-string-parser": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", - "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-identifier": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", - "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-option": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz", - "integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helpers": { - "version": "7.29.2", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.2.tgz", - "integrity": "sha512-HoGuUs4sCZNezVEKdVcwqmZN8GoHirLUcLaYVNBK2J0DadGtdcqgr3BCbvH8+XUo4NGjNl3VOtSjEKNzqfFgKw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/template": "^7.28.6", - "@babel/types": "^7.29.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/parser": { - "version": "7.29.3", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.3.tgz", - "integrity": "sha512-b3ctpQwp+PROvU/cttc4OYl4MzfJUWy6FZg+PMXfzmt/+39iHVF0sDfqay8TQM3JA2EUOyKcFZt75jWriQijsA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.29.0" - }, - "bin": { - "parser": "bin/babel-parser.js" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@babel/plugin-transform-react-jsx-self": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.27.1.tgz", - "integrity": "sha512-6UzkCs+ejGdZ5mFFC/OCUrv028ab2fp1znZmCZjAOBKiBK2jXD1O+BPSfX8X2qjJ75fZBMSnQn3Rq2mrBJK2mw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-react-jsx-source": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.27.1.tgz", - "integrity": "sha512-zbwoTsBruTeKB9hSq73ha66iFeJHuaFkUbwvqElnygoNbj/jHRsSeokowZFN3CZ64IvEqcmmkVe89OPXc7ldAw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/template": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.28.6.tgz", - "integrity": "sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.28.6", - "@babel/parser": "^7.28.6", - "@babel/types": "^7.28.6" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/traverse": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.0.tgz", - "integrity": "sha512-4HPiQr0X7+waHfyXPZpWPfWL/J7dcN1mx9gL6WdQVMbPnF3+ZhSMs8tCxN7oHddJE9fhNE7+lxdnlyemKfJRuA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.29.0", - "@babel/generator": "^7.29.0", - "@babel/helper-globals": "^7.28.0", - "@babel/parser": "^7.29.0", - "@babel/template": "^7.28.6", - "@babel/types": "^7.29.0", - "debug": "^4.3.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/types": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.0.tgz", - "integrity": "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-string-parser": "^7.27.1", - "@babel/helper-validator-identifier": "^7.28.5" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@esbuild/aix-ppc64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.7.tgz", - "integrity": "sha512-EKX3Qwmhz1eMdEJokhALr0YiD0lhQNwDqkPYyPhiSwKrh7/4KRjQc04sZ8db+5DVVnZ1LmbNDI1uAMPEUBnQPg==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-arm": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.7.tgz", - "integrity": "sha512-jbPXvB4Yj2yBV7HUfE2KHe4GJX51QplCN1pGbYjvsyCZbQmies29EoJbkEc+vYuU5o45AfQn37vZlyXy4YJ8RQ==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.7.tgz", - "integrity": "sha512-62dPZHpIXzvChfvfLJow3q5dDtiNMkwiRzPylSCfriLvZeq0a1bWChrGx/BbUbPwOrsWKMn8idSllklzBy+dgQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.7.tgz", - "integrity": "sha512-x5VpMODneVDb70PYV2VQOmIUUiBtY3D3mPBG8NxVk5CogneYhkR7MmM3yR/uMdITLrC1ml/NV1rj4bMJuy9MCg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/darwin-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.7.tgz", - "integrity": "sha512-5lckdqeuBPlKUwvoCXIgI2D9/ABmPq3Rdp7IfL70393YgaASt7tbju3Ac+ePVi3KDH6N2RqePfHnXkaDtY9fkw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.7.tgz", - "integrity": "sha512-rYnXrKcXuT7Z+WL5K980jVFdvVKhCHhUwid+dDYQpH+qu+TefcomiMAJpIiC2EM3Rjtq0sO3StMV/+3w3MyyqQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.7.tgz", - "integrity": "sha512-B48PqeCsEgOtzME2GbNM2roU29AMTuOIN91dsMO30t+Ydis3z/3Ngoj5hhnsOSSwNzS+6JppqWsuhTp6E82l2w==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.7.tgz", - "integrity": "sha512-jOBDK5XEjA4m5IJK3bpAQF9/Lelu/Z9ZcdhTRLf4cajlB+8VEhFFRjWgfy3M1O4rO2GQ/b2dLwCUGpiF/eATNQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-arm": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.7.tgz", - "integrity": "sha512-RkT/YXYBTSULo3+af8Ib0ykH8u2MBh57o7q/DAs3lTJlyVQkgQvlrPTnjIzzRPQyavxtPtfg0EopvDyIt0j1rA==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.7.tgz", - "integrity": "sha512-RZPHBoxXuNnPQO9rvjh5jdkRmVizktkT7TCDkDmQ0W2SwHInKCAV95GRuvdSvA7w4VMwfCjUiPwDi0ZO6Nfe9A==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-ia32": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.7.tgz", - "integrity": "sha512-GA48aKNkyQDbd3KtkplYWT102C5sn/EZTY4XROkxONgruHPU72l+gW+FfF8tf2cFjeHaRbWpOYa/uRBz/Xq1Pg==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.7.tgz", - "integrity": "sha512-a4POruNM2oWsD4WKvBSEKGIiWQF8fZOAsycHOt6JBpZ+JN2n2JH9WAv56SOyu9X5IqAjqSIPTaJkqN8F7XOQ5Q==", - "cpu": [ - "loong64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.7.tgz", - "integrity": "sha512-KabT5I6StirGfIz0FMgl1I+R1H73Gp0ofL9A3nG3i/cYFJzKHhouBV5VWK1CSgKvVaG4q1RNpCTR2LuTVB3fIw==", - "cpu": [ - "mips64el" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.7.tgz", - "integrity": "sha512-gRsL4x6wsGHGRqhtI+ifpN/vpOFTQtnbsupUF5R5YTAg+y/lKelYR1hXbnBdzDjGbMYjVJLJTd2OFmMewAgwlQ==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.7.tgz", - "integrity": "sha512-hL25LbxO1QOngGzu2U5xeXtxXcW+/GvMN3ejANqXkxZ/opySAZMrc+9LY/WyjAan41unrR3YrmtTsUpwT66InQ==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.7.tgz", - "integrity": "sha512-2k8go8Ycu1Kb46vEelhu1vqEP+UeRVj2zY1pSuPdgvbd5ykAw82Lrro28vXUrRmzEsUV0NzCf54yARIK8r0fdw==", - "cpu": [ - "s390x" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.7.tgz", - "integrity": "sha512-hzznmADPt+OmsYzw1EE33ccA+HPdIqiCRq7cQeL1Jlq2gb1+OyWBkMCrYGBJ+sxVzve2ZJEVeePbLM2iEIZSxA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/netbsd-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.7.tgz", - "integrity": "sha512-b6pqtrQdigZBwZxAn1UpazEisvwaIDvdbMbmrly7cDTMFnw/+3lVxxCTGOrkPVnsYIosJJXAsILG9XcQS+Yu6w==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.7.tgz", - "integrity": "sha512-OfatkLojr6U+WN5EDYuoQhtM+1xco+/6FSzJJnuWiUw5eVcicbyK3dq5EeV/QHT1uy6GoDhGbFpprUiHUYggrw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.7.tgz", - "integrity": "sha512-AFuojMQTxAz75Fo8idVcqoQWEHIXFRbOc1TrVcFSgCZtQfSdc1RXgB3tjOn/krRHENUB4j00bfGjyl2mJrU37A==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.7.tgz", - "integrity": "sha512-+A1NJmfM8WNDv5CLVQYJ5PshuRm/4cI6WMZRg1by1GwPIQPCTs1GLEUHwiiQGT5zDdyLiRM/l1G0Pv54gvtKIg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openharmony-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.7.tgz", - "integrity": "sha512-+KrvYb/C8zA9CU/g0sR6w2RBw7IGc5J2BPnc3dYc5VJxHCSF1yNMxTV5LQ7GuKteQXZtspjFbiuW5/dOj7H4Yw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openharmony" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.7.tgz", - "integrity": "sha512-ikktIhFBzQNt/QDyOL580ti9+5mL/YZeUPKU2ivGtGjdTYoqz6jObj6nOMfhASpS4GU4Q/Clh1QtxWAvcYKamA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.7.tgz", - "integrity": "sha512-7yRhbHvPqSpRUV7Q20VuDwbjW5kIMwTHpptuUzV+AA46kiPze5Z7qgt6CLCK3pWFrHeNfDd1VKgyP4O+ng17CA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.7.tgz", - "integrity": "sha512-SmwKXe6VHIyZYbBLJrhOoCJRB/Z1tckzmgTLfFYOfpMAx63BJEaL9ExI8x7v0oAO3Zh6D/Oi1gVxEYr5oUCFhw==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.7.tgz", - "integrity": "sha512-56hiAJPhwQ1R4i+21FVF7V8kSD5zZTdHcVuRFMW0hn753vVfQN8xlx4uOPT4xoGH0Z/oVATuR82AiqSTDIpaHg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.13", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", - "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.5.0", - "@jridgewell/trace-mapping": "^0.3.24" - } - }, - "node_modules/@jridgewell/remapping": { - "version": "2.3.5", - "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", - "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/gen-mapping": "^0.3.5", - "@jridgewell/trace-mapping": "^0.3.24" - } - }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", - "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.5.5", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", - "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", - "dev": true, - "license": "MIT" - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.31", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", - "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/resolve-uri": "^3.1.0", - "@jridgewell/sourcemap-codec": "^1.4.14" - } - }, - "node_modules/@rolldown/pluginutils": { - "version": "1.0.0-rc.3", - "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-rc.3.tgz", - "integrity": "sha512-eybk3TjzzzV97Dlj5c+XrBFW57eTNhzod66y9HrBlzJ6NsCrWCp/2kaPS3K9wJmurBC0Tdw4yPjXKZqlznim3Q==", - "dev": true, - "license": "MIT" - }, - "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.60.4.tgz", - "integrity": "sha512-F5QXMSiFebS9hKZj02XhWLLnRpJ3B3AROP0tWbFBSj+6kCbg5m9j5JoHKd4mmSVy5mS/IMQloYgYxCuJC0fxEQ==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-android-arm64": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.60.4.tgz", - "integrity": "sha512-GxxTKApUpzRhof7poWvCJHRF51C67u1R7D6DiluBE8wKU1u5GWE8t+v81JvJYtbawoBFX1hLv5Ei4eVjkWokaw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.60.4.tgz", - "integrity": "sha512-tua0TaJxMOB1R0V0RS1jFZ/RpURFDJIOR2A6jWwQeawuFyS4gBW+rntLRaQd0EQ4bd6Vp44Z2rXW+YYDBsj6IA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.60.4.tgz", - "integrity": "sha512-CSKq7MsP+5PFIcydhAiR1K0UhEI1A2jWXVKHPCBZ151yOutENwvnPocgVHkivu2kviURtCEB6zUQw0vs8RrhMg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.60.4.tgz", - "integrity": "sha512-+O8OkVdyvXMtJEciu2wS/pzm1IxntEEQx3z5TAVy4l32G0etZn+RsA48ARRrFm6Ri8fvqPQfgrvNxSjKAbnd3g==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ] - }, - "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.60.4.tgz", - "integrity": "sha512-Iw3oMskH3AfNuhU0MSN7vNbdi4me/NiYo2azqPz/Le16zHSa+3RRmliCMWWQmh4lcndccU40xcJuTYJZxNo/lw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ] - }, - "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.60.4.tgz", - "integrity": "sha512-EIPRXTVQpHyF8WOo219AD2yEltPehLTcTMz2fn6JsatLYSzQf00hj3rulF+yauOlF9/FtM2WpkT/hJh/KJFGhA==", - "cpu": [ - "arm" - ], - "dev": true, - "libc": [ - "glibc" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.60.4.tgz", - "integrity": "sha512-J3Yh9PzzF1Ovah2At+lHiGQdsYgArxBbXv/zHfSyaiFQEqvNv7DcW98pCrmdjCZBrqBiKrKKe2V+aaSGWuBe/w==", - "cpu": [ - "arm" - ], - "dev": true, - "libc": [ - "musl" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.60.4.tgz", - "integrity": "sha512-BFDEZMYfUvLn37ONE1yMBojPxnMlTFsdyNoqncT0qFq1mAfllL+ATMMJd8TeuVMiX84s1KbcxcZbXInmcO2mRg==", - "cpu": [ - "arm64" - ], - "dev": true, - "libc": [ - "glibc" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.60.4.tgz", - "integrity": "sha512-pc9EYOSlOgdQ2uPl1o9PF6/kLSgaUosia7gOuS8mB69IxJvlclko1MECXysjs5ryez1/5zjYqx3+xYU0TU6R1A==", - "cpu": [ - "arm64" - ], - "dev": true, - "libc": [ - "musl" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-loong64-gnu": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.60.4.tgz", - "integrity": "sha512-NxnomyxYerDh5n4iLrNa+sH+Z+U4BMEE46V2PgQ/hoB909i8gV1M5wPojWg9fk1jWpO3IQnOs20K4wyZuFLEFQ==", - "cpu": [ - "loong64" - ], - "dev": true, - "libc": [ - "glibc" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-loong64-musl": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.60.4.tgz", - "integrity": "sha512-nbJnQ8a3z1mtmrwImCYhc6BGpThAyYVRQxw9uKSKG4wR6aAYno9sVjJ0zaZcW9BPJX1GbrDPf+SvdWjgTuDmnw==", - "cpu": [ - "loong64" - ], - "dev": true, - "libc": [ - "musl" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-ppc64-gnu": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.60.4.tgz", - "integrity": "sha512-2EU6acNrQLd8tYvo/LXW535wupT3m6fo7HKo6lr7ktQoItxTyOL1ZCR/GfGCuXl2vR+zmfI6eRXkSemafv+iVg==", - "cpu": [ - "ppc64" - ], - "dev": true, - "libc": [ - "glibc" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-ppc64-musl": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.60.4.tgz", - "integrity": "sha512-WeBtoMuaMxiiIrO2IYP3xs6GMWkJP2C0EoT8beTLkUPmzV1i/UcOSVw1d5r9KBODtHKilG5yFxsGRnBbK3wJ4A==", - "cpu": [ - "ppc64" - ], - "dev": true, - "libc": [ - "musl" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.60.4.tgz", - "integrity": "sha512-FJHFfqpKUI3A10WrWKiFbBZ7yVbGT4q4B5o1qKFFojqpaYoh9LrQgqWCmmcxQzVSXYtyB5bzkXrYzlHTs21MYA==", - "cpu": [ - "riscv64" - ], - "dev": true, - "libc": [ - "glibc" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.60.4.tgz", - "integrity": "sha512-mcEl6CUT5IAUmQf1m9FYSmVqCJlpQ8r8eyftFUHG8i9OhY7BkBXSUdnLH5DOf0wCOjcP9v/QO93zpmF1SptCCw==", - "cpu": [ - "riscv64" - ], - "dev": true, - "libc": [ - "musl" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.60.4.tgz", - "integrity": "sha512-ynt3JxVd2w2buzoKDWIyiV1pJW93xlQic1THVLXilz429oijRpSHivZAgp65KBu+cMcgf1eVVjdnTLvPxgCuoQ==", - "cpu": [ - "s390x" - ], - "dev": true, - "libc": [ - "glibc" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.60.4.tgz", - "integrity": "sha512-Boiz5+MsaROEWDf+GGEwF8VMHGhlUoQMtIPjOgA5fv4osupqTVnJteQNKJwUcnUog2G55jYXH7KZFFiJe0TEzQ==", - "cpu": [ - "x64" - ], - "dev": true, - "libc": [ - "glibc" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.60.4.tgz", - "integrity": "sha512-+qfSY27qIrFfI/Hom04KYFw3GKZSGU4lXus51wsb5EuySfFlWRwjkKWoE9emgRw/ukoT4Udsj4W/+xxG8VbPKg==", - "cpu": [ - "x64" - ], - "dev": true, - "libc": [ - "musl" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-openbsd-x64": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.60.4.tgz", - "integrity": "sha512-VpTfOPHgVXEBeeR8hZ2O0F3aSso+JDWqTWmTmzcQKted54IAdUVbxE+j/MVxUsKa8L20HJhv3vUezVPoquqWjA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ] - }, - "node_modules/@rollup/rollup-openharmony-arm64": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.60.4.tgz", - "integrity": "sha512-IPOsh5aRYuLv/nkU51X10Bf75Bsf6+gZdx1X+QP5QM6lIJFHHqbHLG0uJn/hWthzo13UAc2umiUorqZy3axoZg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openharmony" - ] - }, - "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.60.4.tgz", - "integrity": "sha512-4QzE9E81OohJ/HKzHhsqU+zcYYojVOXlFMs1DdyMT6qXl/niOH7AVElmmEdUNHHS/oRkc++d5k6Vy85zFs0DEw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.60.4.tgz", - "integrity": "sha512-zTPgT1YuHHcd+Tmx7h8aml0FWFVelV5N54oHow9SLj+GfoDy/huQ+UV396N/C7KpMDMiPspRktzM1/0r1usYEA==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-x64-gnu": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.60.4.tgz", - "integrity": "sha512-DRS4G7mi9lJxqEDezIkKCaUIKCrLUUDCUaCsTPCi/rtqaC6D/jjwslMQyiDU50Ka0JKpeXeRBFBAXwArY52vBw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.60.4.tgz", - "integrity": "sha512-QVTUovf40zgTqlFVrKA1uXMVvU2QWEFWfAH8Wdc48IxLvrJMQVMBRjuQyUpzZCDkakImib9eVazbWlC6ksWtJw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@types/babel__core": { - "version": "7.20.5", - "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", - "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/parser": "^7.20.7", - "@babel/types": "^7.20.7", - "@types/babel__generator": "*", - "@types/babel__template": "*", - "@types/babel__traverse": "*" - } - }, - "node_modules/@types/babel__generator": { - "version": "7.27.0", - "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.27.0.tgz", - "integrity": "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.0.0" - } - }, - "node_modules/@types/babel__template": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", - "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0" - } - }, - "node_modules/@types/babel__traverse": { - "version": "7.28.0", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.28.0.tgz", - "integrity": "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.28.2" - } - }, - "node_modules/@types/estree": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", - "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/react": { - "version": "19.2.14", - "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.14.tgz", - "integrity": "sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w==", - "dev": true, - "license": "MIT", - "dependencies": { - "csstype": "^3.2.2" - } - }, - "node_modules/@types/react-dom": { - "version": "19.2.3", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.3.tgz", - "integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==", - "dev": true, - "license": "MIT", - "peerDependencies": { - "@types/react": "^19.2.0" - } - }, - "node_modules/@vitejs/plugin-react": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-5.2.0.tgz", - "integrity": "sha512-YmKkfhOAi3wsB1PhJq5Scj3GXMn3WvtQ/JC0xoopuHoXSdmtdStOpFrYaT1kie2YgFBcIe64ROzMYRjCrYOdYw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/core": "^7.29.0", - "@babel/plugin-transform-react-jsx-self": "^7.27.1", - "@babel/plugin-transform-react-jsx-source": "^7.27.1", - "@rolldown/pluginutils": "1.0.0-rc.3", - "@types/babel__core": "^7.20.5", - "react-refresh": "^0.18.0" - }, - "engines": { - "node": "^20.19.0 || >=22.12.0" - }, - "peerDependencies": { - "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" - } - }, - "node_modules/baseline-browser-mapping": { - "version": "2.10.31", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.31.tgz", - "integrity": "sha512-MujYO3eP72uvmSE0i4wltsodRfIpZATP3jvzRNRGGxgzId7aVocVJJV3nf01qnzzKFGxQVC9bpWxl5cjxTr/7Q==", - "dev": true, - "license": "Apache-2.0", - "bin": { - "baseline-browser-mapping": "dist/cli.cjs" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/browserslist": { - "version": "4.28.2", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.2.tgz", - "integrity": "sha512-48xSriZYYg+8qXna9kwqjIVzuQxi+KYWp2+5nCYnYKPTr0LvD89Jqk2Or5ogxz0NUMfIjhh2lIUX/LyX9B4oIg==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "baseline-browser-mapping": "^2.10.12", - "caniuse-lite": "^1.0.30001782", - "electron-to-chromium": "^1.5.328", - "node-releases": "^2.0.36", - "update-browserslist-db": "^1.2.3" - }, - "bin": { - "browserslist": "cli.js" - }, - "engines": { - "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" - } - }, - "node_modules/caniuse-lite": { - "version": "1.0.30001793", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001793.tgz", - "integrity": "sha512-iwSsYWaCOoh26cV8NwNRViHlrfUvYsHDfRVcbtmw0Kg6PJIZZXwMkj1442FYLBGkeUf1juAsU3DTfxW579mrPA==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/caniuse-lite" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "CC-BY-4.0" - }, - "node_modules/convert-source-map": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", - "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", - "dev": true, - "license": "MIT" - }, - "node_modules/csstype": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", - "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/debug": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", - "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/electron-to-chromium": { - "version": "1.5.359", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.359.tgz", - "integrity": "sha512-8lPELWuYZIWk7NDvCNthtmMw/7Q5Wu25NpM4djFMHBmk8DubPAtL4YTOp7ou0e7HyJtwkVlWv8XMLURnrtgJQw==", - "dev": true, - "license": "ISC" - }, - "node_modules/esbuild": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.7.tgz", - "integrity": "sha512-IxpibTjyVnmrIQo5aqNpCgoACA/dTKLTlhMHihVHhdkxKyPO1uBBthumT0rdHmcsk9uMonIWS0m4FljWzILh3w==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=18" - }, - "optionalDependencies": { - "@esbuild/aix-ppc64": "0.27.7", - "@esbuild/android-arm": "0.27.7", - "@esbuild/android-arm64": "0.27.7", - "@esbuild/android-x64": "0.27.7", - "@esbuild/darwin-arm64": "0.27.7", - "@esbuild/darwin-x64": "0.27.7", - "@esbuild/freebsd-arm64": "0.27.7", - "@esbuild/freebsd-x64": "0.27.7", - "@esbuild/linux-arm": "0.27.7", - "@esbuild/linux-arm64": "0.27.7", - "@esbuild/linux-ia32": "0.27.7", - "@esbuild/linux-loong64": "0.27.7", - "@esbuild/linux-mips64el": "0.27.7", - "@esbuild/linux-ppc64": "0.27.7", - "@esbuild/linux-riscv64": "0.27.7", - "@esbuild/linux-s390x": "0.27.7", - "@esbuild/linux-x64": "0.27.7", - "@esbuild/netbsd-arm64": "0.27.7", - "@esbuild/netbsd-x64": "0.27.7", - "@esbuild/openbsd-arm64": "0.27.7", - "@esbuild/openbsd-x64": "0.27.7", - "@esbuild/openharmony-arm64": "0.27.7", - "@esbuild/sunos-x64": "0.27.7", - "@esbuild/win32-arm64": "0.27.7", - "@esbuild/win32-ia32": "0.27.7", - "@esbuild/win32-x64": "0.27.7" - } - }, - "node_modules/escalade": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", - "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/fdir": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", - "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "picomatch": "^3 || ^4" - }, - "peerDependenciesMeta": { - "picomatch": { - "optional": true - } - } - }, - "node_modules/fsevents": { - "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, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/gensync": { - "version": "1.0.0-beta.2", - "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", - "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/jsesc": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", - "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", - "dev": true, - "license": "MIT", - "bin": { - "jsesc": "bin/jsesc" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/json5": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", - "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", - "dev": true, - "license": "MIT", - "bin": { - "json5": "lib/cli.js" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "license": "ISC", - "dependencies": { - "yallist": "^3.0.2" - } - }, - "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true, - "license": "MIT" - }, - "node_modules/nanoid": { - "version": "3.3.12", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.12.tgz", - "integrity": "sha512-ZB9RH/39qpq5Vu6Y+NmUaFhQR6pp+M2Xt76XBnEwDaGcVAqhlvxrl3B2bKS5D3NH3QR76v3aSrKaF/Kiy7lEtQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, - "node_modules/node-releases": { - "version": "2.0.44", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.44.tgz", - "integrity": "sha512-5WUyunoPMsvvEhS8AxHtRzP+oA8UCkJ7YRxatWKjngndhDGLiqEVAQKWjFAiAiuL8zMRGzGSJxFnLetoa43qGQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/picocolors": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", - "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", - "dev": true, - "license": "ISC" - }, - "node_modules/picomatch": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz", - "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/postcss": { - "version": "8.5.14", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.14.tgz", - "integrity": "sha512-SoSL4+OSEtR99LHFZQiJLkT59C5B1amGO1NzTwj7TT1qCUgUO6hxOvzkOYxD+vMrXBM3XJIKzokoERdqQq/Zmg==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/postcss" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "nanoid": "^3.3.11", - "picocolors": "^1.1.1", - "source-map-js": "^1.2.1" - }, - "engines": { - "node": "^10 || ^12 || >=14" - } - }, - "node_modules/react": { - "version": "19.2.6", - "resolved": "https://registry.npmjs.org/react/-/react-19.2.6.tgz", - "integrity": "sha512-sfWGGfavi0xr8Pg0sVsyHMAOziVYKgPLNrS7ig+ivMNb3wbCBw3KxtflsGBAwD3gYQlE/AEZsTLgToRrSCjb0Q==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/react-dom": { - "version": "19.2.6", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.6.tgz", - "integrity": "sha512-0prMI+hvBbPjsWnxDLxlCGyM8PN6UuWjEUCYmZhO67xIV9Xasa/r/vDnq+Xyq4Lo27g8QSbO5YzARu0D1Sps3g==", - "license": "MIT", - "dependencies": { - "scheduler": "^0.27.0" - }, - "peerDependencies": { - "react": "^19.2.6" - } - }, - "node_modules/react-refresh": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.18.0.tgz", - "integrity": "sha512-QgT5//D3jfjJb6Gsjxv0Slpj23ip+HtOpnNgnb2S5zU3CB26G/IDPGoy4RJB42wzFE46DRsstbW6tKHoKbhAxw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/rollup": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.60.4.tgz", - "integrity": "sha512-WHeFSbZYsPu3+bLoNRUuAO+wavNlocOPf3wSHTP7hcFKVnJeWsYlCDbr3mTS14FCizf9ccIxXA8sGL8zKeQN3g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/estree": "1.0.8" - }, - "bin": { - "rollup": "dist/bin/rollup" - }, - "engines": { - "node": ">=18.0.0", - "npm": ">=8.0.0" - }, - "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.60.4", - "@rollup/rollup-android-arm64": "4.60.4", - "@rollup/rollup-darwin-arm64": "4.60.4", - "@rollup/rollup-darwin-x64": "4.60.4", - "@rollup/rollup-freebsd-arm64": "4.60.4", - "@rollup/rollup-freebsd-x64": "4.60.4", - "@rollup/rollup-linux-arm-gnueabihf": "4.60.4", - "@rollup/rollup-linux-arm-musleabihf": "4.60.4", - "@rollup/rollup-linux-arm64-gnu": "4.60.4", - "@rollup/rollup-linux-arm64-musl": "4.60.4", - "@rollup/rollup-linux-loong64-gnu": "4.60.4", - "@rollup/rollup-linux-loong64-musl": "4.60.4", - "@rollup/rollup-linux-ppc64-gnu": "4.60.4", - "@rollup/rollup-linux-ppc64-musl": "4.60.4", - "@rollup/rollup-linux-riscv64-gnu": "4.60.4", - "@rollup/rollup-linux-riscv64-musl": "4.60.4", - "@rollup/rollup-linux-s390x-gnu": "4.60.4", - "@rollup/rollup-linux-x64-gnu": "4.60.4", - "@rollup/rollup-linux-x64-musl": "4.60.4", - "@rollup/rollup-openbsd-x64": "4.60.4", - "@rollup/rollup-openharmony-arm64": "4.60.4", - "@rollup/rollup-win32-arm64-msvc": "4.60.4", - "@rollup/rollup-win32-ia32-msvc": "4.60.4", - "@rollup/rollup-win32-x64-gnu": "4.60.4", - "@rollup/rollup-win32-x64-msvc": "4.60.4", - "fsevents": "~2.3.2" - } - }, - "node_modules/scheduler": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz", - "integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==", - "license": "MIT" - }, - "node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/source-map-js": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", - "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/tinyglobby": { - "version": "0.2.16", - "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.16.tgz", - "integrity": "sha512-pn99VhoACYR8nFHhxqix+uvsbXineAasWm5ojXoN8xEwK5Kd3/TrhNn1wByuD52UxWRLy8pu+kRMniEi6Eq9Zg==", - "dev": true, - "license": "MIT", - "dependencies": { - "fdir": "^6.5.0", - "picomatch": "^4.0.4" - }, - "engines": { - "node": ">=12.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/SuperchupuDev" - } - }, - "node_modules/typescript": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", - "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", - "dev": true, - "license": "Apache-2.0", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, - "node_modules/update-browserslist-db": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", - "integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "escalade": "^3.2.0", - "picocolors": "^1.1.1" - }, - "bin": { - "update-browserslist-db": "cli.js" - }, - "peerDependencies": { - "browserslist": ">= 4.21.0" - } - }, - "node_modules/vite": { - "version": "7.3.3", - "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.3.tgz", - "integrity": "sha512-/4XH147Ui7OGTjg3HbdWe5arnZQSbfuRzdr9Ec7TQi5I7R+ir0Rlc9GIvD4v0XZurELqA035KVXJXpR61xhiTA==", - "dev": true, - "license": "MIT", - "dependencies": { - "esbuild": "^0.27.0", - "fdir": "^6.5.0", - "picomatch": "^4.0.3", - "postcss": "^8.5.6", - "rollup": "^4.43.0", - "tinyglobby": "^0.2.15" - }, - "bin": { - "vite": "bin/vite.js" - }, - "engines": { - "node": "^20.19.0 || >=22.12.0" - }, - "funding": { - "url": "https://github.com/vitejs/vite?sponsor=1" - }, - "optionalDependencies": { - "fsevents": "~2.3.3" - }, - "peerDependencies": { - "@types/node": "^20.19.0 || >=22.12.0", - "jiti": ">=1.21.0", - "less": "^4.0.0", - "lightningcss": "^1.21.0", - "sass": "^1.70.0", - "sass-embedded": "^1.70.0", - "stylus": ">=0.54.8", - "sugarss": "^5.0.0", - "terser": "^5.16.0", - "tsx": "^4.8.1", - "yaml": "^2.4.2" - }, - "peerDependenciesMeta": { - "@types/node": { - "optional": true - }, - "jiti": { - "optional": true - }, - "less": { - "optional": true - }, - "lightningcss": { - "optional": true - }, - "sass": { - "optional": true - }, - "sass-embedded": { - "optional": true - }, - "stylus": { - "optional": true - }, - "sugarss": { - "optional": true - }, - "terser": { - "optional": true - }, - "tsx": { - "optional": true - }, - "yaml": { - "optional": true - } - } - }, - "node_modules/yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true, - "license": "ISC" - } - } -} diff --git a/oneapi-gateway/admin-ui/package.json b/oneapi-gateway/admin-ui/package.json deleted file mode 100644 index 6c8d514..0000000 --- a/oneapi-gateway/admin-ui/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "oneapi-admin-ui", - "private": true, - "version": "0.1.0", - "type": "module", - "scripts": { - "dev": "vite --host 0.0.0.0 --port 5173", - "build": "tsc -p tsconfig.json --noEmit && vite build" - }, - "dependencies": { - "react": "^19.1.1", - "react-dom": "^19.1.1" - }, - "devDependencies": { - "@types/react": "^19.1.12", - "@types/react-dom": "^19.1.8", - "@vitejs/plugin-react": "^5.0.2", - "typescript": "^5.7.3", - "vite": "^7.1.3" - } -} diff --git a/oneapi-gateway/admin-ui/src/main.tsx b/oneapi-gateway/admin-ui/src/main.tsx deleted file mode 100644 index 479c4e4..0000000 --- a/oneapi-gateway/admin-ui/src/main.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import React from "react"; -import { createRoot } from "react-dom/client"; -import { App } from "./ui/App"; - -createRoot(document.getElementById("root")!).render( - - - , -); diff --git a/oneapi-gateway/admin-ui/src/ui/App.tsx b/oneapi-gateway/admin-ui/src/ui/App.tsx deleted file mode 100644 index a5dde16..0000000 --- a/oneapi-gateway/admin-ui/src/ui/App.tsx +++ /dev/null @@ -1,1597 +0,0 @@ -import { useEffect, useMemo, useRef, useState } from "react"; -import type { CSSProperties } from "react"; - -type Tab = "usage" | "keys" | "tenants"; - -type UsageRow = { - principal: string; - auth_mode: string; - tenant_id: string | null; - api_key_id: number | null; - api_key_prefix: string | null; - requests: number; - errors: number; - cached: number; - p95_latency_ms: number | null; - total_tokens: number | null; -}; - -type ApiKeyRow = { - id: number; - name: string | null; - key_prefix: string; - key_suffix: string | null; - masked_key: string; - environment: string; - scopes: string[] | null; - created_at: string; - revoked_at: string | null; - expires_at: string | null; - last_used_at: string | null; - last_used_ip: string | null; - revocation_scheduled_at: string | null; - auto_revoke_after_unused_days: number | null; - ip_allow_cidrs: string[] | null; - status: string; - rpm_limit: number | null; - tenant_id: string | null; -}; - -type TenantRow = { - tenant_id: string; - created_at: string; - rpm_limit: number | null; - tpm_limit: number | null; - disabled: boolean; -}; - -type HealthStatus = { - ok: boolean; - service: string; - appEnv?: string; - upstreams: string[]; - authModes: string[]; - cacheEnabled: boolean; -}; - -function formatTime(s: string) { - const d = new Date(s); - if (Number.isNaN(d.getTime())) return s; - return d.toISOString().replace("T", " ").slice(0, 19); -} - -function extractAssistantText(payload: any): string { - const content = payload?.choices?.[0]?.message?.content; - if (typeof content === "string") return content; - if (Array.isArray(content)) { - return content - .map((part) => { - if (typeof part === "string") return part; - if (typeof part?.text === "string") return part.text; - try { - return JSON.stringify(part); - } catch { - return String(part ?? ""); - } - }) - .join("\n"); - } - try { - return JSON.stringify(payload, null, 2); - } catch { - return String(payload ?? ""); - } -} - -function formatUsage(payload: any): string { - const usage = payload?.usage; - if (!usage || typeof usage !== "object") return ""; - const prompt = typeof usage.prompt_tokens === "number" ? usage.prompt_tokens : "-"; - const completion = typeof usage.completion_tokens === "number" ? usage.completion_tokens : "-"; - const total = typeof usage.total_tokens === "number" ? usage.total_tokens : "-"; - return `Prompt ${prompt} / Completion ${completion} / Total ${total}`; -} - -function extractStreamChunkText(payload: any): string { - const delta = payload?.choices?.[0]?.delta; - if (typeof delta?.content === "string") return delta.content; - if (Array.isArray(delta?.content)) { - return delta.content - .map((part: any) => { - if (typeof part === "string") return part; - if (typeof part?.text === "string") return part.text; - return ""; - }) - .join(""); - } - const message = payload?.choices?.[0]?.message; - if (typeof message?.content === "string") return message.content; - return ""; -} - -function getDeploymentLabel(appEnv?: string | null): { text: string; tone: string } { - if (appEnv === undefined) return { text: "环境检测中", tone: "#6b7280" }; - if (appEnv === null) return { text: "环境未知", tone: "#6b7280" }; - return appEnv === "production" - ? { text: "线上环境", tone: "#137333" } - : { text: "开发环境", tone: "#b45309" }; -} - -function DeploymentBadge(props: { appEnv?: string }) { - const { text, tone } = getDeploymentLabel(props.appEnv); - return ( -
- - {text} -
- ); -} - -async function fetchJson(url: string, init?: RequestInit) { - const method = (init?.method ?? "GET").toUpperCase(); - const needsAdminAction = url.startsWith("/admin/api/") && method !== "GET"; - const res = await fetch(url, { - ...init, - headers: { - ...(init?.headers ?? {}), - accept: "application/json", - ...(needsAdminAction ? { "x-oneapi-admin-action": "1" } : {}), - }, - }); - const text = await res.text(); - if (!res.ok) throw new Error(text || String(res.status)); - return text ? JSON.parse(text) : null; -} - -const SCOPE_OPTIONS = [ - { value: "model:invoke", label: "模型调用" }, - { value: "chat:read", label: "聊天读取" }, - { value: "chat:write", label: "聊天写入" }, - { value: "batch:read", label: "Batch 读取" }, - { value: "batch:write", label: "Batch 写入" }, - { value: "*", label: "全部权限" }, -]; - -const DEFAULT_KEY_SCOPES = ["model:invoke", "chat:read", "chat:write", "batch:read", "batch:write"]; - -function scopeDisplayName(scope: string): string { - return SCOPE_OPTIONS.find((opt) => opt.value === scope)?.label ?? scope; -} - -const dateInputStyle = { - width: "100%", - minWidth: 0, - fontFamily: "system-ui, -apple-system, Segoe UI, Roboto, sans-serif", - fontVariantNumeric: "tabular-nums", - letterSpacing: 0, -} as const; - -function datePart(value: string | null | undefined): string { - if (!value) return ""; - const raw = String(value); - const match = raw.match(/^(\d{4}-\d{2}-\d{2})/); - return match?.[1] ?? ""; -} - -function timePart(value: string | null | undefined): string { - if (!value) return "00:00"; - const raw = String(value); - const match = raw.match(/[T\s](\d{2}:\d{2})/); - return match?.[1] ?? "00:00"; -} - -function composeDateTimeForApi(date: string, time: string): string | null { - if (!date) return null; - return `${date}T${time || "00:00"}`; -} - -type DateTimeInputProps = { - value?: string | null; - disabled?: boolean; - style?: CSSProperties; - onDraftChange?: (value: string) => void; - onCommit: (value: string | null) => void; -}; - -function DateTimeInput(props: DateTimeInputProps) { - const { value, disabled, style, onDraftChange, onCommit } = props; - const rootRef = useRef(null); - const [open, setOpen] = useState(false); - const [popover, setPopover] = useState<{ top: number; left: number; width: number } | null>(null); - const [date, setDate] = useState(datePart(value)); - const [time, setTime] = useState(timePart(value)); - const label = date ? `${date} ${time || "00:00"}` : "选择过期时间"; - - useEffect(() => { - setDate(datePart(value)); - setTime(timePart(value)); - }, [value]); - - useEffect(() => { - if (!open) return; - function updatePopover() { - const root = rootRef.current; - if (!root) return; - const rect = root.getBoundingClientRect(); - const width = Math.min(280, window.innerWidth - 32); - const left = Math.min(Math.max(16, rect.left), window.innerWidth - width - 16); - const panelHeight = 188; - const belowTop = rect.bottom + 6; - const aboveTop = rect.top - panelHeight - 6; - const top = belowTop + panelHeight <= window.innerHeight || aboveTop < 16 - ? Math.min(belowTop, window.innerHeight - panelHeight - 16) - : aboveTop; - setPopover({ top: Math.max(16, top), left, width }); - } - updatePopover(); - function onPointerDown(event: MouseEvent | TouchEvent) { - const root = rootRef.current; - if (!root || root.contains(event.target as Node)) return; - setOpen(false); - } - function onKeyDown(event: KeyboardEvent) { - if (event.key === "Escape") setOpen(false); - } - document.addEventListener("mousedown", onPointerDown); - document.addEventListener("touchstart", onPointerDown); - document.addEventListener("keydown", onKeyDown); - window.addEventListener("resize", updatePopover); - window.addEventListener("scroll", updatePopover, true); - return () => { - document.removeEventListener("mousedown", onPointerDown); - document.removeEventListener("touchstart", onPointerDown); - document.removeEventListener("keydown", onKeyDown); - window.removeEventListener("resize", updatePopover); - window.removeEventListener("scroll", updatePopover, true); - }; - }, [open]); - - function commit(nextDate: string, nextTime: string) { - const normalized = composeDateTimeForApi(nextDate, nextTime); - onDraftChange?.(normalized ?? ""); - onCommit(normalized); - } - - return ( -
- - {open && !disabled ? ( -
-
- - -
- - -
-
-
- ) : null} -
- ); -} - -type ScopeMultiSelectProps = { - value: string[]; - disabled?: boolean; - onChange: (next: string[]) => void; -}; - -function ScopeMultiSelect(props: ScopeMultiSelectProps) { - const { value, disabled, onChange } = props; - const [open, setOpen] = useState(false); - const [popover, setPopover] = useState<{ top: number; left: number; width: number; maxHeight: number } | null>(null); - const rootRef = useRef(null); - const selected = new Set(value); - const label = value.length ? value.map(scopeDisplayName).join("、") : "全部权限"; - - useEffect(() => { - if (!open) return; - function updatePopover() { - const root = rootRef.current; - if (!root) return; - const rect = root.getBoundingClientRect(); - const width = Math.min(Math.max(rect.width, 280), window.innerWidth - 32); - const left = Math.min(Math.max(16, rect.left), window.innerWidth - width - 16); - const preferredHeight = 270; - const belowTop = rect.bottom + 6; - const belowSpace = window.innerHeight - belowTop - 16; - const aboveSpace = rect.top - 22; - const openUp = belowSpace < preferredHeight && aboveSpace > belowSpace; - const maxHeight = Math.max(160, Math.min(preferredHeight, openUp ? aboveSpace : belowSpace)); - const top = openUp ? Math.max(16, rect.top - maxHeight - 6) : belowTop; - setPopover({ top, left, width, maxHeight }); - } - updatePopover(); - function onPointerDown(event: MouseEvent | TouchEvent) { - const root = rootRef.current; - if (!root || root.contains(event.target as Node)) return; - setOpen(false); - } - function onKeyDown(event: KeyboardEvent) { - if (event.key === "Escape") setOpen(false); - } - document.addEventListener("mousedown", onPointerDown); - document.addEventListener("touchstart", onPointerDown); - document.addEventListener("keydown", onKeyDown); - window.addEventListener("resize", updatePopover); - window.addEventListener("scroll", updatePopover, true); - return () => { - document.removeEventListener("mousedown", onPointerDown); - document.removeEventListener("touchstart", onPointerDown); - document.removeEventListener("keydown", onKeyDown); - window.removeEventListener("resize", updatePopover); - window.removeEventListener("scroll", updatePopover, true); - }; - }, [open]); - - function toggle(scope: string) { - const next = new Set(selected); - if (scope === "*") { - onChange(selected.has("*") ? [] : ["*"]); - return; - } - next.delete("*"); - if (next.has(scope)) next.delete(scope); - else next.add(scope); - onChange(Array.from(next)); - } - - return ( -
- - {open && !disabled ? ( -
- {SCOPE_OPTIONS.map((opt) => ( - - ))} -
- ) : null} -
- ); -} - -type TenantPickerProps = { - value: string | null; - disabled: boolean; - tenants: string[]; - boundCountByTenant: Map; - onCommit: (tenantId: string | null) => void; -}; - -function TenantPicker(props: TenantPickerProps) { - const { value, disabled, tenants, boundCountByTenant, onCommit } = props; - const rootRef = useRef(null); - const [open, setOpen] = useState(false); - const [popover, setPopover] = useState<{ top: number; left: number; width: number; maxHeight: number } | null>(null); - const [q, setQ] = useState(""); - const [active, setActive] = useState(-1); - - const items = useMemo(() => { - const query = q.trim().toLowerCase(); - const filtered = query ? tenants.filter((t) => t.toLowerCase().includes(query)) : tenants; - return filtered.slice(0, 30); - }, [q, tenants]); - - const display = value ?? ""; - const bound = value ? boundCountByTenant.get(value) ?? 0 : 0; - - useEffect(() => { - if (!open) return; - function updatePopover() { - const root = rootRef.current; - if (!root) return; - const rect = root.getBoundingClientRect(); - const width = Math.min(Math.max(rect.width, 260), window.innerWidth - 32); - const left = Math.min(Math.max(16, rect.left), window.innerWidth - width - 16); - const preferredHeight = 280; - const belowTop = rect.bottom + 6; - const belowSpace = window.innerHeight - belowTop - 16; - const aboveSpace = rect.top - 22; - const openUp = belowSpace < preferredHeight && aboveSpace > belowSpace; - const maxHeight = Math.max(140, Math.min(preferredHeight, openUp ? aboveSpace : belowSpace)); - const top = openUp ? Math.max(16, rect.top - maxHeight - 6) : belowTop; - setPopover({ top, left, width, maxHeight }); - } - updatePopover(); - window.addEventListener("resize", updatePopover); - window.addEventListener("scroll", updatePopover, true); - return () => { - window.removeEventListener("resize", updatePopover); - window.removeEventListener("scroll", updatePopover, true); - }; - }, [open]); - - return ( -
-
- { - if (disabled) return; - setQ(display); - setOpen(true); - setActive(-1); - }} - onChange={(e) => { - setQ(e.currentTarget.value); - setOpen(true); - setActive(-1); - }} - onKeyDown={(e) => { - if (disabled) return; - if (!open && (e.key === "ArrowDown" || e.key === "ArrowUp")) { - setOpen(true); - setQ(display); - setActive(-1); - e.preventDefault(); - return; - } - if (!open) return; - if (e.key === "Escape") { - setOpen(false); - setQ(""); - setActive(-1); - e.preventDefault(); - return; - } - if (e.key === "ArrowDown") { - const max = items.length - 1; - setActive((a) => Math.min(max, a + 1)); - e.preventDefault(); - return; - } - if (e.key === "ArrowUp") { - setActive((a) => Math.max(-1, a - 1)); - e.preventDefault(); - return; - } - if (e.key === "Enter") { - if (active === -1) onCommit(null); - else if (active >= 0 && active < items.length) onCommit(items[active] ?? null); - setOpen(false); - setQ(""); - setActive(-1); - e.preventDefault(); - return; - } - }} - onBlur={() => { - setOpen(false); - setQ(""); - setActive(-1); - }} - disabled={disabled} - style={{ width: "100%" }} - /> - {value ? {bound} 个密钥 : null} -
- - {open && !disabled ? ( -
-
{ - e.preventDefault(); - onCommit(null); - setOpen(false); - setQ(""); - setActive(-1); - }} - style={{ - padding: "10px 12px", - cursor: "pointer", - borderBottom: "1px solid #f2f2f2", - background: active === -1 ? "#f6f7f8" : "#fff", - }} - > - 未绑定 -
- {items.map((t) => ( -
{ - e.preventDefault(); - onCommit(t); - setOpen(false); - setQ(""); - setActive(-1); - }} - style={{ - padding: "10px 12px", - cursor: "pointer", - display: "flex", - justifyContent: "space-between", - background: items[active] === t ? "#f6f7f8" : "#fff", - }} - > - {t} - {boundCountByTenant.get(t) ?? 0} 个密钥 -
- ))} -
- ) : null} -
- ); -} - -export function App() { - const playgroundAbortRef = useRef(null); - const [tab, setTab] = useState("usage"); - const [sinceMinutes, setSinceMinutes] = useState(60); - const [usageRows, setUsageRows] = useState([]); - const [keys, setKeys] = useState([]); - const [tenants, setTenants] = useState([]); - const [newTenantId, setNewTenantId] = useState(""); - const [tenantSearch, setTenantSearch] = useState(""); - const [tenantPage, setTenantPage] = useState(1); - const [keySearch, setKeySearch] = useState(""); - const [keyPage, setKeyPage] = useState(1); - const [newKeyName, setNewKeyName] = useState(""); - const [newKeyScopes, setNewKeyScopes] = useState(DEFAULT_KEY_SCOPES); - const [newKeyExpiresAt, setNewKeyExpiresAt] = useState(""); - const [status, setStatus] = useState(""); - const [createdKey, setCreatedKey] = useState(null); - const [playgroundModels, setPlaygroundModels] = useState([]); - const [playgroundModel, setPlaygroundModel] = useState(""); - const [playgroundSystemPrompt, setPlaygroundSystemPrompt] = useState("你是一个有帮助的 AI 助手。"); - const [playgroundUserPrompt, setPlaygroundUserPrompt] = useState(""); - const [playgroundTemperature, setPlaygroundTemperature] = useState("0"); - const [playgroundMaxTokens, setPlaygroundMaxTokens] = useState("512"); - const [playgroundStream, setPlaygroundStream] = useState(false); - const [playgroundLoading, setPlaygroundLoading] = useState(false); - const [playgroundResult, setPlaygroundResult] = useState(""); - const [playgroundRaw, setPlaygroundRaw] = useState(""); - const [playgroundUsage, setPlaygroundUsage] = useState(""); - const [playgroundLatencyMs, setPlaygroundLatencyMs] = useState(null); - const [health, setHealth] = useState(undefined); - - function stopPlayground() { - const controller = playgroundAbortRef.current; - if (!controller) return; - controller.abort(); - playgroundAbortRef.current = null; - setPlaygroundLoading(false); - setStatus("已停止"); - } - - const title = useMemo(() => { - if (tab === "usage") return "用量统计"; - if (tab === "keys") return "API 密钥"; - return "租户管理"; - }, [tab]); - - async function loadUsage() { - setStatus("加载中..."); - try { - const data = await fetchJson(`/admin/api/usage?sinceMinutes=${encodeURIComponent(String(sinceMinutes))}`); - setUsageRows((data?.rows ?? []) as UsageRow[]); - setStatus("成功"); - } catch (e: any) { - setStatus(e?.message ?? "失败"); - } - } - - async function loadHealth() { - try { - const res = await fetch("/healthz", { headers: { accept: "application/json" } }); - const data = await res.json(); - if (!res.ok) throw new Error(String(res.status)); - setHealth(data as HealthStatus); - } catch { - setHealth(null); - } - } - - async function loadKeys() { - setStatus("加载中..."); - try { - const data = await fetchJson("/admin/api/keys"); - setKeys((data?.keys ?? []) as ApiKeyRow[]); - setStatus("成功"); - } catch (e: any) { - setStatus(e?.message ?? "失败"); - } - } - - async function loadTenants() { - setStatus("加载中..."); - try { - const data = await fetchJson("/admin/api/tenants"); - setTenants((data?.tenants ?? []) as TenantRow[]); - setStatus("成功"); - } catch (e: any) { - setStatus(e?.message ?? "失败"); - } - } - - async function loadPlaygroundModels() { - setStatus("加载中..."); - try { - const data = await fetchJson("/admin/api/playground/models"); - const models = Array.isArray(data?.data) - ? (data.data as any[]) - .map((item) => String(item?.id ?? "").trim()) - .filter(Boolean) - : []; - setPlaygroundModels(models); - setPlaygroundModel((current) => current || models[0] || ""); - setStatus("成功"); - } catch (e: any) { - setStatus(e?.message ?? "失败"); - } - } - - async function runPlayground() { - const model = playgroundModel.trim(); - const userPrompt = playgroundUserPrompt.trim(); - if (!model) { - setStatus("请先选择模型"); - return; - } - if (!userPrompt) { - setStatus("请输入用户消息"); - return; - } - - const messages: Array<{ role: string; content: string }> = []; - if (playgroundSystemPrompt.trim()) { - messages.push({ role: "system", content: playgroundSystemPrompt.trim() }); - } - messages.push({ role: "user", content: userPrompt }); - - const body: Record = { - model, - messages, - stream: playgroundStream, - }; - if (playgroundTemperature.trim()) body.temperature = Number(playgroundTemperature); - if (playgroundMaxTokens.trim()) body.max_tokens = Number(playgroundMaxTokens); - - setPlaygroundLoading(true); - setPlaygroundResult(""); - setPlaygroundRaw(""); - setPlaygroundUsage(""); - setPlaygroundLatencyMs(null); - setStatus("请求中..."); - - const startedAt = performance.now(); - const controller = new AbortController(); - playgroundAbortRef.current = controller; - try { - if (playgroundStream) { - const res = await fetch("/admin/api/playground/chat", { - method: "POST", - headers: { - accept: "text/event-stream", - "content-type": "application/json", - "x-oneapi-admin-action": "1", - }, - signal: controller.signal, - body: JSON.stringify(body), - }); - if (!res.ok) { - const text = await res.text(); - throw new Error(text || String(res.status)); - } - - const reader = res.body?.getReader(); - if (!reader) throw new Error("stream not supported by browser"); - const decoder = new TextDecoder(); - let buffer = ""; - let raw = ""; - let output = ""; - let usageText = ""; - - while (true) { - const { done, value } = await reader.read(); - if (done) break; - const chunk = decoder.decode(value, { stream: true }); - raw += chunk; - buffer += chunk; - setPlaygroundRaw(raw); - - const events = buffer.split("\n\n"); - buffer = events.pop() ?? ""; - for (const event of events) { - const lines = event - .split("\n") - .map((line) => line.trim()) - .filter((line) => line.startsWith("data: ")); - for (const line of lines) { - const dataText = line.slice(6); - if (dataText === "[DONE]") continue; - let parsed: any; - try { - parsed = JSON.parse(dataText); - } catch { - continue; - } - if (parsed?.error?.message) { - throw new Error(String(parsed.error.message)); - } - const text = extractStreamChunkText(parsed); - if (text) { - output += text; - setPlaygroundResult(output); - } - const nextUsage = formatUsage(parsed); - if (nextUsage) { - usageText = nextUsage; - setPlaygroundUsage(nextUsage); - } - } - } - } - - const latency = Math.round(performance.now() - startedAt); - setPlaygroundLatencyMs(latency); - setPlaygroundUsage((current) => current || usageText); - setStatus("成功"); - } else { - const data = await fetchJson("/admin/api/playground/chat", { - method: "POST", - headers: { "content-type": "application/json" }, - signal: controller.signal, - body: JSON.stringify(body), - }); - const latency = Math.round(performance.now() - startedAt); - setPlaygroundLatencyMs(latency); - setPlaygroundResult(extractAssistantText(data)); - setPlaygroundRaw(JSON.stringify(data, null, 2)); - setPlaygroundUsage(formatUsage(data)); - setStatus("成功"); - } - } catch (e: any) { - if (e?.name === "AbortError") { - setStatus("已停止"); - } else { - setStatus(e?.message ?? "失败"); - } - } finally { - if (playgroundAbortRef.current === controller) { - playgroundAbortRef.current = null; - } - setPlaygroundLoading(false); - } - } - - async function createKey() { - setStatus("创建中..."); - try { - const data = await fetchJson("/admin/api/keys", { - method: "POST", - headers: { "content-type": "application/json" }, - body: JSON.stringify({ - name: newKeyName.trim() || null, - scopes: newKeyScopes, - expires_at: newKeyExpiresAt || null, - }), - }); - setCreatedKey(String(data?.api_key ?? "")); - setNewKeyName(""); - await loadKeys(); - setStatus("成功"); - } catch (e: any) { - setStatus(e?.message ?? "失败"); - } - } - - async function revokeKey(id: number) { - setStatus("撤销中..."); - try { - await fetchJson(`/admin/api/keys/${id}/revoke`, { method: "POST" }); - await loadKeys(); - setStatus("成功"); - } catch (e: any) { - setStatus(e?.message ?? "失败"); - } - } - - async function scheduleRevokeKey(id: number) { - const raw = prompt("延迟撤销小时数,例如 24 或 168"); - if (!raw) return; - const hours = Number(raw); - if (!Number.isFinite(hours) || hours <= 0) { - setStatus("请输入有效小时数"); - return; - } - setStatus("设置中..."); - try { - await fetchJson(`/admin/api/keys/${id}/revoke`, { - method: "POST", - headers: { "content-type": "application/json" }, - body: JSON.stringify({ mode: "scheduled", delay_hours: hours }), - }); - await loadKeys(); - setStatus("成功"); - } catch (e: any) { - setStatus(e?.message ?? "失败"); - } - } - - async function autoRevokeKey(id: number) { - const raw = prompt("连续多少天无调用后自动撤销,例如 7"); - if (!raw) return; - const days = Number(raw); - if (!Number.isFinite(days) || days <= 0) { - setStatus("请输入有效天数"); - return; - } - setStatus("设置中..."); - try { - await fetchJson(`/admin/api/keys/${id}/revoke`, { - method: "POST", - headers: { "content-type": "application/json" }, - body: JSON.stringify({ mode: "unused", unused_days: days }), - }); - await loadKeys(); - setStatus("成功"); - } catch (e: any) { - setStatus(e?.message ?? "失败"); - } - } - - async function deleteKey(id: number, force: boolean) { - setStatus("删除中..."); - try { - await fetchJson(`/admin/api/keys/${id}`, { - method: "DELETE", - headers: { "content-type": "application/json" }, - body: JSON.stringify({ force }), - }); - await loadKeys(); - setStatus("成功"); - } catch (e: any) { - setStatus(e?.message ?? "失败"); - } - } - - async function updateRpm(id: number, rpm: number | null) { - setStatus("保存中..."); - try { - await fetchJson(`/admin/api/keys/${id}/rpm`, { - method: "PUT", - headers: { "content-type": "application/json" }, - body: JSON.stringify({ rpm_limit: rpm }), - }); - await loadKeys(); - setStatus("成功"); - } catch (e: any) { - setStatus(e?.message ?? "失败"); - } - } - - async function updateKeyTenant(id: number, tenantId: string | null) { - setStatus("保存中..."); - try { - await fetchJson(`/admin/api/keys/${id}/tenant`, { - method: "PUT", - headers: { "content-type": "application/json" }, - body: JSON.stringify({ tenant_id: tenantId }), - }); - await loadKeys(); - setStatus("成功"); - } catch (e: any) { - setStatus(e?.message ?? "失败"); - } - } - - async function updateKeyMetadata(k: ApiKeyRow, patch: Partial) { - setStatus("保存中..."); - try { - const next = { ...k, ...patch }; - await fetchJson(`/admin/api/keys/${k.id}`, { - method: "PATCH", - headers: { "content-type": "application/json" }, - body: JSON.stringify({ - name: next.name, - scopes: next.scopes ?? null, - expires_at: next.expires_at, - }), - }); - await loadKeys(); - setStatus("成功"); - } catch (e: any) { - setStatus(e?.message ?? "失败"); - } - } - - async function upsertTenant(tenantId: string, rpm: number | null, tpm: number | null, disabled: boolean) { - setStatus("保存中..."); - try { - await fetchJson(`/admin/api/tenants/${encodeURIComponent(tenantId)}`, { - method: "PUT", - headers: { "content-type": "application/json" }, - body: JSON.stringify({ rpm_limit: rpm, tpm_limit: tpm, disabled }), - }); - await loadTenants(); - setStatus("成功"); - } catch (e: any) { - setStatus(e?.message ?? "失败"); - } - } - - async function deleteTenant(tenantId: string, force: boolean) { - setStatus("删除中..."); - try { - await fetchJson(`/admin/api/tenants/${encodeURIComponent(tenantId)}`, { - method: "DELETE", - headers: { "content-type": "application/json" }, - body: JSON.stringify({ force }), - }); - await loadTenants(); - await loadKeys(); - setStatus("成功"); - } catch (e: any) { - setStatus(e?.message ?? "失败"); - } - } - - async function unbindTenantKeys(tenantId: string) { - setStatus("解绑中..."); - try { - await fetchJson(`/admin/api/tenants/${encodeURIComponent(tenantId)}/unbind_keys`, { method: "POST" }); - await loadTenants(); - await loadKeys(); - setStatus("成功"); - } catch (e: any) { - setStatus(e?.message ?? "失败"); - } - } - - useEffect(() => { - if (tab === "usage") loadUsage(); - if (tab === "keys") { - loadKeys(); - loadTenants(); - } - if (tab === "tenants") { - loadTenants(); - loadKeys(); - } - }, [tab]); - - useEffect(() => { - loadHealth(); - return () => { - playgroundAbortRef.current?.abort(); - playgroundAbortRef.current = null; - }; - }, []); - - const boundKeyCountByTenant = useMemo(() => { - const m = new Map(); - for (const k of keys) { - const tid = k.tenant_id; - if (!tid) continue; - m.set(tid, (m.get(tid) ?? 0) + 1); - } - return m; - }, [keys]); - - const tenantOptions = useMemo(() => tenants.map((t) => t.tenant_id).sort((a, b) => a.localeCompare(b)), [tenants]); - - const filteredTenants = useMemo(() => { - const q = tenantSearch.trim().toLowerCase(); - const base = q ? tenants.filter((t) => t.tenant_id.toLowerCase().includes(q)) : tenants; - return base; - }, [tenants, tenantSearch]); - - const tenantPageSize = 20; - const tenantTotalPages = Math.max(1, Math.ceil(filteredTenants.length / tenantPageSize)); - const tenantPageClamped = Math.min(Math.max(1, tenantPage), tenantTotalPages); - const tenantPageRows = useMemo(() => { - const start = (tenantPageClamped - 1) * tenantPageSize; - return filteredTenants.slice(start, start + tenantPageSize); - }, [filteredTenants, tenantPageClamped]); - - const filteredKeys = useMemo(() => { - const q = keySearch.trim().toLowerCase(); - if (!q) return keys; - return keys.filter((k) => { - const id = String(k.id); - const prefix = k.key_prefix.toLowerCase(); - const suffix = (k.key_suffix ?? "").toLowerCase(); - const name = (k.name ?? "").toLowerCase(); - const tenant = (k.tenant_id ?? "").toLowerCase(); - const status = k.status.toLowerCase(); - return id.includes(q) || prefix.includes(q) || suffix.includes(q) || name.includes(q) || tenant.includes(q) || status.includes(q); - }); - }, [keys, keySearch]); - - const keyPageSize = 20; - const keyTotalPages = Math.max(1, Math.ceil(filteredKeys.length / keyPageSize)); - const keyPageClamped = Math.min(Math.max(1, keyPage), keyTotalPages); - const keyPageRows = useMemo(() => { - const start = (keyPageClamped - 1) * keyPageSize; - return filteredKeys.slice(start, start + keyPageSize); - }, [filteredKeys, keyPageClamped]); - - return ( -
-
-

OneAPI 管理台

- -
-
-
-
网关状态
- {health?.ok ? "Gateway online" : "Unknown"} -
-
-
认证模式
- {health?.authModes?.join(", ") || "-"} -
-
-
缓存
- {health ? (health.cacheEnabled ? "enabled" : "disabled") : "-"} -
-
-
上游
- {health?.upstreams?.join(", ") || "-"} -
-
-
- - - - {status} -
- -

{title}

- - {tab === "usage" ? ( -
-
- - -
- - - - - {["主体", "鉴权方式", "租户", "API 密钥", "请求数", "错误数", "缓存命中", "P95 延迟(毫秒)", "总 Tokens"].map((h) => ( - - ))} - - - - {usageRows.map((r) => ( - - - - - - - - - - - - ))} - -
- {h} -
- {r.principal} - - {r.auth_mode} - - {r.tenant_id ? {r.tenant_id} : -} - - {r.api_key_id ? ( - - #{r.api_key_id} - {r.api_key_prefix ? ` (${r.api_key_prefix})` : ""} - - ) : ( - - - )} - {r.requests}{r.errors}{r.cached} - {r.p95_latency_ms ? Math.round(r.p95_latency_ms) : ""} - {r.total_tokens ?? ""}
-
- ) : null} - - {tab === "keys" ? ( -
-
- setNewKeyName(e.currentTarget.value)} - style={{ flex: "1 1 180px", minWidth: 0 }} - /> -
- -
- setNewKeyExpiresAt(value ?? "")} - style={{ ...dateInputStyle, flex: "1 1 190px" }} - /> - - { - setKeySearch(e.currentTarget.value); - setKeyPage(1); - }} - style={{ flex: "1 1 180px", minWidth: 0 }} - /> - -
- -
- - - 第 {keyPageClamped} / {keyTotalPages} 页(共 {filteredKeys.length} 个密钥) - - -
- - {createdKey ? ( -
-
新建 API 密钥(仅展示一次):
- {createdKey} -
- -
-
- ) : null} - -
- {keyPageRows.map((k) => ( -
-
-
- updateKeyMetadata(k, { name: e.currentTarget.value.trim() || null })} - disabled={Boolean(k.revoked_at)} - style={{ display: "block", marginBottom: 6, width: "min(100%, 260px)" }} - /> - - {k.masked_key || `${k.key_prefix}...${k.key_suffix ?? ""}`} - -
-
-
#{k.id}
- {k.status} -
-
- -
- - - - -
- 租户 - updateKeyTenant(k.id, tenantId)} - /> -
-
- -
- - -
- -
-
-
创建时间
-
{formatTime(k.created_at)}
-
-
-
最后使用
-
{k.last_used_at ? `${formatTime(k.last_used_at)} ${k.last_used_ip ?? ""}` : "尚无调用"}
-
-
-
撤销策略
-
- {k.revoked_at - ? `已撤销 ${formatTime(k.revoked_at)}` - : k.revocation_scheduled_at - ? `计划撤销 ${formatTime(k.revocation_scheduled_at)}` - : k.auto_revoke_after_unused_days - ? `${k.auto_revoke_after_unused_days} 天无调用自动撤销` - : "-"} -
-
-
- -
- - - - - -
-
- ))} -
-
- ) : null} - - {tab === "tenants" ? ( -
-
- setNewTenantId(e.target.value)} - /> - - { - setTenantSearch(e.currentTarget.value); - setTenantPage(1); - }} - style={{ marginLeft: 10 }} - /> - -
- -
- - - 第 {tenantPageClamped} / {tenantTotalPages} 页(共 {filteredTenants.length} 个租户) - - -
- - - - - {["租户", "创建时间", "已绑定密钥", "RPM 限制", "TPM 限制", "禁用", "操作"].map((h) => ( - - ))} - - - - {tenantPageRows.map((t) => ( - - - - - - - - - - ))} - -
- {h} -
- {t.tenant_id} - {formatTime(t.created_at)}{boundKeyCountByTenant.get(t.tenant_id) ?? 0} - - - - - - - - - -
-
- ) : null} - -
- ); -} diff --git a/oneapi-gateway/admin-ui/tsconfig.json b/oneapi-gateway/admin-ui/tsconfig.json deleted file mode 100644 index cb12523..0000000 --- a/oneapi-gateway/admin-ui/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2022", - "lib": ["ES2022", "DOM", "DOM.Iterable"], - "module": "ESNext", - "moduleResolution": "Bundler", - "jsx": "react-jsx", - "strict": true, - "skipLibCheck": true, - "noEmit": true, - "types": ["vite/client"] - }, - "include": ["src"] -} diff --git a/oneapi-gateway/admin-ui/vite.config.ts b/oneapi-gateway/admin-ui/vite.config.ts deleted file mode 100644 index 8b8a300..0000000 --- a/oneapi-gateway/admin-ui/vite.config.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { defineConfig } from "vite"; -import react from "@vitejs/plugin-react"; - -export default defineConfig({ - plugins: [react()], - base: "/dashboard/", - build: { - outDir: "dist", - emptyOutDir: true, - }, -}); diff --git a/oneapi-gateway/chat-ui/index.html b/oneapi-gateway/chat-ui/index.html deleted file mode 100644 index 0d82d0d..0000000 --- a/oneapi-gateway/chat-ui/index.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - EasyAI Chat - - - -
- - - diff --git a/oneapi-gateway/chat-ui/package-lock.json b/oneapi-gateway/chat-ui/package-lock.json deleted file mode 100644 index 33fab60..0000000 --- a/oneapi-gateway/chat-ui/package-lock.json +++ /dev/null @@ -1,1820 +0,0 @@ -{ - "name": "oneapi-chat-ui", - "version": "0.1.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "oneapi-chat-ui", - "version": "0.1.0", - "dependencies": { - "react": "^19.1.1", - "react-dom": "^19.1.1" - }, - "devDependencies": { - "@types/react": "^19.1.12", - "@types/react-dom": "^19.1.8", - "@vitejs/plugin-react": "^5.0.2", - "typescript": "^5.7.3", - "vite": "^7.1.3" - } - }, - "node_modules/@babel/code-frame": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.0.tgz", - "integrity": "sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-validator-identifier": "^7.28.5", - "js-tokens": "^4.0.0", - "picocolors": "^1.1.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/compat-data": { - "version": "7.29.3", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.3.tgz", - "integrity": "sha512-LIVqM46zQWZhj17qA8wb4nW/ixr2y1Nw+r1etiAWgRM6U1IqP+LNhL1yg440jYZR72jCWcWbLWzIosH+uP1fqg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/core": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.0.tgz", - "integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.29.0", - "@babel/generator": "^7.29.0", - "@babel/helper-compilation-targets": "^7.28.6", - "@babel/helper-module-transforms": "^7.28.6", - "@babel/helpers": "^7.28.6", - "@babel/parser": "^7.29.0", - "@babel/template": "^7.28.6", - "@babel/traverse": "^7.29.0", - "@babel/types": "^7.29.0", - "@jridgewell/remapping": "^2.3.5", - "convert-source-map": "^2.0.0", - "debug": "^4.1.0", - "gensync": "^1.0.0-beta.2", - "json5": "^2.2.3", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/babel" - } - }, - "node_modules/@babel/generator": { - "version": "7.29.1", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.1.tgz", - "integrity": "sha512-qsaF+9Qcm2Qv8SRIMMscAvG4O3lJ0F1GuMo5HR/Bp02LopNgnZBC/EkbevHFeGs4ls/oPz9v+Bsmzbkbe+0dUw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/parser": "^7.29.0", - "@babel/types": "^7.29.0", - "@jridgewell/gen-mapping": "^0.3.12", - "@jridgewell/trace-mapping": "^0.3.28", - "jsesc": "^3.0.2" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-compilation-targets": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.28.6.tgz", - "integrity": "sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/compat-data": "^7.28.6", - "@babel/helper-validator-option": "^7.27.1", - "browserslist": "^4.24.0", - "lru-cache": "^5.1.1", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-globals": { - "version": "7.28.0", - "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.28.0.tgz", - "integrity": "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-imports": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.28.6.tgz", - "integrity": "sha512-l5XkZK7r7wa9LucGw9LwZyyCUscb4x37JWTPz7swwFE/0FMQAGpiWUZn8u9DzkSBWEcK25jmvubfpw2dnAMdbw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/traverse": "^7.28.6", - "@babel/types": "^7.28.6" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-transforms": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.28.6.tgz", - "integrity": "sha512-67oXFAYr2cDLDVGLXTEABjdBJZ6drElUSI7WKp70NrpyISso3plG9SAGEF6y7zbha/wOzUByWWTJvEDVNIUGcA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-module-imports": "^7.28.6", - "@babel/helper-validator-identifier": "^7.28.5", - "@babel/traverse": "^7.28.6" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-plugin-utils": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.28.6.tgz", - "integrity": "sha512-S9gzZ/bz83GRysI7gAD4wPT/AI3uCnY+9xn+Mx/KPs2JwHJIz1W8PZkg2cqyt3RNOBM8ejcXhV6y8Og7ly/Dug==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-string-parser": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", - "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-identifier": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", - "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-option": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz", - "integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helpers": { - "version": "7.29.2", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.2.tgz", - "integrity": "sha512-HoGuUs4sCZNezVEKdVcwqmZN8GoHirLUcLaYVNBK2J0DadGtdcqgr3BCbvH8+XUo4NGjNl3VOtSjEKNzqfFgKw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/template": "^7.28.6", - "@babel/types": "^7.29.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/parser": { - "version": "7.29.3", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.3.tgz", - "integrity": "sha512-b3ctpQwp+PROvU/cttc4OYl4MzfJUWy6FZg+PMXfzmt/+39iHVF0sDfqay8TQM3JA2EUOyKcFZt75jWriQijsA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.29.0" - }, - "bin": { - "parser": "bin/babel-parser.js" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@babel/plugin-transform-react-jsx-self": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.27.1.tgz", - "integrity": "sha512-6UzkCs+ejGdZ5mFFC/OCUrv028ab2fp1znZmCZjAOBKiBK2jXD1O+BPSfX8X2qjJ75fZBMSnQn3Rq2mrBJK2mw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-react-jsx-source": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.27.1.tgz", - "integrity": "sha512-zbwoTsBruTeKB9hSq73ha66iFeJHuaFkUbwvqElnygoNbj/jHRsSeokowZFN3CZ64IvEqcmmkVe89OPXc7ldAw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/template": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.28.6.tgz", - "integrity": "sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.28.6", - "@babel/parser": "^7.28.6", - "@babel/types": "^7.28.6" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/traverse": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.0.tgz", - "integrity": "sha512-4HPiQr0X7+waHfyXPZpWPfWL/J7dcN1mx9gL6WdQVMbPnF3+ZhSMs8tCxN7oHddJE9fhNE7+lxdnlyemKfJRuA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.29.0", - "@babel/generator": "^7.29.0", - "@babel/helper-globals": "^7.28.0", - "@babel/parser": "^7.29.0", - "@babel/template": "^7.28.6", - "@babel/types": "^7.29.0", - "debug": "^4.3.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/types": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.0.tgz", - "integrity": "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-string-parser": "^7.27.1", - "@babel/helper-validator-identifier": "^7.28.5" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@esbuild/aix-ppc64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.7.tgz", - "integrity": "sha512-EKX3Qwmhz1eMdEJokhALr0YiD0lhQNwDqkPYyPhiSwKrh7/4KRjQc04sZ8db+5DVVnZ1LmbNDI1uAMPEUBnQPg==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-arm": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.7.tgz", - "integrity": "sha512-jbPXvB4Yj2yBV7HUfE2KHe4GJX51QplCN1pGbYjvsyCZbQmies29EoJbkEc+vYuU5o45AfQn37vZlyXy4YJ8RQ==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.7.tgz", - "integrity": "sha512-62dPZHpIXzvChfvfLJow3q5dDtiNMkwiRzPylSCfriLvZeq0a1bWChrGx/BbUbPwOrsWKMn8idSllklzBy+dgQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.7.tgz", - "integrity": "sha512-x5VpMODneVDb70PYV2VQOmIUUiBtY3D3mPBG8NxVk5CogneYhkR7MmM3yR/uMdITLrC1ml/NV1rj4bMJuy9MCg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/darwin-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.7.tgz", - "integrity": "sha512-5lckdqeuBPlKUwvoCXIgI2D9/ABmPq3Rdp7IfL70393YgaASt7tbju3Ac+ePVi3KDH6N2RqePfHnXkaDtY9fkw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.7.tgz", - "integrity": "sha512-rYnXrKcXuT7Z+WL5K980jVFdvVKhCHhUwid+dDYQpH+qu+TefcomiMAJpIiC2EM3Rjtq0sO3StMV/+3w3MyyqQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.7.tgz", - "integrity": "sha512-B48PqeCsEgOtzME2GbNM2roU29AMTuOIN91dsMO30t+Ydis3z/3Ngoj5hhnsOSSwNzS+6JppqWsuhTp6E82l2w==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.7.tgz", - "integrity": "sha512-jOBDK5XEjA4m5IJK3bpAQF9/Lelu/Z9ZcdhTRLf4cajlB+8VEhFFRjWgfy3M1O4rO2GQ/b2dLwCUGpiF/eATNQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-arm": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.7.tgz", - "integrity": "sha512-RkT/YXYBTSULo3+af8Ib0ykH8u2MBh57o7q/DAs3lTJlyVQkgQvlrPTnjIzzRPQyavxtPtfg0EopvDyIt0j1rA==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.7.tgz", - "integrity": "sha512-RZPHBoxXuNnPQO9rvjh5jdkRmVizktkT7TCDkDmQ0W2SwHInKCAV95GRuvdSvA7w4VMwfCjUiPwDi0ZO6Nfe9A==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-ia32": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.7.tgz", - "integrity": "sha512-GA48aKNkyQDbd3KtkplYWT102C5sn/EZTY4XROkxONgruHPU72l+gW+FfF8tf2cFjeHaRbWpOYa/uRBz/Xq1Pg==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.7.tgz", - "integrity": "sha512-a4POruNM2oWsD4WKvBSEKGIiWQF8fZOAsycHOt6JBpZ+JN2n2JH9WAv56SOyu9X5IqAjqSIPTaJkqN8F7XOQ5Q==", - "cpu": [ - "loong64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.7.tgz", - "integrity": "sha512-KabT5I6StirGfIz0FMgl1I+R1H73Gp0ofL9A3nG3i/cYFJzKHhouBV5VWK1CSgKvVaG4q1RNpCTR2LuTVB3fIw==", - "cpu": [ - "mips64el" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.7.tgz", - "integrity": "sha512-gRsL4x6wsGHGRqhtI+ifpN/vpOFTQtnbsupUF5R5YTAg+y/lKelYR1hXbnBdzDjGbMYjVJLJTd2OFmMewAgwlQ==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.7.tgz", - "integrity": "sha512-hL25LbxO1QOngGzu2U5xeXtxXcW+/GvMN3ejANqXkxZ/opySAZMrc+9LY/WyjAan41unrR3YrmtTsUpwT66InQ==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.7.tgz", - "integrity": "sha512-2k8go8Ycu1Kb46vEelhu1vqEP+UeRVj2zY1pSuPdgvbd5ykAw82Lrro28vXUrRmzEsUV0NzCf54yARIK8r0fdw==", - "cpu": [ - "s390x" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.7.tgz", - "integrity": "sha512-hzznmADPt+OmsYzw1EE33ccA+HPdIqiCRq7cQeL1Jlq2gb1+OyWBkMCrYGBJ+sxVzve2ZJEVeePbLM2iEIZSxA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/netbsd-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.7.tgz", - "integrity": "sha512-b6pqtrQdigZBwZxAn1UpazEisvwaIDvdbMbmrly7cDTMFnw/+3lVxxCTGOrkPVnsYIosJJXAsILG9XcQS+Yu6w==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.7.tgz", - "integrity": "sha512-OfatkLojr6U+WN5EDYuoQhtM+1xco+/6FSzJJnuWiUw5eVcicbyK3dq5EeV/QHT1uy6GoDhGbFpprUiHUYggrw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.7.tgz", - "integrity": "sha512-AFuojMQTxAz75Fo8idVcqoQWEHIXFRbOc1TrVcFSgCZtQfSdc1RXgB3tjOn/krRHENUB4j00bfGjyl2mJrU37A==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.7.tgz", - "integrity": "sha512-+A1NJmfM8WNDv5CLVQYJ5PshuRm/4cI6WMZRg1by1GwPIQPCTs1GLEUHwiiQGT5zDdyLiRM/l1G0Pv54gvtKIg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openharmony-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.7.tgz", - "integrity": "sha512-+KrvYb/C8zA9CU/g0sR6w2RBw7IGc5J2BPnc3dYc5VJxHCSF1yNMxTV5LQ7GuKteQXZtspjFbiuW5/dOj7H4Yw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openharmony" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.7.tgz", - "integrity": "sha512-ikktIhFBzQNt/QDyOL580ti9+5mL/YZeUPKU2ivGtGjdTYoqz6jObj6nOMfhASpS4GU4Q/Clh1QtxWAvcYKamA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.7.tgz", - "integrity": "sha512-7yRhbHvPqSpRUV7Q20VuDwbjW5kIMwTHpptuUzV+AA46kiPze5Z7qgt6CLCK3pWFrHeNfDd1VKgyP4O+ng17CA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.7.tgz", - "integrity": "sha512-SmwKXe6VHIyZYbBLJrhOoCJRB/Z1tckzmgTLfFYOfpMAx63BJEaL9ExI8x7v0oAO3Zh6D/Oi1gVxEYr5oUCFhw==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.7.tgz", - "integrity": "sha512-56hiAJPhwQ1R4i+21FVF7V8kSD5zZTdHcVuRFMW0hn753vVfQN8xlx4uOPT4xoGH0Z/oVATuR82AiqSTDIpaHg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.13", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", - "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.5.0", - "@jridgewell/trace-mapping": "^0.3.24" - } - }, - "node_modules/@jridgewell/remapping": { - "version": "2.3.5", - "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", - "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/gen-mapping": "^0.3.5", - "@jridgewell/trace-mapping": "^0.3.24" - } - }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", - "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.5.5", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", - "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", - "dev": true, - "license": "MIT" - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.31", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", - "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/resolve-uri": "^3.1.0", - "@jridgewell/sourcemap-codec": "^1.4.14" - } - }, - "node_modules/@rolldown/pluginutils": { - "version": "1.0.0-rc.3", - "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-rc.3.tgz", - "integrity": "sha512-eybk3TjzzzV97Dlj5c+XrBFW57eTNhzod66y9HrBlzJ6NsCrWCp/2kaPS3K9wJmurBC0Tdw4yPjXKZqlznim3Q==", - "dev": true, - "license": "MIT" - }, - "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.60.4.tgz", - "integrity": "sha512-F5QXMSiFebS9hKZj02XhWLLnRpJ3B3AROP0tWbFBSj+6kCbg5m9j5JoHKd4mmSVy5mS/IMQloYgYxCuJC0fxEQ==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-android-arm64": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.60.4.tgz", - "integrity": "sha512-GxxTKApUpzRhof7poWvCJHRF51C67u1R7D6DiluBE8wKU1u5GWE8t+v81JvJYtbawoBFX1hLv5Ei4eVjkWokaw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.60.4.tgz", - "integrity": "sha512-tua0TaJxMOB1R0V0RS1jFZ/RpURFDJIOR2A6jWwQeawuFyS4gBW+rntLRaQd0EQ4bd6Vp44Z2rXW+YYDBsj6IA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.60.4.tgz", - "integrity": "sha512-CSKq7MsP+5PFIcydhAiR1K0UhEI1A2jWXVKHPCBZ151yOutENwvnPocgVHkivu2kviURtCEB6zUQw0vs8RrhMg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.60.4.tgz", - "integrity": "sha512-+O8OkVdyvXMtJEciu2wS/pzm1IxntEEQx3z5TAVy4l32G0etZn+RsA48ARRrFm6Ri8fvqPQfgrvNxSjKAbnd3g==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ] - }, - "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.60.4.tgz", - "integrity": "sha512-Iw3oMskH3AfNuhU0MSN7vNbdi4me/NiYo2azqPz/Le16zHSa+3RRmliCMWWQmh4lcndccU40xcJuTYJZxNo/lw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ] - }, - "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.60.4.tgz", - "integrity": "sha512-EIPRXTVQpHyF8WOo219AD2yEltPehLTcTMz2fn6JsatLYSzQf00hj3rulF+yauOlF9/FtM2WpkT/hJh/KJFGhA==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.60.4.tgz", - "integrity": "sha512-J3Yh9PzzF1Ovah2At+lHiGQdsYgArxBbXv/zHfSyaiFQEqvNv7DcW98pCrmdjCZBrqBiKrKKe2V+aaSGWuBe/w==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.60.4.tgz", - "integrity": "sha512-BFDEZMYfUvLn37ONE1yMBojPxnMlTFsdyNoqncT0qFq1mAfllL+ATMMJd8TeuVMiX84s1KbcxcZbXInmcO2mRg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.60.4.tgz", - "integrity": "sha512-pc9EYOSlOgdQ2uPl1o9PF6/kLSgaUosia7gOuS8mB69IxJvlclko1MECXysjs5ryez1/5zjYqx3+xYU0TU6R1A==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-loong64-gnu": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.60.4.tgz", - "integrity": "sha512-NxnomyxYerDh5n4iLrNa+sH+Z+U4BMEE46V2PgQ/hoB909i8gV1M5wPojWg9fk1jWpO3IQnOs20K4wyZuFLEFQ==", - "cpu": [ - "loong64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-loong64-musl": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.60.4.tgz", - "integrity": "sha512-nbJnQ8a3z1mtmrwImCYhc6BGpThAyYVRQxw9uKSKG4wR6aAYno9sVjJ0zaZcW9BPJX1GbrDPf+SvdWjgTuDmnw==", - "cpu": [ - "loong64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-ppc64-gnu": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.60.4.tgz", - "integrity": "sha512-2EU6acNrQLd8tYvo/LXW535wupT3m6fo7HKo6lr7ktQoItxTyOL1ZCR/GfGCuXl2vR+zmfI6eRXkSemafv+iVg==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-ppc64-musl": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.60.4.tgz", - "integrity": "sha512-WeBtoMuaMxiiIrO2IYP3xs6GMWkJP2C0EoT8beTLkUPmzV1i/UcOSVw1d5r9KBODtHKilG5yFxsGRnBbK3wJ4A==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.60.4.tgz", - "integrity": "sha512-FJHFfqpKUI3A10WrWKiFbBZ7yVbGT4q4B5o1qKFFojqpaYoh9LrQgqWCmmcxQzVSXYtyB5bzkXrYzlHTs21MYA==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.60.4.tgz", - "integrity": "sha512-mcEl6CUT5IAUmQf1m9FYSmVqCJlpQ8r8eyftFUHG8i9OhY7BkBXSUdnLH5DOf0wCOjcP9v/QO93zpmF1SptCCw==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.60.4.tgz", - "integrity": "sha512-ynt3JxVd2w2buzoKDWIyiV1pJW93xlQic1THVLXilz429oijRpSHivZAgp65KBu+cMcgf1eVVjdnTLvPxgCuoQ==", - "cpu": [ - "s390x" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.60.4.tgz", - "integrity": "sha512-Boiz5+MsaROEWDf+GGEwF8VMHGhlUoQMtIPjOgA5fv4osupqTVnJteQNKJwUcnUog2G55jYXH7KZFFiJe0TEzQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.60.4.tgz", - "integrity": "sha512-+qfSY27qIrFfI/Hom04KYFw3GKZSGU4lXus51wsb5EuySfFlWRwjkKWoE9emgRw/ukoT4Udsj4W/+xxG8VbPKg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-openbsd-x64": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.60.4.tgz", - "integrity": "sha512-VpTfOPHgVXEBeeR8hZ2O0F3aSso+JDWqTWmTmzcQKted54IAdUVbxE+j/MVxUsKa8L20HJhv3vUezVPoquqWjA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ] - }, - "node_modules/@rollup/rollup-openharmony-arm64": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.60.4.tgz", - "integrity": "sha512-IPOsh5aRYuLv/nkU51X10Bf75Bsf6+gZdx1X+QP5QM6lIJFHHqbHLG0uJn/hWthzo13UAc2umiUorqZy3axoZg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openharmony" - ] - }, - "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.60.4.tgz", - "integrity": "sha512-4QzE9E81OohJ/HKzHhsqU+zcYYojVOXlFMs1DdyMT6qXl/niOH7AVElmmEdUNHHS/oRkc++d5k6Vy85zFs0DEw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.60.4.tgz", - "integrity": "sha512-zTPgT1YuHHcd+Tmx7h8aml0FWFVelV5N54oHow9SLj+GfoDy/huQ+UV396N/C7KpMDMiPspRktzM1/0r1usYEA==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-x64-gnu": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.60.4.tgz", - "integrity": "sha512-DRS4G7mi9lJxqEDezIkKCaUIKCrLUUDCUaCsTPCi/rtqaC6D/jjwslMQyiDU50Ka0JKpeXeRBFBAXwArY52vBw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.60.4.tgz", - "integrity": "sha512-QVTUovf40zgTqlFVrKA1uXMVvU2QWEFWfAH8Wdc48IxLvrJMQVMBRjuQyUpzZCDkakImib9eVazbWlC6ksWtJw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@types/babel__core": { - "version": "7.20.5", - "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", - "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/parser": "^7.20.7", - "@babel/types": "^7.20.7", - "@types/babel__generator": "*", - "@types/babel__template": "*", - "@types/babel__traverse": "*" - } - }, - "node_modules/@types/babel__generator": { - "version": "7.27.0", - "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.27.0.tgz", - "integrity": "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.0.0" - } - }, - "node_modules/@types/babel__template": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", - "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0" - } - }, - "node_modules/@types/babel__traverse": { - "version": "7.28.0", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.28.0.tgz", - "integrity": "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.28.2" - } - }, - "node_modules/@types/estree": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", - "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/react": { - "version": "19.2.14", - "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.14.tgz", - "integrity": "sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w==", - "dev": true, - "license": "MIT", - "dependencies": { - "csstype": "^3.2.2" - } - }, - "node_modules/@types/react-dom": { - "version": "19.2.3", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.3.tgz", - "integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==", - "dev": true, - "license": "MIT", - "peerDependencies": { - "@types/react": "^19.2.0" - } - }, - "node_modules/@vitejs/plugin-react": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-5.2.0.tgz", - "integrity": "sha512-YmKkfhOAi3wsB1PhJq5Scj3GXMn3WvtQ/JC0xoopuHoXSdmtdStOpFrYaT1kie2YgFBcIe64ROzMYRjCrYOdYw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/core": "^7.29.0", - "@babel/plugin-transform-react-jsx-self": "^7.27.1", - "@babel/plugin-transform-react-jsx-source": "^7.27.1", - "@rolldown/pluginutils": "1.0.0-rc.3", - "@types/babel__core": "^7.20.5", - "react-refresh": "^0.18.0" - }, - "engines": { - "node": "^20.19.0 || >=22.12.0" - }, - "peerDependencies": { - "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" - } - }, - "node_modules/baseline-browser-mapping": { - "version": "2.10.31", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.31.tgz", - "integrity": "sha512-MujYO3eP72uvmSE0i4wltsodRfIpZATP3jvzRNRGGxgzId7aVocVJJV3nf01qnzzKFGxQVC9bpWxl5cjxTr/7Q==", - "dev": true, - "license": "Apache-2.0", - "bin": { - "baseline-browser-mapping": "dist/cli.cjs" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/browserslist": { - "version": "4.28.2", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.2.tgz", - "integrity": "sha512-48xSriZYYg+8qXna9kwqjIVzuQxi+KYWp2+5nCYnYKPTr0LvD89Jqk2Or5ogxz0NUMfIjhh2lIUX/LyX9B4oIg==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "baseline-browser-mapping": "^2.10.12", - "caniuse-lite": "^1.0.30001782", - "electron-to-chromium": "^1.5.328", - "node-releases": "^2.0.36", - "update-browserslist-db": "^1.2.3" - }, - "bin": { - "browserslist": "cli.js" - }, - "engines": { - "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" - } - }, - "node_modules/caniuse-lite": { - "version": "1.0.30001793", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001793.tgz", - "integrity": "sha512-iwSsYWaCOoh26cV8NwNRViHlrfUvYsHDfRVcbtmw0Kg6PJIZZXwMkj1442FYLBGkeUf1juAsU3DTfxW579mrPA==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/caniuse-lite" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "CC-BY-4.0" - }, - "node_modules/convert-source-map": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", - "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", - "dev": true, - "license": "MIT" - }, - "node_modules/csstype": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", - "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/debug": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", - "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/electron-to-chromium": { - "version": "1.5.359", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.359.tgz", - "integrity": "sha512-8lPELWuYZIWk7NDvCNthtmMw/7Q5Wu25NpM4djFMHBmk8DubPAtL4YTOp7ou0e7HyJtwkVlWv8XMLURnrtgJQw==", - "dev": true, - "license": "ISC" - }, - "node_modules/esbuild": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.7.tgz", - "integrity": "sha512-IxpibTjyVnmrIQo5aqNpCgoACA/dTKLTlhMHihVHhdkxKyPO1uBBthumT0rdHmcsk9uMonIWS0m4FljWzILh3w==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=18" - }, - "optionalDependencies": { - "@esbuild/aix-ppc64": "0.27.7", - "@esbuild/android-arm": "0.27.7", - "@esbuild/android-arm64": "0.27.7", - "@esbuild/android-x64": "0.27.7", - "@esbuild/darwin-arm64": "0.27.7", - "@esbuild/darwin-x64": "0.27.7", - "@esbuild/freebsd-arm64": "0.27.7", - "@esbuild/freebsd-x64": "0.27.7", - "@esbuild/linux-arm": "0.27.7", - "@esbuild/linux-arm64": "0.27.7", - "@esbuild/linux-ia32": "0.27.7", - "@esbuild/linux-loong64": "0.27.7", - "@esbuild/linux-mips64el": "0.27.7", - "@esbuild/linux-ppc64": "0.27.7", - "@esbuild/linux-riscv64": "0.27.7", - "@esbuild/linux-s390x": "0.27.7", - "@esbuild/linux-x64": "0.27.7", - "@esbuild/netbsd-arm64": "0.27.7", - "@esbuild/netbsd-x64": "0.27.7", - "@esbuild/openbsd-arm64": "0.27.7", - "@esbuild/openbsd-x64": "0.27.7", - "@esbuild/openharmony-arm64": "0.27.7", - "@esbuild/sunos-x64": "0.27.7", - "@esbuild/win32-arm64": "0.27.7", - "@esbuild/win32-ia32": "0.27.7", - "@esbuild/win32-x64": "0.27.7" - } - }, - "node_modules/escalade": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", - "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/fdir": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", - "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "picomatch": "^3 || ^4" - }, - "peerDependenciesMeta": { - "picomatch": { - "optional": true - } - } - }, - "node_modules/fsevents": { - "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, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/gensync": { - "version": "1.0.0-beta.2", - "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", - "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/jsesc": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", - "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", - "dev": true, - "license": "MIT", - "bin": { - "jsesc": "bin/jsesc" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/json5": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", - "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", - "dev": true, - "license": "MIT", - "bin": { - "json5": "lib/cli.js" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "license": "ISC", - "dependencies": { - "yallist": "^3.0.2" - } - }, - "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true, - "license": "MIT" - }, - "node_modules/nanoid": { - "version": "3.3.12", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.12.tgz", - "integrity": "sha512-ZB9RH/39qpq5Vu6Y+NmUaFhQR6pp+M2Xt76XBnEwDaGcVAqhlvxrl3B2bKS5D3NH3QR76v3aSrKaF/Kiy7lEtQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, - "node_modules/node-releases": { - "version": "2.0.44", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.44.tgz", - "integrity": "sha512-5WUyunoPMsvvEhS8AxHtRzP+oA8UCkJ7YRxatWKjngndhDGLiqEVAQKWjFAiAiuL8zMRGzGSJxFnLetoa43qGQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/picocolors": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", - "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", - "dev": true, - "license": "ISC" - }, - "node_modules/picomatch": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz", - "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/postcss": { - "version": "8.5.15", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.15.tgz", - "integrity": "sha512-FfR8sjd4em2T6fb3I2MwAJU7HWVMr9zba+enmQeeWFfCbm+UOC/0X4DS8XtpUTMwWMGbjKYP7xjfNekzyGmB3A==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/postcss" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "nanoid": "^3.3.12", - "picocolors": "^1.1.1", - "source-map-js": "^1.2.1" - }, - "engines": { - "node": "^10 || ^12 || >=14" - } - }, - "node_modules/react": { - "version": "19.2.6", - "resolved": "https://registry.npmjs.org/react/-/react-19.2.6.tgz", - "integrity": "sha512-sfWGGfavi0xr8Pg0sVsyHMAOziVYKgPLNrS7ig+ivMNb3wbCBw3KxtflsGBAwD3gYQlE/AEZsTLgToRrSCjb0Q==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/react-dom": { - "version": "19.2.6", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.6.tgz", - "integrity": "sha512-0prMI+hvBbPjsWnxDLxlCGyM8PN6UuWjEUCYmZhO67xIV9Xasa/r/vDnq+Xyq4Lo27g8QSbO5YzARu0D1Sps3g==", - "license": "MIT", - "dependencies": { - "scheduler": "^0.27.0" - }, - "peerDependencies": { - "react": "^19.2.6" - } - }, - "node_modules/react-refresh": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.18.0.tgz", - "integrity": "sha512-QgT5//D3jfjJb6Gsjxv0Slpj23ip+HtOpnNgnb2S5zU3CB26G/IDPGoy4RJB42wzFE46DRsstbW6tKHoKbhAxw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/rollup": { - "version": "4.60.4", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.60.4.tgz", - "integrity": "sha512-WHeFSbZYsPu3+bLoNRUuAO+wavNlocOPf3wSHTP7hcFKVnJeWsYlCDbr3mTS14FCizf9ccIxXA8sGL8zKeQN3g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/estree": "1.0.8" - }, - "bin": { - "rollup": "dist/bin/rollup" - }, - "engines": { - "node": ">=18.0.0", - "npm": ">=8.0.0" - }, - "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.60.4", - "@rollup/rollup-android-arm64": "4.60.4", - "@rollup/rollup-darwin-arm64": "4.60.4", - "@rollup/rollup-darwin-x64": "4.60.4", - "@rollup/rollup-freebsd-arm64": "4.60.4", - "@rollup/rollup-freebsd-x64": "4.60.4", - "@rollup/rollup-linux-arm-gnueabihf": "4.60.4", - "@rollup/rollup-linux-arm-musleabihf": "4.60.4", - "@rollup/rollup-linux-arm64-gnu": "4.60.4", - "@rollup/rollup-linux-arm64-musl": "4.60.4", - "@rollup/rollup-linux-loong64-gnu": "4.60.4", - "@rollup/rollup-linux-loong64-musl": "4.60.4", - "@rollup/rollup-linux-ppc64-gnu": "4.60.4", - "@rollup/rollup-linux-ppc64-musl": "4.60.4", - "@rollup/rollup-linux-riscv64-gnu": "4.60.4", - "@rollup/rollup-linux-riscv64-musl": "4.60.4", - "@rollup/rollup-linux-s390x-gnu": "4.60.4", - "@rollup/rollup-linux-x64-gnu": "4.60.4", - "@rollup/rollup-linux-x64-musl": "4.60.4", - "@rollup/rollup-openbsd-x64": "4.60.4", - "@rollup/rollup-openharmony-arm64": "4.60.4", - "@rollup/rollup-win32-arm64-msvc": "4.60.4", - "@rollup/rollup-win32-ia32-msvc": "4.60.4", - "@rollup/rollup-win32-x64-gnu": "4.60.4", - "@rollup/rollup-win32-x64-msvc": "4.60.4", - "fsevents": "~2.3.2" - } - }, - "node_modules/scheduler": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz", - "integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==", - "license": "MIT" - }, - "node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/source-map-js": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", - "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/tinyglobby": { - "version": "0.2.16", - "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.16.tgz", - "integrity": "sha512-pn99VhoACYR8nFHhxqix+uvsbXineAasWm5ojXoN8xEwK5Kd3/TrhNn1wByuD52UxWRLy8pu+kRMniEi6Eq9Zg==", - "dev": true, - "license": "MIT", - "dependencies": { - "fdir": "^6.5.0", - "picomatch": "^4.0.4" - }, - "engines": { - "node": ">=12.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/SuperchupuDev" - } - }, - "node_modules/typescript": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", - "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", - "dev": true, - "license": "Apache-2.0", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, - "node_modules/update-browserslist-db": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", - "integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "escalade": "^3.2.0", - "picocolors": "^1.1.1" - }, - "bin": { - "update-browserslist-db": "cli.js" - }, - "peerDependencies": { - "browserslist": ">= 4.21.0" - } - }, - "node_modules/vite": { - "version": "7.3.3", - "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.3.tgz", - "integrity": "sha512-/4XH147Ui7OGTjg3HbdWe5arnZQSbfuRzdr9Ec7TQi5I7R+ir0Rlc9GIvD4v0XZurELqA035KVXJXpR61xhiTA==", - "dev": true, - "license": "MIT", - "dependencies": { - "esbuild": "^0.27.0", - "fdir": "^6.5.0", - "picomatch": "^4.0.3", - "postcss": "^8.5.6", - "rollup": "^4.43.0", - "tinyglobby": "^0.2.15" - }, - "bin": { - "vite": "bin/vite.js" - }, - "engines": { - "node": "^20.19.0 || >=22.12.0" - }, - "funding": { - "url": "https://github.com/vitejs/vite?sponsor=1" - }, - "optionalDependencies": { - "fsevents": "~2.3.3" - }, - "peerDependencies": { - "@types/node": "^20.19.0 || >=22.12.0", - "jiti": ">=1.21.0", - "less": "^4.0.0", - "lightningcss": "^1.21.0", - "sass": "^1.70.0", - "sass-embedded": "^1.70.0", - "stylus": ">=0.54.8", - "sugarss": "^5.0.0", - "terser": "^5.16.0", - "tsx": "^4.8.1", - "yaml": "^2.4.2" - }, - "peerDependenciesMeta": { - "@types/node": { - "optional": true - }, - "jiti": { - "optional": true - }, - "less": { - "optional": true - }, - "lightningcss": { - "optional": true - }, - "sass": { - "optional": true - }, - "sass-embedded": { - "optional": true - }, - "stylus": { - "optional": true - }, - "sugarss": { - "optional": true - }, - "terser": { - "optional": true - }, - "tsx": { - "optional": true - }, - "yaml": { - "optional": true - } - } - }, - "node_modules/yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true, - "license": "ISC" - } - } -} diff --git a/oneapi-gateway/chat-ui/package.json b/oneapi-gateway/chat-ui/package.json deleted file mode 100644 index c6d5730..0000000 --- a/oneapi-gateway/chat-ui/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "oneapi-chat-ui", - "private": true, - "version": "0.1.0", - "type": "module", - "scripts": { - "dev": "vite --host 0.0.0.0 --port 5174", - "build": "tsc -p tsconfig.json --noEmit && vite build" - }, - "dependencies": { - "react": "^19.1.1", - "react-dom": "^19.1.1" - }, - "devDependencies": { - "@types/react": "^19.1.12", - "@types/react-dom": "^19.1.8", - "@vitejs/plugin-react": "^5.0.2", - "typescript": "^5.7.3", - "vite": "^7.1.3" - } -} diff --git a/oneapi-gateway/chat-ui/src/main.tsx b/oneapi-gateway/chat-ui/src/main.tsx deleted file mode 100644 index 479c4e4..0000000 --- a/oneapi-gateway/chat-ui/src/main.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import React from "react"; -import { createRoot } from "react-dom/client"; -import { App } from "./ui/App"; - -createRoot(document.getElementById("root")!).render( - - - , -); diff --git a/oneapi-gateway/chat-ui/src/ui/App.tsx b/oneapi-gateway/chat-ui/src/ui/App.tsx deleted file mode 100644 index 7bacdab..0000000 --- a/oneapi-gateway/chat-ui/src/ui/App.tsx +++ /dev/null @@ -1,1625 +0,0 @@ -import { useCallback, useEffect, useMemo, useRef, useState } from "react"; -import { createClientId } from "./id"; -import { shouldApplyLoadedMessages } from "./messageLoad"; -import { parseSseDataEvents } from "./stream"; - -type Conversation = { - id: string; - title: string; - message_count: number; - created_at: string; - updated_at: string; -}; - -type Message = { - id: string; - conversation_id: string; - role: string; - content: string; - model: string | null; - created_at: string; -}; - -type ViewMode = "chat" | "test"; - -type HealthStatus = { - ok: boolean; - service: string; - appEnv?: string; - upstreams?: string[]; - authModes?: string[]; - cacheEnabled?: boolean; -}; - -const LS_KEY = "easyai_chat_api_key"; - -function getStoredKey(): string | null { - try { - return localStorage.getItem(LS_KEY); - } catch { - return null; - } -} - -function setStoredKey(k: string) { - try { - localStorage.setItem(LS_KEY, k); - } catch {} -} - -function clearStoredKey() { - try { - localStorage.removeItem(LS_KEY); - } catch {} -} - -function authHeaders(): Record { - const k = getStoredKey(); - if (!k) return {}; - return { authorization: `Bearer ${k}` }; -} - -async function fetchJson(url: string, init?: RequestInit) { - const headers: Record = { - ...authHeaders(), - accept: "application/json", - }; - if (init?.method !== "GET" && init?.body !== undefined && init?.body !== null) { - headers["content-type"] = "application/json"; - } - - const res = await fetch(url, { - ...init, - headers: { - ...(init?.headers ?? {}), - ...headers, - }, - }); - const text = await res.text(); - if (!res.ok) { - let msg = text || String(res.status); - try { - const j = JSON.parse(text); - msg = j.error || msg; - } catch {} - throw new Error(msg); - } - return text ? JSON.parse(text) : null; -} - -function truncate(s: string, n: number): string { - if (s.length <= n) return s; - return s.slice(0, n - 1) + "…"; -} - -function formatTime(s: string): string { - const d = new Date(s); - if (Number.isNaN(d.getTime())) return s; - const now = new Date(); - const diffMs = now.getTime() - d.getTime(); - const diffMin = Math.floor(diffMs / 60000); - if (diffMin < 1) return "刚刚"; - if (diffMin < 60) return `${diffMin} 分钟前`; - const diffHour = Math.floor(diffMin / 60); - if (diffHour < 24) return `${diffHour} 小时前`; - const diffDay = Math.floor(diffHour / 24); - if (diffDay < 7) return `${diffDay} 天前`; - return d.toISOString().replace("T", " ").slice(0, 16); -} - -function extractAssistantText(payload: any): string { - const content = payload?.choices?.[0]?.message?.content; - if (typeof content === "string") return content; - if (Array.isArray(content)) { - return content - .map((part) => { - if (typeof part === "string") return part; - if (typeof part?.text === "string") return part.text; - try { - return JSON.stringify(part); - } catch { - return String(part ?? ""); - } - }) - .join("\n"); - } - try { - return JSON.stringify(payload, null, 2); - } catch { - return String(payload ?? ""); - } -} - -function formatUsage(payload: any): string { - const usage = payload?.usage; - if (!usage || typeof usage !== "object") return ""; - const prompt = typeof usage.prompt_tokens === "number" ? usage.prompt_tokens : "-"; - const completion = typeof usage.completion_tokens === "number" ? usage.completion_tokens : "-"; - const total = typeof usage.total_tokens === "number" ? usage.total_tokens : "-"; - return `Prompt ${prompt} / Completion ${completion} / Total ${total}`; -} - -function extractStreamChunkText(payload: any): string { - const delta = payload?.choices?.[0]?.delta; - if (typeof delta?.content === "string") return delta.content; - if (Array.isArray(delta?.content)) { - return delta.content - .map((part: any) => { - if (typeof part === "string") return part; - if (typeof part?.text === "string") return part.text; - return ""; - }) - .join(""); - } - const message = payload?.choices?.[0]?.message; - if (typeof message?.content === "string") return message.content; - return ""; -} - -function getDeploymentLabel(appEnv?: string | null): { text: string; tone: string } { - if (appEnv === undefined) return { text: "环境检测中", tone: "#6b7280" }; - if (appEnv === null) return { text: "环境未知", tone: "#6b7280" }; - return appEnv === "production" - ? { text: "线上环境", tone: "#137333" } - : { text: "开发环境", tone: "#b45309" }; -} - -function DeploymentBadge(props: { appEnv?: string }) { - const { text, tone } = getDeploymentLabel(props.appEnv); - return ( -
- - {text} -
- ); -} - -export function App() { - const [apiKey, setApiKey] = useState(getStoredKey); - const [keyInput, setKeyInput] = useState(getStoredKey() ?? ""); - const [loginError, setLoginError] = useState(""); - const [viewMode, setViewMode] = useState("chat"); - const [conversations, setConversations] = useState([]); - const [currentId, setCurrentId] = useState(null); - const [messages, setMessages] = useState([]); - const [models, setModels] = useState([]); - const [selectedModel, setSelectedModel] = useState(""); - const [inputText, setInputText] = useState(""); - const [isStreaming, setIsStreaming] = useState(false); - const [streamContent, setStreamContent] = useState(""); - const [status, setStatus] = useState(""); - const [showSettings, setShowSettings] = useState(false); - const [temperature, setTemperature] = useState("0.7"); - const [maxTokens, setMaxTokens] = useState("2048"); - const [testSystemPrompt, setTestSystemPrompt] = useState("你是一个有帮助的 AI 助手。"); - const [testUserPrompt, setTestUserPrompt] = useState(""); - const [testStream, setTestStream] = useState(false); - const [testLoading, setTestLoading] = useState(false); - const [testResult, setTestResult] = useState(""); - const [testRaw, setTestRaw] = useState(""); - const [testUsage, setTestUsage] = useState(""); - const [testLatencyMs, setTestLatencyMs] = useState(null); - const [health, setHealth] = useState(undefined); - const [convLoading, setConvLoading] = useState(false); - const [renamingId, setRenamingId] = useState(null); - const [renameInput, setRenameInput] = useState(""); - const [pendingDelete, setPendingDelete] = useState<{ id: string; title: string } | null>(null); - - const abortRef = useRef(null); - const testAbortRef = useRef(null); - const messagesScrollRef = useRef(null); - const messagesEndRef = useRef(null); - const inputRef = useRef(null); - const currentIdRef = useRef(null); - const isStreamingRef = useRef(false); - const messageLoadSeqRef = useRef(0); - - const currentConv = useMemo( - () => conversations.find((c) => c.id === currentId) ?? null, - [conversations, currentId], - ); - - const scrollToBottom = useCallback(() => { - const panel = messagesScrollRef.current; - if (!panel) return; - panel.scrollTo({ top: panel.scrollHeight, behavior: "auto" }); - }, []); - - useEffect(() => { - scrollToBottom(); - }, [messages, streamContent, scrollToBottom]); - - useEffect(() => { - currentIdRef.current = currentId; - }, [currentId]); - - useEffect(() => { - isStreamingRef.current = isStreaming; - }, [isStreaming]); - - const loadModels = useCallback(async () => { - try { - const data = await fetchJson("/chat-api/models"); - const list = Array.isArray(data?.data) - ? (data.data as any[]).map((m) => String(m?.id ?? "").trim()).filter(Boolean) - : []; - setModels(list); - if (list.length > 0 && !selectedModel) setSelectedModel(list[0]!); - } catch {} - }, []); - - const loadHealth = useCallback(async () => { - try { - const res = await fetch("/healthz", { headers: { accept: "application/json" } }); - const data = await res.json(); - if (!res.ok) throw new Error(String(res.status)); - setHealth(data as HealthStatus); - } catch { - setHealth(null); - } - }, []); - - const loadConversations = useCallback(async () => { - setConvLoading(true); - try { - const data = await fetchJson("/chat-api/conversations"); - setConversations(data?.conversations ?? []); - } catch (e: any) { - if (e?.message?.includes("unauthorized")) { - setLoginError("登录已失效,请重新输入 API Key。"); - handleLogout(); - return; - } - } finally { - setConvLoading(false); - } - }, []); - - const loadMessages = useCallback(async (convId: string) => { - const seq = ++messageLoadSeqRef.current; - try { - const data = await fetchJson(`/chat-api/conversations/${encodeURIComponent(convId)}/messages`); - if (!shouldApplyLoadedMessages({ - requestSeq: seq, - currentSeq: messageLoadSeqRef.current, - requestedConversationId: convId, - currentConversationId: currentIdRef.current, - isStreaming: isStreamingRef.current, - })) return; - setMessages(data?.messages ?? []); - } catch {} - }, []); - - const handleLogin = useCallback(async () => { - const key = keyInput.trim(); - if (!key) return; - setLoginError(""); - try { - const res = await fetch("/chat-api/models", { - headers: { - authorization: `Bearer ${key}`, - accept: "application/json", - }, - }); - if (!res.ok) throw new Error("invalid_api_key"); - setStoredKey(key); - setApiKey(key); - } catch { - setLoginError("API Key 无效或服务未就绪,请检查后重试。"); - } - }, [keyInput]); - - function handleLogout() { - clearStoredKey(); - setApiKey(null); - setKeyInput(""); - setViewMode("chat"); - setConversations([]); - setCurrentId(null); - setMessages([]); - setIsStreaming(false); - setStreamContent(""); - setTestLoading(false); - setTestResult(""); - setTestRaw(""); - setTestUsage(""); - setTestLatencyMs(null); - setTestUserPrompt(""); - testAbortRef.current?.abort(); - testAbortRef.current = null; - abortRef.current?.abort(); - abortRef.current = null; - } - - const handleNewConversation = useCallback(async () => { - if (isStreaming) return; - try { - const data = await fetchJson("/chat-api/conversations", { method: "POST" }); - const id = data?.id; - if (id) { - setCurrentId(id); - setMessages([]); - setStreamContent(""); - await loadConversations(); - } - } catch (e: any) { - setStatus(e?.message ?? "创建失败"); - } - }, [isStreaming, loadConversations]); - - const handleSelectConversation = useCallback( - async (id: string) => { - if (isStreaming) return; - setCurrentId(id); - setMessages([]); - setStreamContent(""); - await loadMessages(id); - }, - [isStreaming, loadMessages], - ); - - const handleDeleteConversation = useCallback( - async (id: string) => { - if (isStreaming) return; - try { - await fetchJson(`/chat-api/conversations/${encodeURIComponent(id)}`, { method: "DELETE" }); - setConversations((prev) => prev.filter((c) => c.id !== id)); - if (currentId === id) { - setCurrentId(null); - setMessages([]); - setStreamContent(""); - setStatus("会话已删除"); - } - await loadConversations(); - } catch (e: any) { - setStatus(e?.message ?? "删除失败"); - } - }, - [isStreaming, currentId, loadConversations], - ); - - const handleCloseConversation = useCallback(() => { - if (isStreaming) return; - setCurrentId(null); - setMessages([]); - setStreamContent(""); - setStatus(""); - }, [isStreaming]); - - const requestDeleteConversation = useCallback( - (id: string, title?: string) => { - if (isStreaming) return; - setPendingDelete({ id, title: title?.trim() || "新对话" }); - }, - [isStreaming], - ); - - const confirmDeleteConversation = useCallback(async () => { - const target = pendingDelete; - if (!target) return; - setPendingDelete(null); - await handleDeleteConversation(target.id); - }, [pendingDelete, handleDeleteConversation]); - - useEffect(() => { - if (apiKey) { - loadConversations(); - loadModels(); - } - }, [apiKey, loadConversations, loadModels]); - - useEffect(() => { - loadHealth(); - }, [loadHealth]); - - useEffect(() => { - if (currentId) { - loadMessages(currentId); - } else { - setMessages([]); - } - }, [currentId, loadMessages]); - - useEffect(() => { - return () => { - abortRef.current?.abort(); - abortRef.current = null; - testAbortRef.current?.abort(); - testAbortRef.current = null; - }; - }, []); - - const handleSend = useCallback(async () => { - const msg = inputText.trim(); - if (!msg || isStreaming || !selectedModel) return; - - setInputText(""); - messageLoadSeqRef.current += 1; - setIsStreaming(true); - setStreamContent(""); - setStatus("发送中..."); - - let activeConvId: string; - if (!currentId) { - try { - const created = await fetchJson("/chat-api/conversations", { method: "POST" }); - const createdId = created?.id; - if (!createdId || typeof createdId !== "string") throw new Error("创建会话失败"); - activeConvId = createdId; - setCurrentId(activeConvId); - await loadConversations(); - } catch (e: any) { - setIsStreaming(false); - setStatus(e?.message ?? "创建会话失败"); - return; - } - } else { - activeConvId = currentId; - } - - const userMsg: Message = { - id: createClientId(), - conversation_id: activeConvId, - role: "user", - content: msg, - model: selectedModel, - created_at: new Date().toISOString(), - }; - setMessages((prev) => [...prev, userMsg]); - - const controller = new AbortController(); - abortRef.current = controller; - - try { - const body = JSON.stringify({ - model: selectedModel, - message: msg, - temperature: Number(temperature) || undefined, - max_tokens: Number(maxTokens) || undefined, - stream: true, - }); - - const res = await fetch(`/chat-api/conversations/${encodeURIComponent(activeConvId)}/chat`, { - method: "POST", - headers: { - ...authHeaders(), - "content-type": "application/json", - accept: "text/event-stream", - }, - body, - signal: controller.signal, - }); - - if (!res.ok) { - const text = await res.text(); - throw new Error(text || String(res.status)); - } - - const reader = res.body?.getReader(); - if (!reader) throw new Error("stream not available"); - - const decoder = new TextDecoder(); - let buffer = ""; - let output = ""; - let doneSeen = false; - - while (!doneSeen) { - const { done, value } = await reader.read(); - if (done) break; - const chunk = decoder.decode(value, { stream: true }); - buffer += chunk; - - const parsedEvents = parseSseDataEvents(buffer); - buffer = parsedEvents.rest; - for (const dataText of parsedEvents.dataEvents) { - if (dataText === "[DONE]") { - doneSeen = true; - break; - } - let parsed: any; - try { - parsed = JSON.parse(dataText); - } catch { - continue; - } - if (parsed?.error?.message) { - throw new Error(String(parsed.error.message)); - } - const text = extractStreamChunkText(parsed); - if (text) { - output += text; - setStreamContent(output); - } - } - } - if (buffer) { - const parsedEvents = parseSseDataEvents(buffer, true); - buffer = parsedEvents.rest; - for (const dataText of parsedEvents.dataEvents) { - if (dataText === "[DONE]") break; - let parsed: any; - try { - parsed = JSON.parse(dataText); - } catch { - continue; - } - if (parsed?.error?.message) { - throw new Error(String(parsed.error.message)); - } - const text = extractStreamChunkText(parsed); - if (text) { - output += text; - setStreamContent(output); - } - } - } - if (doneSeen) { - await reader.cancel().catch(() => {}); - } - - const assistantMsg: Message = { - id: createClientId(), - conversation_id: activeConvId, - role: "assistant", - content: output, - model: selectedModel, - created_at: new Date().toISOString(), - }; - setMessages((prev) => [...prev, assistantMsg]); - setStreamContent(""); - setStatus(""); - await loadConversations(); - } catch (e: any) { - if (e?.name === "AbortError") { - setStatus("已停止"); - } else { - setStatus(e?.message ?? "请求失败"); - const errMsg: Message = { - id: createClientId(), - conversation_id: activeConvId, - role: "assistant", - content: `**错误:** ${e?.message ?? "请求失败"}`, - model: selectedModel, - created_at: new Date().toISOString(), - }; - setMessages((prev) => [...prev, errMsg]); - setStreamContent(""); - } - } finally { - if (abortRef.current === controller) abortRef.current = null; - setIsStreaming(false); - } - }, [inputText, isStreaming, currentId, selectedModel, temperature, maxTokens, loadConversations]); - - const handleStop = useCallback(() => { - abortRef.current?.abort(); - abortRef.current = null; - setIsStreaming(false); - setStatus("已停止"); - }, []); - - const handleStopTest = useCallback(() => { - testAbortRef.current?.abort(); - testAbortRef.current = null; - setTestLoading(false); - setStatus("已停止"); - }, []); - - const runTest = useCallback(async () => { - const model = selectedModel.trim(); - const userPrompt = testUserPrompt.trim(); - if (!model) { - setStatus("请先选择模型"); - return; - } - if (!userPrompt) { - setStatus("请输入用户消息"); - return; - } - - const messagesPayload: Array<{ role: string; content: string }> = []; - if (testSystemPrompt.trim()) { - messagesPayload.push({ role: "system", content: testSystemPrompt.trim() }); - } - messagesPayload.push({ role: "user", content: userPrompt }); - - const body: Record = { - model, - messages: messagesPayload, - stream: testStream, - }; - if (temperature.trim()) body.temperature = Number(temperature); - if (maxTokens.trim()) body.max_tokens = Number(maxTokens); - - setTestLoading(true); - setTestResult(""); - setTestRaw(""); - setTestUsage(""); - setTestLatencyMs(null); - setStatus("请求中..."); - - const startedAt = performance.now(); - const controller = new AbortController(); - testAbortRef.current = controller; - - try { - if (testStream) { - const res = await fetch("/v1/chat/completions", { - method: "POST", - headers: { - ...authHeaders(), - accept: "text/event-stream", - "content-type": "application/json", - }, - signal: controller.signal, - body: JSON.stringify(body), - }); - if (!res.ok) { - const text = await res.text(); - throw new Error(text || String(res.status)); - } - - const reader = res.body?.getReader(); - if (!reader) throw new Error("stream not supported by browser"); - const decoder = new TextDecoder(); - let buffer = ""; - let raw = ""; - let output = ""; - let usageText = ""; - let doneSeen = false; - - while (!doneSeen) { - const { done, value } = await reader.read(); - if (done) break; - const chunk = decoder.decode(value, { stream: true }); - raw += chunk; - buffer += chunk; - setTestRaw(raw); - - const parsedEvents = parseSseDataEvents(buffer); - buffer = parsedEvents.rest; - for (const dataText of parsedEvents.dataEvents) { - if (dataText === "[DONE]") { - doneSeen = true; - break; - } - let parsed: any; - try { - parsed = JSON.parse(dataText); - } catch { - continue; - } - if (parsed?.error?.message) { - throw new Error(String(parsed.error.message)); - } - const text = extractStreamChunkText(parsed); - if (text) { - output += text; - setTestResult(output); - } - const nextUsage = formatUsage(parsed); - if (nextUsage) { - usageText = nextUsage; - setTestUsage(nextUsage); - } - } - } - if (buffer) { - const parsedEvents = parseSseDataEvents(buffer, true); - buffer = parsedEvents.rest; - for (const dataText of parsedEvents.dataEvents) { - if (dataText === "[DONE]") break; - let parsed: any; - try { - parsed = JSON.parse(dataText); - } catch { - continue; - } - if (parsed?.error?.message) { - throw new Error(String(parsed.error.message)); - } - const text = extractStreamChunkText(parsed); - if (text) { - output += text; - setTestResult(output); - } - const nextUsage = formatUsage(parsed); - if (nextUsage) { - usageText = nextUsage; - setTestUsage(nextUsage); - } - } - } - if (doneSeen) { - await reader.cancel().catch(() => {}); - } - - const latency = Math.round(performance.now() - startedAt); - setTestLatencyMs(latency); - setTestUsage((current) => current || usageText); - setStatus("成功"); - } else { - const data = await fetchJson("/v1/chat/completions", { - method: "POST", - signal: controller.signal, - body: JSON.stringify(body), - }); - const latency = Math.round(performance.now() - startedAt); - setTestLatencyMs(latency); - setTestResult(extractAssistantText(data)); - setTestRaw(JSON.stringify(data, null, 2)); - setTestUsage(formatUsage(data)); - setStatus("成功"); - } - } catch (e: any) { - if (e?.name === "AbortError") { - setStatus("已停止"); - } else { - setStatus(e?.message ?? "失败"); - } - } finally { - if (testAbortRef.current === controller) { - testAbortRef.current = null; - } - setTestLoading(false); - } - }, [maxTokens, selectedModel, temperature, testStream, testSystemPrompt, testUserPrompt]); - - const handleKeyDown = useCallback( - (e: React.KeyboardEvent) => { - if (e.key === "Enter" && !e.shiftKey) { - e.preventDefault(); - handleSend(); - } - }, - [handleSend], - ); - - const handleUpdateTitle = useCallback( - async (id: string, title: string) => { - try { - await fetchJson(`/chat-api/conversations/${encodeURIComponent(id)}/title`, { - method: "PUT", - body: JSON.stringify({ title }), - }); - await loadConversations(); - } catch {} - }, - [loadConversations], - ); - - if (!apiKey) { - return ( -
-
-
-

EasyAI Chat

- -
-

- 请输入 API Key 开始使用。若聊天返回 model not found,请先在服务端拉取配置中的 Ollama 模型。 -

- setKeyInput(e.target.value)} - onKeyDown={(e) => e.key === "Enter" && handleLogin()} - placeholder="sk-..." - style={{ - width: "100%", - padding: "12px 16px", - borderRadius: 8, - border: "1px solid #ddd", - fontSize: 14, - boxSizing: "border-box", - marginBottom: 16, - }} - /> - - {loginError && ( -
- {loginError} -
- )} -
-
- ); - } - - const sidebarWidth = 280; - const modelList = models; - - return ( -
- {/* Sidebar */} -
-
-
-

EasyAI Chat

- -
- -
- -
- {convLoading && conversations.length === 0 ? ( -
加载中...
- ) : conversations.length === 0 ? ( -
暂无对话
- ) : ( - conversations.map((conv) => ( -
handleSelectConversation(conv.id)} - style={{ - padding: "10px 12px", - borderRadius: 8, - marginBottom: 4, - cursor: isStreaming ? "default" : "pointer", - background: conv.id === currentId ? "#e8f0fe" : "transparent", - display: "flex", - gap: 8, - alignItems: "flex-start", - opacity: isStreaming ? 0.6 : 1, - }} - > -
- {renamingId === conv.id ? ( - setRenameInput(e.target.value)} - onKeyDown={(e) => { - if (e.key === "Enter") { - e.stopPropagation(); - const trimmed = renameInput.trim(); - if (trimmed) handleUpdateTitle(conv.id, trimmed); - setRenamingId(null); - } - if (e.key === "Escape") { - e.stopPropagation(); - setRenamingId(null); - } - }} - onBlur={() => { - const trimmed = renameInput.trim(); - if (trimmed) handleUpdateTitle(conv.id, trimmed); - setRenamingId(null); - }} - onClick={(e) => e.stopPropagation()} - autoFocus - style={{ - width: "100%", - padding: "2px 6px", - borderRadius: 4, - border: "1px solid #1a73e8", - fontSize: 14, - fontFamily: "inherit", - outline: "none", - boxSizing: "border-box", - }} - /> - ) : ( -
{ - if (isStreaming) return; - setRenamingId(conv.id); - setRenameInput(conv.title || ""); - }} - style={{ - fontSize: 14, - fontWeight: conv.id === currentId ? 600 : 400, - overflow: "hidden", - textOverflow: "ellipsis", - whiteSpace: "nowrap", - cursor: isStreaming ? "default" : "text", - }} - title="点击重命名" - > - {conv.title || "新对话"} -
- )} -
- {conv.message_count} 条消息 · {formatTime(conv.updated_at)} -
-
- -
- )) - )} -
- -
- {truncate(apiKey, 24)} - -
-
- - {/* Main area */} -
- {/* Top bar */} -
- - - - - - - {isStreaming && ( - - )} - - {viewMode === "test" && testLoading && ( - - )} - - {status && ( - {status} - )} - {currentConv && ( - - )} - {currentConv && ( - - )} -
- - {viewMode === "chat" ? ( - <> - {/* Settings panel */} - {showSettings && ( -
- - -
- )} - - {/* Messages */} -
- {!currentConv && ( -
-
💬
-
选择或创建一个对话开始聊天
-
- )} - - {messages.map((msg) => ( -
-
- {msg.content} -
-
- ))} - - {isStreaming && ( -
-
- {streamContent} - -
-
- )} - -
-
- - {/* Input area */} -
-
-