新增:
- scripts/service/platform_collector.py:Playwright RPA(持久化 browser profile 复用登录态),抓合同表(姓名/单位/到期日/剩余天数/预警/建议),逐行点"续聘材料包"按钮下载 PDF/Word 到 data/materials/
- scripts/service/material_parser.py:PDF/Word 文本提取(pypdf → pdf2image + pytesseract OCR 扫描件兜底;python-docx 抽 docx;antiword 兜底 .doc)
- scripts/service/llm_decision.py:AI 决策统一入口(优先调宿主 jiangchang_skill_core.llm_manager.call_llm_json;本地降级到规则版;输出 decision_source ∈ {llm, rules, rules_no_materials})
- scripts/db/migrations.py:idempotent ALTER/CREATE,建 materials_content 表 + renewal_tasks 加 decision_source / materials_summary 列
修改:
- scripts/db/connection.py:init_db() 自动调 apply_all() 应用 v1.1.1 迁移
- scripts/db/repository.py:加 insert_material / list_materials_for_contract / list_pending_materials / summarize_materials / get_task_full
- scripts/service/task_generator.py:AI 决策统一改为调 llm_decision.decide_suggestion(materials_summary=...);reason 文案加「已结合材料包(X 份文件,Y 字 / 待解析)综合判断:...」
- scripts/service/html_renderer.py:ctx 加 DECISION_SOURCE(LLM 推理 / 本地规则 / 本地规则(无材料))+ MATERIALS_COUNT
- scripts/templates/task.html.j2:footer 加 "AI 建议来源:{{DECISION_SOURCE}} · 已审阅材料 {{MATERIALS_COUNT}} 份"
- scripts/cli/app.py:新增 2 个 CLI(collect-from-platform / parse-materials);现有 9 个不动
- requirements.txt:playwright / pypdf / python-docx / pdf2image / pytesseract / Pillow
- .env.example:SMARTCAMPUS_BASE_URL / SMARTCAMPUS_PROFILE_DIR / MATERIALS_DOWNLOAD_DIR / OCR_LANG / LLM_MODEL_NAME / LLM_API_BASE_URL / LLM_API_TOKEN
- SKILL.md:version 1.1.0 → 1.1.1;用户意图路由表加 2 行;新增「数据来源」段(三层来源 + AI 决策透明化)
- README.md:使用前要准备 → 加 playwright install chromium 步骤
- CHANGELOG.md:v1.1.1 条目
- scripts/util/constants.py:SKILL_VERSION 1.1.0 → 1.1.1
本地验证:11 个 CLI 全部 exit 0;decision_source=rules;reason 含「已结合材料包(6 份文件,待解析)」;HTML footer 含决策来源。
Co-Authored-By: Claude Code <noreply@anthropic.com>
119 lines
4.2 KiB
Django/Jinja
119 lines
4.2 KiB
Django/Jinja
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<title>{{TITLE}}</title>
|
|
<style>
|
|
/* 数据管理 iframe 预览布局基线 */
|
|
html, body {
|
|
margin: 0;
|
|
padding: 16px;
|
|
font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
|
|
color: #1f2329;
|
|
background: #fafbfc;
|
|
line-height: 1.6;
|
|
}
|
|
.report { max-width: 100%; }
|
|
.header {
|
|
padding: 20px;
|
|
background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
|
|
color: #fff;
|
|
border-radius: 8px;
|
|
margin-bottom: 16px;
|
|
}
|
|
.header h1 { margin: 0 0 8px; font-size: 22px; }
|
|
.header .meta { color: #dbeafe; font-size: 13px; }
|
|
.info-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
gap: 12px;
|
|
margin-bottom: 16px;
|
|
}
|
|
.info-card {
|
|
padding: 12px 16px;
|
|
background: #fff;
|
|
border: 1px solid #e5e6eb;
|
|
border-radius: 8px;
|
|
}
|
|
.info-card .label { color: #8c959f; font-size: 12px; }
|
|
.info-card .value { font-size: 16px; font-weight: 600; margin-top: 4px; word-break: break-word; }
|
|
.section {
|
|
padding: 16px 20px;
|
|
background: #fff;
|
|
border: 1px solid #e5e6eb;
|
|
border-radius: 8px;
|
|
margin-bottom: 16px;
|
|
}
|
|
.section h2 { margin: 0 0 12px; font-size: 16px; color: #1e3a8a; }
|
|
.summary-text { white-space: pre-wrap; color: #4e5969; }
|
|
.ai-suggestion {
|
|
padding: 14px 18px;
|
|
border-left: 4px solid #3b82f6;
|
|
background: #eff6ff;
|
|
border-radius: 4px;
|
|
color: #1e40af;
|
|
}
|
|
.ai-suggestion.renew { border-left-color: #059669; background: #ecfdf5; color: #065f46; }
|
|
.ai-suggestion.observe { border-left-color: #d97706; background: #fffbeb; color: #92400e; }
|
|
.ai-suggestion.non-renew { border-left-color: #c53030; background: #fef2f2; color: #991b1b; }
|
|
.checklist { list-style: none; padding: 0; margin: 0; }
|
|
.checklist li {
|
|
padding: 8px 0;
|
|
border-bottom: 1px solid #f0f1f3;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
}
|
|
.checklist li:last-child { border-bottom: 0; }
|
|
.checklist .box {
|
|
width: 16px; height: 16px;
|
|
border: 1px solid #cbd5e1;
|
|
border-radius: 3px;
|
|
flex-shrink: 0;
|
|
}
|
|
.footer { margin-top: 16px; color: #8c959f; font-size: 12px; text-align: right; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="report">
|
|
<div class="header">
|
|
<h1>{{TITLE}}</h1>
|
|
<div class="meta">任务编号:{{TASK_ID}} · 生成时间:{{GENERATED_AT}}</div>
|
|
</div>
|
|
|
|
<div class="info-grid">
|
|
<div class="info-card"><div class="label">教职工姓名</div><div class="value">{{TEACHER_NAME}}</div></div>
|
|
<div class="info-card"><div class="label">工号</div><div class="value">{{EMPLOYEE_ID}}</div></div>
|
|
<div class="info-card"><div class="label">所在单位</div><div class="value">{{UNIT_NAME}}</div></div>
|
|
<div class="info-card"><div class="label">聘任岗位</div><div class="value">{{POSITION}}</div></div>
|
|
<div class="info-card"><div class="label">合同类型</div><div class="value">{{CONTRACT_TYPE}}</div></div>
|
|
<div class="info-card"><div class="label">合同起止</div><div class="value">{{CONTRACT_START}} ~ {{CONTRACT_END}}</div></div>
|
|
<div class="info-card"><div class="label">距到期日</div><div class="value">{{DAYS_TO_EXPIRE}} 天</div></div>
|
|
<div class="info-card"><div class="label">预警等级</div><div class="value">{{ALERT_LEVEL}}</div></div>
|
|
</div>
|
|
|
|
<div class="section">
|
|
<h2>近三年工作业绩摘要</h2>
|
|
<div class="summary-text">{{PERFORMANCE_SUMMARY}}</div>
|
|
</div>
|
|
|
|
<div class="section">
|
|
<h2>AI 续聘建议</h2>
|
|
<div class="ai-suggestion {{SUGGESTION_CLASS}}">
|
|
<strong>{{SUGGESTION_LABEL}}</strong><br />
|
|
{{SUGGESTION_REASON}}
|
|
</div>
|
|
</div>
|
|
|
|
<div class="section">
|
|
<h2>所需材料清单(请于 {{DEADLINE}} 前备齐)</h2>
|
|
<ul class="checklist">
|
|
{{CHECKLIST_BODY}}
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="footer">本任务书由「合同到期智能预警与续聘辅助」技能自动生成 · AI 建议来源:{{DECISION_SOURCE}} · 已审阅材料 {{MATERIALS_COUNT}} 份 · 最终续聘决定权归人事处</div>
|
|
</div>
|
|
</body>
|
|
</html>
|