mirror of
https://github.com/handsomezhuzhu/QQuiz.git
synced 2026-02-20 20:10:14 +00:00
docs: 完善文档和清理项目,添加 Gemini 配置指南
主要更新: 📚 文档改进 - 新增 AI_CONFIGURATION.md:详细的 AI 提供商配置指南 - 新增 CHINA_MIRROR_GUIDE.md:中国镜像加速指南 - 删除 6 个过时文档(DEPLOYMENT.md, QUICK_START.md 等) - 更新 README.md:添加 Gemini 功能特性和 AI 提供商对比表 🧹 脚本清理 - 删除 11 个重复/过时脚本(从 25 个减少到 14 个) - 删除 PostgreSQL 相关脚本(项目使用 MySQL) - 删除重复的启动脚本(start_windows.bat, start_app.bat 等) ⚙️ 配置文件更新 - 更新 .env.example:添加 Gemini 配置示例和说明 - 默认 AI_PROVIDER 改为 gemini(推荐) - 添加各提供商的获取 API Key 链接 🎯 核心改进 - 突出 Gemini 原生 PDF 理解优势 - 提供清晰的 AI 提供商选择指南 - 简化项目结构,提高可维护性 清理内容: - 删除 docs: DEPLOYMENT.md, DOCKER_MIRROR_SETUP.md, GITHUB_PUSH_GUIDE.md, QUICK_START.md, README_QUICKSTART.md, START_HERE.txt - 删除 scripts: auto_setup_and_run.bat, check_postgres.bat, logs_windows.bat, push_to_github.bat, quick_config.bat, restart_docker.bat, setup_docker_mirror.bat, start_app.bat, start_postgres.bat, start_windows.bat, start_windows_china.bat 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -28,24 +28,19 @@ async def get_current_user(
|
||||
headers={"WWW-Authenticate": "Bearer"},
|
||||
)
|
||||
|
||||
print(f"🔍 Received token (first 50 chars): {token[:50] if token else 'None'}...")
|
||||
|
||||
# Decode token
|
||||
payload = decode_access_token(token)
|
||||
if payload is None:
|
||||
print(f"❌ Token decode failed - Invalid or expired token")
|
||||
raise credentials_exception
|
||||
|
||||
user_id = payload.get("sub")
|
||||
if user_id is None:
|
||||
print(f"❌ No 'sub' in payload: {payload}")
|
||||
raise credentials_exception
|
||||
|
||||
# Convert user_id to int if it's a string
|
||||
try:
|
||||
user_id = int(user_id)
|
||||
except (ValueError, TypeError):
|
||||
print(f"❌ Invalid user_id format: {user_id}")
|
||||
raise credentials_exception
|
||||
|
||||
# Get user from database
|
||||
@@ -53,10 +48,8 @@ async def get_current_user(
|
||||
user = result.scalar_one_or_none()
|
||||
|
||||
if user is None:
|
||||
print(f"❌ User not found with id: {user_id}")
|
||||
raise credentials_exception
|
||||
|
||||
print(f"✅ User authenticated: {user.username} (id={user.id})")
|
||||
return user
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user