冗余公司名字
This commit is contained in:
@@ -143,7 +143,7 @@ async def _do_clean(data: dict) -> None:
|
|||||||
return
|
return
|
||||||
|
|
||||||
# 第一次AI:结构化提取
|
# 第一次AI:结构化提取
|
||||||
user_message = _build_user_message(data)
|
user_message = await _build_user_message(data)
|
||||||
result = await ai_chat_json(JobCleanModel.STRUCTURE, JOB_STRUCTURE_SYSTEM, user_message, scene="structure")
|
result = await ai_chat_json(JobCleanModel.STRUCTURE, JOB_STRUCTURE_SYSTEM, user_message, scene="structure")
|
||||||
if result is None or not result.get("valid", False):
|
if result is None or not result.get("valid", False):
|
||||||
log.info("[id={}] 丢弃:AI判定无效", data_id)
|
log.info("[id={}] 丢弃:AI判定无效", data_id)
|
||||||
@@ -373,14 +373,18 @@ async def _update_pg_status(data_id: int, status: str) -> None:
|
|||||||
await pg.commit()
|
await pg.commit()
|
||||||
|
|
||||||
|
|
||||||
def _build_user_message(data: dict) -> str:
|
async def _build_user_message(data: dict) -> str:
|
||||||
"""构建第一次AI的用户消息"""
|
"""构建第一次AI的用户消息"""
|
||||||
|
# 从 app_url_list 取来源公司名,作为 companyShortName 的参考
|
||||||
|
input_company_name = await _get_input_company_name(data.get("urllistid"))
|
||||||
|
|
||||||
parts = [
|
parts = [
|
||||||
"【原始数据】",
|
"【原始数据】",
|
||||||
f"岗位名称: {data.get('job_title') or ''}",
|
f"岗位名称: {data.get('job_title') or ''}",
|
||||||
f"薪资: {data.get('salary') or ''}",
|
f"薪资: {data.get('salary') or ''}",
|
||||||
f"工作地点: {data.get('location') or ''}",
|
f"工作地点: {data.get('location') or ''}",
|
||||||
f"公司: {data.get('company') or ''}",
|
f"公司: {data.get('company') or ''}",
|
||||||
|
f"来源公司名(参考): {input_company_name or ''}",
|
||||||
f"经验要求: {data.get('experience') or ''}",
|
f"经验要求: {data.get('experience') or ''}",
|
||||||
f"学历要求: {data.get('education') or ''}",
|
f"学历要求: {data.get('education') or ''}",
|
||||||
f"岗位详情: {data.get('description') or ''}",
|
f"岗位详情: {data.get('description') or ''}",
|
||||||
@@ -390,3 +394,15 @@ def _build_user_message(data: dict) -> str:
|
|||||||
f"【行业列表】\n{dict_cache.industry_text}",
|
f"【行业列表】\n{dict_cache.industry_text}",
|
||||||
]
|
]
|
||||||
return "\n".join(parts)
|
return "\n".join(parts)
|
||||||
|
|
||||||
|
|
||||||
|
async def _get_input_company_name(urllistid: int | None) -> str | None:
|
||||||
|
"""从 PG app_url_list 按 urllistid 读取 input_company_name"""
|
||||||
|
if not urllistid:
|
||||||
|
return None
|
||||||
|
async with PgSession() as pg:
|
||||||
|
row = await pg.execute(
|
||||||
|
text("SELECT input_company_name FROM app_url_list WHERE id = :id"),
|
||||||
|
{"id": urllistid},
|
||||||
|
)
|
||||||
|
return row.scalar()
|
||||||
|
|||||||
Reference in New Issue
Block a user