Commit Graph
51 Commits
Author SHA1 Message Date
admin 6853facbe0 fix(web-ai): store encryption key in database 2026-07-19 20:20:57 +08:00
admin 925b48e436 feat(work-report): add voice-first reporting flow 2026-07-19 12:17:11 +08:00
admin 24da833fa6 feat(personal-assistant): add confirmed project memory 2026-07-19 08:19:24 +08:00
admin 064816a784 feat(knowledge): add short-term ask memory 2026-07-18 21:22:49 +08:00
adminandClaude Fable 5 dfd82e1886 fix: unify all aihr collations, stop silent logout on biz 403, enable knowledge apps
线上现象:「问」页语音提问报 401(请求不带 token),用户观察为
「点了几个页面后登录状态失效」。

根因链(逐环生产验证):
1. 问师傅 /api/knowledge/query 对真实登录返回业务 403
   「当前登录端未启用知识问答应用」——生产 aihr_knowledge_app 为空表,
   多租户知识平台的应用注册/空间绑定/角色授权从未在生产配置(P1 遗留)。
2. 前端 readPayload 把 403 也视为认证失败并 clearAuth() —— 业务 403
   触发静默登出,localStorage token 被清。
3. 之后语音 ASR 请求裸奔 -> 401「未能读取到有效 token」。

同期回归:凌晨对 aihr_practice_assignment.ext_party_id 的单列 collation
热修复,使其与 aihr_practice_session(仍 0900_ai_ci)的 JOIN 反向失配,
/practice/mistakes 500。

修复:
- backend/script/sql/update/aihr_20260718_unify_all_collations_mysql8.sql:
  47 张 aihr 表全部 CONVERT 到运行时基准 collation(生产=general_ci),
  终结 collation 打地鼠;本地验证后已在生产执行
  (schema 备份 /opt/wygj/backups/aihr-schema-before-unify-20260718041407.sql),
  13 项移动端接口回归全 200(含 mistakes)。
- api.ts/auth.ts:本地登录态仅在真正 401(HTTP 或业务码)时清除,并经
  redirectToLoginForAuthLoss 记住当前页自动回登录(2s 防抖,登录页内不跳);
  业务 403(权限拒绝,如录音归属/知识空间)只报错不登出;
  authenticatedFileUrl 同步收紧(403 不再清登录态)。
- 生产数据配置(幂等 INSERT,业务范围保守):
  · aihr_knowledge_app 注册 yc_admin(pc)/yc_mobile(app) SESSION 应用
  · yc_mobile 绑定 SOP 域 5 库(1001/1002/1003/1201/1202),
    employee/supervisor ROLE READ;yc_admin 绑定全部 13 库,
    hr_operator/superadmin MANAGE
  · 财务/销售/行政等大库(1004-1010)暂仅管理端,待业务确认再放开

生产验证:
- 问师傅 query 200,真实回答+引用「投诉处理 SOP v1.0」
- E2E:登录后全 tab 浏览+语音+文字提问,token 全程稳定(storage 打桩零触发)
- 无效 token 点语音提问 -> 自动回登录页(原为死胡同 toast)
- H5 已发布(备份 h5-before-20260718042238)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 04:24:45 +08:00
adminandClaude Fable 5 680b4cf83c fix: align aihr_practice_assignment.ext_party_id collation to utf8mb4_general_ci
根因:生产库 aihr_practice_assignment.ext_party_id 继承表级默认 utf8mb4_0900_ai_ci,
与 aihr_practice_question_feedback.ext_party_id (utf8mb4_general_ci) 冲突,
导致 AihrPracticeSeedService.assignments() 子查询抛 ERROR 1267,
/me 接口异常,员工端误报'人力系统未匹配'。

修复:
- ALTER TABLE 对齐 ext_party_id 列排序规则为 utf8mb4_general_ci
- 已在生产热修复并验证,查询恢复正常
- 本地 docker 容器复现+修复验证通过
- 前端无需改动,H5 重新构建确认流程无误

