prepare backend-only fastapi deployment

This commit is contained in:
刘金宝
2026-06-01 17:32:18 +08:00
parent 338e2c8e1d
commit 132155c280
59 changed files with 374 additions and 9155 deletions
+8 -1
View File
@@ -18,7 +18,14 @@ def hello(ctx: UserContext = Depends(get_user_context), db: Session = Depends(ge
db.commit()
return ok(
AgentHelloResponse(
user=AgentHelloUser(user_id=ctx.user_id, tenant_id=ctx.tenant_id, role=ctx.role),
user=AgentHelloUser(
user_id=ctx.user_id,
tenant_id=ctx.tenant_id,
role=ctx.role,
source=ctx.auth_source,
username=ctx.username,
display_name=ctx.display_name,
),
features=settings.as_public_dict(),
)
)
+21 -1
View File
@@ -9,7 +9,8 @@ router = APIRouter()
@router.get("/me", response_model=ApiResponse[AuthMeResponse])
async def auth_me(ctx: UserContext = Depends(get_user_context)):
"""当前用户:返回经 Django 用户中心或 Demo Header 标准化后的用户信息。"""
"""当前用户:转发 Authorization 到 Django 用户中心,并返回标准化后的用户信息。"""
profile = ctx.profile or {}
return ok(
AuthMeResponse(
user_id=ctx.user_id,
@@ -18,5 +19,24 @@ async def auth_me(ctx: UserContext = Depends(get_user_context)):
display_name=ctx.display_name,
tenant_id=ctx.tenant_id,
role=ctx.role,
phone=profile.get("phone"),
avatar=profile.get("avatar"),
gender=profile.get("gender"),
institution=profile.get("institution"),
institution_name=profile.get("institution_name"),
department=profile.get("department"),
department_name=profile.get("department_name"),
title_name=profile.get("title_name"),
major=profile.get("major"),
training_stage=profile.get("training_stage"),
learning_target=profile.get("learning_target"),
competency_profile=profile.get("competency_profile"),
weak_dimensions=profile.get("weak_dimensions"),
strong_dimensions=profile.get("strong_dimensions"),
ai_preference=profile.get("ai_preference"),
total_training_count=profile.get("total_training_count"),
total_case_count=profile.get("total_case_count"),
current_level=profile.get("current_level"),
status=profile.get("status"),
)
)