generated from kgod/ai-review-template
自内部仓库剥离深度优化与 RAG 知识库后的交付版本: - Builder 对话式简历生成(FSM + 意图路由 LLM 兜底增强) - 条目级轻度优化:事实覆盖门禁 + STAR/bullet 修复链,功能/简介/成果与技术栈同级保护 - 简历导入:DOCX/PDF 解析、结构归一、手机号脱敏 - PostgreSQL 运行时 + Alembic 迁移链 Co-Authored-By: Claude <noreply@anthropic.com>
78 lines
2.4 KiB
Python
78 lines
2.4 KiB
Python
"""Custom resume-card selection after the fixed enrichment queue."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
from .fsm import Transition, assistant_turn, component
|
|
from .models import ComposerMode, Stage
|
|
|
|
CUSTOM_CARD_OPTIONS = (
|
|
("education", "教育经历"),
|
|
("work_experience", "工作经历"),
|
|
("internship_experience", "实习经历"),
|
|
("campus_experience", "校园经历"),
|
|
("project_experience", "项目经历"),
|
|
("competition", "竞赛获奖"),
|
|
("finish", "完成完善"),
|
|
)
|
|
|
|
CUSTOM_MODULES = {
|
|
"education": "education",
|
|
"work_experience": "more_work",
|
|
"internship_experience": "internship",
|
|
"campus_experience": "campus_experience",
|
|
"project_experience": "project",
|
|
"competition": "competition",
|
|
}
|
|
|
|
|
|
def custom_card_picker_transition(
|
|
profile: dict[str, Any], *, refresh: bool = False
|
|
) -> Transition:
|
|
enrichment = profile["enrichment"]
|
|
enrichment["current"] = None
|
|
enrichment["module_draft"] = {}
|
|
enrichment["custom_mode"] = True
|
|
profile["enrichment_finished"] = False
|
|
transition = Transition(
|
|
Stage.RESUME_ENRICHING,
|
|
profile,
|
|
assistant_turn(
|
|
"固定流程已完成,你可以继续添加需要的简历卡片。",
|
|
[
|
|
component(
|
|
"CustomCardPicker",
|
|
title="添加简历卡片",
|
|
description="选择一类内容继续补充,或完成本次完善。",
|
|
field="card_type",
|
|
options=[
|
|
{"value": value, "label": label}
|
|
for value, label in CUSTOM_CARD_OPTIONS
|
|
],
|
|
)
|
|
],
|
|
mode=ComposerMode.UI_ONLY,
|
|
),
|
|
lifecycle="confirmed",
|
|
)
|
|
transition.refresh_resume = refresh
|
|
return transition
|
|
|
|
|
|
def finish_custom_enrichment(profile: dict[str, Any]) -> Transition:
|
|
profile["enrichment"]["current"] = None
|
|
profile["enrichment"]["module_draft"] = {}
|
|
profile["enrichment_finished"] = True
|
|
return Transition(
|
|
Stage.CONTENT_READY,
|
|
profile,
|
|
assistant_turn(
|
|
"补充完成,简历已更新。",
|
|
[component("ContentReadyCard", can_continue=True, formal_content_ready=True)],
|
|
mode=ComposerMode.UI_ONLY,
|
|
),
|
|
lifecycle="confirmed",
|
|
generate_profile_summary=True,
|
|
)
|