影响范围:
- 仅 aihr_practice_assignment 表单列 MODIFY
- 保留所有数据与索引,无业务中断
- 回滚材料在 /opt/wygj/backups/release-20260718005151

遗留:
- position 页异常场景退出入口待下轮补充(P1)
- schema 规范:后续 DDL 显式声明 COLLATE,不依赖表级默认

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 02:27:11 +08:00
admin 32fa376d63 fix: align release table collations 2026-07-18 01:04:17 +08:00
admin 6bdc86e3fc feat: restore learning feedback and knowledge capabilities 2026-07-18 00:50:11 +08:00
admin 735e9a78c1 feat(knowledge): add multi-space platform schema 2026-07-16 10:21:35 +08:00
admin d44e9440ce feat(aihr): add position qualification schema contract 2026-07-15 02:04:05 +08:00
admin 1ca5d1eca4 fix(aihr): version candidate interview review migration 2026-07-15 00:59:08 +08:00
admin ef21d4d61b fix(aihr): version practice session evidence migration 2026-07-15 00:53:52 +08:00
admin d9fec80e6c fix(aihr): version knowledge feedback migrations 2026-07-15 00:51:42 +08:00
admin 0bfaee7d22 feat(aihr): complete case learning review loop 2026-07-14 23:41:59 +08:00
admin 804bc62de7 fix(aihr): seed production prompt templates 2026-07-14 23:22:34 +08:00
admin 82aec83cb5 fix(aihr): add practice catalog schema migration 2026-07-14 23:16:51 +08:00
admin 94f48f4c1b fix(aihr): version case media schema gate 2026-07-14 23:12:22 +08:00
admin 0a30fe7034 feat(aihr): align BRD scenarios and SOP seed content 2026-07-14 23:04:23 +08:00
admin ab10e56523 fix(aihr): expire unbound practice audio 2026-07-14 22:00:12 +08:00
admin 0609bd3d17 fix(aihr): version SOP traceability migration 2026-07-14 16:18:59 +08:00
admin 52af9b6e4c fix(aihr): harden legacy schema migrations 2026-07-14 16:13:49 +08:00
admin 638f231d0c fix(aihr): make daily score migration backward compatible 2026-07-14 16:09:06 +08:00
admin 4d4d911bad fix(aihr): add semantic daily drill scoring fallback 2026-07-14 15:53:04 +08:00
admin 14d91f86a9 fix(aihr): bind SOP reviews to pilot identity 2026-07-14 15:43:23 +08:00
admin 94d483d334 fix(aihr): align practice scoring with BRD five dimensions 2026-07-14 15:12:47 +08:00
admin 3f39be7fee fix(aihr): persist org hire dates 2026-07-14 14:48:48 +08:00
admin e0da5f0ac5 chore(aihr): add practice evidence migration 2026-07-14 14:40:00 +08:00
admin 9c35949984 fix(aihr): persist daily drill scores 2026-07-14 11:35:57 +08:00
admin 00cb4d48e9 fix(aihr): audit candidate material reviews 2026-07-14 11:00:36 +08:00
admin 816bf0e6f5 fix(aihr): audit knowledge feedback reviews 2026-07-14 10:52:46 +08:00
admin e55abec630 feat(aihr): persist interview human review 2026-07-14 09:44:03 +08:00
admin e332efb731 fix(aihr): prevent duplicate employee principal links 2026-07-14 06:29:03 +08:00
admin ef188d3283 feat(aihr): link candidates to employee principals 2026-07-14 06:22:36 +08:00
admin 9ace0cb5c9 feat(case): persist source audio for learning detail 2026-07-14 05:51:45 +08:00
admin 9bbfd575a3 feat(aihr): add voice answers to daily drills 2026-07-14 05:44:26 +08:00
admin c5a6e677dd feat(aihr): persist sop prompt version 2026-07-14 04:32:21 +08:00
admin 07ab28fd7b feat(aihr): trace sop feedback to search review 2026-07-14 04:18:09 +08:00
admin d3552cc22d feat(aihr): add pilot satisfaction evidence loop 2026-07-14 04:13:02 +08:00
admin 87360a25d3 feat(aihr): align figma pages for release 2026-07-14 02:04:36 +08:00
admin 6f0a4c3d63 fix(aihr): polish model fallback wording 2026-07-09 23:52:44 +08:00
admin b650304ef1 chore(aihr): add phones to org seed 2026-07-09 21:14:12 +08:00
admin 5f92847c00 feat(aihr): map supervisor phone to org scope 2026-07-09 12:54:33 +08:00
admin 15cd789da6 feat(aihr): add SOP answer thumbs up/down feedback loop
- New aihr_knowledge_answer_feedback table; unique (tenant, query_norm,
  fragment_id) pair keeps submissions idempotent
