Commit Graph

11 Commits

Author SHA1 Message Date
Hermes Agent
d83f1a1c72 fix(audit): LLM 返回 markdown-fenced JSON 时正确解析,避免静默吞异常
问题: AuditService._llm_enhance_audit 直接 json.loads(resp.content),
当 LLM 返回 ```json ... ``` 包裹内容时必然失败,被外层
except Exception: return [] 静默吞掉,导致 LLM 增强永远不生效。
表面看似已接入 LLM,实际从未真正调用成功。

修复: 在 json.loads 前剥离 markdown fence(```json / ``` 标记),
兼容主流 LLM 的 markdown 输出习惯。

验证:
- 真实 53hk 中转链路(MiniMax-M2.7-highspeed)端到端调用通过
- 修复前 AuditService.suggestions 无 '🤖 LLM' 输出
- 修复后真实返回 8 条 LLM 风险分析 + 建议操作条目
- 新增回归测试 test_llm_enhance_audit_handles_markdown_json_fence
- 全部 LLM/audit 测试通过 (16+7=23 项)
2026-06-29 21:00:46 +08:00
Hermes Agent
a3d8c73a84 feat(llm): AuditService LLM增强 + 完整规划页 LLM方案生成
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
AuditService:
- 新增 llm_client 构造参数
- audit() 完成规则检查后, 如果 LLM 已配置, 调用 LLM 做深度风险分析
- _llm_enhance_audit(): 调用 build_audit_prompt, 解析 key_findings/suggestions,
  以 🤖 前缀注入 suggestions 列表头部
- LLM 未配置或调用失败时, 自动回退到纯规则审核结果

完整规划页 (_render_full_plan_placeholder_page):
- 新增 settings 参数
- 如果 LLM 已配置, 调用 build_full_plan_prompt 生成完整志愿方案
- 渲染为结构化表格: 档位(冲🔴/稳🟢/保🔵) + 院校 + 专业 + 推荐理由
- 输出 overall_assessment, strategy, warnings
- LLM 调用失败时显示'AI 方案生成暂时不可用'而非空白

调用链:
- full_plan_page 路由传递 settings 到渲染函数

验证: pytest 32 passed (llm 12 + web_public 20)
2026-06-28 12:36:06 +08:00
Hermes Agent
a015f6780a docs(cleanup): finalize 417-file review inventory
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
2026-06-18 10:46:40 +08:00
Hermes Agent
246f21c7f2 feat(review): land unified remediation and rules evidence closure
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
2026-06-18 10:21:38 +08:00
Hermes Agent
ca480ebf84 chore(quality): close T5.5 coverage gate
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
2026-06-13 22:31:40 +08:00
Hermes Agent
3f46811e49 release: cut v2.1
Some checks failed
CI / pytest (Python 3.10) (push) Has been cancelled
CI / pytest (Python 3.11) (push) Has been cancelled
CI / pytest (Python 3.12) (push) Has been cancelled
2026-06-13 14:49:58 +08:00
Hermes
fc5810e13b docs(audit): T1.3 完成后更新 SKILL.md DoD 复选框 + 版本号
T1.2 交付时遗留的两条 DoD 复选框('提交 commit 前完成本地结构校验'
'待 T1.3 完成后整体跑测试套件')在 T1.3 实际完成时勾选上,避免
bookkeeping 漂移(父任务 t_3e346fc1 review 关注点之一)。

版本号 v1.0 → v1.1,对应任务补注 T1.3。
2026-06-12 16:24:34 +08:00
Hermes
b796d0d4dd feat(audit): T1.3 实现方案解析器 plan_parser + T1.2 review 闭环修复
plan_parser.py(295 行):从大厂AI方案文本(PDF/纯文本/截图OCR)提取
考生信息+志愿列表。10 个单元测试全部通过(基础解析/志愿列表/省份别名/
选科/PDF格式/空文本/无志愿/编号多样性/序列化/真实样本回归)。

支持 27 省 + 别名(湘/HN/Hunan 等);志愿行 4 种行首编号格式
(. / 、/ )/ 空格);学校-专业 4 种分隔风格(-/:/()/ 空格)。

