修复场景经验不参与匹配:解析的场景写入 matchState 并随 /api/match 提交(单人诊断与推荐岗位此前均写死空数组,导致场景维度恒 0)

This commit is contained in:
FinStab
2026-09-01 20:46:17 +08:00
parent fc200a7592
commit 8f613e37dd
2 changed files with 5 additions and 4 deletions
+4 -3
View File
@@ -1301,7 +1301,7 @@ function renderEvoReplace(jobId) {
}
/* ================= 人岗匹配(三步向导) ================= */
const matchState = { step: 1, skills: [], years: 0, result: null, profileText: "" };
const matchState = { step: 1, skills: [], years: 0, result: null, profileText: "", scenarios: [] };
let lastProfile = null; // 最近一次解析的完整简历画像(结构化模板与导出用)
function setMatchStep(n) {
@@ -1387,6 +1387,7 @@ function applyParsedProfile(p, sourceDesc) {
matchState.profileText = p.raw_masked_text || "";
matchState.skills = [...p.skills];
matchState.years = p.years || 0;
matchState.scenarios = [...(p.scenarios || [])]; // 场景经验参与匹配评分(此前解析后未传入)
$("#resume-text").value = p.raw_masked_text || "";
const studentish = (p.education || "").includes("在读")
|| /应届|在读|大[一二三四]/.test(p.raw_masked_text || "");
@@ -1450,7 +1451,7 @@ $("#btn-run-match").onclick = async () => {
try {
const m = await post("/api/match", {
job_id: jobId, skills: matchState.skills, years: matchState.years,
scenarios: [],
scenarios: matchState.scenarios,
});
matchState.result = m;
renderMatchResult(m);
@@ -1622,7 +1623,7 @@ async function renderRecJobs(current) {
box.innerHTML = `<div class="text-weak text-aux">计算中…</div>`;
const others = CN.jobs.filter((j) => j.job_id !== current.job_id).slice(0, 12);
const results = await Promise.all(others.map((j) =>
post("/api/match", { job_id: j.job_id, skills: matchState.skills, years: matchState.years, scenarios: [] })
post("/api/match", { job_id: j.job_id, skills: matchState.skills, years: matchState.years, scenarios: matchState.scenarios })
.then((m) => ({ job: j, m })).catch(() => null)));
const top = results.filter(Boolean).sort((a, b) => b.m.total_score - a.m.total_score).slice(0, 3);
box.innerHTML = top.map(({ job, m }) => `