Files
resume-agent/backend/app/optimization_tiers.py
T
hypandClaude ae2d9b128d feat: builder 简历生成 + 轻度优化 + 简历导入交付副本
自内部仓库剥离深度优化与 RAG 知识库后的交付版本:
- Builder 对话式简历生成(FSM + 意图路由 LLM 兜底增强)
- 条目级轻度优化:事实覆盖门禁 + STAR/bullet 修复链,功能/简介/成果与技术栈同级保护
- 简历导入:DOCX/PDF 解析、结构归一、手机号脱敏
- PostgreSQL 运行时 + Alembic 迁移链

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-05 11:08:30 +08:00

56 lines
1.5 KiB
Python

"""Membership-tier parameters for the shared optimization pipeline."""
from __future__ import annotations
import os
from dataclasses import dataclass
from typing import Any
@dataclass(frozen=True, slots=True)
class TierConfig:
tier: str
deep_allowed: bool
max_questions: int
min_questions: int
gap_threshold: float
include_gap_report: bool
TIER_CONFIGS: dict[str, TierConfig] = {
"free": TierConfig(
tier="free",
deep_allowed=False,
max_questions=0,
min_questions=0,
gap_threshold=5.0,
include_gap_report=True,
),
"vip": TierConfig(
tier="vip",
deep_allowed=True,
max_questions=6,
min_questions=2,
gap_threshold=8.0,
include_gap_report=True,
),
}
def tier_config_for_session(session: dict[str, Any]) -> TierConfig:
"""Resolve an explicit entitlement first, then the local development default."""
raw = str(
(session.get("profile") or {}).get("entitlement_tier") or _default_tier()
).strip().lower()
return TIER_CONFIGS.get(raw, TIER_CONFIGS["free"])
def _default_tier() -> str:
"""Use a local-only default tier when RESUME_AGENT_DEFAULT_TIER is configured.
Explicit session entitlements always take precedence. Production deployments must
leave this environment variable unset so the default remains ``free``.
"""
value = os.environ.get("RESUME_AGENT_DEFAULT_TIER", "free").strip().lower()
return value if value in TIER_CONFIGS else "free"