Spaces:
Sleeping
Sleeping
Upload 35 files
Browse files- offer-puplayer-hf/.gitignore +7 -0
- offer-puplayer-hf/Dockerfile +32 -0
- offer-puplayer-hf/README.md +67 -0
- offer-puplayer-hf/backend/app/agents/__init__.py +0 -0
- offer-puplayer-hf/backend/app/agents/advisor.py +111 -0
- offer-puplayer-hf/backend/app/agents/base_agent.py +50 -0
- offer-puplayer-hf/backend/app/agents/jd_parser.py +70 -0
- offer-puplayer-hf/backend/app/agents/matcher.py +99 -0
- offer-puplayer-hf/backend/app/agents/resume_parser.py +41 -0
- offer-puplayer-hf/backend/app/database.py +124 -0
- offer-puplayer-hf/backend/app/main.py +173 -0
- offer-puplayer-hf/backend/app/models.py +32 -0
- offer-puplayer-hf/backend/app/orchestrator.py +33 -0
- offer-puplayer-hf/backend/app/services/embedding_service.py +32 -0
- offer-puplayer-hf/backend/app/services/job_service.py +240 -0
- offer-puplayer-hf/backend/app/services/resume_service.py +53 -0
- offer-puplayer-hf/backend/data/jobs.json +402 -0
- offer-puplayer-hf/backend/requirements.txt +8 -0
- offer-puplayer-hf/frontend/index.html +13 -0
- offer-puplayer-hf/frontend/package.json +24 -0
- offer-puplayer-hf/frontend/public/favicon.svg +1 -0
- offer-puplayer-hf/frontend/public/icons.svg +24 -0
- offer-puplayer-hf/frontend/src/App.jsx +122 -0
- offer-puplayer-hf/frontend/src/api/index.js +130 -0
- offer-puplayer-hf/frontend/src/api/mock.js +73 -0
- offer-puplayer-hf/frontend/src/components/JobCard.jsx +189 -0
- offer-puplayer-hf/frontend/src/components/PipelineFlow.jsx +39 -0
- offer-puplayer-hf/frontend/src/components/RadarChart.jsx +49 -0
- offer-puplayer-hf/frontend/src/components/ReportCard.jsx +149 -0
- offer-puplayer-hf/frontend/src/main.jsx +10 -0
- offer-puplayer-hf/frontend/src/pages/DiagnosePage.jsx +271 -0
- offer-puplayer-hf/frontend/src/pages/HomePage.jsx +548 -0
- offer-puplayer-hf/frontend/src/pages/RecommendPage.jsx +113 -0
- offer-puplayer-hf/frontend/src/pages/SuggestPage.jsx +150 -0
- offer-puplayer-hf/frontend/vite.config.js +12 -0
offer-puplayer-hf/.gitignore
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
__pycache__/
|
| 2 |
+
*.pyc
|
| 3 |
+
.env
|
| 4 |
+
*.db
|
| 5 |
+
node_modules/
|
| 6 |
+
dist/
|
| 7 |
+
.DS_Store
|
offer-puplayer-hf/Dockerfile
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Stage 1: Build frontend
|
| 2 |
+
FROM node:20 AS frontend-build
|
| 3 |
+
WORKDIR /app
|
| 4 |
+
COPY frontend/package.json frontend/package-lock.json* ./
|
| 5 |
+
RUN npm install
|
| 6 |
+
COPY frontend/ .
|
| 7 |
+
RUN npm run build
|
| 8 |
+
|
| 9 |
+
# Stage 2: Backend
|
| 10 |
+
FROM python:3.10-slim
|
| 11 |
+
WORKDIR /app
|
| 12 |
+
|
| 13 |
+
# Install system dependencies for pdfplumber
|
| 14 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 15 |
+
gcc \
|
| 16 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 17 |
+
|
| 18 |
+
# Copy and install Python dependencies
|
| 19 |
+
COPY backend/requirements.txt .
|
| 20 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 21 |
+
|
| 22 |
+
# Copy backend code
|
| 23 |
+
COPY backend/ .
|
| 24 |
+
|
| 25 |
+
# Copy frontend build
|
| 26 |
+
COPY --from=frontend-build /app/dist ./static
|
| 27 |
+
|
| 28 |
+
# HF Space port
|
| 29 |
+
EXPOSE 7860
|
| 30 |
+
|
| 31 |
+
# Start server
|
| 32 |
+
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
offer-puplayer-hf/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Offer 捕手 — HuggingFace Spaces 部署指南
|
| 2 |
+
|
| 3 |
+
## 前置
|
| 4 |
+
- 一个 GitHub 账号(https://github.com)
|
| 5 |
+
- 一个 HuggingFace 账号(https://huggingface.co,建议用 GitHub 登录)
|
| 6 |
+
|
| 7 |
+
## 步骤
|
| 8 |
+
|
| 9 |
+
### 1. 在 HuggingFace 创建 Space
|
| 10 |
+
|
| 11 |
+
1. 打开 https://huggingface.co/new-space
|
| 12 |
+
2. 填写:
|
| 13 |
+
- **Space Name**: `offer-puplayer`
|
| 14 |
+
- **License**: `mit`
|
| 15 |
+
- **Space SDK**: **Docker**
|
| 16 |
+
- **Space Hardware**: CPU basic(免费)
|
| 17 |
+
3. 点击 **Create Space**
|
| 18 |
+
|
| 19 |
+
### 2. 上传代码
|
| 20 |
+
|
| 21 |
+
**方式一:Git 推送(推荐)**
|
| 22 |
+
```bash
|
| 23 |
+
# 克隆你的 Space(替换成你的用户名)
|
| 24 |
+
git clone https://huggingface.co/spaces/你的用户名/offer-puplayer
|
| 25 |
+
cd offer-puplayer
|
| 26 |
+
|
| 27 |
+
# 把部署文件复制进去(从本地的 offer-puplayer-hf/ 目录复制)
|
| 28 |
+
# 然后把所有文件 add、commit、push
|
| 29 |
+
git add .
|
| 30 |
+
git commit -m "Initial deploy"
|
| 31 |
+
git push
|
| 32 |
+
```
|
| 33 |
+
|
| 34 |
+
**方式二:网页上传(更简单)**
|
| 35 |
+
1. 进入你的 Space 页面
|
| 36 |
+
2. 点击 **Files** → **Add file** → **Upload files**
|
| 37 |
+
3. 把 `D:\tencent_HR_aiwork\offer-puplayer-hf\` 目录下的全部文件拖进去
|
| 38 |
+
4. 点击 **Commit changes**
|
| 39 |
+
|
| 40 |
+
### 3. 设置环境变量
|
| 41 |
+
|
| 42 |
+
在 Space 页面的 **Settings** → **Repository Secrets** 添加:
|
| 43 |
+
|
| 44 |
+
| Name | Value |
|
| 45 |
+
|------|-------|
|
| 46 |
+
| `DEEPSEEK_API_KEY` | `sk-07006f4e7e7945a7bef2ec29879719fd` |
|
| 47 |
+
|
| 48 |
+
### 4. 等待构建
|
| 49 |
+
|
| 50 |
+
1. 回到 Space 主页面 → 切换到 **Builder** 标签
|
| 51 |
+
2. 看到 Docker 构建日志(约 10-15 分钟,因为要安装 torch)
|
| 52 |
+
3. 构建成功后自动启动,出现 **Running** 状态
|
| 53 |
+
4. 访问 `https://你的用户名-offer-puplayer.hf.space`
|
| 54 |
+
|
| 55 |
+
### 5. 验证
|
| 56 |
+
|
| 57 |
+
打开浏览器访问上面的 URL:
|
| 58 |
+
- [ ] 首页能加载
|
| 59 |
+
- [ ] 推荐岗位列表能显示
|
| 60 |
+
- [ ] 上传简历/手工填写 → 确认
|
| 61 |
+
- [ ] 点击「查看匹配诊断」→ Agent 流式输出
|
| 62 |
+
|
| 63 |
+
## 常见问题
|
| 64 |
+
|
| 65 |
+
- **构建失败**: 查看 Builder 日志,通常是网络问题,点 **Restart** 重试
|
| 66 |
+
- **启动超时**: 模型加载需要 30 秒左右,HF Spaces 默认 60 秒超时,如果超时去 Settings 调大
|
| 67 |
+
- **首次访问慢**: 首次请求要加载向量模型(30s),后续请求正常
|
offer-puplayer-hf/backend/app/agents/__init__.py
ADDED
|
File without changes
|
offer-puplayer-hf/backend/app/agents/advisor.py
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
from app.agents.base_agent import BaseAgent
|
| 3 |
+
|
| 4 |
+
MOCK_RESPONSE = {
|
| 5 |
+
"rewrite_suggestions": [
|
| 6 |
+
{
|
| 7 |
+
"dimension": "技能匹配",
|
| 8 |
+
"issue": "JD要求Python后端开发经验,简历未体现",
|
| 9 |
+
"original": "熟悉Java、C++,了解数据结构与算法",
|
| 10 |
+
"suggestion": "补充Python后端项目经历,例如\"使用FastAPI开发RESTful API,实现用户认证与数据持久化\"",
|
| 11 |
+
"reason": "JD核心技术栈为Python后端,仅列举Java/C++无法满足岗位核心要求,需明确展示Python实战经验"
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"dimension": "经验匹配",
|
| 15 |
+
"issue": "缺少企业级后端实习经历",
|
| 16 |
+
"original": "在校课程项目:图书管理系统",
|
| 17 |
+
"suggestion": "突出项目难点与高并发场景,例如\"优化数据库查询减少50%响应时间,支撑日均10万请求\"",
|
| 18 |
+
"reason": "JD要求有后端实习经验,课程项目需用量化成果弥补实习缺失,展示工程化思维"
|
| 19 |
+
},
|
| 20 |
+
{
|
| 21 |
+
"dimension": "项目契合",
|
| 22 |
+
"issue": "项目方向与JD业务场景不匹配",
|
| 23 |
+
"original": "基于Java Swing的桌面应用开发",
|
| 24 |
+
"suggestion": "将项目描述重构为\"基于Python的Web全栈项目\",体现完整开发流程",
|
| 25 |
+
"reason": "JD业务涉及Web后端服务,桌面应用项目与岗位技术栈差异大,需重新包装体现相关能力"
|
| 26 |
+
},
|
| 27 |
+
],
|
| 28 |
+
"interview_tips": [
|
| 29 |
+
{
|
| 30 |
+
"topic": "Python异步编程与FastAPI",
|
| 31 |
+
"reason": "JD明确要求asyncio和FastAPI,简历中无相关经验",
|
| 32 |
+
"tip": "准备asyncio核心概念(事件循环、协程、Task),结合FastAPI源码理解异步请求处理流程,准备一个异步爬虫或WebSocket demo"
|
| 33 |
+
},
|
| 34 |
+
{
|
| 35 |
+
"topic": "数据库设计与ORM",
|
| 36 |
+
"reason": "JD要求熟悉MySQL和Redis,简历仅提到\"了解数据库\"",
|
| 37 |
+
"tip": "复习SQLAlchemy/FastAPI集成、索引优化、事务隔离级别,准备缓存穿透/雪崩的解决方案"
|
| 38 |
+
},
|
| 39 |
+
{
|
| 40 |
+
"topic": "系统设计",
|
| 41 |
+
"reason": "岗位为校招,可能会考察基础设计能力",
|
| 42 |
+
"tip": "准备短URL服务、秒杀系统等常见设计题,重点练习Python伪代码表达能力"
|
| 43 |
+
},
|
| 44 |
+
],
|
| 45 |
+
"encouragement": "你的基础扎实,Java和C++的背景说明你有良好的编程思维。建议集中2-3周时间做一个完整的Python后端项目(如简易电商API),就能在简历上大幅提升匹配度。你的学习能力完全胜任这个方向,加油!"
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
class Advisor(BaseAgent):
|
| 50 |
+
name = "advisor"
|
| 51 |
+
|
| 52 |
+
def build_prompt(self, match_report: dict, jd_text: str) -> tuple[str, dict]:
|
| 53 |
+
system = (
|
| 54 |
+
"你是一个求职建议专家。你的任务是:\n"
|
| 55 |
+
"1. 基于匹配报告,给出精准的简历修改建议。\n"
|
| 56 |
+
"2. 建议必须包含:哪个维度、具体问题、原文、改写建议、原因。\n"
|
| 57 |
+
"3. 每条建议必须做到\"HR一眼能看出改变\"的程度,不要泛泛而谈。\n"
|
| 58 |
+
"4. 如果匹配度低于50分,必须在鼓励中包含'从匹配度角度不推荐'的提示。\n"
|
| 59 |
+
"5. 提供不超过3个面试准备话题(每个话题包含 topic、reason、tip)。\n"
|
| 60 |
+
"6. 最后输出一段鼓励语,要求真诚具体,不敷衍。\n\n"
|
| 61 |
+
"请严格按以下JSON格式输出,字段名必须完全匹配:\n"
|
| 62 |
+
'{\n'
|
| 63 |
+
' "rewrite_suggestions": [\n'
|
| 64 |
+
' {"dimension": "技能匹配", "issue": "...", "original": "...", "suggestion": "...", "reason": "..."}\n'
|
| 65 |
+
' ],\n'
|
| 66 |
+
' "interview_tips": [\n'
|
| 67 |
+
' {"topic": "...", "reason": "...", "tip": "..."}\n'
|
| 68 |
+
' ],\n'
|
| 69 |
+
' "encouragement": "..."\n'
|
| 70 |
+
'}\n\n'
|
| 71 |
+
"输出格式为JSON,不要加markdown代码块标记。"
|
| 72 |
+
)
|
| 73 |
+
user = {
|
| 74 |
+
"match_report": match_report,
|
| 75 |
+
"jd_text": jd_text
|
| 76 |
+
}
|
| 77 |
+
return system, user
|
| 78 |
+
|
| 79 |
+
async def generate_suggestions(self, match_report: dict, jd_text: str) -> dict:
|
| 80 |
+
api_key = os.environ.get("DEEPSEEK_API_KEY")
|
| 81 |
+
if not api_key or os.environ.get("MOCK_MODE", "").lower() == "true":
|
| 82 |
+
return MOCK_RESPONSE
|
| 83 |
+
system, user_input = self.build_prompt(match_report, jd_text)
|
| 84 |
+
result = await self.call_llm(system, user_input)
|
| 85 |
+
raw_suggestions = result.get("rewrite_suggestions") or result.get("suggestions") or result.get("modifications") or []
|
| 86 |
+
normalized = []
|
| 87 |
+
for s in raw_suggestions:
|
| 88 |
+
if isinstance(s, dict):
|
| 89 |
+
normalized.append({
|
| 90 |
+
"dimension": s.get("dimension") or s.get("name") or "",
|
| 91 |
+
"issue": s.get("issue") or s.get("problem") or "",
|
| 92 |
+
"original": s.get("original") or s.get("original_text") or "",
|
| 93 |
+
"suggestion": s.get("suggestion") or s.get("rewrite") or "",
|
| 94 |
+
"reason": s.get("reason") or s.get("rationale") or "",
|
| 95 |
+
})
|
| 96 |
+
result["rewrite_suggestions"] = normalized
|
| 97 |
+
raw_tips = result.get("interview_tips") or result.get("tips") or result.get("preparation") or []
|
| 98 |
+
normalized_tips = []
|
| 99 |
+
for t in raw_tips:
|
| 100 |
+
if isinstance(t, dict):
|
| 101 |
+
normalized_tips.append({
|
| 102 |
+
"topic": t.get("topic") or t.get("title") or "",
|
| 103 |
+
"reason": t.get("reason") or t.get("why") or "",
|
| 104 |
+
"tip": t.get("tip") or t.get("advice") or "",
|
| 105 |
+
})
|
| 106 |
+
result["interview_tips"] = normalized_tips
|
| 107 |
+
if not result.get("encouragement"):
|
| 108 |
+
result["encouragement"] = ""
|
| 109 |
+
if "error" in result:
|
| 110 |
+
return MOCK_RESPONSE
|
| 111 |
+
return result
|
offer-puplayer-hf/backend/app/agents/base_agent.py
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import logging
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
+
import httpx
|
| 6 |
+
|
| 7 |
+
logger = logging.getLogger(__name__)
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
class BaseAgent:
|
| 11 |
+
name = "base"
|
| 12 |
+
|
| 13 |
+
async def call_llm(self, system_prompt: str, user_input: dict) -> dict:
|
| 14 |
+
api_key = os.getenv("DEEPSEEK_API_KEY")
|
| 15 |
+
if not api_key:
|
| 16 |
+
logger.warning("DEEPSEEK_API_KEY not set, agent=%s cannot call LLM", self.name)
|
| 17 |
+
return {"error": "no_api_key", "agent": self.name}
|
| 18 |
+
try:
|
| 19 |
+
async with httpx.AsyncClient(timeout=60.0) as client:
|
| 20 |
+
resp = await client.post(
|
| 21 |
+
"https://api.deepseek.com/chat/completions",
|
| 22 |
+
headers={
|
| 23 |
+
"Authorization": f"Bearer {api_key}",
|
| 24 |
+
"Content-Type": "application/json",
|
| 25 |
+
},
|
| 26 |
+
json={
|
| 27 |
+
"model": "deepseek-chat",
|
| 28 |
+
"response_format": {"type": "json_object"},
|
| 29 |
+
"messages": [
|
| 30 |
+
{"role": "system", "content": system_prompt},
|
| 31 |
+
{"role": "user", "content": json.dumps(user_input, ensure_ascii=False)},
|
| 32 |
+
],
|
| 33 |
+
},
|
| 34 |
+
)
|
| 35 |
+
resp.raise_for_status()
|
| 36 |
+
body = resp.json()
|
| 37 |
+
content = body["choices"][0]["message"]["content"]
|
| 38 |
+
return json.loads(content)
|
| 39 |
+
except httpx.TimeoutException:
|
| 40 |
+
logger.error("LLM call timeout for agent=%s", self.name)
|
| 41 |
+
return {"error": "timeout", "agent": self.name}
|
| 42 |
+
except json.JSONDecodeError:
|
| 43 |
+
logger.error("LLM response parse error for agent=%s", self.name)
|
| 44 |
+
return {"error": "format_error", "agent": self.name}
|
| 45 |
+
except Exception:
|
| 46 |
+
logger.exception("LLM call failed for agent=%s", self.name)
|
| 47 |
+
return {"error": "unknown", "agent": self.name}
|
| 48 |
+
|
| 49 |
+
def build_prompt(self, **kwargs) -> tuple[str, dict]:
|
| 50 |
+
raise NotImplementedError
|
offer-puplayer-hf/backend/app/agents/jd_parser.py
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
|
| 3 |
+
from app.agents.base_agent import BaseAgent
|
| 4 |
+
|
| 5 |
+
MOCK_RESULT = {
|
| 6 |
+
"must_have": [
|
| 7 |
+
"Java", "SpringBoot", "MyBatis", "MySQL", "Redis",
|
| 8 |
+
"分布式系统", "微服务架构", "本科及以上学历", "计算机相关专业",
|
| 9 |
+
],
|
| 10 |
+
"nice_to_have": [
|
| 11 |
+
"Kubernetes", "Docker", "消息队列", "Elasticsearch",
|
| 12 |
+
"大流量高并发经验", "开源项目贡献",
|
| 13 |
+
],
|
| 14 |
+
"buzzwords": [
|
| 15 |
+
"具有较强的学习能力和团队协作精神",
|
| 16 |
+
"工作积极主动,责任心强",
|
| 17 |
+
"具备良好的沟通表达能力",
|
| 18 |
+
"有较强的抗压能力",
|
| 19 |
+
],
|
| 20 |
+
"expectation_signals": [
|
| 21 |
+
{"tag": "加班文化", "evidence": "能承受较大工作压力", "confidence": "medium"},
|
| 22 |
+
{"tag": "技术氛围", "evidence": "钻研前沿技术,追求卓越", "confidence": "high"},
|
| 23 |
+
{"tag": "团队协作", "evidence": "具备良好的团队协作精神", "confidence": "medium"},
|
| 24 |
+
{"tag": "结果导向", "evidence": "以结果为导向,注重交付质量", "confidence": "high"},
|
| 25 |
+
],
|
| 26 |
+
"position_summary": "Java后端开发工程师,负责核心业务系统的设计与开发,要求具备扎实的Java基础和微服务实践经验",
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
class JdParser(BaseAgent):
|
| 31 |
+
name = "jd_parser"
|
| 32 |
+
|
| 33 |
+
def build_prompt(self, jd_text: str) -> tuple[str, dict]:
|
| 34 |
+
system = (
|
| 35 |
+
"你是一个JD解析专家。请对提供的JD文本执行以下四项任务:\n\n"
|
| 36 |
+
"1. 去噪(Denoise):识别并过滤掉模板话术/通用套话(buzzwords),"
|
| 37 |
+
"这些描述通常在任何岗位中都能出现,缺乏具体信息量。\n\n"
|
| 38 |
+
"2. 分层(Layer):将JD中要求的能力/条件分为两类:\n"
|
| 39 |
+
" - must_have:明确要求的必备技能或条件\n"
|
| 40 |
+
" - nice_to_have:加分项、优先考虑项、期望但不强制\n\n"
|
| 41 |
+
"3. 翻译(Translate):将模糊描述转换为具体的技术栈或技能标签。\n"
|
| 42 |
+
" 例如:'熟悉主流框架' → SpringBoot, MyBatis\n"
|
| 43 |
+
" 例如:'熟悉数据库技术' → MySQL, Redis\n"
|
| 44 |
+
" 例如:'熟练掌握Linux操作' → Linux\n\n"
|
| 45 |
+
"4. 期望信号提取(Expectation Signals):提取JD中隐含的关于加班文化、"
|
| 46 |
+
"团队氛围、薪酬待遇、技术风格等信号。\n"
|
| 47 |
+
" 每条信号必须包含:\n"
|
| 48 |
+
" - tag:信号类别(如'加班文化''技术氛围''结果导向''团队协作'等)\n"
|
| 49 |
+
" - evidence:原文引用(精确的JD原文段落)\n"
|
| 50 |
+
" - confidence:置信度(high/medium/low)\n\n"
|
| 51 |
+
"请严格按以下JSON格式输出:\n"
|
| 52 |
+
"{\n"
|
| 53 |
+
' "must_have": ["技能1", "技能2", ...],\n'
|
| 54 |
+
' "nice_to_have": ["技能1", "技能2", ...],\n'
|
| 55 |
+
' "buzzwords": ["套话1", "套话2", ...],\n'
|
| 56 |
+
' "expectation_signals": [\n'
|
| 57 |
+
' {"tag": "信号类别", "evidence": "原文引用", "confidence": "high/medium/low"}\n'
|
| 58 |
+
" ],\n"
|
| 59 |
+
' "position_summary": "一句话总结该岗位"\n'
|
| 60 |
+
"}"
|
| 61 |
+
)
|
| 62 |
+
user = {"jd_text": jd_text}
|
| 63 |
+
return system, user
|
| 64 |
+
|
| 65 |
+
async def parse_jd(self, jd_text: str) -> dict:
|
| 66 |
+
if not os.getenv("DEEPSEEK_API_KEY"):
|
| 67 |
+
return dict(MOCK_RESULT)
|
| 68 |
+
system, user_input = self.build_prompt(jd_text)
|
| 69 |
+
result = await self.call_llm(system, user_input)
|
| 70 |
+
return result
|
offer-puplayer-hf/backend/app/agents/matcher.py
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
from copy import deepcopy
|
| 3 |
+
|
| 4 |
+
from app.agents.base_agent import BaseAgent
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
_MOCK_RESULT = {
|
| 8 |
+
"dimensions": [
|
| 9 |
+
{"name": "技能匹配", "score": 80, "evidence": {"jd_quote": "熟悉Python", "resume_quote": "熟练使用Python进行数据处理和模型开发"}},
|
| 10 |
+
{"name": "经验匹配", "score": 40, "evidence": {"jd_quote": "3年以上相关经验", "resume_quote": "6个月实习经历"}},
|
| 11 |
+
{"name": "学历匹配", "score": 100, "evidence": {"jd_quote": "计算机相关专业", "resume_quote": "计算机科学与技术专业"}},
|
| 12 |
+
{"name": "项目契合", "score": 65, "evidence": {"jd_quote": "有推荐系统经验优先", "resume_quote": "课程项目实现了协同过滤推荐算法"}},
|
| 13 |
+
{"name": "软性素质", "score": 75, "evidence": {"jd_quote": "具备团队协作能力", "resume_quote": "项目描述中提及与3名同学协作完成"}},
|
| 14 |
+
],
|
| 15 |
+
"total_score": 72,
|
| 16 |
+
"strength": "技能基础扎实,学历完全符合要求",
|
| 17 |
+
"gap": "缺乏全职工作经验,项目深度有待提升",
|
| 18 |
+
"hr_view": {
|
| 19 |
+
"first_impression": "技能列表与 JD 匹配度高,但项目描述缺乏量化成果",
|
| 20 |
+
"attention_points": [
|
| 21 |
+
{"aspect": "技能栈匹配", "finding": "Python/Flask 完全覆盖 JD 要求", "concern": "无"},
|
| 22 |
+
{"aspect": "项目深度", "finding": "仅课程项目,无企业级实践", "concern": "项目描述偏功能实现,未见性能优化或架构设计"},
|
| 23 |
+
{"aspect": "学历背景", "finding": "985 计算机专业,符合门槛", "concern": "无"},
|
| 24 |
+
],
|
| 25 |
+
"hr_concern_level": "medium",
|
| 26 |
+
"screen_summary": "简历整体合格,项目深度是最大短板,建议补充量化成果",
|
| 27 |
+
},
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
class Matcher(BaseAgent):
|
| 32 |
+
name = "matcher"
|
| 33 |
+
|
| 34 |
+
def build_prompt(self, jd_parsed: dict, resume_data: dict) -> tuple[str, dict]:
|
| 35 |
+
system = (
|
| 36 |
+
"你是一个简历匹配诊断专家。你的任务是将候选人的简历与岗位要求进行多维度匹配评估。\n\n"
|
| 37 |
+
"匹配维度(固定5个):\n"
|
| 38 |
+
"1. 技能匹配 — 候选人掌握的技术栈 vs JD要求的技术栈\n"
|
| 39 |
+
"2. 经验匹配 — 工作/实习年限 vs JD要求\n"
|
| 40 |
+
"3. 学历匹配 — 学历/专业 vs JD要求\n"
|
| 41 |
+
"4. 项目契合 — 项目经历与岗位方向的相关度\n"
|
| 42 |
+
"5. 软性素质 — 沟通/协作/自驱力(从项目描述中推断)\n\n"
|
| 43 |
+
"评分规则:\n"
|
| 44 |
+
"- 每个维度 0-100 分\n"
|
| 45 |
+
"- 每个分数必须附 evidence 字段:\n"
|
| 46 |
+
" - jd_quote: JD中的原文依据\n"
|
| 47 |
+
" - resume_quote: 简历中的原文依据\n"
|
| 48 |
+
"- 证据必须精确到原文引用,不能模糊概括\n\n"
|
| 49 |
+
"额外要求:\n"
|
| 50 |
+
"- total_score 为5个维度的加权总分(权重:技能0.25, 经验0.20, 学历0.15, 项目0.25, 软性0.15)\n"
|
| 51 |
+
"- strength 总结候选人优势\n"
|
| 52 |
+
"- gap 总结候选人差距\n"
|
| 53 |
+
"- hr_view 字段提供HR快速筛查模拟视角,包含 first_impression / attention_points(aspect/finding/concern)/ hr_concern_level(low/medium/high)/ screen_summary\n\n"
|
| 54 |
+
"请严格按以下JSON格式输出,字段名必须完全匹配:\n"
|
| 55 |
+
'{\n'
|
| 56 |
+
' "dimensions": [\n'
|
| 57 |
+
' {"name": "技能匹配", "score": 80, "evidence": {"jd_quote": "JD原文", "resume_quote": "简历原文"}},\n'
|
| 58 |
+
' {"name": "经验匹配", "score": 40, "evidence": {"jd_quote": "...", "resume_quote": "..."}},\n'
|
| 59 |
+
' {"name": "学历匹配", "score": 100, "evidence": {"jd_quote": "...", "resume_quote": "..."}},\n'
|
| 60 |
+
' {"name": "项目契合", "score": 65, "evidence": {"jd_quote": "...", "resume_quote": "..."}},\n'
|
| 61 |
+
' {"name": "软性素质", "score": 75, "evidence": {"jd_quote": "...", "resume_quote": "..."}}\n'
|
| 62 |
+
' ],\n'
|
| 63 |
+
' "total_score": 72,\n'
|
| 64 |
+
' "strength": "优势总结",\n'
|
| 65 |
+
' "gap": "差距总结",\n'
|
| 66 |
+
' "hr_view": {\n'
|
| 67 |
+
' "first_impression": "...",\n'
|
| 68 |
+
' "attention_points": [\n'
|
| 69 |
+
' {"aspect": "...", "finding": "...", "concern": "..."}\n'
|
| 70 |
+
' ],\n'
|
| 71 |
+
' "hr_concern_level": "medium",\n'
|
| 72 |
+
' "screen_summary": "..."\n'
|
| 73 |
+
' }\n'
|
| 74 |
+
'}\n\n'
|
| 75 |
+
"确保 total_score 为 0-100 的整数(加权:技能0.25, 经验0.20, 学历0.15, 项目0.25, 软性0.15)。\n\n"
|
| 76 |
+
"输出格式: JSON"
|
| 77 |
+
)
|
| 78 |
+
user = {"jd_parsed": jd_parsed, "resume_data": resume_data}
|
| 79 |
+
return system, user
|
| 80 |
+
|
| 81 |
+
async def match_resume(self, resume_data: dict, jd_parsed: dict) -> dict:
|
| 82 |
+
api_key = os.environ.get("DEEPSEEK_API_KEY")
|
| 83 |
+
if not api_key or os.environ.get("MOCK_MODE", "").lower() == "true":
|
| 84 |
+
return deepcopy(_MOCK_RESULT)
|
| 85 |
+
system, user = self.build_prompt(jd_parsed=jd_parsed, resume_data=resume_data)
|
| 86 |
+
result = await self.call_llm(system, user)
|
| 87 |
+
raw_dims = result.get("dimensions") or result.get("dimension_list") or result.get("matches") or []
|
| 88 |
+
normalized = []
|
| 89 |
+
for d in raw_dims:
|
| 90 |
+
if isinstance(d, dict):
|
| 91 |
+
normalized.append({
|
| 92 |
+
"name": d.get("name") or d.get("dimension") or d.get("title") or "",
|
| 93 |
+
"score": d.get("score") or d.get("value") or 0,
|
| 94 |
+
"evidence": d.get("evidence") or d.get("detail") or {"jd_quote": "", "resume_quote": ""},
|
| 95 |
+
})
|
| 96 |
+
result["dimensions"] = normalized
|
| 97 |
+
if "error" in result:
|
| 98 |
+
return deepcopy(_MOCK_RESULT)
|
| 99 |
+
return result
|
offer-puplayer-hf/backend/app/agents/resume_parser.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
|
| 3 |
+
from app.agents.base_agent import BaseAgent
|
| 4 |
+
|
| 5 |
+
MOCK_RESULT = {
|
| 6 |
+
"name": "张三",
|
| 7 |
+
"school": "华南理工大学",
|
| 8 |
+
"major": "计算机科学与技术",
|
| 9 |
+
"grade": "研二",
|
| 10 |
+
"skills": ["Python", "Java", "SQL", "PyTorch", "Flask"],
|
| 11 |
+
"projects": ["基于协同过滤的推荐系统", "在线商城后端开发"],
|
| 12 |
+
"summary": "技术栈集中在Python/Java后端开发,有推荐系统和Web开发项目经验",
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
class ResumeParser(BaseAgent):
|
| 17 |
+
name = "resume_parser"
|
| 18 |
+
|
| 19 |
+
def build_prompt(self, pdf_text: str) -> tuple[str, dict]:
|
| 20 |
+
system = (
|
| 21 |
+
"你是一个简历解析专家。从提供的简历文本中提取以下结构化信息,字段名必须精确匹配:\n"
|
| 22 |
+
"1. name: 姓名\n"
|
| 23 |
+
"2. school: 学校\n"
|
| 24 |
+
"3. major: 专业\n"
|
| 25 |
+
"4. grade: 年级/学历(如'研二'、'本科四年级'、'硕士')\n"
|
| 26 |
+
"5. skills: 技能列表(数组,提取所有技术关键词,不遗漏)\n"
|
| 27 |
+
"6. projects: 项目经历列表(数组,每项包含 name 和 description 字段)\n"
|
| 28 |
+
"7. summary: 一句话摘要\n\n"
|
| 29 |
+
"输出JSON格式,不要markdown代码块。"
|
| 30 |
+
)
|
| 31 |
+
user = {"resume_text": pdf_text}
|
| 32 |
+
return system, user
|
| 33 |
+
|
| 34 |
+
async def parse_resume(self, pdf_text: str) -> dict:
|
| 35 |
+
if not os.getenv("DEEPSEEK_API_KEY"):
|
| 36 |
+
return dict(MOCK_RESULT)
|
| 37 |
+
system, user_input = self.build_prompt(pdf_text)
|
| 38 |
+
result = await self.call_llm(system, user_input)
|
| 39 |
+
if "error" in result:
|
| 40 |
+
return dict(MOCK_RESULT)
|
| 41 |
+
return result
|
offer-puplayer-hf/backend/app/database.py
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sqlite3
|
| 2 |
+
import json
|
| 3 |
+
import os
|
| 4 |
+
import logging
|
| 5 |
+
|
| 6 |
+
logger = logging.getLogger(__name__)
|
| 7 |
+
|
| 8 |
+
DB_PATH = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'data', 'offer.db')
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def get_conn():
|
| 12 |
+
conn = sqlite3.connect(DB_PATH)
|
| 13 |
+
conn.row_factory = sqlite3.Row
|
| 14 |
+
return conn
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def init_db():
|
| 18 |
+
conn = get_conn()
|
| 19 |
+
conn.executescript("""
|
| 20 |
+
CREATE TABLE IF NOT EXISTS users (
|
| 21 |
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
| 22 |
+
name TEXT DEFAULT '',
|
| 23 |
+
school TEXT DEFAULT '',
|
| 24 |
+
major TEXT DEFAULT '',
|
| 25 |
+
grade TEXT DEFAULT '',
|
| 26 |
+
skills TEXT DEFAULT '[]',
|
| 27 |
+
projects TEXT DEFAULT '[]',
|
| 28 |
+
summary TEXT DEFAULT '',
|
| 29 |
+
experience TEXT DEFAULT '',
|
| 30 |
+
education TEXT DEFAULT '',
|
| 31 |
+
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
| 32 |
+
);
|
| 33 |
+
|
| 34 |
+
CREATE TABLE IF NOT EXISTS jobs (
|
| 35 |
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
| 36 |
+
job_id INTEGER UNIQUE,
|
| 37 |
+
name TEXT NOT NULL,
|
| 38 |
+
company TEXT DEFAULT '',
|
| 39 |
+
city TEXT DEFAULT '',
|
| 40 |
+
salary TEXT DEFAULT '',
|
| 41 |
+
tags TEXT DEFAULT '[]',
|
| 42 |
+
description TEXT DEFAULT '',
|
| 43 |
+
requirements TEXT DEFAULT '',
|
| 44 |
+
expectation_signals TEXT DEFAULT '[]',
|
| 45 |
+
embedding TEXT DEFAULT '',
|
| 46 |
+
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
| 47 |
+
);
|
| 48 |
+
|
| 49 |
+
CREATE TABLE IF NOT EXISTS diagnoses (
|
| 50 |
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
| 51 |
+
user_id INTEGER REFERENCES users(id),
|
| 52 |
+
job_id INTEGER REFERENCES jobs(job_id),
|
| 53 |
+
match_report TEXT DEFAULT '{}',
|
| 54 |
+
advice TEXT DEFAULT '{}',
|
| 55 |
+
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
| 56 |
+
);
|
| 57 |
+
""")
|
| 58 |
+
|
| 59 |
+
count = conn.execute("SELECT COUNT(*) FROM jobs").fetchone()[0]
|
| 60 |
+
if count == 0:
|
| 61 |
+
jobs_path = os.path.join(os.path.dirname(DB_PATH), 'jobs.json')
|
| 62 |
+
jobs = json.load(open(jobs_path, encoding='utf-8'))
|
| 63 |
+
for j in jobs:
|
| 64 |
+
conn.execute(
|
| 65 |
+
"INSERT INTO jobs (job_id, name, company, city, salary, tags, description, requirements, expectation_signals) VALUES (?,?,?,?,?,?,?,?,?)",
|
| 66 |
+
(int(j['id'].split('_')[-1]) if isinstance(j['id'], str) else j['id'],
|
| 67 |
+
j['name'], j.get('company',''), j.get('city',''), j.get('salary',''),
|
| 68 |
+
json.dumps(j.get('tags',[]), ensure_ascii=False),
|
| 69 |
+
j.get('description',''), j.get('requirements',''),
|
| 70 |
+
json.dumps(j.get('expectation_signals',[]), ensure_ascii=False))
|
| 71 |
+
)
|
| 72 |
+
conn.commit()
|
| 73 |
+
_compute_job_embeddings(conn)
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
def _compute_job_embeddings(conn):
|
| 77 |
+
try:
|
| 78 |
+
from app.services.embedding_service import compute_embedding
|
| 79 |
+
rows = conn.execute("SELECT job_id, name, description, requirements, tags FROM jobs").fetchall()
|
| 80 |
+
for r in rows:
|
| 81 |
+
text = " ".join([
|
| 82 |
+
r["name"] or "",
|
| 83 |
+
r["description"] or "",
|
| 84 |
+
r["requirements"] or "",
|
| 85 |
+
" ".join(json.loads(r["tags"] or "[]")),
|
| 86 |
+
])
|
| 87 |
+
vec = compute_embedding(text)
|
| 88 |
+
conn.execute(
|
| 89 |
+
"UPDATE jobs SET embedding=? WHERE job_id=?",
|
| 90 |
+
(json.dumps(vec, ensure_ascii=False), r["job_id"])
|
| 91 |
+
)
|
| 92 |
+
conn.commit()
|
| 93 |
+
logger.info("Computed embeddings for %d jobs", len(rows))
|
| 94 |
+
except Exception as e:
|
| 95 |
+
logger.warning("Failed to compute job embeddings: %s", e)
|
| 96 |
+
|
| 97 |
+
count = conn.execute("SELECT COUNT(*) FROM users").fetchone()[0]
|
| 98 |
+
if count == 0:
|
| 99 |
+
conn.execute(
|
| 100 |
+
"INSERT INTO users (name, school, major, grade, skills, projects, summary) VALUES (?,?,?,?,?,?,?)",
|
| 101 |
+
('张三', '华南理工大学', '计算机科学与技术', '研二',
|
| 102 |
+
json.dumps(['Python','Java','SQL','PyTorch','Flask'], ensure_ascii=False),
|
| 103 |
+
json.dumps(['基于协同过滤的推荐系统','在线商城后端开发'], ensure_ascii=False),
|
| 104 |
+
'技术栈集中在Python/Java后端开发,有推荐系统和Web开发项目经验')
|
| 105 |
+
)
|
| 106 |
+
|
| 107 |
+
conn.commit()
|
| 108 |
+
conn.close()
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
def migrate_db():
|
| 112 |
+
conn = get_conn()
|
| 113 |
+
try:
|
| 114 |
+
conn.execute("SELECT embedding FROM jobs LIMIT 1")
|
| 115 |
+
except:
|
| 116 |
+
conn.execute("ALTER TABLE jobs ADD COLUMN embedding TEXT DEFAULT ''")
|
| 117 |
+
conn.commit()
|
| 118 |
+
empty = conn.execute("SELECT COUNT(*) FROM jobs WHERE embedding IS NULL OR embedding = ''").fetchone()[0]
|
| 119 |
+
if empty > 0:
|
| 120 |
+
try:
|
| 121 |
+
_compute_job_embeddings(conn)
|
| 122 |
+
except Exception as e:
|
| 123 |
+
logger.warning("Embedding computation failed: %s", e)
|
| 124 |
+
conn.close()
|
offer-puplayer-hf/backend/app/main.py
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
from contextlib import asynccontextmanager
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
|
| 5 |
+
from dotenv import load_dotenv
|
| 6 |
+
from fastapi import FastAPI, File, UploadFile, Query
|
| 7 |
+
from fastapi.middleware.cors import CORSMiddleware
|
| 8 |
+
from fastapi.responses import StreamingResponse
|
| 9 |
+
from fastapi.staticfiles import StaticFiles
|
| 10 |
+
|
| 11 |
+
from app import database
|
| 12 |
+
from app.models import GenerateRequest, RerankRequest, UploadResponse, ResumeData
|
| 13 |
+
from app.orchestrator import ReportOrchestrator
|
| 14 |
+
from app.services import resume_service, job_service
|
| 15 |
+
|
| 16 |
+
load_dotenv()
|
| 17 |
+
|
| 18 |
+
orchestrator = ReportOrchestrator()
|
| 19 |
+
|
| 20 |
+
_confirmed_resume = None
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
@asynccontextmanager
|
| 24 |
+
async def lifespan(app: FastAPI):
|
| 25 |
+
database.init_db()
|
| 26 |
+
database.migrate_db()
|
| 27 |
+
print("Offer 捕手后端已启动")
|
| 28 |
+
yield
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
app = FastAPI(lifespan=lifespan)
|
| 32 |
+
|
| 33 |
+
app.add_middleware(
|
| 34 |
+
CORSMiddleware,
|
| 35 |
+
allow_origins=["*"],
|
| 36 |
+
allow_credentials=True,
|
| 37 |
+
allow_methods=["*"],
|
| 38 |
+
allow_headers=["*"],
|
| 39 |
+
)
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
@app.post("/api/resume/upload")
|
| 43 |
+
async def upload_resume(file: UploadFile = File(...)):
|
| 44 |
+
content = await file.read()
|
| 45 |
+
result = await resume_service.parse_resume_pdf(content)
|
| 46 |
+
if result is None:
|
| 47 |
+
return UploadResponse(success=False, error="简历解析失败")
|
| 48 |
+
return UploadResponse(success=True, data=result)
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
@app.post("/api/resume/confirm")
|
| 52 |
+
async def confirm_resume(req: ResumeData):
|
| 53 |
+
global _confirmed_resume
|
| 54 |
+
data = req.model_dump()
|
| 55 |
+
edu = data.get("education", "")
|
| 56 |
+
if isinstance(edu, dict):
|
| 57 |
+
edu = edu.get("school", "") or edu.get("name", "") or json.dumps(edu, ensure_ascii=False)
|
| 58 |
+
data["education"] = edu
|
| 59 |
+
_confirmed_resume = data
|
| 60 |
+
conn = database.get_conn()
|
| 61 |
+
conn.execute(
|
| 62 |
+
"UPDATE users SET name=?, school=?, major=?, grade=?, skills=?, projects=?, summary=?, experience=?, education=? WHERE id=1",
|
| 63 |
+
(data.get("name",""), data.get("school",""), data.get("major",""), data.get("grade",""),
|
| 64 |
+
json.dumps(data.get("skills",[]), ensure_ascii=False),
|
| 65 |
+
json.dumps(data.get("projects",[]), ensure_ascii=False),
|
| 66 |
+
data.get("summary",""), data.get("experience",""), data.get("education",""))
|
| 67 |
+
)
|
| 68 |
+
conn.commit()
|
| 69 |
+
conn.close()
|
| 70 |
+
return {"success": True, "data": _confirmed_resume}
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
@app.get("/api/jobs/recommend")
|
| 74 |
+
async def recommend_jobs(resume_id: int = Query(...)):
|
| 75 |
+
conn = database.get_conn()
|
| 76 |
+
user = conn.execute("SELECT * FROM users WHERE id = ?", (resume_id,)).fetchone()
|
| 77 |
+
conn.close()
|
| 78 |
+
if user:
|
| 79 |
+
resume_data = {
|
| 80 |
+
"name": user["name"] or "",
|
| 81 |
+
"school": user["school"] or "",
|
| 82 |
+
"major": user["major"] or "",
|
| 83 |
+
"grade": user["grade"] or "",
|
| 84 |
+
"skills": json.loads(user["skills"] or "[]"),
|
| 85 |
+
"projects": json.loads(user["projects"] or "[]"),
|
| 86 |
+
"summary": user["summary"] or "",
|
| 87 |
+
"experience": user["experience"] or "",
|
| 88 |
+
"education": user["education"] or "",
|
| 89 |
+
}
|
| 90 |
+
else:
|
| 91 |
+
resume_data = resume_service.MOCK_RESULT
|
| 92 |
+
jobs = job_service.recommend_jobs(resume_data)
|
| 93 |
+
return {"jobs": jobs}
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
def _load_job_by_id(job_id: int) -> dict | None:
|
| 97 |
+
conn = database.get_conn()
|
| 98 |
+
row = conn.execute("SELECT * FROM jobs WHERE job_id = ?", (job_id,)).fetchone()
|
| 99 |
+
conn.close()
|
| 100 |
+
if row is None:
|
| 101 |
+
return None
|
| 102 |
+
return dict(row)
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
@app.post("/api/report/generate")
|
| 106 |
+
async def generate_report(req: GenerateRequest):
|
| 107 |
+
job = _load_job_by_id(req.job_id)
|
| 108 |
+
jd_text = (job.get("description", "") + "\n" + job.get("requirements", "")) if job else ""
|
| 109 |
+
resume_dict = req.resume_data.model_dump() if req.resume_data else resume_service.MOCK_RESULT
|
| 110 |
+
|
| 111 |
+
async def event_stream():
|
| 112 |
+
async for event in orchestrator.generate_report(resume_dict, jd_text):
|
| 113 |
+
yield f"data: {event}\n\n"
|
| 114 |
+
|
| 115 |
+
return StreamingResponse(
|
| 116 |
+
event_stream(),
|
| 117 |
+
media_type="text/event-stream",
|
| 118 |
+
)
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
@app.post("/api/report/rerank")
|
| 122 |
+
async def rerank_report(req: RerankRequest):
|
| 123 |
+
job = _load_job_by_id(req.job_id)
|
| 124 |
+
jd_text = (job.get("description", "") + "\n" + job.get("requirements", "")) if job else ""
|
| 125 |
+
|
| 126 |
+
from app.agents.jd_parser import JdParser
|
| 127 |
+
from app.agents.matcher import Matcher
|
| 128 |
+
|
| 129 |
+
parser = JdParser()
|
| 130 |
+
matcher = Matcher()
|
| 131 |
+
|
| 132 |
+
jd_parsed = await parser.parse_jd(jd_text)
|
| 133 |
+
|
| 134 |
+
if req.edited_resume_data is not None:
|
| 135 |
+
edited_resume_data = req.edited_resume_data
|
| 136 |
+
else:
|
| 137 |
+
try:
|
| 138 |
+
parsed = json.loads(req.edited_resume)
|
| 139 |
+
if isinstance(parsed, dict) and ("skills" in parsed or "projects" in parsed):
|
| 140 |
+
edited_resume_data = parsed
|
| 141 |
+
else:
|
| 142 |
+
edited_resume_data = {
|
| 143 |
+
"skills": [],
|
| 144 |
+
"projects": [req.edited_resume],
|
| 145 |
+
"summary": req.edited_resume,
|
| 146 |
+
}
|
| 147 |
+
except (json.JSONDecodeError, TypeError):
|
| 148 |
+
edited_resume_data = {
|
| 149 |
+
"skills": [],
|
| 150 |
+
"projects": [req.edited_resume],
|
| 151 |
+
"summary": req.edited_resume,
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
resume_for_previous = _confirmed_resume if _confirmed_resume else (req.resume_data.model_dump() if req.resume_data else resume_service.MOCK_RESULT)
|
| 155 |
+
|
| 156 |
+
match_result = await matcher.match_resume(edited_resume_data, jd_parsed)
|
| 157 |
+
current_rate = match_result.get("total_score", 50)
|
| 158 |
+
|
| 159 |
+
previous_result = await matcher.match_resume(resume_for_previous, jd_parsed)
|
| 160 |
+
previous_rate = previous_result.get("total_score", 50)
|
| 161 |
+
|
| 162 |
+
return {"match_rate": current_rate, "previous_rate": previous_rate}
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
if __name__ == "__main__":
|
| 166 |
+
import uvicorn
|
| 167 |
+
|
| 168 |
+
uvicorn.run("app.main:app", host="0.0.0.0", port=7860, reload=True)
|
| 169 |
+
|
| 170 |
+
# Serve frontend static files (for HuggingFace Spaces deployment)
|
| 171 |
+
_static_dir = Path(__file__).parent.parent / "static"
|
| 172 |
+
if _static_dir.exists():
|
| 173 |
+
app.mount("/", StaticFiles(directory=str(_static_dir), html=True), name="static")
|
offer-puplayer-hf/backend/app/models.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pydantic import BaseModel, Field
|
| 2 |
+
from typing import Optional
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
class ResumeData(BaseModel):
|
| 6 |
+
name: str = ""
|
| 7 |
+
school: str = ""
|
| 8 |
+
major: str = ""
|
| 9 |
+
grade: str = ""
|
| 10 |
+
skills: list[str] = Field(default_factory=list)
|
| 11 |
+
projects: list[str | dict] = Field(default_factory=list)
|
| 12 |
+
summary: str = ""
|
| 13 |
+
experience: str = ""
|
| 14 |
+
education: str | dict = ""
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
class UploadResponse(BaseModel):
|
| 18 |
+
success: bool
|
| 19 |
+
data: Optional[ResumeData] = None
|
| 20 |
+
error: Optional[str] = None
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
class GenerateRequest(BaseModel):
|
| 24 |
+
job_id: int
|
| 25 |
+
resume_data: Optional[ResumeData] = None
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
class RerankRequest(BaseModel):
|
| 29 |
+
job_id: int
|
| 30 |
+
edited_resume: str
|
| 31 |
+
resume_data: Optional[ResumeData] = None
|
| 32 |
+
edited_resume_data: Optional[dict] = None
|
offer-puplayer-hf/backend/app/orchestrator.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
from typing import AsyncGenerator
|
| 3 |
+
|
| 4 |
+
from app.agents.jd_parser import JdParser
|
| 5 |
+
from app.agents.matcher import Matcher
|
| 6 |
+
from app.agents.advisor import Advisor
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class ReportOrchestrator:
|
| 10 |
+
def __init__(self):
|
| 11 |
+
self.jd_parser = JdParser()
|
| 12 |
+
self.matcher = Matcher()
|
| 13 |
+
self.advisor = Advisor()
|
| 14 |
+
|
| 15 |
+
async def generate_report(self, resume_data: dict, jd_text: str) -> AsyncGenerator[str, None]:
|
| 16 |
+
yield json.dumps({"type": "agent_start", "agent": "agent1"}, ensure_ascii=False)
|
| 17 |
+
jd_parsed = await self.jd_parser.parse_jd(jd_text)
|
| 18 |
+
yield json.dumps({"type": "agent_complete", "agent": "agent1", "data": jd_parsed}, ensure_ascii=False)
|
| 19 |
+
|
| 20 |
+
yield json.dumps({"type": "agent_start", "agent": "agent2"}, ensure_ascii=False)
|
| 21 |
+
match_report = await self.matcher.match_resume(resume_data, jd_parsed)
|
| 22 |
+
yield json.dumps({"type": "agent_complete", "agent": "agent2", "data": match_report}, ensure_ascii=False)
|
| 23 |
+
|
| 24 |
+
yield json.dumps({"type": "agent_start", "agent": "agent3"}, ensure_ascii=False)
|
| 25 |
+
advice = await self.advisor.generate_suggestions(match_report, jd_text)
|
| 26 |
+
yield json.dumps({"type": "agent_complete", "agent": "agent3", "data": advice}, ensure_ascii=False)
|
| 27 |
+
|
| 28 |
+
full_report = {
|
| 29 |
+
"jd_parsed": jd_parsed,
|
| 30 |
+
"match_report": match_report,
|
| 31 |
+
"advice": advice,
|
| 32 |
+
}
|
| 33 |
+
yield json.dumps({"type": "report_complete", "data": full_report}, ensure_ascii=False)
|
offer-puplayer-hf/backend/app/services/embedding_service.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import logging
|
| 2 |
+
import math
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
+
logger = logging.getLogger(__name__)
|
| 6 |
+
|
| 7 |
+
_model = None
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def _get_model():
|
| 11 |
+
global _model
|
| 12 |
+
if _model is None:
|
| 13 |
+
logger.info("Loading embedding model ...")
|
| 14 |
+
from sentence_transformers import SentenceTransformer
|
| 15 |
+
_model = SentenceTransformer("BAAI/bge-small-zh-v1.5")
|
| 16 |
+
logger.info("Embedding model loaded, dim=%s", _model.get_embedding_dimension())
|
| 17 |
+
return _model
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def compute_embedding(text: str) -> list[float]:
|
| 21 |
+
model = _get_model()
|
| 22 |
+
vec = model.encode(text, normalize_embeddings=True)
|
| 23 |
+
return vec.tolist()
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def cosine_similarity(a: list[float], b: list[float]) -> float:
|
| 27 |
+
dot = sum(x * y for x, y in zip(a, b))
|
| 28 |
+
na = math.sqrt(sum(x * x for x in a))
|
| 29 |
+
nb = math.sqrt(sum(y * y for y in b))
|
| 30 |
+
if na == 0 or nb == 0:
|
| 31 |
+
return 0.0
|
| 32 |
+
return dot / (na * nb)
|
offer-puplayer-hf/backend/app/services/job_service.py
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import os
|
| 3 |
+
import logging
|
| 4 |
+
|
| 5 |
+
import httpx
|
| 6 |
+
|
| 7 |
+
from app import database
|
| 8 |
+
|
| 9 |
+
logger = logging.getLogger(__name__)
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
_985_UNIVERSITIES = {
|
| 13 |
+
"清华大学","北京大学","复旦大学","上海交通大学","浙江大学","南京大学","中国科学技术大学",
|
| 14 |
+
"哈尔滨工业大学","西安交通大学","武汉大学","华中科技大学","中山大学","四川大学","南开大学",
|
| 15 |
+
"天津大学","山东大学","东南大学","吉林大学","厦门大学","同济大学","北京师范大学",
|
| 16 |
+
"国防科技大学","中国人民大学","北京航空航天大学","北京理工大学","中国农业大学",
|
| 17 |
+
"中央民族大学","华东师范大学","兰州大学","西北工业大学","电子科技大学",
|
| 18 |
+
"重庆大学","湖南大学","中南大学","大连理工大学","东北大学","华南理工大学"
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
_211_UNIVERSITIES = _985_UNIVERSITIES | {
|
| 22 |
+
"北京科技大学","北京交通大学","北京邮电大学","北京林业大学","北京外国语大学",
|
| 23 |
+
"中国传媒大学","中央财经大学","对外经济贸易大学","北京体育大学","中国政法大学",
|
| 24 |
+
"华北电力大学","河北工业大学","太原理工大学","内蒙古大学","辽宁大学","大连海事大学",
|
| 25 |
+
"延边大学","东北师范大学","哈尔滨工程大学","东北农业大学","华东理工大学","东华大学",
|
| 26 |
+
"上海外国语大学","上海财经大学","上海大学","苏州大学","南京航空航天大学","南京理工大学",
|
| 27 |
+
"中国矿业大学","河海大学","江南大学","南京农业大学","中国药科大学","南京师范大学",
|
| 28 |
+
"安徽大学","合肥工业大学","福州大学","南昌大学","中国石油大学","郑州大学",
|
| 29 |
+
"中国地质大学","武汉理工大学","华中农业大学","华中师范大学","中南财经政法大学",
|
| 30 |
+
"湖南师范大学","暨南大学","华南师范大学","广西大学","海南大学","西南交通大学",
|
| 31 |
+
"西南大学","西南财经大学","贵州大学","云南大学","西藏大学","西北大学",
|
| 32 |
+
"西安电子科技大学","长安大学","陕西师范大学","青海大学","宁夏大学","石河子大学",
|
| 33 |
+
"新疆大学","北京工业大学","天津医科大学","南京信息工程大学","南方科技大学",
|
| 34 |
+
"上海科技大学","中国社科院大学","中国科学院大学"
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
def _get_school_tier(school: str) -> int:
|
| 39 |
+
if not school:
|
| 40 |
+
return 0
|
| 41 |
+
if school in _985_UNIVERSITIES:
|
| 42 |
+
return 2
|
| 43 |
+
if school in _211_UNIVERSITIES:
|
| 44 |
+
return 1
|
| 45 |
+
return 0
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def _build_resume_text(resume_data: dict) -> str:
|
| 49 |
+
skills = " ".join(s.lower().strip() for s in resume_data.get("skills", []))
|
| 50 |
+
projects = " ".join(
|
| 51 |
+
p if isinstance(p, str) else (p.get("name", "") + " " + p.get("description", ""))
|
| 52 |
+
for p in resume_data.get("projects", [])
|
| 53 |
+
)
|
| 54 |
+
parts = [
|
| 55 |
+
resume_data.get("summary") or "",
|
| 56 |
+
projects,
|
| 57 |
+
resume_data.get("experience") or "",
|
| 58 |
+
resume_data.get("education") or "",
|
| 59 |
+
resume_data.get("major") or "",
|
| 60 |
+
skills,
|
| 61 |
+
]
|
| 62 |
+
return " ".join(parts)
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def _calc_match_rate(resume_data: dict, job: dict, tag_score: float, edu_score: float, vec_score: float) -> float:
|
| 66 |
+
final_score = vec_score * 0.40 + tag_score * 0.35 + edu_score * 0.25
|
| 67 |
+
return round(min(final_score, 1.0), 4)
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
def _calc_tag_score(resume_data: dict, job: dict) -> float:
|
| 71 |
+
skills = [s.lower().strip() for s in resume_data.get("skills", [])]
|
| 72 |
+
tags = [t.lower().strip() for t in job.get("tags", [])]
|
| 73 |
+
if not tags:
|
| 74 |
+
return 0.0
|
| 75 |
+
matched = sum(1 for t in tags if t in skills)
|
| 76 |
+
return matched / len(tags)
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
def _calc_edu_score(resume_data: dict, job: dict) -> float:
|
| 80 |
+
school = (resume_data.get("school") or "")
|
| 81 |
+
grade = (resume_data.get("grade") or "").lower()
|
| 82 |
+
jd_requirements = (job.get("requirements") or "").lower()
|
| 83 |
+
score = 0.4
|
| 84 |
+
tier = _get_school_tier(school)
|
| 85 |
+
if tier >= 2:
|
| 86 |
+
score = 1.0
|
| 87 |
+
elif tier >= 1:
|
| 88 |
+
score = 0.8
|
| 89 |
+
elif school:
|
| 90 |
+
score = 0.5
|
| 91 |
+
if ("硕士" in grade or "博士" in grade or "研" in grade) and "硕士" in jd_requirements:
|
| 92 |
+
score = min(score + 0.15, 1.0)
|
| 93 |
+
return score
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
def recommend_jobs(resume_data: dict) -> list[dict]:
|
| 97 |
+
if not resume_data or not resume_data.get("skills"):
|
| 98 |
+
return []
|
| 99 |
+
|
| 100 |
+
conn = database.get_conn()
|
| 101 |
+
rows = conn.execute("SELECT * FROM jobs ORDER BY job_id").fetchall()
|
| 102 |
+
conn.close()
|
| 103 |
+
|
| 104 |
+
jobs = []
|
| 105 |
+
for r in rows:
|
| 106 |
+
embedding_raw = r["embedding"] if "embedding" in r.keys() else ""
|
| 107 |
+
jobs.append({
|
| 108 |
+
"job_id": r["job_id"],
|
| 109 |
+
"name": r["name"],
|
| 110 |
+
"company": r["company"],
|
| 111 |
+
"city": r["city"],
|
| 112 |
+
"salary": r["salary"],
|
| 113 |
+
"tags": json.loads(r["tags"] or "[]"),
|
| 114 |
+
"description": r["description"],
|
| 115 |
+
"requirements": r["requirements"],
|
| 116 |
+
"expectation_signals": json.loads(r["expectation_signals"] or "[]"),
|
| 117 |
+
"_embedding": json.loads(embedding_raw) if embedding_raw else None,
|
| 118 |
+
})
|
| 119 |
+
|
| 120 |
+
resume_text = _build_resume_text(resume_data)
|
| 121 |
+
resume_vec = None
|
| 122 |
+
try:
|
| 123 |
+
from app.services.embedding_service import compute_embedding, cosine_similarity
|
| 124 |
+
resume_vec = compute_embedding(resume_text)
|
| 125 |
+
except Exception as e:
|
| 126 |
+
logger.warning("Resume embedding failed: %s", e)
|
| 127 |
+
|
| 128 |
+
for job in jobs:
|
| 129 |
+
tag_score = _calc_tag_score(resume_data, job)
|
| 130 |
+
edu_score = _calc_edu_score(resume_data, job)
|
| 131 |
+
|
| 132 |
+
vec_raw = 0.0
|
| 133 |
+
if resume_vec and job["_embedding"]:
|
| 134 |
+
vec_raw = cosine_similarity(resume_vec, job["_embedding"])
|
| 135 |
+
|
| 136 |
+
job["_tag_score"] = tag_score
|
| 137 |
+
job["_edu_score"] = edu_score
|
| 138 |
+
job["_vec_raw"] = vec_raw
|
| 139 |
+
|
| 140 |
+
raw_vecs = [j["_vec_raw"] for j in jobs]
|
| 141 |
+
min_vec = min(raw_vecs)
|
| 142 |
+
max_vec = max(raw_vecs)
|
| 143 |
+
vec_range = max_vec - min_vec
|
| 144 |
+
|
| 145 |
+
for job in jobs:
|
| 146 |
+
if vec_range > 0:
|
| 147 |
+
job["_vec_score"] = (job["_vec_raw"] - min_vec) / vec_range
|
| 148 |
+
else:
|
| 149 |
+
job["_vec_score"] = 0.5
|
| 150 |
+
|
| 151 |
+
scored = []
|
| 152 |
+
for job in jobs:
|
| 153 |
+
match_rate = _calc_match_rate(
|
| 154 |
+
resume_data, job,
|
| 155 |
+
job["_tag_score"], job["_edu_score"], job["_vec_score"]
|
| 156 |
+
)
|
| 157 |
+
scored.append({
|
| 158 |
+
"job_id": job["job_id"],
|
| 159 |
+
"match_rate": match_rate,
|
| 160 |
+
"job": job,
|
| 161 |
+
})
|
| 162 |
+
|
| 163 |
+
scored.sort(key=lambda x: x["match_rate"], reverse=True)
|
| 164 |
+
top_n = scored
|
| 165 |
+
|
| 166 |
+
api_key = os.getenv("DEEPSEEK_API_KEY")
|
| 167 |
+
if api_key and top_n:
|
| 168 |
+
try:
|
| 169 |
+
job_summaries = []
|
| 170 |
+
for item in top_n:
|
| 171 |
+
j = item["job"]
|
| 172 |
+
job_summaries.append(
|
| 173 |
+
f' {j.get("job_id")}: {j.get("name")} @ {j.get("company")} | '
|
| 174 |
+
f'tags={j.get("tags")} | match_rate={item["match_rate"]}'
|
| 175 |
+
)
|
| 176 |
+
|
| 177 |
+
system_prompt = (
|
| 178 |
+
"你是一个岗位推荐排序专家。给定候选人的技能列表和全部候选岗位,"
|
| 179 |
+
"请根据岗位与候选人的匹配程度重新排序,输出最匹配的岗位ID列表(从最匹配到最不匹配)。"
|
| 180 |
+
"输出格式为JSON:{\"ranked_job_ids\": [1, 2, 3, ...]}"
|
| 181 |
+
)
|
| 182 |
+
user_input = {
|
| 183 |
+
"skills": resume_data.get("skills", []),
|
| 184 |
+
"candidates": "\n".join(job_summaries),
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
with httpx.Client(timeout=30.0) as client:
|
| 188 |
+
resp = client.post(
|
| 189 |
+
"https://api.deepseek.com/chat/completions",
|
| 190 |
+
headers={
|
| 191 |
+
"Authorization": f"Bearer {api_key}",
|
| 192 |
+
"Content-Type": "application/json",
|
| 193 |
+
},
|
| 194 |
+
json={
|
| 195 |
+
"model": "deepseek-chat",
|
| 196 |
+
"response_format": {"type": "json_object"},
|
| 197 |
+
"messages": [
|
| 198 |
+
{"role": "system", "content": system_prompt},
|
| 199 |
+
{"role": "user", "content": json.dumps(user_input, ensure_ascii=False)},
|
| 200 |
+
],
|
| 201 |
+
},
|
| 202 |
+
)
|
| 203 |
+
resp.raise_for_status()
|
| 204 |
+
body = resp.json()
|
| 205 |
+
content = body["choices"][0]["message"]["content"]
|
| 206 |
+
llm_result = json.loads(content)
|
| 207 |
+
|
| 208 |
+
ranked_ids = llm_result.get("ranked_job_ids", [])
|
| 209 |
+
id_to_item = {item["job"]["job_id"]: item for item in top_n}
|
| 210 |
+
re_ranked = []
|
| 211 |
+
for raw_id in ranked_ids:
|
| 212 |
+
if raw_id in id_to_item:
|
| 213 |
+
re_ranked.append(id_to_item[raw_id])
|
| 214 |
+
for item in top_n:
|
| 215 |
+
if item["job"]["job_id"] not in ranked_ids:
|
| 216 |
+
re_ranked.append(item)
|
| 217 |
+
top_n = re_ranked
|
| 218 |
+
except Exception as e:
|
| 219 |
+
logger.warning("LLM ranking failed: %s", e)
|
| 220 |
+
|
| 221 |
+
return [
|
| 222 |
+
{
|
| 223 |
+
"job_id": item["job_id"],
|
| 224 |
+
"match_rate": item["match_rate"],
|
| 225 |
+
"match_detail": {
|
| 226 |
+
"semantic": round(item["job"]["_vec_score"], 4),
|
| 227 |
+
"tags": round(item["job"]["_tag_score"], 4),
|
| 228 |
+
"education": round(item["job"]["_edu_score"], 4),
|
| 229 |
+
},
|
| 230 |
+
"name": item["job"].get("name", ""),
|
| 231 |
+
"company": item["job"].get("company", ""),
|
| 232 |
+
"city": item["job"].get("city", ""),
|
| 233 |
+
"salary": item["job"].get("salary", ""),
|
| 234 |
+
"tags": item["job"].get("tags", []),
|
| 235 |
+
"description": item["job"].get("description", ""),
|
| 236 |
+
"requirements": item["job"].get("requirements", ""),
|
| 237 |
+
"expectation_signals": item["job"].get("expectation_signals", []),
|
| 238 |
+
}
|
| 239 |
+
for item in top_n
|
| 240 |
+
]
|
offer-puplayer-hf/backend/app/services/resume_service.py
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import asyncio
|
| 2 |
+
import io
|
| 3 |
+
import logging
|
| 4 |
+
|
| 5 |
+
try:
|
| 6 |
+
import pdfplumber
|
| 7 |
+
PDFPLUMBER_AVAILABLE = True
|
| 8 |
+
except ImportError:
|
| 9 |
+
PDFPLUMBER_AVAILABLE = False
|
| 10 |
+
|
| 11 |
+
logger = logging.getLogger(__name__)
|
| 12 |
+
|
| 13 |
+
MOCK_RESULT = {
|
| 14 |
+
"name": "张三",
|
| 15 |
+
"school": "华南理工大学",
|
| 16 |
+
"major": "计算机科学与技术",
|
| 17 |
+
"grade": "研二",
|
| 18 |
+
"skills": ["Python", "Java", "SQL", "PyTorch", "Flask"],
|
| 19 |
+
"projects": [
|
| 20 |
+
"基于协同过滤的推荐系统",
|
| 21 |
+
"在线商城后端开发",
|
| 22 |
+
],
|
| 23 |
+
"summary": "技术栈集中在Python/Java后端开发,有推荐系统和Web开发项目经验",
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
async def parse_resume_pdf(file_bytes: bytes) -> dict:
|
| 28 |
+
if not PDFPLUMBER_AVAILABLE:
|
| 29 |
+
return dict(MOCK_RESULT)
|
| 30 |
+
|
| 31 |
+
try:
|
| 32 |
+
with pdfplumber.open(io.BytesIO(file_bytes)) as pdf:
|
| 33 |
+
text_parts = []
|
| 34 |
+
for page in pdf.pages:
|
| 35 |
+
page_text = page.extract_text()
|
| 36 |
+
if page_text:
|
| 37 |
+
text_parts.append(page_text)
|
| 38 |
+
full_text = "\n".join(text_parts)
|
| 39 |
+
|
| 40 |
+
if not full_text.strip():
|
| 41 |
+
return dict(MOCK_RESULT)
|
| 42 |
+
|
| 43 |
+
from app.agents.resume_parser import ResumeParser
|
| 44 |
+
parser = ResumeParser()
|
| 45 |
+
result = await parser.parse_resume(full_text)
|
| 46 |
+
if isinstance(result, dict) and "error" not in result:
|
| 47 |
+
return result
|
| 48 |
+
logger.warning("Resume parser returned error: %s", result.get("error"))
|
| 49 |
+
return dict(MOCK_RESULT)
|
| 50 |
+
|
| 51 |
+
except Exception as e:
|
| 52 |
+
logger.error("Resume parsing failed: %s", e)
|
| 53 |
+
return dict(MOCK_RESULT)
|
offer-puplayer-hf/backend/data/jobs.json
ADDED
|
@@ -0,0 +1,402 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"id": "job_001",
|
| 4 |
+
"name": "后端开发实习生",
|
| 5 |
+
"company": "腾讯",
|
| 6 |
+
"city": "深圳",
|
| 7 |
+
"salary": "200-250元/天",
|
| 8 |
+
"tags": ["Go", "微服务", "MySQL", "Redis", "Kafka"],
|
| 9 |
+
"description": "负责腾讯云核心服务的后端模块开发,参与高并发分布式系统的设计与优化,完成接口文档编写与单元测试覆盖。",
|
| 10 |
+
"requirements": "2026届本科及以上学历,计算机相关专业;熟悉Go或Java语言,了解微服务架构;具备扎实的数据结构与算法基础;有分布式系统项目经验者优先。",
|
| 11 |
+
"expectation_signals": [
|
| 12 |
+
{"tag": "加班强度大", "evidence": "腾讯核心部门普遍加班,尤其是云业务线交付压力大", "confidence": 0.75},
|
| 13 |
+
{"tag": "技术氛围浓厚", "evidence": "腾讯以技术驱动著称,内部技术分享和开源文化丰富", "confidence": 0.85},
|
| 14 |
+
{"tag": "待遇高于行业平均", "evidence": "200-250元/天在实习岗位中属于较高水平", "confidence": 0.80},
|
| 15 |
+
{"tag": "核心业务参与", "evidence": "腾讯云核心服务直接服务于公司战略级业务", "confidence": 0.85}
|
| 16 |
+
]
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"id": "job_002",
|
| 20 |
+
"name": "AI算法实习生",
|
| 21 |
+
"company": "字节跳动",
|
| 22 |
+
"city": "北京",
|
| 23 |
+
"salary": "250-300元/天",
|
| 24 |
+
"tags": ["LLM", "PyTorch", "NLP", "模型微调", "AIGC"],
|
| 25 |
+
"description": "参与大语言模型的训练与推理优化,负责数据清洗、Prompt工程、模型评测以及AIGC相关能力的落地探索。",
|
| 26 |
+
"requirements": "2026届硕士及以上学历,人工智能/计算机相关专业;熟悉Transformer架构和PyTorch框架;有NLP/CV方向顶会论文或开源项目贡献者优先。",
|
| 27 |
+
"expectation_signals": [
|
| 28 |
+
{"tag": "加班强度大", "evidence": "字节跳动以快速迭代和高强度工作节奏著称", "confidence": 0.80},
|
| 29 |
+
{"tag": "AI前沿方向", "evidence": "LLM训练与推理优化处于AI技术最前沿", "confidence": 0.90},
|
| 30 |
+
{"tag": "待遇优厚", "evidence": "250-300元/天在算法实习岗位中极具竞争力", "confidence": 0.85},
|
| 31 |
+
{"tag": "技术驱动文化", "evidence": "字节跳动重视技术投入,AI团队资源充足", "confidence": 0.85}
|
| 32 |
+
]
|
| 33 |
+
},
|
| 34 |
+
{
|
| 35 |
+
"id": "job_003",
|
| 36 |
+
"name": "前端开发实习生",
|
| 37 |
+
"company": "阿里巴巴",
|
| 38 |
+
"city": "杭州",
|
| 39 |
+
"salary": "200-250元/天",
|
| 40 |
+
"tags": ["React", "TypeScript", "Node.js", "Webpack", "CSS"],
|
| 41 |
+
"description": "负责淘宝/天猫商家端PC及移动端H5页面开发,参与组件库建设与性能优化,推动前端工程化与自动化测试落地。",
|
| 42 |
+
"requirements": "2026届本科及以上学历,计算机相关专业;熟悉HTML/CSS/JavaScript及React框架;了解前端构建工具链;有跨端开发经验者优先。",
|
| 43 |
+
"expectation_signals": [
|
| 44 |
+
{"tag": "大促期间加班多", "evidence": "阿里大促期间前端需随时待命保障页面稳定", "confidence": 0.70},
|
| 45 |
+
{"tag": "技术沉淀深厚", "evidence": "阿里前端技术生态成熟,具有业界领先的组件库体系", "confidence": 0.80},
|
| 46 |
+
{"tag": "待遇中等偏上", "evidence": "200-250元/天在前端实习中属于中等偏上", "confidence": 0.75},
|
| 47 |
+
{"tag": "高流量业务场景", "evidence": "淘宝/天猫商家端服务千万级商家,流量巨大", "confidence": 0.85}
|
| 48 |
+
]
|
| 49 |
+
},
|
| 50 |
+
{
|
| 51 |
+
"id": "job_004",
|
| 52 |
+
"name": "产品经理实习生",
|
| 53 |
+
"company": "美团",
|
| 54 |
+
"city": "北京",
|
| 55 |
+
"salary": "180-220元/天",
|
| 56 |
+
"tags": ["用户研究", "数据分析", "PRD", "竞品分析", "Axure"],
|
| 57 |
+
"description": "负责到店餐饮业务线产品需求分析,输出PRD并跟进开发迭代,通过用户调研和数据埋点驱动产品体验优化。",
|
| 58 |
+
"requirements": "2026届本科及以上学历,专业不限;具备出色的逻辑分析能力和用户同理心;有互联网产品实习经验或独立上线产品项目者优先。",
|
| 59 |
+
"expectation_signals": [
|
| 60 |
+
{"tag": "业务节奏快", "evidence": "美团到店餐饮业务竞争激烈,产品迭代速度快", "confidence": 0.70},
|
| 61 |
+
{"tag": "数据驱动文化", "evidence": "美团以数据分析驱动决策著称,产品岗位需强数据能力", "confidence": 0.85},
|
| 62 |
+
{"tag": "待遇行业中等", "evidence": "180-220元/天属于产品实习岗位中等水平", "confidence": 0.70},
|
| 63 |
+
{"tag": "核心业务线", "evidence": "到店餐饮是美团核心业务之一,成长空间大", "confidence": 0.80}
|
| 64 |
+
]
|
| 65 |
+
},
|
| 66 |
+
{
|
| 67 |
+
"id": "job_005",
|
| 68 |
+
"name": "数据分析实习生",
|
| 69 |
+
"company": "快手",
|
| 70 |
+
"city": "北京",
|
| 71 |
+
"salary": "200-250元/天",
|
| 72 |
+
"tags": ["SQL", "Python", "Tableau", "AB实验", "数据建模"],
|
| 73 |
+
"description": "负责快手主站DAU增长方向的数据监控与归因分析,搭建AB实验指标体系,产出业务洞察报告辅助运营决策。",
|
| 74 |
+
"requirements": "2026届本科及以上学历,统计学/数学/计算机相关专业;精通SQL和Python数据分���库;有海量数据处理经验;熟悉因果推断方法者优先。",
|
| 75 |
+
"expectation_signals": [
|
| 76 |
+
{"tag": "工作节奏较快", "evidence": "快手增长团队工作节奏快,数据产出时效性要求高", "confidence": 0.65},
|
| 77 |
+
{"tag": "数据导向文化", "evidence": "快手高度重视数据驱动业务决策,数据岗位话语权强", "confidence": 0.85},
|
| 78 |
+
{"tag": "待遇中等偏上", "evidence": "200-250元/天在数据分析实习中属于较高水平", "confidence": 0.75},
|
| 79 |
+
{"tag": "核心业务指标", "evidence": "DAU增长方向直接关系公司核心KPI", "confidence": 0.85}
|
| 80 |
+
]
|
| 81 |
+
},
|
| 82 |
+
{
|
| 83 |
+
"id": "job_006",
|
| 84 |
+
"name": "客户端开发实习生",
|
| 85 |
+
"company": "百度",
|
| 86 |
+
"city": "北京",
|
| 87 |
+
"salary": "200-250元/天",
|
| 88 |
+
"tags": ["Android", "Kotlin", "性能优化", "Jetpack", "Gradle"],
|
| 89 |
+
"description": "参与百度App Android端的功能开发与性能优化,负责模块化架构下的需求迭代、启动速度优化及崩溃率治理。",
|
| 90 |
+
"requirements": "2026届本科及以上学历,计算机相关专业;熟悉Android开发及Kotlin/Java语言;了解常用性能分析工具;有开源Android项目者优先。",
|
| 91 |
+
"expectation_signals": [
|
| 92 |
+
{"tag": "核心产品维护任务重", "evidence": "百度App用户量巨大,性能优化工作持续不断", "confidence": 0.70},
|
| 93 |
+
{"tag": "技术积累深厚", "evidence": "百度Android技术团队积累了大量的性能优化经验", "confidence": 0.80},
|
| 94 |
+
{"tag": "待遇中等偏上", "evidence": "200-250元/天在客户端实习中较为优厚", "confidence": 0.75},
|
| 95 |
+
{"tag": "大规模用户场景", "evidence": "百度App服务亿万用户,技术挑战大", "confidence": 0.85}
|
| 96 |
+
]
|
| 97 |
+
},
|
| 98 |
+
{
|
| 99 |
+
"id": "job_007",
|
| 100 |
+
"name": "测试开发实习生",
|
| 101 |
+
"company": "网易",
|
| 102 |
+
"city": "广州",
|
| 103 |
+
"salary": "180-220元/天",
|
| 104 |
+
"tags": ["自动化测试", "Python", "Selenium", "CI/CD", "接口测试"],
|
| 105 |
+
"description": "负责网易游戏周边产品的质量保障体系建设,设计和实现接口自动化与UI自动化用例,推动流水线集成与测试左移。",
|
| 106 |
+
"requirements": "2026届本科及以上学历,计算机相关专业;熟悉Python及至少一种自动化测试框架;了解CI/CD流程;有游戏测试经验者优先。",
|
| 107 |
+
"expectation_signals": [
|
| 108 |
+
{"tag": "阶段性加班", "evidence": "游戏行业上线前测试密集,版本节点需加班", "confidence": 0.60},
|
| 109 |
+
{"tag": "重视质量文化", "evidence": "网易游戏周边产品质量保障体系完善", "confidence": 0.80},
|
| 110 |
+
{"tag": "待遇行业中等", "evidence": "180-220元/天属于测试岗位中等水平", "confidence": 0.70},
|
| 111 |
+
{"tag": "测试体系建设", "evidence": "从零建设质量保障体系,锻炼系统化思维", "confidence": 0.80}
|
| 112 |
+
]
|
| 113 |
+
},
|
| 114 |
+
{
|
| 115 |
+
"id": "job_008",
|
| 116 |
+
"name": "运维开发实习生",
|
| 117 |
+
"company": "小红书",
|
| 118 |
+
"city": "上海",
|
| 119 |
+
"salary": "200-250元/天",
|
| 120 |
+
"tags": ["Kubernetes", "Docker", "Prometheus", "Terraform", "Shell"],
|
| 121 |
+
"description": "负责小红书推荐系统SRE工作,参与容器化部署改造、监控告警规则配置及运维自动化脚本开发,保障线上服务高可用。",
|
| 122 |
+
"requirements": "2026届本科及以上学历,计算机相关专业;熟悉Linux操作系统和容器技术;了解监控与日志系统;有大规模集群运维经验者优先。",
|
| 123 |
+
"expectation_signals": [
|
| 124 |
+
{"tag": "需值班响应", "evidence": "SRE岗位需24小时值班,紧急情况及时响应", "confidence": 0.75},
|
| 125 |
+
{"tag": "DevOps文化深厚", "evidence": "小红书技术团队DevOps实践成熟,自动化程度高", "confidence": 0.80},
|
| 126 |
+
{"tag": "待遇中等偏上", "evidence": "200-250元/天在运维岗位中属于较高水平", "confidence": 0.75},
|
| 127 |
+
{"tag": "核心基础设施", "evidence": "推荐系统SRE保障公司核心业务的高可用", "confidence": 0.85}
|
| 128 |
+
]
|
| 129 |
+
},
|
| 130 |
+
{
|
| 131 |
+
"id": "job_009",
|
| 132 |
+
"name": "运营实习生",
|
| 133 |
+
"company": "B站",
|
| 134 |
+
"city": "上海",
|
| 135 |
+
"salary": "150-200元/天",
|
| 136 |
+
"tags": ["内容运营", "社群运营", "数据分析", "活动策划", "PS"],
|
| 137 |
+
"description": "负责B站知识区创作者运营,制定社群运营策略并落地创作者拉新与活跃活动,通过数据复盘优化运营SOP。",
|
| 138 |
+
"requirements": "2026届本科及以上学历,专业不限;B站重度用户,熟悉站内生态和UP主文化;有较强的文案和活动策划能力;有社群运营实习经验者优先。",
|
| 139 |
+
"expectation_signals": [
|
| 140 |
+
{"tag": "活动节点较忙", "evidence": "活动运营期间工作节奏较快,需多线程推进", "confidence": 0.55},
|
| 141 |
+
{"tag": "年轻化社区氛围", "evidence": "B站内容运营团队年轻有活力,氛围轻松", "confidence": 0.85},
|
| 142 |
+
{"tag": "待遇偏低", "evidence": "150-200元/天在实习岗位中处于偏低水平", "confidence": 0.60},
|
| 143 |
+
{"tag": "核心运营岗位", "evidence": "知识区创作者运营直接服务B站核心内容生态", "confidence": 0.80}
|
| 144 |
+
]
|
| 145 |
+
},
|
| 146 |
+
{
|
| 147 |
+
"id": "job_010",
|
| 148 |
+
"name": "游戏开发实习生",
|
| 149 |
+
"company": "米哈游",
|
| 150 |
+
"city": "上海",
|
| 151 |
+
"salary": "250-300元/天",
|
| 152 |
+
"tags": ["Unity", "C#", "渲染管线", "性能优化", "Shader"],
|
| 153 |
+
"description": "参与米哈游在研项目的游戏客户端功能开发,负责战斗系统模块迭代、渲染效果调优及移动端性能优化。",
|
| 154 |
+
"requirements": "2026届本科及以上学历,计算机/图形学相关专业;熟悉Unity引擎和C#开发;了解渲染管线与GPU调试;有Game Jam或独立游戏作品者优先。",
|
| 155 |
+
"expectation_signals": [
|
| 156 |
+
{"tag": "加班较为常见", "evidence": "米哈游项目研发周期紧张,游戏行业加班普遍", "confidence": 0.80},
|
| 157 |
+
{"tag": "追求极致品质", "evidence": "米哈游以技术和内容品质著称,对交付质量要求极高", "confidence": 0.90},
|
| 158 |
+
{"tag": "待遇行业较高", "evidence": "250-300元/天在游戏开发实习中属于较高水平", "confidence": 0.85},
|
| 159 |
+
{"tag": "核心技术岗位", "evidence": "战斗系统与渲染性能是游戏核心体验的关键", "confidence": 0.90}
|
| 160 |
+
]
|
| 161 |
+
},
|
| 162 |
+
{
|
| 163 |
+
"id": "job_011",
|
| 164 |
+
"name": "后端开发实习生(Java)",
|
| 165 |
+
"company": "字节跳动",
|
| 166 |
+
"city": "北京",
|
| 167 |
+
"salary": "250-300元/天",
|
| 168 |
+
"tags": ["Java", "Spring Boot", "微服务", "MySQL", "Kafka", "Redis"],
|
| 169 |
+
"description": "参与字节跳动抖音电商后端服务开发,负责订单、支付等核心链路的迭代优化,支撑高并发秒杀场景下的系统稳定性。",
|
| 170 |
+
"requirements": "2026届本科及以上学历,计算机相关专业;熟悉Java及Spring Boot框架;了解分布式系统基本原理;有高并发项目经验者优先。",
|
| 171 |
+
"expectation_signals": [
|
| 172 |
+
{"tag": "加班强度高", "evidence": "抖音电商业务快速扩张,研发节奏极快", "confidence": 0.85},
|
| 173 |
+
{"tag": "核心业务线", "evidence": "电商是字节跳动战略级业务,资源倾斜明显", "confidence": 0.90},
|
| 174 |
+
{"tag": "待遇优厚", "evidence": "250-300元/天处于后端实习的顶尖水平", "confidence": 0.85},
|
| 175 |
+
{"tag": "海量并发场景", "evidence": "抖音电商服务亿万用户,秒杀场景极其挑战", "confidence": 0.90}
|
| 176 |
+
]
|
| 177 |
+
},
|
| 178 |
+
{
|
| 179 |
+
"id": "job_012",
|
| 180 |
+
"name": "数据平台开发实习生",
|
| 181 |
+
"company": "蚂蚁集团",
|
| 182 |
+
"city": "杭州",
|
| 183 |
+
"salary": "200-280元/天",
|
| 184 |
+
"tags": ["Flink", "Spark", "Hadoop", "Kafka", "SQL", "Java"],
|
| 185 |
+
"description": "参与蚂蚁集团数据中台建设,负责实时计算管线的开发与优化,保障百亿级数据量的离线与实时处理链路稳定运行。",
|
| 186 |
+
"requirements": "2026届本科及以上学历,计算机/数学相关专业;熟悉Java/Scala;了解大数据生态组件(Flink/Spark/Hive);有数据仓库建模经验者优先。",
|
| 187 |
+
"expectation_signals": [
|
| 188 |
+
{"tag": "业务稳定性要求高", "evidence": "金融级数据平台的稳定性直接关系到核心交易链路", "confidence": 0.85},
|
| 189 |
+
{"tag": "大数据技术深度", "evidence": "蚂蚁数据中台具备业界顶级的大数据技术积累", "confidence": 0.90},
|
| 190 |
+
{"tag": "待遇优厚", "evidence": "200-280元/天在大数据岗位中属于较高水平", "confidence": 0.80},
|
| 191 |
+
{"tag": "核心基础设施", "evidence": "数据中台支撑全集团的数据业务决策", "confidence": 0.85}
|
| 192 |
+
]
|
| 193 |
+
},
|
| 194 |
+
{
|
| 195 |
+
"id": "job_013",
|
| 196 |
+
"name": "全栈开发实习生",
|
| 197 |
+
"company": "华为",
|
| 198 |
+
"city": "武汉",
|
| 199 |
+
"salary": "200-250元/天",
|
| 200 |
+
"tags": ["React", "TypeScript", "Node.js", "Python", "Docker", "PostgreSQL"],
|
| 201 |
+
"description": "参与华为云DevOps平台的全栈开发,负责前端界面交互、后端API设计及云服务部署,推动内部工具的平台化升级。",
|
| 202 |
+
"requirements": "2026届本科及以上学历,计算机相关专业;同时具备前端(React/TypeScript)和后端(Node.js/Python)开发能力;有全栈项目经验者优先。",
|
| 203 |
+
"expectation_signals": [
|
| 204 |
+
{"tag": "项目周期相对可控", "evidence": "内部工具平台开发节奏相比核心业务略为平稳", "confidence": 0.60},
|
| 205 |
+
{"tag": "技术栈全面", "evidence": "可接触前后端+云服务全套技术栈", "confidence": 0.85},
|
| 206 |
+
{"tag": "内部转正机会高", "evidence": "华为云实习生转正率较高,表现优秀可留用", "confidence": 0.80},
|
| 207 |
+
{"tag": "武汉性价比高", "evidence": "武汉生活成本远低于北上深,实习工资购买力强", "confidence": 0.75}
|
| 208 |
+
]
|
| 209 |
+
},
|
| 210 |
+
{
|
| 211 |
+
"id": "job_014",
|
| 212 |
+
"name": "推荐系统开发实习生",
|
| 213 |
+
"company": "快手",
|
| 214 |
+
"city": "北京",
|
| 215 |
+
"salary": "250-300元/天",
|
| 216 |
+
"tags": ["C++", "Python", "推荐算法", "TensorFlow", "Spark", "特征工程"],
|
| 217 |
+
"description": "负责快手主站推荐系统的特征工程与模型serving优化,参与召回/排序/重排全链路迭代,提升核心内容消费指标。",
|
| 218 |
+
"requirements": "2026届硕士及以上学历,计算机/机器学习相关专业;熟悉C++或Python,了解常用推荐算法(FM/DeepFM/DIN);有推荐系统实习经验者优先。",
|
| 219 |
+
"expectation_signals": [
|
| 220 |
+
{"tag": "技术密集型岗位", "evidence": "推荐系统是快手最核心的技术方向,投入巨大", "confidence": 0.90},
|
| 221 |
+
{"tag": "加班强度较大", "evidence": "推荐算法团队每周多次实验迭代,节奏快", "confidence": 0.75},
|
| 222 |
+
{"tag": "待遇行业顶级", "evidence": "250-300元/天是算法岗位中的高薪水平", "confidence": 0.85},
|
| 223 |
+
{"tag": "核心业务影响力", "evidence": "推荐效果直接决定快手DAU和使用时长", "confidence": 0.90}
|
| 224 |
+
]
|
| 225 |
+
},
|
| 226 |
+
{
|
| 227 |
+
"id": "job_015",
|
| 228 |
+
"name": "安全工程师实习生",
|
| 229 |
+
"company": "奇安信",
|
| 230 |
+
"city": "北京",
|
| 231 |
+
"salary": "200-250元/天",
|
| 232 |
+
"tags": ["渗透测试", "Web安全", "Python", "Burp Suite", "SQL注入"],
|
| 233 |
+
"description": "参与奇安信安全服务项目,负责Web应用渗透测试、漏洞挖掘与复现、安全报告编写,支撑国家级安全保障活动。",
|
| 234 |
+
"requirements": "2026届本科及以上学历,信息安全/计算机相关专业;熟悉OWASP Top 10漏洞原理;至少有1次CTF或漏洞挖掘实战经历;持有CISP-PTE认证者优先。",
|
| 235 |
+
"expectation_signals": [
|
| 236 |
+
{"tag": "项目节奏明显", "evidence": "安全服务项目按合同交付,节点性加班", "confidence": 0.60},
|
| 237 |
+
{"tag": "国家项目经验", "evidence": "有机会参与国家级安全保障活动,履历含金量高", "confidence": 0.85},
|
| 238 |
+
{"tag": "待遇中等偏上", "evidence": "200-250元/天在安全岗位中处于较好水平", "confidence": 0.75},
|
| 239 |
+
{"tag": "实战能力锻炼", "evidence": "大量真实攻防场景,技术成长极快", "confidence": 0.90}
|
| 240 |
+
]
|
| 241 |
+
},
|
| 242 |
+
{
|
| 243 |
+
"id": "job_016",
|
| 244 |
+
"name": "AI产品经理实习生",
|
| 245 |
+
"company": "百度",
|
| 246 |
+
"city": "北京",
|
| 247 |
+
"salary": "180-220元/天",
|
| 248 |
+
"tags": ["AI产品", "数据分析", "用户调研", "PRD", "AIGC"],
|
| 249 |
+
"description": "参与百度文心一言的AI产品能力建设,负责竞品分析、用户需求调研及产品功能定义,推动模型能力的场景化落地。",
|
| 250 |
+
"requirements": "2026届本科及以上学历,专业不限;对大模型产品有深度使用经验和独到理解;有数据分析能力(SQL/Python);有AI相关产品实习经验者优先。",
|
| 251 |
+
"expectation_signals": [
|
| 252 |
+
{"tag": "AI前沿领域", "evidence": "文心一言是百度AI战略的核心产品", "confidence": 0.90},
|
| 253 |
+
{"tag": "节奏紧凑", "evidence": "大模型行业竞争白热化,产品迭代频率极高", "confidence": 0.75},
|
| 254 |
+
{"tag": "待遇中等", "evidence": "180-220元/天在产品实习中属于一般水平", "confidence": 0.65},
|
| 255 |
+
{"tag": "技术理解要求高", "evidence": "AI产品经理需比普通PM更深入的技术理解力", "confidence": 0.80}
|
| 256 |
+
]
|
| 257 |
+
},
|
| 258 |
+
{
|
| 259 |
+
"id": "job_017",
|
| 260 |
+
"name": "DevOps开发实习生",
|
| 261 |
+
"company": "腾讯",
|
| 262 |
+
"city": "深圳",
|
| 263 |
+
"salary": "200-250元/天",
|
| 264 |
+
"tags": ["Docker", "Kubernetes", "Terraform", "CI/CD", "Python", "Linux"],
|
| 265 |
+
"description": "负责腾讯云TKE容器服务的运维工具开发,参与云原生监控告警系统的建设,提升Kubernetes集群的运维自动化水平。",
|
| 266 |
+
"requirements": "2026届本科及以上学历,计算机相关专业;熟悉Linux和容器技术;有Kubernetes集群操作经验;有Go或Python开发能力者优先。",
|
| 267 |
+
"expectation_signals": [
|
| 268 |
+
{"tag": "需on-call值班", "evidence": "云原生基础设施岗位需7x24小时响应机制", "confidence": 0.80},
|
| 269 |
+
{"tag": "云原生前沿技术", "evidence": "Kubernetes/Terraform是当前基础设施方向的核心技术栈", "confidence": 0.90},
|
| 270 |
+
{"tag": "待遇较高", "evidence": "200-250元/天在运维开发岗位中属于较高水平", "confidence": 0.75},
|
| 271 |
+
{"tag": "大规模集群管理", "evidence": "腾讯云管理数百万核的Kubernetes集群", "confidence": 0.90}
|
| 272 |
+
]
|
| 273 |
+
},
|
| 274 |
+
{
|
| 275 |
+
"id": "job_018",
|
| 276 |
+
"name": "硬件开发实习生",
|
| 277 |
+
"company": "大疆",
|
| 278 |
+
"city": "深圳",
|
| 279 |
+
"salary": "200-300元/天",
|
| 280 |
+
"tags": ["嵌入式", "C", "RTOS", "I2C", "SPI", "PCB设计"],
|
| 281 |
+
"description": "参与大疆无人机飞控系统的硬件驱动开发与调优,负责传感器数据采集、电机控制算法的嵌入式实现及硬件调试。",
|
| 282 |
+
"requirements": "2026届本科及以上学历,电子/自动化/计算机相关专业;熟悉C语言和嵌入式开发(STM32/FreeRTOS);了解常用通信协议(I2C/SPI/UART);有RoboMaster或电子设计竞赛经历者优先。",
|
| 283 |
+
"expectation_signals": [
|
| 284 |
+
{"tag": "研发导向重技术", "evidence": "大疆以技术驱动产品创新,研发投入占比很高", "confidence": 0.85},
|
| 285 |
+
{"tag": "硬件调试节奏波动大", "evidence": "硬件开发在流片和测试阶段需集中攻关", "confidence": 0.65},
|
| 286 |
+
{"tag": "待遇行业较好", "evidence": "200-300元/天在硬件实习中属于上等水平", "confidence": 0.80},
|
| 287 |
+
{"tag": "核心技术岗位", "evidence": "飞控系统是无人机最核心的技术壁垒", "confidence": 0.90}
|
| 288 |
+
]
|
| 289 |
+
},
|
| 290 |
+
{
|
| 291 |
+
"id": "job_019",
|
| 292 |
+
"name": "算法研究实习生(大模型方向)",
|
| 293 |
+
"company": "DeepSeek",
|
| 294 |
+
"city": "杭州",
|
| 295 |
+
"salary": "300-400元/天",
|
| 296 |
+
"tags": ["PyTorch", "Transformer", "CUDA", "分布式训练", "模型压缩", "RLHF"],
|
| 297 |
+
"description": "参与大语言模型的预训练与对齐算法研究,负责模型训练流程优化、RLHF算法实现及推理加速,探索下一代模型架构。",
|
| 298 |
+
"requirements": "2026届硕士及以上学历(博士优先),人工智能/计算机相关专业;有AI顶会论文(NeurIPS/ICML/ACL等);精通PyTorch及分布式训练框架;有LLM训练经验者优先。",
|
| 299 |
+
"expectation_signals": [
|
| 300 |
+
{"tag": "学术导向极强", "evidence": "该岗位要求顶会论文,以发表研究成果为主要目标", "confidence": 0.90},
|
| 301 |
+
{"tag": "研究氛围浓厚", "evidence": "DeepSeek团队以年轻研究员为主,学术交流频繁", "confidence": 0.85},
|
| 302 |
+
{"tag": "待遇行业顶尖", "evidence": "300-400元/天是所有实习岗位中的天花板水平", "confidence": 0.90},
|
| 303 |
+
{"tag": "算力资源充足", "evidence": "拥有大规模GPU集群,支持前沿研究探索", "confidence": 0.95}
|
| 304 |
+
]
|
| 305 |
+
},
|
| 306 |
+
{
|
| 307 |
+
"id": "job_020",
|
| 308 |
+
"name": "技术产品运营实习生",
|
| 309 |
+
"company": "小红书",
|
| 310 |
+
"city": "上海",
|
| 311 |
+
"salary": "180-220元/天",
|
| 312 |
+
"tags": ["用户增长", "AB实验", "数据分析", "SQL", "内容运营"],
|
| 313 |
+
"description": "负责小红书搜索产品的用户增长策略制定与落地,通过数据分析和AB实验优化搜索引导和推荐策略,提升搜索渗透率。",
|
| 314 |
+
"requirements": "2026届本科及以上学历,专业不限;具备SQL数据提取和分析能力;有产品运营或用户增长实习经验者优先;小红书重度用户加分。",
|
| 315 |
+
"expectation_signals": [
|
| 316 |
+
{"tag": "数据驱动要求高", "evidence": "该岗位以AB实验和数据分析为日常核心工作", "confidence": 0.80},
|
| 317 |
+
{"tag": "节奏较快", "evidence": "用户增长团队需持续追赶增长目标,节奏紧凑", "confidence": 0.70},
|
| 318 |
+
{"tag": "待遇中等", "evidence": "180-220元/天在运营岗中属于一般水平", "confidence": 0.65},
|
| 319 |
+
{"tag": "核心业务方向", "evidence": "搜索是小红书用户获取信息的主要入口,战略地位高", "confidence": 0.85}
|
| 320 |
+
]
|
| 321 |
+
},
|
| 322 |
+
{
|
| 323 |
+
"id": "job_021",
|
| 324 |
+
"name": "产品经理实习生",
|
| 325 |
+
"company": "腾讯",
|
| 326 |
+
"city": "深圳",
|
| 327 |
+
"salary": "180-220元/天",
|
| 328 |
+
"tags": ["用户调研", "数据分析", "PRD", "Axure", "需求分析"],
|
| 329 |
+
"description": "负责腾讯云产品线的需求收集与PRD输出,协调前后端与设计团队推进需求落地,通过数据埋点验证产品迭代效果。",
|
| 330 |
+
"requirements": "2026届本科及以上学历,专业不限;具备良好的逻辑能力和沟通协调能力;有互联网产品实习经验者优先;有技术背景或ToB产品经验者加分。",
|
| 331 |
+
"expectation_signals": [
|
| 332 |
+
{"tag": "985/211院校偏好", "evidence": "腾讯产品岗简历池竞争激烈,HR会优先筛选985/211院校学生", "confidence": 0.85},
|
| 333 |
+
{"tag": "实习经历硬门槛", "evidence": "产品岗几乎不招收零实习经历的学生,至少有一段互联网公司实习", "confidence": 0.90},
|
| 334 |
+
{"tag": "行业经验匹配度高", "evidence": "有云服务或ToB产品实习经验的候选人会优先进入面试", "confidence": 0.80},
|
| 335 |
+
{"tag": "逻辑表达能力要求高", "evidence": "PRD质量直接反映候选人的逻辑思维和书面表达能力", "confidence": 0.85}
|
| 336 |
+
]
|
| 337 |
+
},
|
| 338 |
+
{
|
| 339 |
+
"id": "job_022",
|
| 340 |
+
"name": "内容运营实习生",
|
| 341 |
+
"company": "字节跳动",
|
| 342 |
+
"city": "北京",
|
| 343 |
+
"salary": "150-200元/天",
|
| 344 |
+
"tags": ["内容策划", "社群运营", "数据分析", "PS", "文案撰写"],
|
| 345 |
+
"description": "负责抖音生活服务内容运营,策划话题活动与达人合作方案,通过内容数据分析和用户反馈持续优化运营策略。",
|
| 346 |
+
"requirements": "2026届本科及以上学历,新闻传播/中文/市场营销相关专业优先;具备优秀的文案能力和内容敏感度;熟练使用PS/剪映等工具;有自媒体或内容运营经验者优先。",
|
| 347 |
+
"expectation_signals": [
|
| 348 |
+
{"tag": "专业背景偏好", "evidence": "HR会优先看新闻传播/中文/市场营销等文科专业简历", "confidence": 0.75},
|
| 349 |
+
{"tag": "作品集是加分项", "evidence": "有个人公众号/小红书账号或短视频作品集的候选人更受青睐", "confidence": 0.85},
|
| 350 |
+
{"tag": "工具技能基础门槛", "evidence": "PS/剪映等工具是内容运营的基础能力,HR会留意技能关键词", "confidence": 0.80},
|
| 351 |
+
{"tag": "平台熟悉度隐性要求", "evidence": "重度抖音用户更容易理解平台生态和内容调性", "confidence": 0.75}
|
| 352 |
+
]
|
| 353 |
+
},
|
| 354 |
+
{
|
| 355 |
+
"id": "job_023",
|
| 356 |
+
"name": "品牌营销实习生",
|
| 357 |
+
"company": "宝洁",
|
| 358 |
+
"city": "广州",
|
| 359 |
+
"salary": "180-220元/天",
|
| 360 |
+
"tags": ["品牌策划", "市场调研", "活动执行", "PPT", "数据整理"],
|
| 361 |
+
"description": "参与宝洁大中华区洗护品牌的营销战役策划,协助完成竞品分析、消费者洞察报告以及线下推广活动的落地执行与效果复盘。",
|
| 362 |
+
"requirements": "2026届本科及以上学历,市场营销/广告/商科相关专业优先;出色的PPT制作与表达能力;有快消或广告公司实习经历者优先;英语读写流利。",
|
| 363 |
+
"expectation_signals": [
|
| 364 |
+
{"tag": "英语能力硬指标", "evidence": "外企HR会重点看四六级/雅思成绩,英语能力是简历初筛红线", "confidence": 0.90},
|
| 365 |
+
{"tag": "商科专业背景偏好", "evidence": "市场营销和商科专业出身的简历通过率远高于其他专业", "confidence": 0.80},
|
| 366 |
+
{"tag": "实习经历相关度", "evidence": "有快消或4A广告公司实习经历是简历亮点,HR重点关注", "confidence": 0.85},
|
| 367 |
+
{"tag": "逻辑表达与数据分析并重", "evidence": "快消营销越来越依赖数据驱动,会数据分析的候选人更有竞争力", "confidence": 0.75}
|
| 368 |
+
]
|
| 369 |
+
},
|
| 370 |
+
{
|
| 371 |
+
"id": "job_024",
|
| 372 |
+
"name": "UI/UX设计实习生",
|
| 373 |
+
"company": "网易",
|
| 374 |
+
"city": "杭州",
|
| 375 |
+
"salary": "180-220元/天",
|
| 376 |
+
"tags": ["Figma", "Sketch", "设计系统", "用户研究", "交互设计"],
|
| 377 |
+
"description": "负责网易云音乐产品线的界面设计与交互优化,参与设计系统组件维护,基于用户研究数据输出高保真原型与设计规范文档。",
|
| 378 |
+
"requirements": "2026届本科及以上学历,设计/艺术/人机交互相关专业;精通Figma或Sketch等设计工具;了解设计系统和工作流规范;有完整上线作品者优先。",
|
| 379 |
+
"expectation_signals": [
|
| 380 |
+
{"tag": "作品集是必须项", "evidence": "设计岗HR必看作品集,无作品集直接淘汰,作品集质量决定初筛结果", "confidence": 0.95},
|
| 381 |
+
{"tag": "设计相关专业要求", "evidence": "设计/艺术/人机交互专业为HR筛选时的偏好方向", "confidence": 0.80},
|
| 382 |
+
{"tag": "设计系统理解力", "evidence": "有大厂设计系统参与经验的候选人会被高亮标记", "confidence": 0.80},
|
| 383 |
+
{"tag": "工具掌握是基础分", "evidence": "Figma已是设计行业标配,HR会从技能关键词判断基础能力", "confidence": 0.85}
|
| 384 |
+
]
|
| 385 |
+
},
|
| 386 |
+
{
|
| 387 |
+
"id": "job_025",
|
| 388 |
+
"name": "商业分析实习生",
|
| 389 |
+
"company": "美团",
|
| 390 |
+
"city": "北京",
|
| 391 |
+
"salary": "200-250元/天",
|
| 392 |
+
"tags": ["SQL", "Python", "商业建模", "行业研究", "数据可视化"],
|
| 393 |
+
"description": "负责美团到店事业群的商业分析工作,搭建业务指标体系并产出周报/月报,通过行业对标和用户分层分析驱动业务策略调整。",
|
| 394 |
+
"requirements": "2026届本科及以上学历,统计学/经济学/金融/计算机相关专业;精通SQL和Excel;掌握Python或R进行数据处理和分析;有咨询公司或互联网商业分析实习经历者优先。",
|
| 395 |
+
"expectation_signals": [
|
| 396 |
+
{"tag": "量化背景是硬门槛", "evidence": "HR会优先筛选统计学/经济学等量化背景专业的学生", "confidence": 0.85},
|
| 397 |
+
{"tag": "SQL能力是下限要求", "evidence": "商业分析岗SQL是必选项,无SQL能力的简历直接淘汰", "confidence": 0.90},
|
| 398 |
+
{"tag": "咨询/行研实习加分", "evidence": "有MBB或四大咨询实习经历的候选人会被优先考虑", "confidence": 0.80},
|
| 399 |
+
{"tag": "数据分析案例亮点", "evidence": "简历中如有独立完成的商业分析项目案例会是关键加分项", "confidence": 0.85}
|
| 400 |
+
]
|
| 401 |
+
}
|
| 402 |
+
]
|
offer-puplayer-hf/backend/requirements.txt
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fastapi
|
| 2 |
+
uvicorn
|
| 3 |
+
pydantic
|
| 4 |
+
python-multipart
|
| 5 |
+
pdfplumber
|
| 6 |
+
httpx
|
| 7 |
+
python-dotenv
|
| 8 |
+
sentence-transformers
|
offer-puplayer-hf/frontend/index.html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!doctype html>
|
| 2 |
+
<html lang="zh-CN">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8" />
|
| 5 |
+
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 7 |
+
<title>Offer 捕手 — 求职匹配助手</title>
|
| 8 |
+
</head>
|
| 9 |
+
<body>
|
| 10 |
+
<div id="app"></div>
|
| 11 |
+
<script type="module" src="/src/main.jsx"></script>
|
| 12 |
+
</body>
|
| 13 |
+
</html>
|
offer-puplayer-hf/frontend/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "offer_puplayer_frontend",
|
| 3 |
+
"private": true,
|
| 4 |
+
"version": "0.0.0",
|
| 5 |
+
"type": "module",
|
| 6 |
+
"scripts": {
|
| 7 |
+
"dev": "vite",
|
| 8 |
+
"build": "vite build",
|
| 9 |
+
"preview": "vite preview"
|
| 10 |
+
},
|
| 11 |
+
"devDependencies": {
|
| 12 |
+
"@vitejs/plugin-react": "^6.0.2",
|
| 13 |
+
"typescript": "~6.0.2",
|
| 14 |
+
"vite": "^8.0.12"
|
| 15 |
+
},
|
| 16 |
+
"dependencies": {
|
| 17 |
+
"axios": "^1.17.0",
|
| 18 |
+
"echarts": "^6.1.0",
|
| 19 |
+
"echarts-for-react": "^3.0.6",
|
| 20 |
+
"react": "^19.2.7",
|
| 21 |
+
"react-dom": "^19.2.7",
|
| 22 |
+
"tslib": "^2.8.1"
|
| 23 |
+
}
|
| 24 |
+
}
|
offer-puplayer-hf/frontend/public/favicon.svg
ADDED
|
|
offer-puplayer-hf/frontend/public/icons.svg
ADDED
|
|
offer-puplayer-hf/frontend/src/App.jsx
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { useState, useEffect } from 'react'
|
| 2 |
+
import { confirmResume } from './api'
|
| 3 |
+
import HomePage from './pages/HomePage'
|
| 4 |
+
import RecommendPage from './pages/RecommendPage'
|
| 5 |
+
import DiagnosePage from './pages/DiagnosePage'
|
| 6 |
+
import SuggestPage from './pages/SuggestPage'
|
| 7 |
+
|
| 8 |
+
function App() {
|
| 9 |
+
const [currentPage, setCurrentPage] = useState('recommend')
|
| 10 |
+
const [resumeData, setResumeData] = useState(null)
|
| 11 |
+
const [selectedJobId, setSelectedJobId] = useState(null)
|
| 12 |
+
const [selectedJob, setSelectedJob] = useState(null)
|
| 13 |
+
const [advice, setAdvice] = useState(null)
|
| 14 |
+
const [pendingJobForDiagnose, setPendingJobForDiagnose] = useState(null)
|
| 15 |
+
|
| 16 |
+
useEffect(() => {
|
| 17 |
+
const saved = localStorage.getItem('offer_resume_data')
|
| 18 |
+
if (saved) {
|
| 19 |
+
try { setResumeData(JSON.parse(saved)) } catch {}
|
| 20 |
+
}
|
| 21 |
+
}, [])
|
| 22 |
+
|
| 23 |
+
useEffect(() => {
|
| 24 |
+
if (resumeData) {
|
| 25 |
+
localStorage.setItem('offer_resume_data', JSON.stringify(resumeData))
|
| 26 |
+
}
|
| 27 |
+
}, [resumeData])
|
| 28 |
+
|
| 29 |
+
const goToHome = () => {
|
| 30 |
+
setCurrentPage('home')
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
const goToRecommend = () => {
|
| 34 |
+
setCurrentPage('recommend')
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
const goToDiagnose = (jobId, jobData) => {
|
| 38 |
+
if (!jobId) return
|
| 39 |
+
setSelectedJobId(jobId)
|
| 40 |
+
setSelectedJob(jobData || null)
|
| 41 |
+
setCurrentPage('diagnose')
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
const goToSuggest = (payload) => {
|
| 45 |
+
if (payload?.advice) setAdvice(payload.advice)
|
| 46 |
+
setCurrentPage('suggest')
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
const handleNavDiagnose = () => {
|
| 50 |
+
if (!selectedJobId) return
|
| 51 |
+
setCurrentPage('diagnose')
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
const handleConfirmResume = async (data) => {
|
| 55 |
+
let resolved = data
|
| 56 |
+
try {
|
| 57 |
+
const res = await confirmResume(data)
|
| 58 |
+
if (res.data?.data) {
|
| 59 |
+
resolved = res.data.data
|
| 60 |
+
}
|
| 61 |
+
} catch {}
|
| 62 |
+
setResumeData(resolved)
|
| 63 |
+
if (pendingJobForDiagnose) {
|
| 64 |
+
const { jobId, jobData } = pendingJobForDiagnose
|
| 65 |
+
setPendingJobForDiagnose(null)
|
| 66 |
+
setSelectedJobId(jobId)
|
| 67 |
+
setSelectedJob(jobData || null)
|
| 68 |
+
setCurrentPage('diagnose')
|
| 69 |
+
} else {
|
| 70 |
+
setCurrentPage('recommend')
|
| 71 |
+
}
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
const goHomeFromDiagnose = () => {
|
| 75 |
+
if (selectedJobId && !resumeData) {
|
| 76 |
+
setPendingJobForDiagnose({ jobId: selectedJobId, jobData: selectedJob })
|
| 77 |
+
}
|
| 78 |
+
setCurrentPage('home')
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
const renderNav = () => (
|
| 82 |
+
<nav className="nav-bar">
|
| 83 |
+
<div className="nav-inner">
|
| 84 |
+
<span className="nav-logo" onClick={goToRecommend}>Offer 捕手</span>
|
| 85 |
+
<div className="nav-links">
|
| 86 |
+
<span className={`nav-link${currentPage === 'home' ? ' active' : ''}`} onClick={goToHome}>个人中心</span>
|
| 87 |
+
<span className={`nav-link${currentPage === 'recommend' ? ' active' : ''}`} onClick={goToRecommend}>推荐岗位</span>
|
| 88 |
+
<span className={`nav-link${currentPage === 'diagnose' ? ' active' : ''}`} onClick={handleNavDiagnose}>匹配诊断</span>
|
| 89 |
+
<span className={`nav-link${currentPage === 'suggest' ? ' active' : ''}`} onClick={() => goToSuggest()}>改进建议</span>
|
| 90 |
+
</div>
|
| 91 |
+
</div>
|
| 92 |
+
</nav>
|
| 93 |
+
)
|
| 94 |
+
|
| 95 |
+
const renderPage = () => {
|
| 96 |
+
switch (currentPage) {
|
| 97 |
+
case 'home':
|
| 98 |
+
return <HomePage resumeData={resumeData} onConfirm={handleConfirmResume} onGoRecommend={goToRecommend} />
|
| 99 |
+
case 'recommend':
|
| 100 |
+
return <RecommendPage
|
| 101 |
+
resumeData={resumeData}
|
| 102 |
+
onSelectJob={(jobId, jobData) => goToDiagnose(jobId, jobData)}
|
| 103 |
+
onGoHome={goToHome}
|
| 104 |
+
/>
|
| 105 |
+
case 'diagnose':
|
| 106 |
+
return <DiagnosePage jobId={selectedJobId} jobData={selectedJob} resumeData={resumeData} onComplete={(payload) => goToSuggest(payload)} onBack={() => setCurrentPage('recommend')} onGoHome={goHomeFromDiagnose} />
|
| 107 |
+
case 'suggest':
|
| 108 |
+
return <SuggestPage jobId={selectedJobId} resumeData={resumeData} advice={advice} onBack={() => setCurrentPage('diagnose')} />
|
| 109 |
+
default:
|
| 110 |
+
return <RecommendPage resumeData={resumeData} onSelectJob={(jobId, jobData) => goToDiagnose(jobId, jobData)} />
|
| 111 |
+
}
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
return (
|
| 115 |
+
<div className="app">
|
| 116 |
+
{renderNav()}
|
| 117 |
+
<main className="page-container">{renderPage()}</main>
|
| 118 |
+
</div>
|
| 119 |
+
)
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
export default App
|
offer-puplayer-hf/frontend/src/api/index.js
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import axios from 'axios'
|
| 2 |
+
import { getMockResumeData, getMockJobs, getMockReport, getMockSuggestions } from './mock'
|
| 3 |
+
|
| 4 |
+
const USE_MOCK = false
|
| 5 |
+
|
| 6 |
+
function delay(ms) {
|
| 7 |
+
return new Promise(resolve => setTimeout(resolve, ms))
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
const api = axios.create({
|
| 11 |
+
baseURL: '',
|
| 12 |
+
timeout: 10000,
|
| 13 |
+
})
|
| 14 |
+
|
| 15 |
+
api.interceptors.response.use(
|
| 16 |
+
(response) => response,
|
| 17 |
+
(error) => {
|
| 18 |
+
if (error.response) {
|
| 19 |
+
const status = error.response.status
|
| 20 |
+
if (status >= 500) {
|
| 21 |
+
console.error('服务器错误,请稍后重试')
|
| 22 |
+
} else if (status >= 400) {
|
| 23 |
+
console.error('请求错误,请检查输入')
|
| 24 |
+
}
|
| 25 |
+
} else if (error.request) {
|
| 26 |
+
console.error('网络连接失败,请检查网络')
|
| 27 |
+
}
|
| 28 |
+
return Promise.reject(error)
|
| 29 |
+
}
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
export async function uploadResume(file) {
|
| 33 |
+
if (USE_MOCK) {
|
| 34 |
+
await delay(800)
|
| 35 |
+
return getMockResumeData()
|
| 36 |
+
}
|
| 37 |
+
const formData = new FormData()
|
| 38 |
+
formData.append('file', file)
|
| 39 |
+
return api.post('/api/resume/upload', formData, {
|
| 40 |
+
headers: { 'Content-Type': 'multipart/form-data' },
|
| 41 |
+
})
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
export async function getRecommendJobs(resumeId) {
|
| 45 |
+
if (USE_MOCK) {
|
| 46 |
+
await delay(500)
|
| 47 |
+
return getMockJobs()
|
| 48 |
+
}
|
| 49 |
+
const res = await api.get('/api/jobs/recommend', { params: { resume_id: resumeId } })
|
| 50 |
+
const list = (res.data?.jobs || []).map(job => ({
|
| 51 |
+
...job,
|
| 52 |
+
match_rate: Math.round((job.match_rate || 0) * 100)
|
| 53 |
+
}))
|
| 54 |
+
return { data: { jobs: list } }
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
export async function generateReport(jobId, resumeData) {
|
| 58 |
+
if (USE_MOCK) {
|
| 59 |
+
const encoder = new TextEncoder()
|
| 60 |
+
const report = getMockReport()
|
| 61 |
+
const suggestions = getMockSuggestions()
|
| 62 |
+
const stream = new ReadableStream({
|
| 63 |
+
async start(controller) {
|
| 64 |
+
const events = [
|
| 65 |
+
{ type: 'agent_start', agent: 'agent1' },
|
| 66 |
+
{ type: 'agent_complete', agent: 'agent1', data: { must_have: ['Python', 'Redis', '分布式系统'], nice_to_have: ['Go', '微服务'], position_summary: '后端开发实习生 - 腾讯' } },
|
| 67 |
+
{ type: 'agent_start', agent: 'agent2' },
|
| 68 |
+
{ type: 'agent_complete', agent: 'agent2', data: { dimensions: report.dimensions, total_score: report.total_score, strength: report.strength, gap: report.gap, hr_view: report.hr_view } },
|
| 69 |
+
{ type: 'agent_start', agent: 'agent3' },
|
| 70 |
+
{ type: 'agent_complete', agent: 'agent3', data: suggestions },
|
| 71 |
+
{ type: 'report_complete', data: { jd_parsed: { must_have: ['Python', 'Redis', '分布式系统'], nice_to_have: ['Go', '微服务'], position_summary: '后端开发实习生 - 腾讯' }, match_report: { dimensions: report.dimensions, total_score: report.total_score, strength: report.strength, gap: report.gap, hr_view: report.hr_view }, advice: suggestions } },
|
| 72 |
+
]
|
| 73 |
+
for (const event of events) {
|
| 74 |
+
await delay(600)
|
| 75 |
+
const line = JSON.stringify(event) + '\n'
|
| 76 |
+
controller.enqueue(encoder.encode(line))
|
| 77 |
+
}
|
| 78 |
+
controller.close()
|
| 79 |
+
}
|
| 80 |
+
})
|
| 81 |
+
return { ok: true, body: { getReader: () => stream.getReader() } }
|
| 82 |
+
}
|
| 83 |
+
const body = { job_id: jobId }
|
| 84 |
+
if (resumeData) {
|
| 85 |
+
const normalizeSkills = (s) => typeof s === 'string' ? s : (s.name || s)
|
| 86 |
+
const normalizeProjects = (p) => typeof p === 'string' ? p : (p.name || JSON.stringify(p))
|
| 87 |
+
const normalizeString = (v) => {
|
| 88 |
+
if (typeof v === 'string') return v
|
| 89 |
+
if (v && typeof v === 'object') return v.school || v.name || JSON.stringify(v)
|
| 90 |
+
return ''
|
| 91 |
+
}
|
| 92 |
+
body.resume_data = {
|
| 93 |
+
name: resumeData.name || '',
|
| 94 |
+
school: normalizeString(resumeData.school),
|
| 95 |
+
major: normalizeString(resumeData.major),
|
| 96 |
+
grade: normalizeString(resumeData.grade),
|
| 97 |
+
skills: (resumeData.skills || []).map(normalizeSkills),
|
| 98 |
+
projects: (resumeData.projects || []).map(normalizeProjects),
|
| 99 |
+
summary: resumeData.summary || '',
|
| 100 |
+
experience: resumeData.experience || '',
|
| 101 |
+
education: normalizeString(resumeData.education),
|
| 102 |
+
}
|
| 103 |
+
}
|
| 104 |
+
return fetch('/api/report/generate', {
|
| 105 |
+
method: 'POST',
|
| 106 |
+
headers: { 'Content-Type': 'application/json' },
|
| 107 |
+
body: JSON.stringify(body),
|
| 108 |
+
})
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
export async function rerankReport(jobId, editedResume) {
|
| 112 |
+
if (USE_MOCK) {
|
| 113 |
+
await delay(800)
|
| 114 |
+
return { data: { match_rate: Math.floor(Math.random() * 30) + 60, previous_rate: 62 } }
|
| 115 |
+
}
|
| 116 |
+
return api.post('/api/report/rerank', {
|
| 117 |
+
job_id: jobId,
|
| 118 |
+
edited_resume: editedResume,
|
| 119 |
+
})
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
export async function confirmResume(resumeData) {
|
| 123 |
+
if (USE_MOCK) {
|
| 124 |
+
await delay(300)
|
| 125 |
+
return { data: { success: true, data: resumeData } }
|
| 126 |
+
}
|
| 127 |
+
return api.post('/api/resume/confirm', resumeData)
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
export default api
|
offer-puplayer-hf/frontend/src/api/mock.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const mockJobs = [
|
| 2 |
+
{ job_id: 1, name: '后端开发实习生', company: '腾讯', city: '深圳', salary: '200-250/天', match_rate: 85, tags: ['Python', 'Go', '后端'], description: '负责后端服务开发和维护,参与微服务架构设计', requirements: '熟悉Python/Go,了解分布式系统', expectation_signals: [{"tag":"加班强度大","evidence":"腾讯核心部门普遍加班,尤其是云业务线交付压力大","confidence":0.75},{"tag":"技术氛围浓厚","evidence":"腾讯以技术驱动著称,内部技术分享和开源文化丰富","confidence":0.85},{"tag":"待遇高于行业平均","evidence":"200-250元/天在实习岗位中属于较高水平","confidence":0.8},{"tag":"核心业务参与","evidence":"腾讯云核心服务直接服务于公司战略级业务","confidence":0.85}] },
|
| 3 |
+
{ job_id: 2, name: 'AI算法实习生', company: '字节跳动', city: '北京', salary: '250-300/天', match_rate: 72, tags: ['机器学习', 'Python', '深度学习'], description: '参与推荐系统算法优化,提升推荐准确率', requirements: '熟悉机器学习基础,有相关项目经验优先', expectation_signals: [{"tag":"加班强度大","evidence":"字节跳动以快速迭代和高强度工作节奏著称","confidence":0.8},{"tag":"AI前沿方向","evidence":"LLM训练与推理优化处于AI技术最前沿","confidence":0.9},{"tag":"待遇优厚","evidence":"250-300元/天在算法实习岗位中极具竞争力","confidence":0.85},{"tag":"技术驱动文化","evidence":"字节跳动重视技术投入,AI团队资源充足","confidence":0.85}] },
|
| 4 |
+
{ job_id: 3, name: '前端开发实习生', company: '阿里巴巴', city: '杭州', salary: '200-250/天', match_rate: 68, tags: ['React', 'TypeScript', '前端'], description: '参与中后台系统前端开发', requirements: '熟悉React/Vue,了解前端工程化', expectation_signals: [{"tag":"大促期间加班","evidence":"阿里大促期间前端需随时待命保障页面稳定","confidence":0.7},{"tag":"技术沉淀深厚","evidence":"阿里前端技术生态成熟,具有业界领先的组件库体系","confidence":0.8},{"tag":"待遇中等偏上","evidence":"200-250元/天在前端实习中属于中等偏上","confidence":0.75},{"tag":"高流量业务场景","evidence":"淘宝/天猫商家端服务千万级商家,流量巨大","confidence":0.85}] },
|
| 5 |
+
{ job_id: 4, name: '产品经理实习生', company: '美团', city: '北京', salary: '180-220/天', match_rate: 55, tags: ['产品设计', '数据分析', '用户研究'], description: '负责B端产品功能设计和迭代', requirements: '有产品实习经验优先,逻辑清晰', expectation_signals: [{"tag":"业务竞争激烈","evidence":"美团所处生活服务赛道竞争激烈,产品推进速度要快","confidence":0.7},{"tag":"数据驱动文化","evidence":"美团以数据驱动运营决策著称,产品岗需强分析能力","confidence":0.85},{"tag":"待遇行业中等","evidence":"180-220元/天在产品实习岗位中属中等水平","confidence":0.7},{"tag":"核心业务板块","evidence":"美团到店/外卖是公司核心业务之一,成长空间大","confidence":0.8}] },
|
| 6 |
+
{ job_id: 5, name: '数据分析实习生', company: '快手', city: '北京', salary: '200-250/天', match_rate: 78, tags: ['SQL', 'Python', '数据分析'], description: '负责业务数据分析和报表建设', requirements: '熟练使用SQL和Python,有数据分析项目经验', expectation_signals: [{"tag":"工作节奏较快","evidence":"快手增长团队工作节奏快,数据产出时效性要求高","confidence":0.65},{"tag":"数据导向文化","evidence":"快手高度重视数据驱动业务决策,数据岗位话语权强","confidence":0.85},{"tag":"待遇中等偏上","evidence":"200-250元/天在数据分析实习中属于较高水平","confidence":0.75},{"tag":"核心业务指标","evidence":"DAU增长方向直接关系公司核心KPI","confidence":0.85}] },
|
| 7 |
+
]
|
| 8 |
+
|
| 9 |
+
const mockReport = {
|
| 10 |
+
dimensions: [
|
| 11 |
+
{ name: '技能匹配', score: 80, evidence: { jd_quote: '熟悉Python', resume_quote: '熟练使用Python进行数据处理和模型开发' } },
|
| 12 |
+
{ name: '经验匹配', score: 40, evidence: { jd_quote: '3年以上相关经验', resume_quote: '6个月实习经历' } },
|
| 13 |
+
{ name: '学历匹配', score: 100, evidence: { jd_quote: '计算机相关专业', resume_quote: '计算机科学与技术专业' } },
|
| 14 |
+
{ name: '项目契合', score: 65, evidence: { jd_quote: '有推荐系统经验优先', resume_quote: '课程项目实现了协同过滤推荐算法' } },
|
| 15 |
+
{ name: '软性素质', score: 75, evidence: { jd_quote: '具备团队协作能力', resume_quote: '与3名同学协作完成课程项目' } },
|
| 16 |
+
],
|
| 17 |
+
total_score: 72,
|
| 18 |
+
strength: '技能基础扎实,学历完全符合要求',
|
| 19 |
+
gap: '缺乏全职工作经验,项目深度有待提升',
|
| 20 |
+
hr_view: {
|
| 21 |
+
first_impression: '技能列表与 JD 匹配度高,但项目描述缺乏量化成果,简历整体合格',
|
| 22 |
+
attention_points: [
|
| 23 |
+
{ aspect: '技能栈匹配', finding: 'Python/Flask 完全覆盖 JD 要求', concern: '无' },
|
| 24 |
+
{ aspect: '项目深度', finding: '仅课程项目,无企业级实践', concern: '项目描述偏功能实现,未见性能优化或架构设计' },
|
| 25 |
+
{ aspect: '学历背景', finding: '985 计算机专业,符合门槛', concern: '无' },
|
| 26 |
+
],
|
| 27 |
+
hr_concern_level: 'medium',
|
| 28 |
+
screen_summary: '简历整体合格,项目深度是最大短板,建议补充量化成果',
|
| 29 |
+
},
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
const mockSuggestions = {
|
| 33 |
+
rewrite_suggestions: [
|
| 34 |
+
{ dimension: '项目契合', issue: '项目描述侧重原理,未体现工程落地能力', original: '使用协同过滤算法实现推荐系统', suggestion: '独立设计并实现基于协同过滤的推荐系统,使用Python+Flask搭建Web服务,处理了10000+用户行为数据,推荐准确率达到85%', reason: 'JD偏向工程落地,HR更关注实际产出而非原理' },
|
| 35 |
+
{ dimension: '技能匹配', issue: 'JD要求Redis但简历未提及', original: '无', suggestion: '在技能列表或项目描述中补充Redis使用经验,如"使用Redis缓存热点数据,查询响应时间降低60%"', reason: 'Redis是JD明确要求的技能,不提及会被直接筛掉' },
|
| 36 |
+
],
|
| 37 |
+
interview_tips: [
|
| 38 |
+
{ topic: 'Redis缓存', reason: 'JD要求熟悉Redis但简历未提及', tip: '准备Redis基础数据结构、缓存穿透/击穿/雪崩、在推荐系统中如何使用缓存' },
|
| 39 |
+
{ topic: '项目深挖', reason: '项目描述较浅', tip: '准备:项目的技术选型原因、遇到的难点和解决方案、如果重做会怎么改进' },
|
| 40 |
+
],
|
| 41 |
+
encouragement: '你的专业背景和技能基础与岗位匹配度不错,只需在项目描述上做针对性调整,命中率会明显提升',
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
const mockResumeData = {
|
| 45 |
+
name: '张三',
|
| 46 |
+
school: '华南理工大学',
|
| 47 |
+
major: '计算机科学与技术',
|
| 48 |
+
grade: '研二',
|
| 49 |
+
skills: ['Python', 'Java', 'SQL', 'PyTorch', 'Flask'],
|
| 50 |
+
projects: [
|
| 51 |
+
{ name: '基于协同过滤的推荐系统', desc: '使用协同过滤算法实现电影推荐,处理了MovieLens数据集' },
|
| 52 |
+
{ name: '在线商城后端开发', desc: '使用Spring Boot实现RESTful API,包括用户管理、商品管理模块' },
|
| 53 |
+
],
|
| 54 |
+
experience: '在字节跳动有过6个月后端开发实习经历,参与推荐系统数据管道维护',
|
| 55 |
+
education: { school: '华南理工大学', major: '计算机科学与技术', degree: '硕士', startYear: '2023', endYear: '2025' },
|
| 56 |
+
summary: '技术栈集中在Python/Java后端开发,有推荐系统和Web开发项目经验,适合投递后端开发/算法类岗位',
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
export function getMockResumeData() {
|
| 60 |
+
return { data: mockResumeData }
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
export function getMockJobs() {
|
| 64 |
+
return { data: { jobs: mockJobs } }
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
export function getMockReport() {
|
| 68 |
+
return mockReport
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
export function getMockSuggestions() {
|
| 72 |
+
return mockSuggestions
|
| 73 |
+
}
|
offer-puplayer-hf/frontend/src/components/JobCard.jsx
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { useState } from 'react'
|
| 2 |
+
|
| 3 |
+
const RADIUS = 40
|
| 4 |
+
const CIRCUMFERENCE = 2 * Math.PI * RADIUS
|
| 5 |
+
|
| 6 |
+
function MatchRing({ rate }) {
|
| 7 |
+
const color = rate >= 80 ? '#10B981' : rate >= 60 ? '#F59E0B' : '#EF4444'
|
| 8 |
+
const offset = CIRCUMFERENCE * (1 - rate / 100)
|
| 9 |
+
|
| 10 |
+
return (
|
| 11 |
+
<svg width="96" height="96" viewBox="0 0 96 96">
|
| 12 |
+
<circle cx="48" cy="48" r={RADIUS} fill="none" stroke="#E5E7EB" strokeWidth="8" />
|
| 13 |
+
<circle
|
| 14 |
+
cx="48" cy="48" r={RADIUS}
|
| 15 |
+
fill="none"
|
| 16 |
+
stroke={color}
|
| 17 |
+
strokeWidth="8"
|
| 18 |
+
strokeDasharray={CIRCUMFERENCE}
|
| 19 |
+
strokeDashoffset={offset}
|
| 20 |
+
strokeLinecap="round"
|
| 21 |
+
transform="rotate(-90 48 48)"
|
| 22 |
+
style={{ transition: 'stroke-dashoffset 0.6s ease' }}
|
| 23 |
+
/>
|
| 24 |
+
<text
|
| 25 |
+
x="48" y="48"
|
| 26 |
+
textAnchor="middle"
|
| 27 |
+
dominantBaseline="central"
|
| 28 |
+
fontSize="20"
|
| 29 |
+
fontWeight="700"
|
| 30 |
+
fill={color}
|
| 31 |
+
>
|
| 32 |
+
{rate}%
|
| 33 |
+
</text>
|
| 34 |
+
</svg>
|
| 35 |
+
)
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
function MatchBreakdown({ detail, rate }) {
|
| 39 |
+
if (!detail) return null
|
| 40 |
+
const bars = [
|
| 41 |
+
{ key: 'semantic', label: '语义匹配', weight: 40, color: '#6366F1' },
|
| 42 |
+
{ key: 'tags', label: '技能匹配', weight: 35, color: '#10B981' },
|
| 43 |
+
{ key: 'education', label: '学历匹配', weight: 25, color: '#F59E0B' },
|
| 44 |
+
]
|
| 45 |
+
return (
|
| 46 |
+
<div className="mt-16" style={{ padding: '12px 16px', backgroundColor: '#FFFFFF', borderRadius: 'var(--radius-sm)', border: '1px solid #E5E7EB' }}>
|
| 47 |
+
<div className="flex-between mb-8">
|
| 48 |
+
<h4 className="font-bold text-sm">匹配度计算</h4>
|
| 49 |
+
<span className="text-xs text-light">总分 = 语义×40% + 技能×35% + 学历×25%</span>
|
| 50 |
+
</div>
|
| 51 |
+
{bars.map(b => {
|
| 52 |
+
const val = detail[b.key] || 0
|
| 53 |
+
const pct = Math.round(val * 100)
|
| 54 |
+
return (
|
| 55 |
+
<div key={b.key} className="flex items-center gap-8 mb-6">
|
| 56 |
+
<span className="text-xs" style={{ width: 56, flexShrink: 0 }}>{b.label}</span>
|
| 57 |
+
<div style={{ flex: 1, height: 8, backgroundColor: '#F3F4F6', borderRadius: 4, overflow: 'hidden' }}>
|
| 58 |
+
<div style={{ width: pct + '%', height: '100%', backgroundColor: b.color, borderRadius: 4, transition: 'width 0.5s ease' }} />
|
| 59 |
+
</div>
|
| 60 |
+
<span className="text-xs font-bold" style={{ width: 32, textAlign: 'right', color: b.color }}>{pct}%</span>
|
| 61 |
+
<span className="text-xs text-light" style={{ width: 28, textAlign: 'right' }}>×{b.weight}%</span>
|
| 62 |
+
</div>
|
| 63 |
+
)
|
| 64 |
+
})}
|
| 65 |
+
<div className="flex-between mt-8" style={{ borderTop: '1px solid #E5E7EB', paddingTop: 8 }}>
|
| 66 |
+
<span className="text-sm font-bold">最终匹配度</span>
|
| 67 |
+
<span className="text-sm font-bold" style={{ color: rate >= 80 ? '#10B981' : rate >= 60 ? '#F59E0B' : '#EF4444' }}>{rate}%</span>
|
| 68 |
+
</div>
|
| 69 |
+
</div>
|
| 70 |
+
)
|
| 71 |
+
}
|
| 72 |
+
function ExpectationSignals({ signals }) {
|
| 73 |
+
if (!signals || signals.length === 0) return null
|
| 74 |
+
return (
|
| 75 |
+
<div className="mt-12">
|
| 76 |
+
<h4 className="font-bold text-sm mb-8">岗位画像</h4>
|
| 77 |
+
<div className="flex flex-wrap gap-8">
|
| 78 |
+
{signals.map((signal, i) => (
|
| 79 |
+
<div key={i} className="tag" style={{
|
| 80 |
+
display: 'flex', flexDirection: 'column', gap: 4,
|
| 81 |
+
padding: '8px 12px', backgroundColor: '#EEF2FF',
|
| 82 |
+
border: '1px solid #C7D2FE', borderRadius: 'var(--radius-sm)'
|
| 83 |
+
}}>
|
| 84 |
+
<span className="text-sm font-bold" style={{ color: '#4338CA' }}>{signal.name || signal.tag}</span>
|
| 85 |
+
{signal.evidence && (
|
| 86 |
+
<span className="text-xs text-secondary">{signal.evidence}</span>
|
| 87 |
+
)}
|
| 88 |
+
{signal.confidence !== undefined && (
|
| 89 |
+
<div className="flex items-center gap-4">
|
| 90 |
+
<span className="text-xs text-light">置信度</span>
|
| 91 |
+
<div style={{
|
| 92 |
+
flex: 1, height: 6, backgroundColor: '#E5E7EB',
|
| 93 |
+
borderRadius: 3, overflow: 'hidden'
|
| 94 |
+
}}>
|
| 95 |
+
<div style={{
|
| 96 |
+
width: `${Math.round(signal.confidence * 100)}%`,
|
| 97 |
+
height: '100%', backgroundColor: '#6366F1',
|
| 98 |
+
borderRadius: 3, transition: 'width 0.4s ease'
|
| 99 |
+
}} />
|
| 100 |
+
</div>
|
| 101 |
+
<span className="text-xs font-bold" style={{ color: '#4338CA' }}>
|
| 102 |
+
{Math.round(signal.confidence * 100)}%
|
| 103 |
+
</span>
|
| 104 |
+
</div>
|
| 105 |
+
)}
|
| 106 |
+
</div>
|
| 107 |
+
))}
|
| 108 |
+
</div>
|
| 109 |
+
</div>
|
| 110 |
+
)
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
function JobCard({ job, onClick, lowMatchWarning, showMatch = true, onUploadClick }) {
|
| 114 |
+
const { job_id, name: title, company, city, match_rate, match_detail, tags = [], description, requirements, expectation_signals } = job
|
| 115 |
+
const [expanded, setExpanded] = useState(false)
|
| 116 |
+
|
| 117 |
+
const visibleTags = tags.slice(0, 3)
|
| 118 |
+
const extraCount = tags.length - 3
|
| 119 |
+
const descSummary = description && description.length > 80
|
| 120 |
+
? description.slice(0, 80) + '...'
|
| 121 |
+
: description
|
| 122 |
+
|
| 123 |
+
return (
|
| 124 |
+
<div className="card">
|
| 125 |
+
<div style={{ cursor: 'pointer' }} onClick={() => setExpanded(!expanded)}>
|
| 126 |
+
<div className="gap-16" style={{ display: 'flex', alignItems: 'center' }}>
|
| 127 |
+
{showMatch && (
|
| 128 |
+
<div style={{ flexShrink: 0 }}>
|
| 129 |
+
<MatchRing rate={match_rate} />
|
| 130 |
+
</div>
|
| 131 |
+
)}
|
| 132 |
+
<div style={{ flex: 1, minWidth: 0 }}>
|
| 133 |
+
<h3 className="font-bold text-lg">{title}</h3>
|
| 134 |
+
<p className="text-secondary mt-8">{company}</p>
|
| 135 |
+
<div className="flex flex-wrap gap-8" style={{ marginTop: 12 }}>
|
| 136 |
+
<span className="text-sm text-secondary">{city}</span>
|
| 137 |
+
{visibleTags.map((tag, i) => (
|
| 138 |
+
<span key={i} className="tag">{tag}</span>
|
| 139 |
+
))}
|
| 140 |
+
{extraCount > 0 && (
|
| 141 |
+
<span className="text-sm text-light">+{extraCount}</span>
|
| 142 |
+
)}
|
| 143 |
+
</div>
|
| 144 |
+
</div>
|
| 145 |
+
</div>
|
| 146 |
+
{showMatch && lowMatchWarning && (
|
| 147 |
+
<div className="text-sm text-warning" style={{ marginTop: 12 }}>
|
| 148 |
+
{match_rate < 60 ? '匹配度较低,别灰心,看看建议提升一下吧' : '匹配度较低'}
|
| 149 |
+
</div>
|
| 150 |
+
)}
|
| 151 |
+
{descSummary && (
|
| 152 |
+
<p className="text-sm text-secondary mt-12" style={{ lineHeight: 1.5 }}>{descSummary}</p>
|
| 153 |
+
)}
|
| 154 |
+
</div>
|
| 155 |
+
|
| 156 |
+
{expanded && (
|
| 157 |
+
<div style={{ marginTop: 12, padding: 16, backgroundColor: '#F9FAFB', borderRadius: 'var(--radius-sm)' }}>
|
| 158 |
+
{description && (
|
| 159 |
+
<div className="mb-12">
|
| 160 |
+
<h4 className="font-bold text-sm mb-4">职位描述</h4>
|
| 161 |
+
<p className="text-sm text-secondary">{description}</p>
|
| 162 |
+
</div>
|
| 163 |
+
)}
|
| 164 |
+
{requirements && (
|
| 165 |
+
<div className="mb-12">
|
| 166 |
+
<h4 className="font-bold text-sm mb-4">职位要求</h4>
|
| 167 |
+
<p className="text-sm text-secondary">{requirements}</p>
|
| 168 |
+
</div>
|
| 169 |
+
)}
|
| 170 |
+
{showMatch && match_detail && <MatchBreakdown detail={match_detail} rate={match_rate} />}
|
| 171 |
+
<ExpectationSignals signals={expectation_signals} />
|
| 172 |
+
<div className="mt-12 flex gap-8" style={{ justifyContent: 'center' }}>
|
| 173 |
+
{showMatch ? (
|
| 174 |
+
<button className="btn btn-primary btn-sm" onClick={(e) => { e.stopPropagation(); onClick && onClick(job_id, { job_id, name: title, company, city, match_rate, tags, description, requirements, expectation_signals }) }}>
|
| 175 |
+
查看匹配诊断
|
| 176 |
+
</button>
|
| 177 |
+
) : (
|
| 178 |
+
<button className="btn btn-primary btn-sm" onClick={(e) => { e.stopPropagation(); onUploadClick && onUploadClick() }}>
|
| 179 |
+
上传简历后使用匹配
|
| 180 |
+
</button>
|
| 181 |
+
)}
|
| 182 |
+
</div>
|
| 183 |
+
</div>
|
| 184 |
+
)}
|
| 185 |
+
</div>
|
| 186 |
+
)
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
export default JobCard
|
offer-puplayer-hf/frontend/src/components/PipelineFlow.jsx
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
function PipelineFlow({ steps = [] }) {
|
| 2 |
+
return (
|
| 3 |
+
<div className="flex-center" style={{ gap: 0, padding: '24px 0' }}>
|
| 4 |
+
{steps.map((step, index) => {
|
| 5 |
+
const isLast = index === steps.length - 1
|
| 6 |
+
return (
|
| 7 |
+
<div key={step.id} className="flex-center" style={{ gap: 0 }}>
|
| 8 |
+
<div className="flex flex-col flex-center" style={{ gap: 8 }}>
|
| 9 |
+
<div
|
| 10 |
+
className={`pipeline-node pipeline-node-${step.status}`}
|
| 11 |
+
>
|
| 12 |
+
{step.status === 'completed' && '✓'}
|
| 13 |
+
{step.status === 'error' && '❗'}
|
| 14 |
+
{(step.status === 'idle' || step.status === 'running') && (
|
| 15 |
+
<span className={step.status === 'running' ? 'pipeline-step-running' : ''}>
|
| 16 |
+
{step.icon || '○'}
|
| 17 |
+
</span>
|
| 18 |
+
)}
|
| 19 |
+
</div>
|
| 20 |
+
<span className={`text-sm pipeline-label-${step.status}`}>
|
| 21 |
+
{step.label}
|
| 22 |
+
</span>
|
| 23 |
+
{step.status === 'error' && (
|
| 24 |
+
<span className="text-sm text-error">暂不可用</span>
|
| 25 |
+
)}
|
| 26 |
+
</div>
|
| 27 |
+
{!isLast && (
|
| 28 |
+
<div
|
| 29 |
+
className={`pipeline-connector pipeline-connector-${step.status === 'completed' ? 'completed' : 'idle'}`}
|
| 30 |
+
/>
|
| 31 |
+
)}
|
| 32 |
+
</div>
|
| 33 |
+
)
|
| 34 |
+
})}
|
| 35 |
+
</div>
|
| 36 |
+
)
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
export default PipelineFlow
|
offer-puplayer-hf/frontend/src/components/RadarChart.jsx
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import ReactECharts from 'echarts-for-react'
|
| 2 |
+
|
| 3 |
+
function RadarChart({ dimensions = [], scores = [], loading = false }) {
|
| 4 |
+
if (loading) {
|
| 5 |
+
return (
|
| 6 |
+
<div className="loading-state" style={{ height: 320 }}>
|
| 7 |
+
<div className="loading-spinner loading-spinner-lg" />
|
| 8 |
+
<p className="text-secondary mt-16">加载中...</p>
|
| 9 |
+
</div>
|
| 10 |
+
)
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
const isEmpty = !dimensions.length || !scores.length || scores.every((s) => s === 0)
|
| 14 |
+
|
| 15 |
+
if (isEmpty) {
|
| 16 |
+
return (
|
| 17 |
+
<div className="flex-center" style={{ height: 320 }}>
|
| 18 |
+
<p className="text-secondary">图表数据暂不可用</p>
|
| 19 |
+
</div>
|
| 20 |
+
)
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
const option = {
|
| 24 |
+
radar: {
|
| 25 |
+
indicator: dimensions.map((name) => ({ name, max: 100 })),
|
| 26 |
+
center: ['50%', '50%'],
|
| 27 |
+
radius: '65%',
|
| 28 |
+
},
|
| 29 |
+
series: [
|
| 30 |
+
{
|
| 31 |
+
type: 'radar',
|
| 32 |
+
data: [{ value: scores, name: '匹配得分' }],
|
| 33 |
+
areaStyle: { color: 'rgba(79, 70, 229, 0.2)' },
|
| 34 |
+
lineStyle: { color: '#4F46E5' },
|
| 35 |
+
itemStyle: { color: '#4F46E5' },
|
| 36 |
+
},
|
| 37 |
+
],
|
| 38 |
+
animationDuration: 1000,
|
| 39 |
+
animationEasing: 'cubicOut',
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
return (
|
| 43 |
+
<div style={{ height: 320 }}>
|
| 44 |
+
<ReactECharts option={option} style={{ height: '100%' }} />
|
| 45 |
+
</div>
|
| 46 |
+
)
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
export default RadarChart
|
offer-puplayer-hf/frontend/src/components/ReportCard.jsx
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
function ReportCard({ dimension, score, evidence = [], viewType, footnote, dataUnavailable, hrView }) {
|
| 2 |
+
if (viewType === 'hr' && hrView && hrView.first_impression) {
|
| 3 |
+
const levelColor = hrView.hr_concern_level === 'low' ? '#10B981' : hrView.hr_concern_level === 'medium' ? '#F59E0B' : '#EF4444'
|
| 4 |
+
const levelLabel = hrView.hr_concern_level === 'low' ? '低' : hrView.hr_concern_level === 'medium' ? '中' : '高'
|
| 5 |
+
return (
|
| 6 |
+
<div className="card">
|
| 7 |
+
<h4 className="font-bold mb-12">{dimension}</h4>
|
| 8 |
+
<div style={{ padding: 12, backgroundColor: 'rgba(79,70,229,0.06)', borderRadius: 'var(--radius-sm)', borderLeft: '3px solid #4F46E5', marginBottom: 16 }}>
|
| 9 |
+
<p className="text-sm" style={{ fontStyle: 'italic' }}>"{hrView.first_impression}"</p>
|
| 10 |
+
</div>
|
| 11 |
+
<div className="flex flex-col gap-12 mb-16">
|
| 12 |
+
{hrView.attention_points && hrView.attention_points.map((point, i) => (
|
| 13 |
+
<div key={i} style={{ padding: 12, backgroundColor: '#F9FAFB', borderRadius: 'var(--radius-sm)' }}>
|
| 14 |
+
<p className="font-bold text-sm">{point.aspect}</p>
|
| 15 |
+
<p className="text-sm text-secondary mt-4">{point.finding}</p>
|
| 16 |
+
{point.concern && point.concern !== '无' && (
|
| 17 |
+
<p className="text-sm" style={{ color: '#DC2626', marginTop: 4 }}>关注点: {point.concern}</p>
|
| 18 |
+
)}
|
| 19 |
+
</div>
|
| 20 |
+
))}
|
| 21 |
+
</div>
|
| 22 |
+
<div className="flex items-center gap-8 mb-16">
|
| 23 |
+
<span className="text-sm text-secondary">HR 关注度:</span>
|
| 24 |
+
<span className="tag" style={{ backgroundColor: `${levelColor}18`, color: levelColor, border: `1px solid ${levelColor}40`, fontWeight: 700 }}>{levelLabel}</span>
|
| 25 |
+
</div>
|
| 26 |
+
{hrView.screen_summary && (
|
| 27 |
+
<p className="text-sm" style={{ padding: 12, backgroundColor: 'rgba(16,185,129,0.06)', borderRadius: 'var(--radius-sm)' }}>
|
| 28 |
+
<span className="font-bold">筛选总结: </span>{hrView.screen_summary}
|
| 29 |
+
</p>
|
| 30 |
+
)}
|
| 31 |
+
</div>
|
| 32 |
+
)
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
if (dataUnavailable) {
|
| 36 |
+
return (
|
| 37 |
+
<div className="card" style={{ opacity: 0.5 }}>
|
| 38 |
+
<h4 className="font-bold">{dimension}</h4>
|
| 39 |
+
<p className="text-secondary mt-8">数据暂不可用</p>
|
| 40 |
+
</div>
|
| 41 |
+
)
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
if (viewType === 'hr') {
|
| 45 |
+
const conclusion = score >= 70 ? 'OK ✓' : score >= 40 ? '⚠️' : '✗'
|
| 46 |
+
const finding = evidence.length > 0 ? evidence[0].text : '暂无关键发现'
|
| 47 |
+
return (
|
| 48 |
+
<div className="card">
|
| 49 |
+
<div className="flex-between">
|
| 50 |
+
<h4 className="font-bold">{dimension}</h4>
|
| 51 |
+
<span className="text-lg font-bold">{conclusion}</span>
|
| 52 |
+
</div>
|
| 53 |
+
<p className="text-secondary mt-8">{finding}</p>
|
| 54 |
+
{footnote && (
|
| 55 |
+
<p className="text-sm text-light mt-8" style={{ padding: '8px 12px', backgroundColor: 'rgba(79,70,229,0.06)', borderRadius: 'var(--radius-sm)' }}>
|
| 56 |
+
{footnote}
|
| 57 |
+
</p>
|
| 58 |
+
)}
|
| 59 |
+
</div>
|
| 60 |
+
)
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
const evidenceObj = Array.isArray(evidence) ? (evidence.length > 0 ? evidence[0] : null) : evidence
|
| 64 |
+
const hasJdQuote = evidenceObj && (evidenceObj.jd_quote || evidenceObj.resume_quote)
|
| 65 |
+
|
| 66 |
+
if (hasJdQuote) {
|
| 67 |
+
return (
|
| 68 |
+
<div className="card">
|
| 69 |
+
<div className="flex-between">
|
| 70 |
+
<h4 className="font-bold">{dimension}</h4>
|
| 71 |
+
<span className="text-lg font-bold">{score}%</span>
|
| 72 |
+
</div>
|
| 73 |
+
<div
|
| 74 |
+
style={{
|
| 75 |
+
height: 8,
|
| 76 |
+
backgroundColor: '#E5E7EB',
|
| 77 |
+
borderRadius: 4,
|
| 78 |
+
marginTop: 12,
|
| 79 |
+
overflow: 'hidden',
|
| 80 |
+
}}
|
| 81 |
+
>
|
| 82 |
+
<div
|
| 83 |
+
style={{
|
| 84 |
+
width: `${score}%`,
|
| 85 |
+
height: '100%',
|
| 86 |
+
backgroundColor: '#4F46E5',
|
| 87 |
+
borderRadius: 4,
|
| 88 |
+
transition: 'width 0.5s ease',
|
| 89 |
+
}}
|
| 90 |
+
/>
|
| 91 |
+
</div>
|
| 92 |
+
<div className="mt-16" style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 12 }}>
|
| 93 |
+
<div style={{ padding: 12, border: '1px solid var(--color-border)', borderRadius: 'var(--radius-sm)', backgroundColor: 'rgba(79,70,229,0.04)' }}>
|
| 94 |
+
<p className="font-bold text-sm mb-4">📋 JD要求</p>
|
| 95 |
+
<p className="text-sm text-secondary">{evidenceObj.jd_quote}</p>
|
| 96 |
+
</div>
|
| 97 |
+
<div style={{ padding: 12, border: '1px solid var(--color-border)', borderRadius: 'var(--radius-sm)', backgroundColor: 'rgba(16,185,129,0.04)' }}>
|
| 98 |
+
<p className="font-bold text-sm mb-4">📝 简历匹配</p>
|
| 99 |
+
<p className="text-sm text-secondary">{evidenceObj.resume_quote}</p>
|
| 100 |
+
</div>
|
| 101 |
+
</div>
|
| 102 |
+
</div>
|
| 103 |
+
)
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
return (
|
| 107 |
+
<div className="card">
|
| 108 |
+
<div className="flex-between">
|
| 109 |
+
<h4 className="font-bold">{dimension}</h4>
|
| 110 |
+
<span className="text-lg font-bold">{score}%</span>
|
| 111 |
+
</div>
|
| 112 |
+
<div
|
| 113 |
+
style={{
|
| 114 |
+
height: 8,
|
| 115 |
+
backgroundColor: '#E5E7EB',
|
| 116 |
+
borderRadius: 4,
|
| 117 |
+
marginTop: 12,
|
| 118 |
+
overflow: 'hidden',
|
| 119 |
+
}}
|
| 120 |
+
>
|
| 121 |
+
<div
|
| 122 |
+
style={{
|
| 123 |
+
width: `${score}%`,
|
| 124 |
+
height: '100%',
|
| 125 |
+
backgroundColor: '#4F46E5',
|
| 126 |
+
borderRadius: 4,
|
| 127 |
+
transition: 'width 0.5s ease',
|
| 128 |
+
}}
|
| 129 |
+
/>
|
| 130 |
+
</div>
|
| 131 |
+
{(Array.isArray(evidence) && evidence.length > 0) && (
|
| 132 |
+
<ul className="mt-16" style={{ listStyle: 'none' }}>
|
| 133 |
+
{evidence.map((item, i) => (
|
| 134 |
+
<li key={i} className="text-sm text-secondary" style={{ marginTop: 4 }}>
|
| 135 |
+
<span style={{ color: '#4F46E5' }}>{item.text}</span>
|
| 136 |
+
{item.source && (
|
| 137 |
+
<span className="text-light" style={{ marginLeft: 4 }}>
|
| 138 |
+
— {item.source}
|
| 139 |
+
</span>
|
| 140 |
+
)}
|
| 141 |
+
</li>
|
| 142 |
+
))}
|
| 143 |
+
</ul>
|
| 144 |
+
)}
|
| 145 |
+
</div>
|
| 146 |
+
)
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
export default ReportCard
|
offer-puplayer-hf/frontend/src/main.jsx
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React from 'react'
|
| 2 |
+
import ReactDOM from 'react-dom/client'
|
| 3 |
+
import App from './App'
|
| 4 |
+
import './App.css'
|
| 5 |
+
|
| 6 |
+
ReactDOM.createRoot(document.getElementById('app')).render(
|
| 7 |
+
<React.StrictMode>
|
| 8 |
+
<App />
|
| 9 |
+
</React.StrictMode>
|
| 10 |
+
)
|
offer-puplayer-hf/frontend/src/pages/DiagnosePage.jsx
ADDED
|
@@ -0,0 +1,271 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { useState, useRef, useCallback, useEffect } from 'react'
|
| 2 |
+
import { generateReport } from '../api'
|
| 3 |
+
import PipelineFlow from '../components/PipelineFlow'
|
| 4 |
+
import RadarChart from '../components/RadarChart'
|
| 5 |
+
import ReportCard from '../components/ReportCard'
|
| 6 |
+
|
| 7 |
+
const INITIAL_STEPS = [
|
| 8 |
+
{ id: 'agent1', label: '简历解析', status: 'idle' },
|
| 9 |
+
{ id: 'agent2', label: '匹配诊断', status: 'idle' },
|
| 10 |
+
{ id: 'agent3', label: '报告生成', status: 'idle' },
|
| 11 |
+
]
|
| 12 |
+
|
| 13 |
+
function DiagnosePage({ jobId, jobData, resumeData, onComplete, onBack, onGoHome }) {
|
| 14 |
+
const [pageStatus, setPageStatus] = useState('idle')
|
| 15 |
+
const [steps, setSteps] = useState(INITIAL_STEPS)
|
| 16 |
+
const [viewType, setViewType] = useState('student')
|
| 17 |
+
const [jdParsed, setJdParsed] = useState(null)
|
| 18 |
+
const [matchReport, setMatchReport] = useState(null)
|
| 19 |
+
const [advice, setAdvice] = useState(null)
|
| 20 |
+
const [errorMsg, setErrorMsg] = useState('')
|
| 21 |
+
const abortRef = useRef(null)
|
| 22 |
+
const retryCountRef = useRef(0)
|
| 23 |
+
const retryTimeoutRef = useRef(null)
|
| 24 |
+
|
| 25 |
+
const jobInfo = jobData || {
|
| 26 |
+
name: '岗位名称',
|
| 27 |
+
company: '公司名称',
|
| 28 |
+
city: '',
|
| 29 |
+
salary: '',
|
| 30 |
+
tags: [],
|
| 31 |
+
description: '',
|
| 32 |
+
requirements: '',
|
| 33 |
+
expectation_signals: []
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
const updateStep = useCallback((agentId, newStatus) => {
|
| 37 |
+
setSteps((prev) => prev.map((s) => (s.id === agentId ? { ...s, status: newStatus } : s)))
|
| 38 |
+
}, [])
|
| 39 |
+
|
| 40 |
+
const handleAnalyze = useCallback(async () => {
|
| 41 |
+
setPageStatus('loading')
|
| 42 |
+
setSteps(INITIAL_STEPS.map((s) => ({ ...s, status: 'idle' })))
|
| 43 |
+
setJdParsed(null)
|
| 44 |
+
setMatchReport(null)
|
| 45 |
+
setAdvice(null)
|
| 46 |
+
retryCountRef.current = 0
|
| 47 |
+
|
| 48 |
+
const controller = new AbortController()
|
| 49 |
+
abortRef.current = controller
|
| 50 |
+
|
| 51 |
+
const doFetch = async () => {
|
| 52 |
+
try {
|
| 53 |
+
const response = await generateReport(jobId, resumeData)
|
| 54 |
+
if (!response.ok) throw new Error('请求失败')
|
| 55 |
+
const reader = response.body.getReader()
|
| 56 |
+
const decoder = new TextDecoder()
|
| 57 |
+
let buffer = ''
|
| 58 |
+
|
| 59 |
+
while (true) {
|
| 60 |
+
const { done, value } = await reader.read()
|
| 61 |
+
if (done) break
|
| 62 |
+
|
| 63 |
+
buffer += decoder.decode(value, { stream: true })
|
| 64 |
+
const lines = buffer.split('\n')
|
| 65 |
+
buffer = lines.pop() || ''
|
| 66 |
+
|
| 67 |
+
for (const line of lines) {
|
| 68 |
+
const trimmed = line.trim()
|
| 69 |
+
if (!trimmed) continue
|
| 70 |
+
const jsonStr = trimmed.startsWith('data: ') ? trimmed.slice(6).trim() : trimmed
|
| 71 |
+
if (!jsonStr) continue
|
| 72 |
+
try {
|
| 73 |
+
const event = JSON.parse(jsonStr)
|
| 74 |
+
const { type, agent, data } = event
|
| 75 |
+
|
| 76 |
+
if (type === 'agent_start') {
|
| 77 |
+
updateStep(agent, 'running')
|
| 78 |
+
} else if (type === 'agent_complete') {
|
| 79 |
+
updateStep(agent, 'completed')
|
| 80 |
+
if (agent === 'agent1' && data) setJdParsed(data)
|
| 81 |
+
if (agent === 'agent2' && data) setMatchReport(data)
|
| 82 |
+
if (agent === 'agent3' && data) setAdvice(data)
|
| 83 |
+
} else if (type === 'report_complete') {
|
| 84 |
+
if (data) {
|
| 85 |
+
if (data.jd_parsed) setJdParsed(data.jd_parsed)
|
| 86 |
+
if (data.match_report) setMatchReport(data.match_report)
|
| 87 |
+
if (data.advice) setAdvice(data.advice)
|
| 88 |
+
}
|
| 89 |
+
} else if (type === 'error') {
|
| 90 |
+
updateStep(agent || 'agent3', 'error')
|
| 91 |
+
}
|
| 92 |
+
} catch {
|
| 93 |
+
// skip invalid lines
|
| 94 |
+
}
|
| 95 |
+
}
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
setPageStatus('success')
|
| 99 |
+
} catch (err) {
|
| 100 |
+
if (err.name === 'AbortError') return
|
| 101 |
+
retryCountRef.current += 1
|
| 102 |
+
if (retryCountRef.current <= 3) {
|
| 103 |
+
const delay = retryCountRef.current * 1000
|
| 104 |
+
retryTimeoutRef.current = setTimeout(doFetch, delay)
|
| 105 |
+
} else {
|
| 106 |
+
setPageStatus('error')
|
| 107 |
+
setErrorMsg('连接中断,请刷新页面')
|
| 108 |
+
}
|
| 109 |
+
}
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
doFetch()
|
| 113 |
+
}, [jobId, updateStep])
|
| 114 |
+
|
| 115 |
+
const abort = useCallback(() => {
|
| 116 |
+
clearTimeout(retryTimeoutRef.current)
|
| 117 |
+
abortRef.current?.abort()
|
| 118 |
+
setPageStatus('idle')
|
| 119 |
+
}, [])
|
| 120 |
+
|
| 121 |
+
useEffect(() => {
|
| 122 |
+
return () => {
|
| 123 |
+
clearTimeout(retryTimeoutRef.current)
|
| 124 |
+
abortRef.current?.abort()
|
| 125 |
+
}
|
| 126 |
+
}, [])
|
| 127 |
+
|
| 128 |
+
const studentDims = matchReport?.dimensions?.map(d => d.name) || ['技能匹配', '经验匹配', '项目匹配', '学历匹配']
|
| 129 |
+
const studentScores = matchReport?.dimensions?.map(d => d.score) || []
|
| 130 |
+
const studentEvidence = matchReport?.dimensions?.map(d => d.evidence) || []
|
| 131 |
+
|
| 132 |
+
const hrViewData = matchReport?.hr_view || {}
|
| 133 |
+
|
| 134 |
+
const showResults = pageStatus === 'loading' || pageStatus === 'success' || pageStatus === 'error'
|
| 135 |
+
const analyzeDone = pageStatus === 'success'
|
| 136 |
+
|
| 137 |
+
if (!resumeData) {
|
| 138 |
+
return (
|
| 139 |
+
<div>
|
| 140 |
+
<div className="card" style={{ textAlign: 'center', padding: 48 }}>
|
| 141 |
+
<h2 className="font-bold text-xl mb-16">匹配诊断</h2>
|
| 142 |
+
<p className="text-secondary mb-24">请先���传或填写简历,才能进行匹配诊断</p>
|
| 143 |
+
<div className="flex gap-12" style={{ justifyContent: 'center' }}>
|
| 144 |
+
<button className="btn btn-primary" onClick={onGoHome}>上传简历</button>
|
| 145 |
+
<button className="btn btn-secondary" onClick={onGoHome}>手工填写</button>
|
| 146 |
+
</div>
|
| 147 |
+
<div className="mt-16">
|
| 148 |
+
<button className="btn btn-secondary" onClick={onBack}>返回推荐</button>
|
| 149 |
+
</div>
|
| 150 |
+
</div>
|
| 151 |
+
</div>
|
| 152 |
+
)
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
return (
|
| 156 |
+
<div>
|
| 157 |
+
<div className="card mb-24">
|
| 158 |
+
<div className="flex-between mb-8">
|
| 159 |
+
<div>
|
| 160 |
+
<h2 className="font-bold text-xl">{jobInfo.name}</h2>
|
| 161 |
+
<p className="text-secondary">{jobInfo.company} · {jobInfo.city || ''} {jobInfo.salary ? '· ' + jobInfo.salary : ''}</p>
|
| 162 |
+
</div>
|
| 163 |
+
<div className="flex gap-8 flex-wrap" style={{ maxWidth: '50%', justifyContent: 'flex-end' }}>
|
| 164 |
+
{(jobInfo.tags || []).map((tag, i) => (
|
| 165 |
+
<span key={i} className="tag" style={{ fontSize: 12 }}>{tag}</span>
|
| 166 |
+
))}
|
| 167 |
+
</div>
|
| 168 |
+
</div>
|
| 169 |
+
|
| 170 |
+
{jobInfo.description && (
|
| 171 |
+
<div className="mb-12">
|
| 172 |
+
<h4 className="font-bold text-sm mb-4">职位描述</h4>
|
| 173 |
+
<p className="text-sm text-secondary" style={{ lineHeight: 1.6, whiteSpace: 'pre-wrap' }}>{jobInfo.description}</p>
|
| 174 |
+
</div>
|
| 175 |
+
)}
|
| 176 |
+
|
| 177 |
+
{jobInfo.requirements && (
|
| 178 |
+
<div className="mb-12">
|
| 179 |
+
<h4 className="font-bold text-sm mb-4">职位要求</h4>
|
| 180 |
+
<p className="text-sm text-secondary" style={{ lineHeight: 1.6, whiteSpace: 'pre-wrap' }}>{jobInfo.requirements}</p>
|
| 181 |
+
</div>
|
| 182 |
+
)}
|
| 183 |
+
|
| 184 |
+
{jobInfo.expectation_signals && jobInfo.expectation_signals.length > 0 && (
|
| 185 |
+
<div className="mb-12">
|
| 186 |
+
<h4 className="font-bold text-sm mb-4">岗位画像</h4>
|
| 187 |
+
<div className="flex flex-col gap-8">
|
| 188 |
+
{jobInfo.expectation_signals.map((signal, i) => (
|
| 189 |
+
<div key={i} style={{ padding: '8px 12px', backgroundColor: '#F9FAFB', borderRadius: 'var(--radius-sm)', border: '1px solid #E5E7EB' }}>
|
| 190 |
+
<div className="flex-between mb-4">
|
| 191 |
+
<span className="text-sm font-bold">{signal.tag || signal.name}</span>
|
| 192 |
+
<span className="text-xs text-light">可信度 {Math.round((signal.confidence || 0) * 100)}%</span>
|
| 193 |
+
</div>
|
| 194 |
+
<p className="text-xs text-secondary mb-4">{signal.evidence || ''}</p>
|
| 195 |
+
<div style={{ height: 4, backgroundColor: '#E5E7EB', borderRadius: 2, overflow: 'hidden' }}>
|
| 196 |
+
<div style={{ width: `${Math.round((signal.confidence || 0) * 100)}%`, height: '100%', backgroundColor: (signal.confidence || 0) > 0.7 ? '#10B981' : (signal.confidence || 0) > 0.4 ? '#F59E0B' : '#EF4444', borderRadius: 2 }} />
|
| 197 |
+
</div>
|
| 198 |
+
</div>
|
| 199 |
+
))}
|
| 200 |
+
</div>
|
| 201 |
+
</div>
|
| 202 |
+
)}
|
| 203 |
+
</div>
|
| 204 |
+
|
| 205 |
+
{pageStatus === 'idle' && (
|
| 206 |
+
<div className="card mb-24" style={{ backgroundColor: '#FAFAFA' }}>
|
| 207 |
+
<h4 className="font-bold mb-8">分析流程说明</h4>
|
| 208 |
+
<p className="text-sm text-secondary mb-12">分析将由 3 个 AI Agent 依次完成:</p>
|
| 209 |
+
<div className="flex flex-col gap-8">
|
| 210 |
+
<div style={{ padding: '8px 12px', backgroundColor: '#FFFFFF', borderRadius: 'var(--radius-sm)', border: '1px solid #E5E7EB' }}>
|
| 211 |
+
<span className="text-sm font-bold">① JD 解析器</span>
|
| 212 |
+
<p className="text-xs text-secondary mt-4">提取岗位核心要求、技术栈、加分项、文化信号</p>
|
| 213 |
+
</div>
|
| 214 |
+
<div style={{ padding: '8px 12px', backgroundColor: '#FFFFFF', borderRadius: 'var(--radius-sm)', border: '1px solid #E5E7EB' }}>
|
| 215 |
+
<span className="text-sm font-bold">② 匹配诊断器</span>
|
| 216 |
+
<p className="text-xs text-secondary mt-4">多维度拆解匹配度,输出分数和引用证据</p>
|
| 217 |
+
</div>
|
| 218 |
+
<div style={{ padding: '8px 12px', backgroundColor: '#FFFFFF', borderRadius: 'var(--radius-sm)', border: '1px solid #E5E7EB' }}>
|
| 219 |
+
<span className="text-sm font-bold">③ 建议生成器</span>
|
| 220 |
+
<p className="text-xs text-secondary mt-4">生成简历修改建议和面试准备方向</p>
|
| 221 |
+
</div>
|
| 222 |
+
</div>
|
| 223 |
+
<button className="btn btn-primary mt-16" onClick={handleAnalyze}>开始分析</button>
|
| 224 |
+
</div>
|
| 225 |
+
)}
|
| 226 |
+
|
| 227 |
+
{showResults && (
|
| 228 |
+
<>
|
| 229 |
+
<div className="card mb-24"><PipelineFlow steps={steps} /></div>
|
| 230 |
+
{pageStatus !== 'loading' && matchReport && (
|
| 231 |
+
<>
|
| 232 |
+
<div className="flex gap-12 mb-24">
|
| 233 |
+
<button className={`btn ${viewType === 'student' ? 'btn-primary' : 'btn-secondary'}`} onClick={() => setViewType('student')}>学生视角</button>
|
| 234 |
+
<button className={`btn ${viewType === 'hr' ? 'btn-primary' : 'btn-secondary'}`} onClick={() => setViewType('hr')}>HR 视角</button>
|
| 235 |
+
</div>
|
| 236 |
+
{viewType === 'student' ? (
|
| 237 |
+
<>
|
| 238 |
+
<div className="card mb-24"><RadarChart dimensions={studentDims} scores={studentScores} /></div>
|
| 239 |
+
<div className="flex flex-col gap-16">
|
| 240 |
+
{studentDims.map((dim, i) => (
|
| 241 |
+
<ReportCard key={dim} dimension={dim} score={studentScores[i]} evidence={studentEvidence[i]} viewType={viewType} />
|
| 242 |
+
))}
|
| 243 |
+
</div>
|
| 244 |
+
</>
|
| 245 |
+
) : (
|
| 246 |
+
<div className="flex flex-col gap-16">
|
| 247 |
+
<ReportCard dimension="HR 快速筛查模拟" viewType="hr" hrView={hrViewData} />
|
| 248 |
+
</div>
|
| 249 |
+
)}
|
| 250 |
+
</>
|
| 251 |
+
)}
|
| 252 |
+
{pageStatus === 'error' && (
|
| 253 |
+
<div className="error-state">
|
| 254 |
+
<p className="error-state-text">{errorMsg}</p>
|
| 255 |
+
<button className="btn btn-primary" onClick={handleAnalyze}>重新分析</button>
|
| 256 |
+
</div>
|
| 257 |
+
)}
|
| 258 |
+
</>
|
| 259 |
+
)}
|
| 260 |
+
|
| 261 |
+
{analyzeDone && (
|
| 262 |
+
<div className="mt-24 flex gap-12" style={{ justifyContent: 'center' }}>
|
| 263 |
+
<button className="btn btn-primary" onClick={() => onComplete({ advice })}>查看改进建议</button>
|
| 264 |
+
<button className="btn btn-secondary" onClick={onBack}>返回推荐</button>
|
| 265 |
+
</div>
|
| 266 |
+
)}
|
| 267 |
+
</div>
|
| 268 |
+
)
|
| 269 |
+
}
|
| 270 |
+
|
| 271 |
+
export default DiagnosePage
|
offer-puplayer-hf/frontend/src/pages/HomePage.jsx
ADDED
|
@@ -0,0 +1,548 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { useState, useEffect, useRef, useCallback } from 'react'
|
| 2 |
+
import { uploadResume, getRecommendJobs } from '../api'
|
| 3 |
+
import RadarChart from '../components/RadarChart'
|
| 4 |
+
|
| 5 |
+
const SKILL_LEVELS = ['精通', '熟悉', '了解']
|
| 6 |
+
|
| 7 |
+
function HomePage({ resumeData, onConfirm, onGoRecommend }) {
|
| 8 |
+
const [status, setStatus] = useState(resumeData ? 'dashboard' : 'idle')
|
| 9 |
+
const [errorMsg, setErrorMsg] = useState('')
|
| 10 |
+
const [localParsed, setLocalParsed] = useState(null)
|
| 11 |
+
const [failCount, setFailCount] = useState(0)
|
| 12 |
+
const [manualMode, setManualMode] = useState(false)
|
| 13 |
+
const [autoTriggered, setAutoTriggered] = useState(false)
|
| 14 |
+
const [previewJobs, setPreviewJobs] = useState([])
|
| 15 |
+
const inputRef = useRef(null)
|
| 16 |
+
|
| 17 |
+
const [formData, setFormData] = useState({
|
| 18 |
+
skillInput: '',
|
| 19 |
+
skills: [],
|
| 20 |
+
projects: [{ name: '', description: '', techStack: '' }],
|
| 21 |
+
experience: '',
|
| 22 |
+
education: { school: '', major: '', degree: '', startYear: '', endYear: '' }
|
| 23 |
+
})
|
| 24 |
+
|
| 25 |
+
const [editValues, setEditValues] = useState({ name: '', school: '', major: '', grade: '', skills: '', projects: '', summary: '', experience: '', education: '' })
|
| 26 |
+
|
| 27 |
+
useEffect(() => {
|
| 28 |
+
if (localParsed) {
|
| 29 |
+
const projToString = (p) => typeof p === 'string' ? p : (p.name || p.title || JSON.stringify(p))
|
| 30 |
+
setEditValues({
|
| 31 |
+
name: localParsed.name || '',
|
| 32 |
+
school: localParsed.school || '',
|
| 33 |
+
major: localParsed.major || '',
|
| 34 |
+
grade: localParsed.grade || '',
|
| 35 |
+
skills: (localParsed.skills || []).join(', '),
|
| 36 |
+
projects: (localParsed.projects || []).map(projToString).join(', '),
|
| 37 |
+
summary: localParsed.summary || '',
|
| 38 |
+
experience: localParsed.experience || '',
|
| 39 |
+
education: localParsed.education || '',
|
| 40 |
+
})
|
| 41 |
+
}
|
| 42 |
+
}, [localParsed])
|
| 43 |
+
|
| 44 |
+
useEffect(() => {
|
| 45 |
+
if (manualMode && !localParsed && !resumeData) {
|
| 46 |
+
const s = formData.skillInput || formData.skills.length > 0 || formData.projects.some(p => p.name)
|
| 47 |
+
if (!s) handleReEdit()
|
| 48 |
+
}
|
| 49 |
+
}, [manualMode])
|
| 50 |
+
|
| 51 |
+
useEffect(() => {
|
| 52 |
+
if (localParsed || resumeData) {
|
| 53 |
+
const fetchPreview = async () => {
|
| 54 |
+
try {
|
| 55 |
+
const resumeId = (localParsed || resumeData)?.id || 1
|
| 56 |
+
const res = await getRecommendJobs(resumeId)
|
| 57 |
+
const list = res.data?.jobs || []
|
| 58 |
+
setPreviewJobs(list.slice(0, 3))
|
| 59 |
+
} catch {
|
| 60 |
+
setPreviewJobs([])
|
| 61 |
+
}
|
| 62 |
+
}
|
| 63 |
+
fetchPreview()
|
| 64 |
+
}
|
| 65 |
+
}, [localParsed, resumeData])
|
| 66 |
+
|
| 67 |
+
useEffect(() => {
|
| 68 |
+
if (resumeData) {
|
| 69 |
+
setStatus('dashboard')
|
| 70 |
+
}
|
| 71 |
+
}, [resumeData])
|
| 72 |
+
|
| 73 |
+
const handleFile = useCallback(async (selectedFile) => {
|
| 74 |
+
if (!selectedFile) return
|
| 75 |
+
if (selectedFile.type !== 'application/pdf') {
|
| 76 |
+
setFailCount(c => { const n = c + 1; if (n >= 3) { setManualMode(true); setAutoTriggered(true) }; return n })
|
| 77 |
+
setStatus('error'); setErrorMsg('请上传 PDF 格式简历'); return
|
| 78 |
+
}
|
| 79 |
+
setStatus('uploading')
|
| 80 |
+
try {
|
| 81 |
+
setStatus('loading')
|
| 82 |
+
const res = await uploadResume(selectedFile)
|
| 83 |
+
const parsed = res.data?.data || res.data
|
| 84 |
+
setLocalParsed(parsed)
|
| 85 |
+
setStatus('preview')
|
| 86 |
+
setFailCount(0)
|
| 87 |
+
} catch {
|
| 88 |
+
setFailCount(c => { const n = c + 1; if (n >= 3) { setManualMode(true); setAutoTriggered(true) }; return n })
|
| 89 |
+
setStatus('error'); setErrorMsg('简历解析失败,请重新上传或手工填写')
|
| 90 |
+
}
|
| 91 |
+
}, [])
|
| 92 |
+
|
| 93 |
+
const handleConfirm = (formData) => {
|
| 94 |
+
const data = formData || localParsed
|
| 95 |
+
if (data) {
|
| 96 |
+
const confirmed = {
|
| 97 |
+
...data,
|
| 98 |
+
name: data.name || localParsed?.name || '',
|
| 99 |
+
school: data.school || localParsed?.school || '',
|
| 100 |
+
major: data.major || localParsed?.major || '',
|
| 101 |
+
grade: data.grade || localParsed?.grade || '',
|
| 102 |
+
skills: typeof data.skills === 'string' ? data.skills.split(',').map(s => s.trim()).filter(Boolean) : (data.skills || localParsed?.skills || []),
|
| 103 |
+
projects: typeof data.projects === 'string' ? data.projects.split(',').map(s => s.trim()).filter(Boolean) : (data.projects || localParsed?.projects || []),
|
| 104 |
+
summary: data.summary || localParsed?.summary || '',
|
| 105 |
+
experience: data.experience || localParsed?.experience || '',
|
| 106 |
+
education: data.education || localParsed?.education || { school: '', major: '', degree: '', startYear: '', endYear: '' },
|
| 107 |
+
}
|
| 108 |
+
onConfirm(confirmed)
|
| 109 |
+
}
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
const handleReEdit = () => {
|
| 113 |
+
const source = localParsed || resumeData
|
| 114 |
+
if (!source) {
|
| 115 |
+
setFormData({
|
| 116 |
+
skillInput: 'Python, Java, SQL, PyTorch, Flask',
|
| 117 |
+
skills: [
|
| 118 |
+
{ name: 'Python', level: '熟悉' },
|
| 119 |
+
{ name: 'Java', level: '熟悉' },
|
| 120 |
+
{ name: 'SQL', level: '熟悉' },
|
| 121 |
+
{ name: 'PyTorch', level: '了解' },
|
| 122 |
+
{ name: 'Flask', level: '了解' },
|
| 123 |
+
],
|
| 124 |
+
projects: [
|
| 125 |
+
{ name: '基于协同过滤的推荐系统', description: '使用协同过滤算法实现电影推荐,处理了MovieLens数据集', techStack: 'Python, Flask' },
|
| 126 |
+
{ name: '在线商城后端开发', description: '使用Spring Boot实现RESTful API,包括用户管理、商品管理模块', techStack: 'Java, Spring Boot' },
|
| 127 |
+
],
|
| 128 |
+
experience: '6个月实习经历,参与推荐系统数据管道维护',
|
| 129 |
+
education: { school: '华南理工大学', major: '计算机科学与技术', degree: '本科', startYear: '2021', endYear: '2025' }
|
| 130 |
+
})
|
| 131 |
+
} else {
|
| 132 |
+
const mapProject = (p) => {
|
| 133 |
+
const pName = typeof p === 'string' ? p : (p.name || '')
|
| 134 |
+
const pDesc = typeof p === 'string' ? p : (p.desc || p.name || '')
|
| 135 |
+
return { name: pName, description: pDesc, techStack: '' }
|
| 136 |
+
}
|
| 137 |
+
setFormData({
|
| 138 |
+
skillInput: (source.skills || []).join(', '),
|
| 139 |
+
skills: (source.skills || []).map(name => ({ name, level: '熟悉' })),
|
| 140 |
+
projects: (source.projects || []).map(mapProject),
|
| 141 |
+
experience: source.experience || '',
|
| 142 |
+
education: {
|
| 143 |
+
school: source.education?.school || '',
|
| 144 |
+
major: source.education?.major || '',
|
| 145 |
+
degree: source.education?.degree || '',
|
| 146 |
+
startYear: source.education?.startYear || '',
|
| 147 |
+
endYear: source.education?.endYear || ''
|
| 148 |
+
}
|
| 149 |
+
})
|
| 150 |
+
}
|
| 151 |
+
setManualMode(true)
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
const parseSkillInput = (text) => {
|
| 155 |
+
const names = text.split(',').map(s => s.trim()).filter(Boolean)
|
| 156 |
+
return names.map(name => {
|
| 157 |
+
const existing = formData.skills.find(s => s.name === name)
|
| 158 |
+
return { name, level: existing ? existing.level : '熟悉' }
|
| 159 |
+
})
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
const handleSkillInputChange = (text) => {
|
| 163 |
+
setFormData(p => ({ ...p, skillInput: text, skills: parseSkillInput(text) }))
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
const handleSkillLevelChange = (skillName, level) => {
|
| 167 |
+
setFormData(p => ({
|
| 168 |
+
...p,
|
| 169 |
+
skills: p.skills.map(s => s.name === skillName ? { ...s, level } : s)
|
| 170 |
+
}))
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
const handleProjectAdd = () => {
|
| 174 |
+
setFormData(p => ({ ...p, projects: [...p.projects, { name: '', description: '', techStack: '' }] }))
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
const handleProjectRemove = (index) => {
|
| 178 |
+
setFormData(p => ({ ...p, projects: p.projects.filter((_, i) => i !== index) }))
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
const handleProjectChange = (index, field, value) => {
|
| 182 |
+
setFormData(p => {
|
| 183 |
+
const projects = [...p.projects]
|
| 184 |
+
projects[index] = { ...projects[index], [field]: value }
|
| 185 |
+
return { ...p, projects }
|
| 186 |
+
})
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
const handleEducationChange = (field, value) => {
|
| 190 |
+
setFormData(p => ({ ...p, education: { ...p.education, [field]: value } }))
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
const handleManualSubmit = useCallback(() => {
|
| 194 |
+
const hasAny = formData.skillInput.trim() || formData.projects.some(p => p.name.trim()) || formData.experience.trim() || formData.education.school.trim()
|
| 195 |
+
if (!hasAny) { setErrorMsg('请至少填写一个字段'); return }
|
| 196 |
+
const data = {
|
| 197 |
+
name: '',
|
| 198 |
+
school: formData.education.school || '',
|
| 199 |
+
major: formData.education.major || '',
|
| 200 |
+
grade: formData.education.degree || '',
|
| 201 |
+
skills: formData.skills.map(s => s.name),
|
| 202 |
+
projects: formData.projects.filter(p => p.name.trim()).map(p => p.name),
|
| 203 |
+
projectDetails: formData.projects.filter(p => p.name.trim()),
|
| 204 |
+
summary: '',
|
| 205 |
+
experience: formData.experience,
|
| 206 |
+
education: formData.education.school
|
| 207 |
+
? `${formData.education.school} ${formData.education.major} ${formData.education.degree} ${formData.education.startYear}-${formData.education.endYear}`
|
| 208 |
+
: ''
|
| 209 |
+
}
|
| 210 |
+
setLocalParsed(data)
|
| 211 |
+
setStatus('preview')
|
| 212 |
+
setManualMode(false)
|
| 213 |
+
setAutoTriggered(false)
|
| 214 |
+
}, [formData])
|
| 215 |
+
|
| 216 |
+
if (manualMode) {
|
| 217 |
+
return (
|
| 218 |
+
<div className="page-container">
|
| 219 |
+
<div className="card" style={{ maxWidth: 640, margin: '0 auto' }}>
|
| 220 |
+
<h2 className="font-bold text-xl mb-24">手工填写简历</h2>
|
| 221 |
+
{autoTriggered && (
|
| 222 |
+
<div className="text-warning text-sm mb-16" style={{ padding: '8px 12px', backgroundColor: 'rgba(245,158,11,0.08)', borderRadius: 'var(--radius-sm)' }}>
|
| 223 |
+
已连续3次上传失败,已自动切换为手工填写模式
|
| 224 |
+
</div>
|
| 225 |
+
)}
|
| 226 |
+
{errorMsg && status === 'error' && (
|
| 227 |
+
<div className="text-error text-sm mb-16" style={{ padding: '8px 12px', backgroundColor: 'rgba(239,68,68,0.08)', borderRadius: 'var(--radius-sm)' }}>
|
| 228 |
+
{errorMsg}
|
| 229 |
+
</div>
|
| 230 |
+
)}
|
| 231 |
+
<div className="flex flex-col gap-16">
|
| 232 |
+
<div>
|
| 233 |
+
<label className="text-sm font-bold">技能(逗号分隔)</label>
|
| 234 |
+
<input
|
| 235 |
+
value={formData.skillInput}
|
| 236 |
+
onChange={e => handleSkillInputChange(e.target.value)}
|
| 237 |
+
className="input"
|
| 238 |
+
placeholder="如: React, Python, SQL"
|
| 239 |
+
/>
|
| 240 |
+
{formData.skills.length > 0 && (
|
| 241 |
+
<div className="flex flex-col gap-8 mt-8">
|
| 242 |
+
{formData.skills.map((skill, i) => (
|
| 243 |
+
<div key={i} className="flex items-center gap-8">
|
| 244 |
+
<span className="text-sm" style={{ minWidth: 80 }}>{skill.name}</span>
|
| 245 |
+
<select
|
| 246 |
+
value={skill.level}
|
| 247 |
+
onChange={e => handleSkillLevelChange(skill.name, e.target.value)}
|
| 248 |
+
className="input"
|
| 249 |
+
style={{ width: 120 }}
|
| 250 |
+
>
|
| 251 |
+
{SKILL_LEVELS.map(level => (
|
| 252 |
+
<option key={level} value={level}>{level}</option>
|
| 253 |
+
))}
|
| 254 |
+
</select>
|
| 255 |
+
</div>
|
| 256 |
+
))}
|
| 257 |
+
</div>
|
| 258 |
+
)}
|
| 259 |
+
</div>
|
| 260 |
+
|
| 261 |
+
<div>
|
| 262 |
+
<div className="flex-between mb-8">
|
| 263 |
+
<label className="text-sm font-bold">项目经历</label>
|
| 264 |
+
<button className="btn btn-sm btn-secondary" onClick={handleProjectAdd}>+ 添加项目</button>
|
| 265 |
+
</div>
|
| 266 |
+
{formData.projects.map((project, i) => (
|
| 267 |
+
<div key={i} className="card mb-8" style={{ padding: 12 }}>
|
| 268 |
+
<div className="flex-between mb-8">
|
| 269 |
+
<span className="text-sm font-bold">项目 #{i + 1}</span>
|
| 270 |
+
{formData.projects.length > 1 && (
|
| 271 |
+
<button className="btn btn-sm btn-secondary" onClick={() => handleProjectRemove(i)} style={{ color: '#EF4444' }}>删除</button>
|
| 272 |
+
)}
|
| 273 |
+
</div>
|
| 274 |
+
<input
|
| 275 |
+
className="input mb-8"
|
| 276 |
+
placeholder="项目名称"
|
| 277 |
+
value={project.name}
|
| 278 |
+
onChange={e => handleProjectChange(i, 'name', e.target.value)}
|
| 279 |
+
/>
|
| 280 |
+
<textarea
|
| 281 |
+
className="input mb-8"
|
| 282 |
+
rows={2}
|
| 283 |
+
placeholder="项目描述"
|
| 284 |
+
value={project.description}
|
| 285 |
+
onChange={e => handleProjectChange(i, 'description', e.target.value)}
|
| 286 |
+
/>
|
| 287 |
+
<input
|
| 288 |
+
className="input"
|
| 289 |
+
placeholder="技术栈(逗号分隔)"
|
| 290 |
+
value={project.techStack}
|
| 291 |
+
onChange={e => handleProjectChange(i, 'techStack', e.target.value)}
|
| 292 |
+
/>
|
| 293 |
+
</div>
|
| 294 |
+
))}
|
| 295 |
+
</div>
|
| 296 |
+
|
| 297 |
+
<div>
|
| 298 |
+
<label className="text-sm font-bold">实习经历</label>
|
| 299 |
+
<textarea
|
| 300 |
+
className="input"
|
| 301 |
+
rows={3}
|
| 302 |
+
value={formData.experience}
|
| 303 |
+
onChange={e => setFormData(p => ({ ...p, experience: e.target.value }))}
|
| 304 |
+
placeholder="简要描述实习经历"
|
| 305 |
+
/>
|
| 306 |
+
</div>
|
| 307 |
+
|
| 308 |
+
<div>
|
| 309 |
+
<label className="text-sm font-bold">教育背景</label>
|
| 310 |
+
<div className="grid" style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 8, marginTop: 8 }}>
|
| 311 |
+
<input className="input" placeholder="学校" value={formData.education.school} onChange={e => handleEducationChange('school', e.target.value)} />
|
| 312 |
+
<input className="input" placeholder="专业" value={formData.education.major} onChange={e => handleEducationChange('major', e.target.value)} />
|
| 313 |
+
<input className="input" placeholder="学位(本科/硕士/博士)" value={formData.education.degree} onChange={e => handleEducationChange('degree', e.target.value)} />
|
| 314 |
+
<div className="flex gap-8">
|
| 315 |
+
<input className="input" placeholder="开始年份" value={formData.education.startYear} onChange={e => handleEducationChange('startYear', e.target.value)} />
|
| 316 |
+
<input className="input" placeholder="结束年份" value={formData.education.endYear} onChange={e => handleEducationChange('endYear', e.target.value)} />
|
| 317 |
+
</div>
|
| 318 |
+
</div>
|
| 319 |
+
</div>
|
| 320 |
+
|
| 321 |
+
<button className="btn btn-primary" onClick={handleManualSubmit}>提交预览</button>
|
| 322 |
+
<button className="btn btn-secondary" onClick={() => { setManualMode(false); setStatus('idle'); setAutoTriggered(false) }}>返回</button>
|
| 323 |
+
</div>
|
| 324 |
+
</div>
|
| 325 |
+
</div>
|
| 326 |
+
)
|
| 327 |
+
}
|
| 328 |
+
|
| 329 |
+
if (status === 'uploading' || status === 'loading') {
|
| 330 |
+
return (
|
| 331 |
+
<div className="loading-state" style={{ height: 320 }}>
|
| 332 |
+
<div className="loading-spinner loading-spinner-lg" />
|
| 333 |
+
<p className="mt-16 text-secondary">{status === 'uploading' ? '上传中...' : '解析中...'}</p>
|
| 334 |
+
</div>
|
| 335 |
+
)
|
| 336 |
+
}
|
| 337 |
+
|
| 338 |
+
if (status === 'error') {
|
| 339 |
+
return (
|
| 340 |
+
<div className="error-state">
|
| 341 |
+
<p className="error-state-text">{errorMsg}</p>
|
| 342 |
+
<div className="flex gap-12">
|
| 343 |
+
<button className="btn btn-primary" onClick={() => setStatus('idle')}>重新上传</button>
|
| 344 |
+
<button className="btn btn-secondary" onClick={() => { setManualMode(true); setAutoTriggered(true) }}>手工填写</button>
|
| 345 |
+
</div>
|
| 346 |
+
</div>
|
| 347 |
+
)
|
| 348 |
+
}
|
| 349 |
+
|
| 350 |
+
if (status === 'preview' && localParsed) {
|
| 351 |
+
return (
|
| 352 |
+
<div className="page-container">
|
| 353 |
+
<div className="card" style={{ maxWidth: 640, margin: '0 auto' }}>
|
| 354 |
+
<h2 className="font-bold text-xl mb-16">简历解析结果</h2>
|
| 355 |
+
<p className="text-sm text-secondary mb-16">请核对并修改解析结果,确认后进入推荐</p>
|
| 356 |
+
<div className="flex flex-col gap-12">
|
| 357 |
+
<div>
|
| 358 |
+
<label className="text-sm font-bold">姓名</label>
|
| 359 |
+
<input className="input mt-4" value={editValues.name} onChange={e => setEditValues(f => ({ ...f, name: e.target.value }))} />
|
| 360 |
+
</div>
|
| 361 |
+
<div>
|
| 362 |
+
<label className="text-sm font-bold">学校</label>
|
| 363 |
+
<input className="input mt-4" value={editValues.school} onChange={e => setEditValues(f => ({ ...f, school: e.target.value }))} />
|
| 364 |
+
</div>
|
| 365 |
+
<div>
|
| 366 |
+
<label className="text-sm font-bold">专业</label>
|
| 367 |
+
<input className="input mt-4" value={editValues.major} onChange={e => setEditValues(f => ({ ...f, major: e.target.value }))} />
|
| 368 |
+
</div>
|
| 369 |
+
<div>
|
| 370 |
+
<label className="text-sm font-bold">年级</label>
|
| 371 |
+
<input className="input mt-4" value={editValues.grade} onChange={e => setEditValues(f => ({ ...f, grade: e.target.value }))} />
|
| 372 |
+
</div>
|
| 373 |
+
<div>
|
| 374 |
+
<label className="text-sm font-bold">技能(逗号分隔)</label>
|
| 375 |
+
<input className="input mt-4" value={editValues.skills} onChange={e => setEditValues(f => ({ ...f, skills: e.target.value }))} placeholder="如: Python, Java, SQL" />
|
| 376 |
+
</div>
|
| 377 |
+
<div>
|
| 378 |
+
<label className="text-sm font-bold">项目经历(逗号分隔)</label>
|
| 379 |
+
<input className="input mt-4" value={editValues.projects} onChange={e => setEditValues(f => ({ ...f, projects: e.target.value }))} placeholder="如: 推荐系统, 电商后端" />
|
| 380 |
+
</div>
|
| 381 |
+
<div>
|
| 382 |
+
<label className="text-sm font-bold">实习经历</label>
|
| 383 |
+
<textarea className="input mt-4" rows={3} value={editValues.experience} onChange={e => setEditValues(f => ({ ...f, experience: e.target.value }))} placeholder="描述实习经历" />
|
| 384 |
+
</div>
|
| 385 |
+
<div>
|
| 386 |
+
<label className="text-sm font-bold">自我评价</label>
|
| 387 |
+
<textarea className="input mt-4" rows={3} value={editValues.summary} onChange={e => setEditValues(f => ({ ...f, summary: e.target.value }))} />
|
| 388 |
+
</div>
|
| 389 |
+
</div>
|
| 390 |
+
<div className="flex gap-12 mt-24">
|
| 391 |
+
<button className="btn btn-primary" onClick={() => handleConfirm(editValues)} style={{ flex: 1 }}>确认并继续</button>
|
| 392 |
+
<button className="btn btn-secondary" onClick={handleReEdit} style={{ flex: 1 }}>重新编辑</button>
|
| 393 |
+
</div>
|
| 394 |
+
</div>
|
| 395 |
+
</div>
|
| 396 |
+
)
|
| 397 |
+
}
|
| 398 |
+
|
| 399 |
+
if (status === 'dashboard' && resumeData) {
|
| 400 |
+
const skillNames = (resumeData.skills || []).map(s => typeof s === 'string' ? s : s.name).join(', ')
|
| 401 |
+
const metrics = [
|
| 402 |
+
{ label: '画像完成度', value: '85%', color: '#10B981' },
|
| 403 |
+
{ label: '已匹配岗位', value: `${previewJobs.length}`, color: '#3B82F6' },
|
| 404 |
+
{ label: '待改进维度', value: '2', color: '#F59E0B' },
|
| 405 |
+
]
|
| 406 |
+
return (
|
| 407 |
+
<div className="page-container">
|
| 408 |
+
<div className="flex-between mb-24" style={{ alignItems: 'flex-start' }}>
|
| 409 |
+
<div>
|
| 410 |
+
<h2 className="font-bold text-xl">个人中心</h2>
|
| 411 |
+
<p className="text-sm text-secondary mt-4">
|
| 412 |
+
{resumeData.name || '求职者'} | {resumeData.school || '未设置'}
|
| 413 |
+
</p>
|
| 414 |
+
</div>
|
| 415 |
+
<div className="flex gap-8">
|
| 416 |
+
<button className="btn btn-sm btn-secondary" onClick={() => inputRef.current?.click()}>上传简历</button>
|
| 417 |
+
<input ref={inputRef} type="file" accept=".pdf" style={{ display: 'none' }} onChange={e => { const f = e.target.files[0]; if (f) handleFile(f); e.target.value = '' }} />
|
| 418 |
+
<button className="btn btn-sm btn-secondary" onClick={() => {
|
| 419 |
+
setFormData({
|
| 420 |
+
skillInput: skillNames,
|
| 421 |
+
skills: (resumeData.skills || []).map(s => ({ name: typeof s === 'string' ? s : s.name, level: '熟悉' })),
|
| 422 |
+
projects: [{ name: '', description: '', techStack: '' }],
|
| 423 |
+
experience: resumeData.experience || '',
|
| 424 |
+
education: { school: '', major: '', degree: '', startYear: '', endYear: '' }
|
| 425 |
+
})
|
| 426 |
+
setManualMode(true)
|
| 427 |
+
}}>编辑简历</button>
|
| 428 |
+
</div>
|
| 429 |
+
</div>
|
| 430 |
+
|
| 431 |
+
<div className="flex gap-12 mb-24">
|
| 432 |
+
{metrics.map((m, i) => (
|
| 433 |
+
<div key={i} className="card" style={{ flex: 1, textAlign: 'center' }}>
|
| 434 |
+
<p className="text-2xl font-bold" style={{ color: m.color }}>{m.value}</p>
|
| 435 |
+
<p className="text-sm text-secondary mt-4">{m.label}</p>
|
| 436 |
+
</div>
|
| 437 |
+
))}
|
| 438 |
+
</div>
|
| 439 |
+
|
| 440 |
+
<div className="card mb-24" style={{ textAlign: 'center' }}>
|
| 441 |
+
<h3 className="font-bold mb-16">能力画像</h3>
|
| 442 |
+
<RadarChart dimensions={resumeData.dimensions || ['技能', '项目', '实习', '学历', '综合素质']} scores={resumeData.scores || [80, 75, 70, 85, 78]} />
|
| 443 |
+
<p className="text-sm text-secondary mt-16">{resumeData.summary || '技术栈集中在Python/Java后端开发,有推荐系统和Web开发项目经验'}</p>
|
| 444 |
+
</div>
|
| 445 |
+
|
| 446 |
+
{previewJobs.length > 0 && (
|
| 447 |
+
<div className="card mb-24">
|
| 448 |
+
<div className="flex-between mb-16">
|
| 449 |
+
<h3 className="font-bold">推荐岗位 Top 3</h3>
|
| 450 |
+
</div>
|
| 451 |
+
<div className="flex flex-col gap-12">
|
| 452 |
+
{previewJobs.map(job => (
|
| 453 |
+
<div key={job.job_id} className="flex-between" style={{ padding: '8px 12px', backgroundColor: '#F9FAFB', borderRadius: 'var(--radius-sm)' }}>
|
| 454 |
+
<div>
|
| 455 |
+
<span className="font-bold text-sm">{job.name}</span>
|
| 456 |
+
<span className="text-sm text-secondary ml-8">{job.company}</span>
|
| 457 |
+
</div>
|
| 458 |
+
<span className="font-bold text-sm" style={{ color: job.match_rate >= 80 ? '#10B981' : job.match_rate >= 60 ? '#F59E0B' : '#EF4444' }}>
|
| 459 |
+
{job.match_rate}%
|
| 460 |
+
</span>
|
| 461 |
+
</div>
|
| 462 |
+
))}
|
| 463 |
+
</div>
|
| 464 |
+
</div>
|
| 465 |
+
)}
|
| 466 |
+
|
| 467 |
+
{previewJobs.length > 0 && (
|
| 468 |
+
<div className="card mb-24">
|
| 469 |
+
<div className="flex-between mb-16">
|
| 470 |
+
<h3 className="font-bold">💡 HR 视角速览</h3>
|
| 471 |
+
</div>
|
| 472 |
+
<p className="text-sm mb-16" style={{ lineHeight: 1.7, color: '#4B5563' }}>
|
| 473 |
+
HR 初筛一份简历平均只花 <strong>10~15 秒</strong>⏱️,他们最先扫一眼你的学校、实习经历和技能关键词。下面是你 Top 3 岗位的 HR 关注点,帮你理解他们筛选时在想什么👇
|
| 474 |
+
</p>
|
| 475 |
+
<div className="flex flex-col gap-12">
|
| 476 |
+
{previewJobs.map(job => (
|
| 477 |
+
<div key={job.job_id} className="card" style={{ padding: '10px 14px', backgroundColor: '#F9FAFB' }}>
|
| 478 |
+
<div className="flex-between mb-8">
|
| 479 |
+
<span className="font-bold text-sm">{job.name}<span className="text-secondary ml-8" style={{ fontWeight: 400 }}>{job.company}</span></span>
|
| 480 |
+
</div>
|
| 481 |
+
<div className="flex flex-wrap gap-4">
|
| 482 |
+
{(job.expectation_signals || []).map((signal, i) => (
|
| 483 |
+
<span key={i} className="text-xs" style={{
|
| 484 |
+
padding: '3px 10px',
|
| 485 |
+
backgroundColor: '#EFF6FF',
|
| 486 |
+
color: '#1D4ED8',
|
| 487 |
+
borderRadius: 'var(--radius-sm)',
|
| 488 |
+
display: 'inline-block',
|
| 489 |
+
marginBottom: 4,
|
| 490 |
+
lineHeight: 1.6
|
| 491 |
+
}}>
|
| 492 |
+
{signal.tag}
|
| 493 |
+
<span className="ml-4" style={{ fontSize: 11, color: '#6B7280' }}>— {signal.evidence}</span>
|
| 494 |
+
</span>
|
| 495 |
+
))}
|
| 496 |
+
</div>
|
| 497 |
+
</div>
|
| 498 |
+
))}
|
| 499 |
+
</div>
|
| 500 |
+
<p className="text-xs mt-16" style={{
|
| 501 |
+
padding: '10px 14px',
|
| 502 |
+
backgroundColor: 'rgba(245,158,11,0.08)',
|
| 503 |
+
borderRadius: 'var(--radius-sm)',
|
| 504 |
+
lineHeight: 1.6,
|
| 505 |
+
color: '#92400E'
|
| 506 |
+
}}>
|
| 507 |
+
✨ <strong>小提醒:</strong>针对每个岗位的 HR 关注点,在简历中有针对性地突出相关关键词和经历,能大幅提高初筛通过率!
|
| 508 |
+
</p>
|
| 509 |
+
</div>
|
| 510 |
+
)}
|
| 511 |
+
|
| 512 |
+
<div className="card mb-24">
|
| 513 |
+
<h3 className="font-bold mb-16">开始匹配</h3>
|
| 514 |
+
<div className="flex flex-row gap-12">
|
| 515 |
+
<button className="btn btn-primary" onClick={() => onConfirm(resumeData)}>确认并继续</button>
|
| 516 |
+
<button className="btn btn-secondary" onClick={handleReEdit}>编辑简历</button>
|
| 517 |
+
<button className="btn btn-secondary" onClick={onGoRecommend}>浏览推荐岗位</button>
|
| 518 |
+
</div>
|
| 519 |
+
</div>
|
| 520 |
+
</div>
|
| 521 |
+
)
|
| 522 |
+
}
|
| 523 |
+
|
| 524 |
+
return (
|
| 525 |
+
<div className="page-container">
|
| 526 |
+
<div className="card" style={{ textAlign: 'center', padding: 48 }}>
|
| 527 |
+
<h2 className="font-bold text-xl mb-8">我的简历</h2>
|
| 528 |
+
<p className="text-secondary mb-24">上传简历,AI 帮你匹配合适岗位、诊断简历匹配度、提供改进建议</p>
|
| 529 |
+
<div
|
| 530 |
+
style={{ border: '2px dashed var(--color-border)', borderRadius: 'var(--radius-lg)', padding: 48, cursor: 'pointer' }}
|
| 531 |
+
onClick={() => inputRef.current?.click()}
|
| 532 |
+
onDrop={e => { e.preventDefault(); const f = e.dataTransfer.files[0]; if (f) handleFile(f) }}
|
| 533 |
+
onDragOver={e => e.preventDefault()}
|
| 534 |
+
>
|
| 535 |
+
<p className="text-secondary">拖拽 PDF 到此处,或点击上传</p>
|
| 536 |
+
<p className="text-sm text-light mt-8">支持 PDF 格式</p>
|
| 537 |
+
</div>
|
| 538 |
+
<input ref={inputRef} type="file" accept=".pdf" style={{ display: 'none' }} onChange={e => { const f = e.target.files[0]; if (f) handleFile(f); e.target.value = '' }} />
|
| 539 |
+
<button className="btn btn-secondary mt-16" onClick={handleReEdit}>没有简历?手工填写</button>
|
| 540 |
+
<div className="mt-16">
|
| 541 |
+
<button className="btn btn-primary" onClick={onGoRecommend}>浏览推荐岗位</button>
|
| 542 |
+
</div>
|
| 543 |
+
</div>
|
| 544 |
+
</div>
|
| 545 |
+
)
|
| 546 |
+
}
|
| 547 |
+
|
| 548 |
+
export default HomePage
|
offer-puplayer-hf/frontend/src/pages/RecommendPage.jsx
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { useState, useEffect } from 'react'
|
| 2 |
+
import { getRecommendJobs } from '../api'
|
| 3 |
+
import JobCard from '../components/JobCard'
|
| 4 |
+
|
| 5 |
+
const PAGE_SIZE = 10
|
| 6 |
+
|
| 7 |
+
function RecommendPage({ resumeData, onSelectJob, onBack, onGoHome }) {
|
| 8 |
+
const [status, setStatus] = useState('loading')
|
| 9 |
+
const [jobs, setJobs] = useState([])
|
| 10 |
+
const [page, setPage] = useState(0)
|
| 11 |
+
const [errorMsg, setErrorMsg] = useState('')
|
| 12 |
+
|
| 13 |
+
const isBrowsing = !resumeData
|
| 14 |
+
|
| 15 |
+
const fetchJobs = async () => {
|
| 16 |
+
setStatus('loading')
|
| 17 |
+
try {
|
| 18 |
+
const resumeId = resumeData?.id || 1
|
| 19 |
+
const res = await getRecommendJobs(resumeId)
|
| 20 |
+
const list = res.data?.jobs || []
|
| 21 |
+
setJobs(list)
|
| 22 |
+
setPage(0)
|
| 23 |
+
setStatus(list.length === 0 ? 'empty' : 'success')
|
| 24 |
+
} catch {
|
| 25 |
+
setStatus('error')
|
| 26 |
+
setErrorMsg('加载失败,请重试')
|
| 27 |
+
}
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
useEffect(() => {
|
| 31 |
+
fetchJobs()
|
| 32 |
+
}, [])
|
| 33 |
+
|
| 34 |
+
const totalPages = Math.ceil(jobs.length / PAGE_SIZE)
|
| 35 |
+
const pageJobs = jobs.slice(page * PAGE_SIZE, (page + 1) * PAGE_SIZE)
|
| 36 |
+
|
| 37 |
+
if (status === 'loading') {
|
| 38 |
+
return (
|
| 39 |
+
<div className="loading-state">
|
| 40 |
+
<div className="loading-spinner loading-spinner-lg" />
|
| 41 |
+
<p className="mt-16 text-secondary">加载推荐岗位中...</p>
|
| 42 |
+
</div>
|
| 43 |
+
)
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
if (status === 'error') {
|
| 47 |
+
return (
|
| 48 |
+
<div className="error-state">
|
| 49 |
+
<p className="error-state-text">{errorMsg}</p>
|
| 50 |
+
<div className="flex gap-12">
|
| 51 |
+
<button className="btn btn-primary" onClick={fetchJobs}>重试</button>
|
| 52 |
+
<button className="btn btn-secondary" onClick={onBack}>返回首页</button>
|
| 53 |
+
</div>
|
| 54 |
+
</div>
|
| 55 |
+
)
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
if (status === 'empty') {
|
| 59 |
+
return (
|
| 60 |
+
<div className="empty-state">
|
| 61 |
+
<p className="empty-state-text">暂无可推荐岗位,请完善简历后重试</p>
|
| 62 |
+
<button className="btn btn-primary" onClick={onBack}>返回首页</button>
|
| 63 |
+
</div>
|
| 64 |
+
)
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
return (
|
| 68 |
+
<div>
|
| 69 |
+
<div className="flex-between mb-24">
|
| 70 |
+
<h2 className="font-bold text-xl">推荐岗位</h2>
|
| 71 |
+
<span className="text-sm text-light">共 {jobs.length} 个岗位</span>
|
| 72 |
+
</div>
|
| 73 |
+
<div className="flex flex-col gap-16">
|
| 74 |
+
{pageJobs.map((job) => (
|
| 75 |
+
<JobCard
|
| 76 |
+
key={job.job_id}
|
| 77 |
+
job={job}
|
| 78 |
+
onClick={(jobId, jobData) => onSelectJob(jobId, jobData || job)}
|
| 79 |
+
lowMatchWarning={(job.match_rate || 0) < 40}
|
| 80 |
+
showMatch={!isBrowsing}
|
| 81 |
+
onUploadClick={isBrowsing ? onGoHome : undefined}
|
| 82 |
+
/>
|
| 83 |
+
))}
|
| 84 |
+
</div>
|
| 85 |
+
{totalPages > 1 && (
|
| 86 |
+
<div className="flex-between mt-24" style={{ justifyContent: 'center', gap: 12 }}>
|
| 87 |
+
<button
|
| 88 |
+
className="btn btn-sm btn-secondary"
|
| 89 |
+
disabled={page === 0}
|
| 90 |
+
onClick={() => setPage(p => Math.max(0, p - 1))}
|
| 91 |
+
>
|
| 92 |
+
上一页
|
| 93 |
+
</button>
|
| 94 |
+
<span className="text-sm text-secondary">
|
| 95 |
+
{page + 1} / {totalPages}
|
| 96 |
+
</span>
|
| 97 |
+
<button
|
| 98 |
+
className="btn btn-sm btn-secondary"
|
| 99 |
+
disabled={page >= totalPages - 1}
|
| 100 |
+
onClick={() => setPage(p => Math.min(totalPages - 1, p + 1))}
|
| 101 |
+
>
|
| 102 |
+
下一页
|
| 103 |
+
</button>
|
| 104 |
+
</div>
|
| 105 |
+
)}
|
| 106 |
+
<div className="mt-24 text-center">
|
| 107 |
+
<button className="btn btn-secondary" onClick={onBack}>返回首页</button>
|
| 108 |
+
</div>
|
| 109 |
+
</div>
|
| 110 |
+
)
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
export default RecommendPage
|
offer-puplayer-hf/frontend/src/pages/SuggestPage.jsx
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { useState, useCallback } from 'react'
|
| 2 |
+
import { rerankReport } from '../api'
|
| 3 |
+
|
| 4 |
+
function SuggestPage({ jobId, resumeData, advice, onBack }) {
|
| 5 |
+
const defaultSkills = 'Python, Java, SQL, PyTorch, Flask'
|
| 6 |
+
const defaultProjects = '推荐系统, 电商后端'
|
| 7 |
+
const defaultExp = '6个月实习经历,参与推荐系统数据管道维护'
|
| 8 |
+
|
| 9 |
+
const initData = resumeData || {}
|
| 10 |
+
const projToString = (p) => typeof p === 'string' ? p : (p.name || p.title || '')
|
| 11 |
+
const [editedResume, setEditedResume] = useState({
|
| 12 |
+
skills: (initData.skills || []).join(', ') || defaultSkills,
|
| 13 |
+
projects: (initData.projects || []).map(projToString).join(', ') || defaultProjects,
|
| 14 |
+
experience: initData.experience || defaultExp
|
| 15 |
+
})
|
| 16 |
+
const [rerankResult, setRerankResult] = useState(null)
|
| 17 |
+
const [reranking, setReranking] = useState(false)
|
| 18 |
+
|
| 19 |
+
const handleRerank = useCallback(async () => {
|
| 20 |
+
const hasContent = editedResume.skills.trim() || editedResume.projects.trim() || editedResume.experience.trim()
|
| 21 |
+
if (!hasContent) return
|
| 22 |
+
setReranking(true)
|
| 23 |
+
try {
|
| 24 |
+
const text = `技能: ${editedResume.skills}\n项目: ${editedResume.projects}\n经历: ${editedResume.experience}`
|
| 25 |
+
const res = await rerankReport(jobId, text)
|
| 26 |
+
setRerankResult(res.data)
|
| 27 |
+
} catch {
|
| 28 |
+
setRerankResult({ error: '重评估失败' })
|
| 29 |
+
}
|
| 30 |
+
setReranking(false)
|
| 31 |
+
}, [jobId, editedResume])
|
| 32 |
+
|
| 33 |
+
return (
|
| 34 |
+
<div>
|
| 35 |
+
<h2 className="font-bold text-xl mb-24">简历修改建议</h2>
|
| 36 |
+
|
| 37 |
+
{advice && (
|
| 38 |
+
<>
|
| 39 |
+
{advice.rewrite_suggestions && advice.rewrite_suggestions.length > 0 && (
|
| 40 |
+
<div className="mb-24">
|
| 41 |
+
<h3 className="font-bold mb-16">📝 简历修改建议</h3>
|
| 42 |
+
<div className="flex flex-col gap-16">
|
| 43 |
+
{advice.rewrite_suggestions.map((item, i) => (
|
| 44 |
+
<div key={i} className="card">
|
| 45 |
+
<div className="flex-between mb-8">
|
| 46 |
+
<span className="font-bold">{item.dimension}</span>
|
| 47 |
+
<span className="text-sm text-warning">{item.issue}</span>
|
| 48 |
+
</div>
|
| 49 |
+
<div className="mb-8">
|
| 50 |
+
<span className="text-sm text-secondary">原文: </span>
|
| 51 |
+
<span className="text-sm" style={{ textDecoration: 'line-through', color: '#EF4444' }}>{item.original}</span>
|
| 52 |
+
</div>
|
| 53 |
+
<div className="mb-8">
|
| 54 |
+
<span className="text-sm text-secondary">建议: </span>
|
| 55 |
+
<span className="text-sm font-bold" style={{ color: '#10B981' }}>{item.suggestion}</span>
|
| 56 |
+
</div>
|
| 57 |
+
<div>
|
| 58 |
+
<span className="text-sm text-light">{item.reason}</span>
|
| 59 |
+
</div>
|
| 60 |
+
</div>
|
| 61 |
+
))}
|
| 62 |
+
</div>
|
| 63 |
+
</div>
|
| 64 |
+
)}
|
| 65 |
+
|
| 66 |
+
{advice.interview_tips && advice.interview_tips.length > 0 && (
|
| 67 |
+
<div className="mb-24">
|
| 68 |
+
<h3 className="font-bold mb-16">🎯 面试准备方向</h3>
|
| 69 |
+
<div className="flex flex-col gap-16">
|
| 70 |
+
{advice.interview_tips.map((item, i) => (
|
| 71 |
+
<div key={i} className="card">
|
| 72 |
+
<div className="flex-between mb-8">
|
| 73 |
+
<span className="font-bold">{item.topic}</span>
|
| 74 |
+
<span className="text-sm text-secondary">{item.reason}</span>
|
| 75 |
+
</div>
|
| 76 |
+
<p className="text-sm" style={{ color: '#4F46E5' }}>{item.tip}</p>
|
| 77 |
+
</div>
|
| 78 |
+
))}
|
| 79 |
+
</div>
|
| 80 |
+
</div>
|
| 81 |
+
)}
|
| 82 |
+
|
| 83 |
+
{advice.encouragement && (
|
| 84 |
+
<div className="card mb-24" style={{ backgroundColor: 'rgba(16,185,129,0.06)', borderColor: '#10B981' }}>
|
| 85 |
+
<h3 className="font-bold mb-8">💪 鼓励</h3>
|
| 86 |
+
<p className="text-secondary">{advice.encouragement}</p>
|
| 87 |
+
</div>
|
| 88 |
+
)}
|
| 89 |
+
|
| 90 |
+
<hr className="divider mb-24" />
|
| 91 |
+
</>
|
| 92 |
+
)}
|
| 93 |
+
|
| 94 |
+
<div className="card mb-24">
|
| 95 |
+
<h3 className="font-bold mb-16">编辑简历</h3>
|
| 96 |
+
<div className="flex flex-col gap-12">
|
| 97 |
+
<div>
|
| 98 |
+
<label className="text-sm font-bold">技能(逗号分隔)</label>
|
| 99 |
+
<input
|
| 100 |
+
className="input"
|
| 101 |
+
value={editedResume.skills}
|
| 102 |
+
onChange={e => setEditedResume(p => ({ ...p, skills: e.target.value }))}
|
| 103 |
+
placeholder="如: React, Python, SQL"
|
| 104 |
+
/>
|
| 105 |
+
</div>
|
| 106 |
+
<div>
|
| 107 |
+
<label className="text-sm font-bold">项目经历</label>
|
| 108 |
+
<textarea
|
| 109 |
+
className="input"
|
| 110 |
+
rows={3}
|
| 111 |
+
value={editedResume.projects}
|
| 112 |
+
onChange={e => setEditedResume(p => ({ ...p, projects: e.target.value }))}
|
| 113 |
+
placeholder="描述你的项目经历"
|
| 114 |
+
/>
|
| 115 |
+
</div>
|
| 116 |
+
<div>
|
| 117 |
+
<label className="text-sm font-bold">实习经历</label>
|
| 118 |
+
<textarea
|
| 119 |
+
className="input"
|
| 120 |
+
rows={3}
|
| 121 |
+
value={editedResume.experience}
|
| 122 |
+
onChange={e => setEditedResume(p => ({ ...p, experience: e.target.value }))}
|
| 123 |
+
placeholder="描述你的实习经历"
|
| 124 |
+
/>
|
| 125 |
+
</div>
|
| 126 |
+
</div>
|
| 127 |
+
<button className="btn btn-primary mt-16" onClick={handleRerank} disabled={reranking || !(editedResume.skills.trim() || editedResume.projects.trim() || editedResume.experience.trim())}>
|
| 128 |
+
{reranking ? '重新评估中...' : '重新评估匹配度'}
|
| 129 |
+
</button>
|
| 130 |
+
</div>
|
| 131 |
+
|
| 132 |
+
{rerankResult && !rerankResult.error && (
|
| 133 |
+
<div className="card mb-24">
|
| 134 |
+
<h3 className="font-bold mb-16">修改后匹配度</h3>
|
| 135 |
+
<p>匹配度:<span className="font-bold text-lg">{rerankResult.match_rate}%</span></p>
|
| 136 |
+
<p className="text-secondary mt-8">修改前:{rerankResult.previous_rate}%</p>
|
| 137 |
+
{rerankResult.match_rate > rerankResult.previous_rate && (
|
| 138 |
+
<p className="text-success mt-8">修改有效,匹配度提升了 {rerankResult.match_rate - rerankResult.previous_rate}%</p>
|
| 139 |
+
)}
|
| 140 |
+
</div>
|
| 141 |
+
)}
|
| 142 |
+
|
| 143 |
+
<div className="text-center">
|
| 144 |
+
<button className="btn btn-secondary" onClick={onBack}>返回诊断</button>
|
| 145 |
+
</div>
|
| 146 |
+
</div>
|
| 147 |
+
)
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
export default SuggestPage
|
offer-puplayer-hf/frontend/vite.config.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { defineConfig } from 'vite'
|
| 2 |
+
import react from '@vitejs/plugin-react'
|
| 3 |
+
|
| 4 |
+
export default defineConfig({
|
| 5 |
+
plugins: [react()],
|
| 6 |
+
server: {
|
| 7 |
+
port: 5173,
|
| 8 |
+
proxy: {
|
| 9 |
+
'/api': 'http://localhost:8000'
|
| 10 |
+
}
|
| 11 |
+
}
|
| 12 |
+
})
|