T1.2 review 闭环修复:
- Environment(autoescape=False) → autoescape=True,修复用户派生字段
  (policy_errors/crowd_risks/data_issues)XSS 注入风险
- 标签平衡检查改为显式 VOID_ELEMENTS 集合(103=103, 7 void 排除),
  原 '(HTML5 void elements ignored)' 注释与实际行为不符已修正

新增 fixture: tests/fixtures/sample_xianyu.txt(百度AI方案真实样本)

测试:gaokao-audit 11/11 通过;项目 244/244(不含无关订单 masking 分支)
2026-06-12 16:24:25 +08:00
Hermes Agent
56c39f73e2 feat(audit): T1.2 创建 gaokao-audit skill 基础结构
承接大厂AI(千问/元宝/百度/豆包)用户转化的 49 元审核服务 skill 骨架:

- SKILL.md (143 行) — 角色边界 + 49 元服务定价 + 四维审核框架
  (政策合规/扎堆风险/数据溯源/改进建议) + 合规红线 + DoD
- templates/audit_report.html (262 行) — Jinja2 报告模板
  含 4 审核维度渲染区块 + 升级到 99 元完整方案卡片
- examples/sample_audit.md (144 行) — 输入样例(大厂AI方案 3 形态)
  + 输出报告样例 + 渲染数据契约表(给 T1.3 parser 用)
- scripts/validate_template.py (137 行) — 模板渲染校验器
  16 个占位符检查 + mock payload 渲染 + 7 个输出字符串断言
- tests/test_validate_template.py (33 行) — pytest 入口,1 用例通过

关键设计:T1.1 review 暴露的 4 个反模式(吞错/模糊 substring/vacuous 测试/
缺失档位)已显式列入 SKILL.md 的'对齐 T1.1 review 教训'表,由 T1.3 plan_parser
实施时强制规避。

验证:
- 项目内测试 7/7 通过(原 6 个 spec_checker 测试 + 1 个新 audit 模板测试)
- SKILL.md frontmatter 合规(name/description ≤ 1024 字符)
- audit_report.html 7063 字符 mock 渲染成功

T1.2 范围限制:plan_parser 由 T1.3 实现,tests/test_plan_parser.py 同步补齐。
2026-06-12 15:34:47 +08:00
Hermes Agent
7cc4a5fa05 feat: 新增龙老师角色Skill(gaokao-counselor-long)
创建一个更专业、更全面的高考志愿规划师角色,定位为
'张雪峰思路+AI技术'的融合体。

核心能力:
- 政策合规专家(27省自动识别)
- 数据驱动型(基于2025年位次)
- 个性化推荐(兴趣+能力+家庭+就业)
- 风险评估前置
- 可视化报告输出

与张雪峰skill的差异:
- 张雪峰:风格化、经验型
- 龙老师:标准化、AI辅助、合规检查

文件结构:
- SKILL.md - 角色定义、风格、核心能力
- references/quick-guide.md - 用户快速指南
- cases/case-001-hunan-578.md - 典型咨询案例
- templates/counselor-report.md - 报告模板

适用场景:
- 标准化咨询流程
- 27省志愿方案
- 自动规范检查
- 可视化报告交付
2026-06-11 16:23:06 +08:00
Hermes Agent
6b067d9c24 v2.0: 初始化项目,建立完整目录结构
- 创建项目目录 /home/long/projects/gaokao-volunteer-system/
- 迁移3个Skills(gaokao-college-advisor, gaokao-spec-checker, zhangxuefeng-skillset)
- 迁移独立脚本(5个当前版本+4个legacy版本)
- 复制所有文档和示例
- 创建规则库(rules/)
  - provinces/ 省份规则
  - errors/ 错误模式库(15种)
- 创建文档体系(docs/)
  - case-studies/ 真实案例
  - optimization-log/ 优化日志
  - future-plan.md 未来规划
- 添加 .gitignore 排除临时文件
- 添加 README.md 和 CHANGELOG.md
- 已支持27个省份自动适配
- 已识别15种错误模式
2026-06-11 16:06:34 +08:00