feat: initialize resume agent with OfferPai sync

This commit is contained in:
Codex
2026-08-05 20:20:18 +08:00
commit 61ec750031
197 changed files with 33291 additions and 0 deletions
+65
View File
@@ -0,0 +1,65 @@
"""Shared helpers for Builder conversation tests."""
from __future__ import annotations
from typing import Any
from fastapi.testclient import TestClient
from test_api import BASE, active_component, event, start_manual_profile # noqa: F401
EDUCATION_IDENTITY = {
"school": "Example University",
"major": "Computer Science",
"degree": "Bachelor",
"start_date": "2021-09",
"end_date_or_present": "2025-06",
}
def create_builder_session(client: TestClient, *, job_type: str = "campus") -> tuple[str, dict[str, Any]]:
session_id, _ = start_manual_profile(client, job_type=job_type)
created = client.post(f"{BASE}/sessions/{session_id}/create", json={})
assert created.status_code == 200, created.text
body = created.json()
assert body["stage"] == "BUILDER_CONVERSATION"
return session_id, body
def select_section(client: TestClient, session_id: str, body: dict[str, Any], section: str) -> dict[str, Any]:
response = event(client, session_id, body, "select", {"value": section})
assert response.status_code == 200, response.text
return response.json()
def submit_identity(client: TestClient, session_id: str, body: dict[str, Any], values: dict[str, str]) -> dict[str, Any]:
response = event(client, session_id, body, "submit", values)
assert response.status_code == 200, response.text
return response.json()
def send_message(client: TestClient, session_id: str, content: str) -> dict[str, Any]:
response = client.post(f"{BASE}/sessions/{session_id}/messages", json={"content": content})
assert response.status_code == 200, response.text
return response.json()
def confirm_card(client: TestClient, session_id: str, body: dict[str, Any], *, use_optimized: bool = False) -> dict[str, Any]:
response = event(client, session_id, body, "confirm", {"use_optimized": use_optimized})
assert response.status_code == 200, response.text
return response.json()
def start_education(client: TestClient, session_id: str, body: dict[str, Any], *, school: str = "Example University") -> dict[str, Any]:
card = select_section(client, session_id, body, "education")
identity = {**EDUCATION_IDENTITY, "school": school}
prompt = submit_identity(client, session_id, card, identity)
assert "没有也可以直接说没有" in prompt["turn"]["content"]
return prompt
def finish_education(client: TestClient, session_id: str, body: dict[str, Any], detail: str) -> dict[str, Any]:
proposal = send_message(client, session_id, detail)
assert active_component(proposal)["data"]["component"] == "experience_confirm_card"
return proposal