feat: 实现数据库驱动的API配置管理和项目结构重组

## 新功能
- 实现管理后台API配置管理(OpenAI/Anthropic/Qwen)
- API配置保存到数据库,实时生效无需重启
- API密钥遮罩显示(前10位+后4位)
- 完整endpoint URL自动显示

## 后端改进
- 新增 config_service.py 用于加载数据库配置
- LLMService 支持动态配置注入,回退到环境变量
- 更新 exam.py 和 question.py 使用数据库配置
- 扩展 schemas.py 支持所有API配置字段

## 前端改进
- 重写 AdminSettings.jsx 增强UI体验
- API密钥显示/隐藏切换
- 当前使用的提供商可视化标识
- 移除"需要重启"的误导性提示

## 项目结构重组
- 移动所有脚本到 scripts/ 目录
- 移动所有文档到 docs/ 目录
- 清理 Python 缓存文件

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-01 19:24:12 +08:00
parent 0ea8e5aa1e
commit a01f3540c5
47 changed files with 1051 additions and 129 deletions

89
scripts/check_status.bat Normal file
View File

@@ -0,0 +1,89 @@
@echo off
title QQuiz - System Status Check
cd /d "%~dp0.."
echo.
echo ========================================
echo QQuiz System Status Check
echo ========================================
echo.
echo [1] Checking Python...
python --version
if %errorlevel% neq 0 (
echo ERROR: Python not found!
) else (
echo OK
)
echo.
echo [2] Checking Node.js...
node --version
if %errorlevel% neq 0 (
echo ERROR: Node.js not found!
) else (
echo OK
)
echo.
echo [3] Checking PostgreSQL...
psql --version
if %errorlevel% neq 0 (
echo WARNING: PostgreSQL command not found in PATH
) else (
echo OK
)
echo.
echo [4] Checking if backend is running...
curl -s http://localhost:8000/health >nul 2>&1
if %errorlevel% neq 0 (
echo ERROR: Backend is NOT running on port 8000
echo.
echo Backend must be started first!
echo Run the backend window manually:
echo cd backend
echo venv\Scripts\activate.bat
echo uvicorn main:app --reload
) else (
echo OK - Backend is running
)
echo.
echo [5] Checking if frontend is running...
curl -s http://localhost:3000 >nul 2>&1
if %errorlevel% neq 0 (
echo WARNING: Frontend is NOT running on port 3000
) else (
echo OK - Frontend is running
)
echo.
echo [6] Checking ports...
echo Checking port 8000 (Backend):
netstat -ano | findstr :8000
echo.
echo Checking port 3000 (Frontend):
netstat -ano | findstr :3000
echo.
echo [7] Checking .env configuration...
if exist ".env" (
echo OK - .env file exists
findstr /C:"OPENAI_API_KEY=sk-" .env >nul
if %errorlevel% neq 0 (
echo WARNING: OPENAI_API_KEY may not be configured properly
) else (
echo OK - API Key appears to be configured
)
) else (
echo ERROR: .env file not found!
)
echo.
echo ========================================
echo Diagnosis Complete
echo ========================================
echo.
pause