generated from kgod/ai-review-template
feat: initialize resume agent with OfferPai sync
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
"""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,
|
||||
)
|
||||
Reference in New Issue
Block a user