修改定制简历保存逻辑

This commit is contained in:
zk
2026-04-28 11:16:50 +08:00
parent dbbc97a836
commit 9daeea9fc5
6 changed files with 102 additions and 48 deletions
+4 -4
View File
@@ -126,8 +126,8 @@ class SkillGapService:
if "skills" in optimize_modules and add_skills:
existing = set(cr.resume.skills)
cr.resume.skills.extend([s for s in add_skills if s not in existing])
# 5. 存 Redis
await customize_resume_store.save(user_id, cr)
# 5. 存数据库
await customize_resume_store.save(user_id, job_id, cr)
@staticmethod
def _experience_tasks(cr: CustomizeResume, job_title: str, job_desc: str) -> list[tuple[str, str]]:
@@ -161,7 +161,7 @@ class SkillGapService:
instruction: str, chat_history: list) -> dict:
"""AI 对话式编辑定制简历(原子化操作版)"""
# 1. 取当前定制简历
cr_data = await customize_resume_store.get(user_id)
cr_data = await customize_resume_store.get(user_id, job_id)
if not cr_data:
raise ValueError("定制简历不存在,请先生成")
cr = CustomizeResume.model_validate(cr_data)
@@ -228,7 +228,7 @@ class SkillGapService:
elif op_type == "add":
self._apply_record_add(cr, mod_name, result)
# 6. 保存(自动备份回滚)
await customize_resume_store.save(user_id, cr)
await customize_resume_store.save(user_id, job_id, cr)
# 拼接更新模块标签
updated_modules = list(dict.fromkeys(op.get("module", "") for op in operations))
label = "".join(_MODULE_LABELS.get(m, m) for m in updated_modules if m)