diff --git a/client/browser/applicant.py b/client/browser/applicant.py
index 7c3e646..44ec660 100644
--- a/client/browser/applicant.py
+++ b/client/browser/applicant.py
@@ -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
diff --git a/client/web/static/app.js b/client/web/static/app.js
index 6dc896b..ba61ee5 100644
--- a/client/web/static/app.js
+++ b/client/web/static/app.js
@@ -354,7 +354,7 @@ async function loadHistory() {
`;
$('historyBody').innerHTML = history.map(h => `
- | ${escapeHtml(h.job_title || '-')} |
+ ${escapeHtml(h.job_title || '-')} |
${escapeHtml(h.company || '-')} |
${escapeHtml(h.salary || '-')} |
${typeLabel(h.apply_type)} |
@@ -368,6 +368,14 @@ async function loadHistory() {
function typeLabel(t) {
return { chat: '沟通', deliver: '投递', skipped: '跳过' }[t] || t;
}
+// 悬停详情:JD 摘要 + 打招呼语(用于 title 属性)
+function recordDetail(h) {
+ const parts = [];
+ if (h.greeting) parts.push(`【打招呼语】${h.greeting}`);
+ if (h.jd_text) parts.push(`【JD】${h.jd_text.substring(0, 300)}${h.jd_text.length > 300 ? '...' : ''}`);
+ if (h.skip_reason) parts.push(`【跳过原因】${h.skip_reason}`);
+ return parts.join('\n\n') || '暂无详情';
+}
// apply_type 仅允许白名单值用作 CSS class,防止注入
function safeType(t) {
return ['chat', 'deliver', 'skipped'].includes(t) ? t : 'skipped';
diff --git a/client/web/templates/index.html b/client/web/templates/index.html
index 144b81c..018a640 100644
--- a/client/web/templates/index.html
+++ b/client/web/templates/index.html
@@ -134,6 +134,7 @@
投递记录与统计
+ 将鼠标悬停在职位名上,可查看归档的 JD 摘要、打招呼语与跳过原因。
diff --git a/server/models.py b/server/models.py
index 6fad8a1..e1fbcbf 100644
--- a/server/models.py
+++ b/server/models.py
@@ -127,6 +127,10 @@ class JobApplication(Base):
ai_reason = Column(String(255), nullable=True)
# 跳过原因
skip_reason = Column(String(255), nullable=True)
+ # 职位 JD 全文(投递/跳过时归档,供复盘与面试准备)
+ jd_text = Column(Text, nullable=True)
+ # 实际发送的打招呼语(仅 chat 方式有值)
+ greeting = Column(String(500), nullable=True)
applied_at = Column(DateTime, default=utcnow, nullable=False)
user = relationship("User", back_populates="applications")
diff --git a/server/routers/jobs.py b/server/routers/jobs.py
index 7b1db02..01ff429 100644
--- a/server/routers/jobs.py
+++ b/server/routers/jobs.py
@@ -37,6 +37,10 @@ def report_application(
existing.ai_score = req.ai_score
existing.ai_reason = req.ai_reason
existing.skip_reason = req.skip_reason
+ if req.jd_text:
+ existing.jd_text = req.jd_text
+ if req.greeting:
+ existing.greeting = req.greeting
if session_id:
existing.session_id = session_id
record = existing
@@ -53,6 +57,8 @@ def report_application(
ai_score=req.ai_score,
ai_reason=req.ai_reason,
skip_reason=req.skip_reason,
+ jd_text=req.jd_text,
+ greeting=req.greeting,
)
db.add(record)
diff --git a/server/schemas.py b/server/schemas.py
index 37fae02..339de6b 100644
--- a/server/schemas.py
+++ b/server/schemas.py
@@ -126,6 +126,8 @@ class ApplicationIn(BaseModel):
ai_score: int = -1
ai_reason: Optional[str] = None
skip_reason: Optional[str] = None
+ jd_text: Optional[str] = None # JD 全文归档
+ greeting: Optional[str] = None # 实际发送的打招呼语
class ApplicationOut(BaseModel):
@@ -139,6 +141,8 @@ class ApplicationOut(BaseModel):
ai_score: int
ai_reason: Optional[str]
skip_reason: Optional[str]
+ jd_text: Optional[str]
+ greeting: Optional[str]
applied_at: datetime
class Config: