Files
AIclinicalresearch/诊断问题.bat
AI Clinical Dev Team 96d9783242 fix: create mock user to resolve FK constraint issue
Issues fixed:
1. Frontend port is 3000 (not 5173)
2. Projects API returns 500 due to missing user
3. Foreign key constraint violation on projects_user_id_fkey

Solutions:
- Created create-mock-user.ts script
- Added user-mock-001 to database
- Created startup guide (娴嬭瘯鍜屽惎鍔?md)
- Created one-click launcher (涓€閿惎鍔?bat)
- Created diagnostic tool (璇婃柇闂.bat)

New files:
- backend/src/scripts/create-mock-user.ts
- 娴嬭瘯鍜屽惎鍔?md
- 涓€閿惎鍔?bat
- 璇婃柇闂.bat
2025-10-10 21:15:04 +08:00

116 lines
2.8 KiB
Batchfile
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@echo off
chcp 65001 >nul
echo ========================================
echo 系统诊断工具
echo ========================================
echo.
echo [检查1] Docker运行状态...
docker ps >nul 2>&1
if errorlevel 1 (
echo ❌ Docker未运行
echo 解决方案: 启动Docker Desktop
) else (
echo ✅ Docker正在运行
echo.
echo 运行中的容器:
docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
)
echo.
echo [检查2] PostgreSQL容器...
docker ps | findstr postgres >nul
if errorlevel 1 (
echo ❌ PostgreSQL容器未运行
echo 解决方案: docker-compose up -d
) else (
echo ✅ PostgreSQL容器正在运行
)
echo.
echo [检查3] Redis容器...
docker ps | findstr redis >nul
if errorlevel 1 (
echo ❌ Redis容器未运行
echo 解决方案: docker-compose up -d
) else (
echo ✅ Redis容器正在运行
)
echo.
echo [检查4] 后端服务...
curl -s http://localhost:3001/health >nul 2>&1
if errorlevel 1 (
echo ❌ 后端服务未响应
echo 解决方案:
echo 1. cd backend
echo 2. npm run dev
) else (
echo ✅ 后端服务正常
echo.
echo 健康检查响应:
curl -s http://localhost:3001/health
)
echo.
echo [检查5] 前端服务...
curl -s http://localhost:3000 >nul 2>&1
if errorlevel 1 (
echo ❌ 前端服务未响应
echo 解决方案:
echo 1. cd frontend
echo 2. npm run dev
) else (
echo ✅ 前端服务正常
)
echo.
echo [检查6] 后端环境配置...
if exist "backend\.env" (
echo ✅ backend\.env 文件存在
echo.
echo 检查API Keys配置:
findstr /C:"DEEPSEEK_API_KEY" backend\.env | findstr /V "your_" >nul
if errorlevel 1 (
echo ⚠️ DEEPSEEK_API_KEY 可能未配置
) else (
echo ✅ DEEPSEEK_API_KEY 已配置
)
findstr /C:"DASHSCOPE_API_KEY" backend\.env | findstr /V "your_" >nul
if errorlevel 1 (
echo ⚠️ DASHSCOPE_API_KEY 可能未配置
) else (
echo ✅ DASHSCOPE_API_KEY 已配置
)
) else (
echo ❌ backend\.env 文件不存在
echo 解决方案:
echo 1. cd backend
echo 2. copy .env.example .env
echo 3. 编辑 .env 文件填入API Keys
)
echo.
echo [检查7] 数据库迁移状态...
if exist "backend\prisma\migrations" (
echo ✅ 数据库迁移文件存在
) else (
echo ❌ 数据库迁移文件不存在
echo 解决方案:
echo 1. cd backend
echo 2. npx prisma migrate dev
)
echo.
echo ========================================
echo 诊断完成
echo ========================================
echo.
echo 如果所有检查都通过但仍有问题,请:
echo 1. 查看后端终端的完整日志
echo 2. 查看浏览器控制台的Network标签
echo 3. 运行: cd backend ^&^& npx prisma studio 检查数据库
echo.
pause