init
This commit is contained in:
@@ -161,20 +161,25 @@ class Applicant:
|
||||
|
||||
self.stats["current"] = f"评估:{card.company} - {card.title}"
|
||||
|
||||
# 2. AI 匹配度评分
|
||||
# 2. 抓取 JD 详情(供 AI 评分与归档记录,统一前置)
|
||||
if not card.jd_text:
|
||||
card.jd_text = self._fetch_jd_detail(card)
|
||||
|
||||
# 3. AI 匹配度评分
|
||||
ai_score, ai_reason = -1, ""
|
||||
if self.ai and self.ai.available() and self.primary_resume_content:
|
||||
jd = card.jd_text or self._fetch_jd_detail(card)
|
||||
result = self.ai.score_job(jd, self.primary_resume_content)
|
||||
result = self.ai.score_job(card.jd_text, self.primary_resume_content)
|
||||
ai_score, ai_reason = result.score, result.reason
|
||||
if not result.is_worth_applying(min_score):
|
||||
self._report_skip(card, f"AI 评分低({ai_score})", ai_score, ai_reason)
|
||||
return 0
|
||||
|
||||
# 3. 执行投递
|
||||
# 4. 执行投递
|
||||
success, apply_type = self._apply(card, greeting)
|
||||
if success:
|
||||
self._report_apply(card, apply_type, ai_score, ai_reason)
|
||||
# 打招呼语仅 chat 方式实际发送过,才归档
|
||||
greeting_used = greeting if (apply_type == "chat" and greeting) else None
|
||||
self._report_apply(card, apply_type, ai_score, ai_reason, greeting_used)
|
||||
self._sleep(*delay_range)
|
||||
return 1
|
||||
return 0
|
||||
@@ -182,7 +187,8 @@ class Applicant:
|
||||
# ------------------------------------------------------------------
|
||||
# 服务端上报
|
||||
# ------------------------------------------------------------------
|
||||
def _report_apply(self, card: JobCard, apply_type: str, ai_score: int, ai_reason: str):
|
||||
def _report_apply(self, card: JobCard, apply_type: str, ai_score: int, ai_reason: str,
|
||||
greeting: str | None = None):
|
||||
try:
|
||||
self.server.report_application(self.session_id, {
|
||||
"job_id": card.job_id,
|
||||
@@ -193,6 +199,8 @@ class Applicant:
|
||||
"apply_type": apply_type,
|
||||
"ai_score": ai_score,
|
||||
"ai_reason": ai_reason[:255] if ai_reason else None,
|
||||
"jd_text": card.jd_text or None,
|
||||
"greeting": greeting,
|
||||
})
|
||||
self.server.update_session_stats(self.session_id, applied_delta=1, skipped_delta=0)
|
||||
self.stats["applied"] += 1
|
||||
@@ -211,6 +219,7 @@ class Applicant:
|
||||
"ai_score": ai_score,
|
||||
"ai_reason": ai_reason[:255] if ai_reason else None,
|
||||
"skip_reason": reason,
|
||||
"jd_text": card.jd_text or None,
|
||||
})
|
||||
self.server.update_session_stats(self.session_id, applied_delta=0, skipped_delta=1)
|
||||
self.stats["skipped"] += 1
|
||||
|
||||
Reference in New Issue
Block a user