generated from kgod/ai-review-template
feat: builder 简历生成 + 轻度优化 + 简历导入交付副本
自内部仓库剥离深度优化与 RAG 知识库后的交付版本: - Builder 对话式简历生成(FSM + 意图路由 LLM 兜底增强) - 条目级轻度优化:事实覆盖门禁 + STAR/bullet 修复链,功能/简介/成果与技术栈同级保护 - 简历导入:DOCX/PDF 解析、结构归一、手机号脱敏 - PostgreSQL 运行时 + Alembic 迁移链 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
"""Production ASGI entrypoint: wraps app.main:app and hides API docs by default.
|
||||
|
||||
Serve with: python -m uvicorn app.asgi:application --port 8000
|
||||
Set RESUME_AGENT_API_DOCS=1 to expose /docs, /redoc and /openapi.json.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from typing import Any
|
||||
|
||||
from .main import app
|
||||
|
||||
_DOC_PATHS = {"/docs", "/docs/oauth2-redirect", "/redoc", "/openapi.json"}
|
||||
|
||||
|
||||
def _docs_enabled() -> bool:
|
||||
return os.getenv("RESUME_AGENT_API_DOCS", "").strip().lower() in {"1", "true", "on"}
|
||||
|
||||
|
||||
class _DocsGate:
|
||||
"""ASGI wrapper returning 404 for API-doc routes unless explicitly enabled."""
|
||||
|
||||
def __init__(self, wrapped: Any) -> None:
|
||||
self.wrapped = wrapped
|
||||
|
||||
async def __call__(self, scope: dict[str, Any], receive: Any, send: Any) -> None:
|
||||
if scope.get("type") == "http" and scope.get("path") in _DOC_PATHS and not _docs_enabled():
|
||||
payload = b'{"detail":"Not Found"}'
|
||||
await send({
|
||||
"type": "http.response.start",
|
||||
"status": 404,
|
||||
"headers": [(b"content-type", b"application/json"), (b"content-length", str(len(payload)).encode())],
|
||||
})
|
||||
await send({"type": "http.response.body", "body": payload})
|
||||
return
|
||||
await self.wrapped(scope, receive, send)
|
||||
|
||||
|
||||
application = _DocsGate(app)
|
||||
Reference in New Issue
Block a user