- POST /api/knowledge/answer-feedback (fragmentIds array), GET pending-review
  list, POST /{id}/review — all under existing auth scope
- Down-voted (question, fragment) pairs are filtered from dbSearch fusion
  results; if filtering empties the hit list the original results are kept
  with an explanatory caution (never degrade to no-answer)
- Feedback table missing/unreachable → filter silently skipped, search
  behavior unchanged (degradation chain preserved)
- SnippetResponse gains optional trailing fragmentId (db hits only; seed
  fallback stays null); mobile sopPanel adds 👍/👎 with locked state after
  submit, up votes auto-marked reviewed to keep the review queue clean
2026-07-08 15:09:27 +08:00
admin 8d78bc69d1 feat(aihr): bind SOP direct-answer digest to sop_answer prompt template
- Seed aihr_prompt_template with code=sop_answer (conclusion-first + numbered
  steps + citations appended), matching the built-in prompt
- Digest prefers the enabled sop_answer template, falls back to the built-in
  constant, and logs prompt_version; answer/keyPoints/cautions contract unchanged
2026-07-08 14:52:02 +08:00
admin 4b10b08eeb feat(aihr): close phase two practice pilot gates 2026-07-08 00:51:32 +08:00
admin 0539adf612 feat(aihr): persist interview results and candidate material review
面试记录落 aihr_interview_result(GET /records 查询),候选人补充资料
走 OSS + aihr_candidate_material,管理端 AI 面试页可审核通过/驳回;
案例整理服务增强;两张新表纳入 reset 脚本。
2026-07-04 16:05:50 +08:00
admin 4fa23617a4 feat(aihr): decouple batch upload from processing via async queue
批量上传治本:POST /doc/upload-async 只暂存+入队即秒回,后台 worker
(并发2)复用 saveDocument 链路逐条解析/归类/向量化;队列表
aihr_knowledge_upload_item 状态机 0/1/2/3,完成/失败 CAS 写入,同名
文件串行防撞 attach 唯一键,卡住30分钟清扫重置,失败暂存保留72h。
新增 GET /doc/upload-items 批次查询与 POST /doc/upload-items/{id}/retry
单文件重试。资料处理页批量导入改走异步:提交即返回,新增本批次
进度面板(排队/加工中/完成/失败+进度条+单条重试),轮询防过期回写。
同步接口保留给 SOP 页单文件即时预览。
2026-07-03 23:36:56 +08:00
admin 939fba85ff feat(aihr): support cancelling running local import tasks
新增 POST /api/knowledge/doc/import-tasks/{id}/cancel,后台目录导入任务
运行中可取消;资料处理页任务列表接取消按钮与状态刷新。
2026-07-03 21:45:38 +08:00
admin 8ead250025 chore(aihr): add org/person static snapshot seed for demo
aihr_org_snapshot 表+两个住宅项目22人快照(项目经理/主管/一线三层),
支撑按项目看人数叙事;reset-dev-db.sh 纳入该脚本。
2026-07-03 20:55:38 +08:00
admin f869d66c90 feat: complete aihr mvp mobile workflow 2026-07-03 16:43:37 +08:00