generated from kgod/ai-review-template
自内部仓库剥离深度优化与 RAG 知识库后的交付版本: - Builder 对话式简历生成(FSM + 意图路由 LLM 兜底增强) - 条目级轻度优化:事实覆盖门禁 + STAR/bullet 修复链,功能/简介/成果与技术栈同级保护 - 简历导入:DOCX/PDF 解析、结构归一、手机号脱敏 - PostgreSQL 运行时 + Alembic 迁移链 Co-Authored-By: Claude <noreply@anthropic.com>
69 lines
1.9 KiB
Python
69 lines
1.9 KiB
Python
"""Pydantic contracts for resume content, editing, and optimization APIs."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from datetime import datetime
|
|
from typing import Any, Literal
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
|
|
class BusinessResume(BaseModel):
|
|
id: str
|
|
session_id: str
|
|
revision: int
|
|
content: dict[str, Any]
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
|
|
class ResumePatchOperation(BaseModel):
|
|
model_config = ConfigDict(extra="forbid")
|
|
|
|
type: Literal[
|
|
"update_basics", "update_entry", "update_bullet", "delete_entry", "delete_bullet",
|
|
"update_skill_groups", "update_profile_summary"
|
|
]
|
|
entry_id: str | None = None
|
|
bullet_id: str | None = None
|
|
fields: dict[str, Any] | None = None
|
|
text: str | None = None
|
|
skills: list[str] | None = Field(default=None, max_length=80)
|
|
|
|
|
|
class ResumePatchRequest(BaseModel):
|
|
model_config = ConfigDict(extra="forbid")
|
|
|
|
expected_revision: int = Field(ge=1)
|
|
operation: ResumePatchOperation
|
|
|
|
|
|
class OptimizeRequest(BaseModel):
|
|
model_config = ConfigDict(extra="forbid")
|
|
|
|
entry_id: str = Field(min_length=1, max_length=64)
|
|
instruction: str | None = Field(default=None, max_length=200)
|
|
|
|
|
|
class OptimizeEntryRequest(BaseModel):
|
|
model_config = ConfigDict(extra="forbid")
|
|
|
|
entry_id: str = Field(min_length=1, max_length=64)
|
|
|
|
class SkillRecommendationRequest(BaseModel):
|
|
model_config = ConfigDict(extra="forbid")
|
|
|
|
question: str = Field(min_length=2, max_length=240)
|
|
|
|
|
|
class SkillRecommendationCandidate(BaseModel):
|
|
skill: str = Field(min_length=1, max_length=48)
|
|
category: str = Field(min_length=1, max_length=48)
|
|
reason: str = Field(min_length=1, max_length=160)
|
|
evidence_supported: bool = False
|
|
|
|
|
|
class SkillRecommendationResponse(BaseModel):
|
|
candidates: list[SkillRecommendationCandidate] = Field(default_factory=list, max_length=12)
|
|
|