Merge branch 'dev-test2' into dev
This commit is contained in:
commit
adab06ead1
14 files changed
+30
-19
No files matched your search
@@ -29,6 +29,8 @@ AUTH_LOCAL_JWT_ISSUER=hxops-backend
|
|||||||
AUTH_LOCAL_JWT_AUDIENCE=hxops-frontend
|
AUTH_LOCAL_JWT_AUDIENCE=hxops-frontend
|
||||||
AUTH_LOCAL_JWT_EXPIRES_HOURS=12
|
AUTH_LOCAL_JWT_EXPIRES_HOURS=12
|
||||||
|
|
||||||
|
DATABASE_URL=postgresql://postgres:@localhost:5432/hxops_db
|
||||||
|
|
||||||
# SiliconFlow API Configuration
|
# SiliconFlow API Configuration
|
||||||
GJL_API_KEY=sk-umfzicwjcvwampzblqczckkqojiscyybtaljzbsvpdwdvxlu
|
GJL_API_KEY=sk-umfzicwjcvwampzblqczckkqojiscyybtaljzbsvpdwdvxlu
|
||||||
GJL_API_BASE=https://api.siliconflow.cn/v1
|
GJL_API_BASE=https://api.siliconflow.cn/v1
|
||||||
|
|||||||
+3
-2
@@ -13,5 +13,6 @@ def make_shell_context():
|
|||||||
return {'db': db, 'User': User, 'Agent': Agent}
|
return {'db': db, 'User': User, 'Agent': Agent}
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# MacOS ControlCenter uses port 5000, so we use 5002
|
# MacOS ControlCenter uses port 5000, so we use 5052
|
||||||
app.run(host='0.0.0.0', port=5002)
|
# (原5002易被Trae IDE自动端口转发劫持)
|
||||||
|
app.run(host='0.0.0.0', port=5052)
|
||||||
@@ -17,7 +17,7 @@ username = sys.argv[1]
|
|||||||
password = sys.argv[2]
|
password = sys.argv[2]
|
||||||
|
|
||||||
# 测试登录 API
|
# 测试登录 API
|
||||||
url = "http://localhost:5002/api/user/login"
|
url = "http://localhost:5052/api/user/login"
|
||||||
headers = {"Content-Type": "application/json"}
|
headers = {"Content-Type": "application/json"}
|
||||||
data = {"username": username, "password": password}
|
data = {"username": username, "password": password}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
import requests
|
import requests
|
||||||
import json
|
import json
|
||||||
|
|
||||||
BASE_URL = "http://127.0.0.1:5002"
|
BASE_URL = "http://127.0.0.1:5052"
|
||||||
|
|
||||||
def test_auth_header_format():
|
def test_auth_header_format():
|
||||||
"""测试不同的认证头格式"""
|
"""测试不同的认证头格式"""
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import requests
|
|||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
BASE_URL = "http://127.0.0.1:5002"
|
BASE_URL = "http://127.0.0.1:5052"
|
||||||
|
|
||||||
def test_login():
|
def test_login():
|
||||||
"""测试登录 API"""
|
"""测试登录 API"""
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@ services:
|
|||||||
- "host.docker.internal:host-gateway"
|
- "host.docker.internal:host-gateway"
|
||||||
# 如果需要在宿主机调试,可暴露端口;生产环境建议只在网络内暴露
|
# 如果需要在宿主机调试,可暴露端口;生产环境建议只在网络内暴露
|
||||||
ports:
|
ports:
|
||||||
- "5002:5002"
|
- "5052:5052"
|
||||||
# 持久化运行时可写文件:
|
# 持久化运行时可写文件:
|
||||||
# - backend/.env 用于保存管理员后台修改的企业微信等配置(与数据库双写,
|
# - backend/.env 用于保存管理员后台修改的企业微信等配置(与数据库双写,
|
||||||
# 防止容器重建后从镜像基线读取丢失修改)。文件不存在时 docker 会自动
|
# 防止容器重建后从镜像基线读取丢失修改)。文件不存在时 docker 会自动
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ hxops/
|
|||||||
- 运行 Flask 应用。
|
- 运行 Flask 应用。
|
||||||
- **Worker**: `gevent` (异步模式)。
|
- **Worker**: `gevent` (异步模式)。
|
||||||
- **并发**: `workers = CPU * 2 + 1`, `worker_connections = 1000+`。
|
- **并发**: `workers = CPU * 2 + 1`, `worker_connections = 1000+`。
|
||||||
- 监听 `127.0.0.1:5002`。
|
- 监听 `127.0.0.1:5052`。
|
||||||
|
|
||||||
4. **PostgreSQL (数据层)**:
|
4. **PostgreSQL (数据层)**:
|
||||||
- 存储用户、应用配置及审计日志。
|
- 存储用户、应用配置及审计日志。
|
||||||
|
|||||||
+5
-5
@@ -129,7 +129,7 @@ python init_db.py
|
|||||||
python run.py
|
python run.py
|
||||||
```
|
```
|
||||||
|
|
||||||
后端本地开发端口:`5002`(`backend/run.py`)。
|
后端本地开发端口:`5052`(`backend/run.py`)。
|
||||||
|
|
||||||
### 5.2 前端(本地)
|
### 5.2 前端(本地)
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@ npm run dev
|
|||||||
```
|
```
|
||||||
|
|
||||||
前端本地开发端口:`8881`(`frontend/vite.config.ts`)。
|
前端本地开发端口:`8881`(`frontend/vite.config.ts`)。
|
||||||
本地开发时前端 `/api` 已代理到 `http://127.0.0.1:5002`。
|
本地开发时前端 `/api` 已代理到 `http://127.0.0.1:5052`。
|
||||||
|
|
||||||
### 5.3 Docker 启动(可选)
|
### 5.3 Docker 启动(可选)
|
||||||
|
|
||||||
@@ -151,9 +151,9 @@ docker compose up -d --build
|
|||||||
当前对外端口映射(`docker-compose.yml`):
|
当前对外端口映射(`docker-compose.yml`):
|
||||||
|
|
||||||
- 前端:`8890:80`
|
- 前端:`8890:80`
|
||||||
- 后端:`5002:5002`
|
- 后端:`5052:5052`
|
||||||
|
|
||||||
注意:当前项目中后端端口存在 `5000` 与 `5002` 并存配置,若容器联调异常,优先统一端口配置。
|
注意:当前项目中后端端口存在 `5000` 与 `5052` 并存配置,若容器联调异常,优先统一端口配置。
|
||||||
|
|
||||||
## 6. 项目登录环境与账号配置
|
## 6. 项目登录环境与账号配置
|
||||||
|
|
||||||
@@ -167,7 +167,7 @@ docker compose up -d --build
|
|||||||
|
|
||||||
| 环境 | 前端地址 | 后端地址 | 登录方式 | 备注 |
|
| 环境 | 前端地址 | 后端地址 | 登录方式 | 备注 |
|
||||||
| ------- | ------------------------------ | ----------------------- | ----------------------- | ---- |
|
| ------- | ------------------------------ | ----------------------- | ----------------------- | ---- |
|
||||||
| 本地 | `http://localhost:8881` | `http://localhost:5002` | 密码/企业微信(按配置) | |
|
| 本地 | `http://localhost:8881` | `http://localhost:5052` | 密码/企业微信(按配置) | |
|
||||||
| 测试 | `待定` | `待定` | 密码/企业微信(按配置) | |
|
| 测试 | `待定` | `待定` | 密码/企业微信(按配置) | |
|
||||||
| 生产 | `http://192.168.100.230:8881/` ;域名 `http://ai.well-trust.com:8881/` | | Casdoor 密码 / 企业微信(经 Casdoor,按配置) | |
|
| 生产 | `http://192.168.100.230:8881/` ;域名 `http://ai.well-trust.com:8881/` | | Casdoor 密码 / 企业微信(经 Casdoor,按配置) | |
|
||||||
| Jenkins | `http://8.152.207.171:10240/` | | 密码 | |
|
| Jenkins | `http://8.152.207.171:10240/` | | 密码 | |
|
||||||
|
|||||||
Generated
+8
@@ -542,6 +542,7 @@
|
|||||||
"integrity": "sha512-oH72nZRfDv9lADUBSo104Aq7gPHpQZc4BTx38r9xf9pg5LfP6EzSyH2n7qFmmxRQXh7YlUXODcYsg6PuTDSxGg==",
|
"integrity": "sha512-oH72nZRfDv9lADUBSo104Aq7gPHpQZc4BTx38r9xf9pg5LfP6EzSyH2n7qFmmxRQXh7YlUXODcYsg6PuTDSxGg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"undici-types": "~7.16.0"
|
"undici-types": "~7.16.0"
|
||||||
}
|
}
|
||||||
@@ -948,6 +949,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"baseline-browser-mapping": "^2.9.0",
|
"baseline-browser-mapping": "^2.9.0",
|
||||||
"caniuse-lite": "^1.0.30001759",
|
"caniuse-lite": "^1.0.30001759",
|
||||||
@@ -2038,6 +2040,7 @@
|
|||||||
"resolved": "https://mirrors.tencent.com/npm/picomatch/-/picomatch-4.0.3.tgz",
|
"resolved": "https://mirrors.tencent.com/npm/picomatch/-/picomatch-4.0.3.tgz",
|
||||||
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
},
|
},
|
||||||
@@ -2082,6 +2085,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"nanoid": "^3.3.11",
|
"nanoid": "^3.3.11",
|
||||||
"picocolors": "^1.1.1",
|
"picocolors": "^1.1.1",
|
||||||
@@ -2440,6 +2444,7 @@
|
|||||||
"resolved": "https://mirrors.tencent.com/npm/tailwindcss/-/tailwindcss-3.4.17.tgz",
|
"resolved": "https://mirrors.tencent.com/npm/tailwindcss/-/tailwindcss-3.4.17.tgz",
|
||||||
"integrity": "sha512-w33E2aCvSDP0tW9RZuNXadXlkHXqFzSkQew/aIa2i/Sj8fThxwovwlXHSPXTbAHwEIhBFXAedUhP2tueAKP8Og==",
|
"integrity": "sha512-w33E2aCvSDP0tW9RZuNXadXlkHXqFzSkQew/aIa2i/Sj8fThxwovwlXHSPXTbAHwEIhBFXAedUhP2tueAKP8Og==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alloc/quick-lru": "^5.2.0",
|
"@alloc/quick-lru": "^5.2.0",
|
||||||
"arg": "^5.0.2",
|
"arg": "^5.0.2",
|
||||||
@@ -2541,6 +2546,7 @@
|
|||||||
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
|
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
|
||||||
"devOptional": true,
|
"devOptional": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
"peer": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsc": "bin/tsc",
|
"tsc": "bin/tsc",
|
||||||
"tsserver": "bin/tsserver"
|
"tsserver": "bin/tsserver"
|
||||||
@@ -2599,6 +2605,7 @@
|
|||||||
"integrity": "sha512-RHX7IvsJlEfjyA1rS7MY0UsmF91etdLAamslHR5lfuO3W/BXRdXm2tRE64ztpSPZbKqB4wAAZ0AwtF6QzfKZLA==",
|
"integrity": "sha512-RHX7IvsJlEfjyA1rS7MY0UsmF91etdLAamslHR5lfuO3W/BXRdXm2tRE64ztpSPZbKqB4wAAZ0AwtF6QzfKZLA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@oxc-project/runtime": "0.114.0",
|
"@oxc-project/runtime": "0.114.0",
|
||||||
"lightningcss": "^1.31.1",
|
"lightningcss": "^1.31.1",
|
||||||
@@ -2684,6 +2691,7 @@
|
|||||||
"resolved": "https://mirrors.tencent.com/npm/vue/-/vue-3.5.28.tgz",
|
"resolved": "https://mirrors.tencent.com/npm/vue/-/vue-3.5.28.tgz",
|
||||||
"integrity": "sha512-BRdrNfeoccSoIZeIhyPBfvWSLFP4q8J3u8Ju8Ug5vu3LdD+yTM13Sg4sKtljxozbnuMu1NB1X5HBHRYUzFocKg==",
|
"integrity": "sha512-BRdrNfeoccSoIZeIhyPBfvWSLFP4q8J3u8Ju8Ug5vu3LdD+yTM13Sg4sKtljxozbnuMu1NB1X5HBHRYUzFocKg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/compiler-dom": "3.5.28",
|
"@vue/compiler-dom": "3.5.28",
|
||||||
"@vue/compiler-sfc": "3.5.28",
|
"@vue/compiler-sfc": "3.5.28",
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export default defineConfig({
|
|||||||
allowedHosts: ['hx.benl.cn'],
|
allowedHosts: ['hx.benl.cn'],
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
target: 'http://127.0.0.1:5002',
|
target: 'http://127.0.0.1:5052',
|
||||||
changeOrigin: true
|
changeOrigin: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@ RUN_DIR="${ROOT_DIR}/.run"
|
|||||||
BACKEND_DIR="${ROOT_DIR}/backend"
|
BACKEND_DIR="${ROOT_DIR}/backend"
|
||||||
FRONTEND_DIR="${ROOT_DIR}/frontend"
|
FRONTEND_DIR="${ROOT_DIR}/frontend"
|
||||||
|
|
||||||
BACKEND_PORT=5002
|
BACKEND_PORT=5052
|
||||||
FRONTEND_PORT=8881
|
FRONTEND_PORT=8881
|
||||||
DB_PORT=5432
|
DB_PORT=5432
|
||||||
DB_DATA_DIR="/opt/homebrew/var/postgresql@18"
|
DB_DATA_DIR="/opt/homebrew/var/postgresql@18"
|
||||||
|
|||||||
+2
-2
@@ -196,7 +196,7 @@ show_entry_urls() {
|
|||||||
host_ip="$(get_host_ip)"
|
host_ip="$(get_host_ip)"
|
||||||
gateway_port="$(get_mapped_port "nginx-gateway" "8881/tcp")"
|
gateway_port="$(get_mapped_port "nginx-gateway" "8881/tcp")"
|
||||||
frontend_port="$(get_mapped_port "hxops-frontend" "80/tcp")"
|
frontend_port="$(get_mapped_port "hxops-frontend" "80/tcp")"
|
||||||
backend_port="$(get_mapped_port "hxops-backend" "5002/tcp")"
|
backend_port="$(get_mapped_port "hxops-backend" "5052/tcp")"
|
||||||
|
|
||||||
echo "== 网站入口地址 =="
|
echo "== 网站入口地址 =="
|
||||||
|
|
||||||
@@ -221,7 +221,7 @@ show_entry_urls() {
|
|||||||
backend_url="http://${host_ip}:${backend_port}/api/agents"
|
backend_url="http://${host_ip}:${backend_port}/api/agents"
|
||||||
echo " 后端API示例: ${backend_url} [HTTP $(http_probe_code "${backend_url}")]"
|
echo " 后端API示例: ${backend_url} [HTTP $(http_probe_code "${backend_url}")]"
|
||||||
else
|
else
|
||||||
echo " 后端API示例: hxops-backend:5002 未映射到宿主机"
|
echo " 后端API示例: hxops-backend:5052 未映射到宿主机"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import sys
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
FRONTEND_URL = "http://localhost:8881"
|
FRONTEND_URL = "http://localhost:8881"
|
||||||
BACKEND_URL = "http://localhost:5002"
|
BACKEND_URL = "http://localhost:5052"
|
||||||
|
|
||||||
def test_backend_direct():
|
def test_backend_direct():
|
||||||
print(f"Testing Backend Direct at {BACKEND_URL}...")
|
print(f"Testing Backend Direct at {BACKEND_URL}...")
|
||||||
@@ -37,7 +37,7 @@ def test_frontend_serve():
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def test_frontend_proxy():
|
def test_frontend_proxy():
|
||||||
# Vite proxy: /api -> http://127.0.0.1:5002
|
# Vite proxy: /api -> http://127.0.0.1:5052
|
||||||
url = f"{FRONTEND_URL}/api/agents"
|
url = f"{FRONTEND_URL}/api/agents"
|
||||||
print(f"Testing Frontend Proxy at {url}...")
|
print(f"Testing Frontend Proxy at {url}...")
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import json
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
BASE_URL = "http://127.0.0.1:5002/api"
|
BASE_URL = "http://127.0.0.1:5052/api"
|
||||||
|
|
||||||
class TestUserFeatures(unittest.TestCase):
|
class TestUserFeatures(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
|||||||
Reference in new issue
Block a user