Commit Graph
9 Commits
Author SHA1 Message Date
lijing 67e55f1875 feat(auth): 角色映射按平台字典(1-7)校准,并移除资源库模块对接
build / build-push (push) Successful in 52s
- 角色字典实测校准(采样 200+ 账号 currentRole/roles):
  1 老师 / 2 校领导 / 3 学生 / 4 家长 / 5 局领导 / 6 工作号 / 7 管理员
  → agent.roles: student=[3] teacher=[1,6] parent=[4] admin=[2,5,7]
  (旧默认 student=[1]/teacher=[2,3]/admin=[4..7] 系臆测,导致老师账号被显示为学生)
- 新增家长身份 AgentRole.PARENT;活动报名/取消改由 STUDENT_OR_PARENT 放行
- 当前身份识别增加 roleName 关键词兜底,避免识别不出就降级为访客
- 移除资源库对接:删除 ResourceTools 及注册/编排/agent.modules/module-landing
- 测试 48/48 通过
2026-10-12 16:10:39 +08:00
lijing 57766c8bba chore(ci): 空提交触发重新构建,为部署产生新镜像 tag
build / build-push (push) Successful in 51s
上一版镜像 tag 15b3c9da 已推送到 Nexus 且 docker-hosted 不允许覆盖已存在的 tag,
重跑同一提交会在「构建并推送镜像」步骤失败(blob upload invalid -
Repository does not allow updating assets)。

本提交无任何代码改动,仅用于产生一个新 tag(新 tag = 本次提交 sha 前 8 位),
让后端 CI 重新构建并入库镜像,并再次通知 projman 建档以供「后端发布」部署。
2026-10-12 14:10:55 +08:00
lijing 15b3c9da30 fix(llm): 修复 thinking mode 的 reasoning_content 协议 400,默认关闭深度思考
build / build-push (push) Successful in 1m31s
线上现象:用户发消息后助手回
「大模型错误:The `reasoning_content` in the thinking mode must be passed back to the API.」

根因:DeepSeek V4 系列(含 deepseek-flash)默认开启 thinking mode。官方协议规定,
只要请求带 tools 参数,历史里所有 assistant 消息的 reasoning_content 都必须原样回传,
否则接口直接回 HTTP 400。而 ChatMessage.toJson() 只输出 role/content/tool_calls/tool_call_id,
把该字段整个丢掉 —— 于是「第一轮模型调工具成功、第二轮请求必炸」。

改动:
- ChatMessage 增加 reasoningContent 字段并在 toJson 里输出(非空才输出);ChatResult 同步解析响应字段。
- AgentOrchestrator 新增 assistantOf(),把模型每次返回的思维链写回对应的 assistant 消息
  (带 tool_calls 的那条与最终回复那条都要带)。
- DeepSeekClient:
  * 新增 agent.llm.thinking(auto/enabled/disabled),按配置显式发送 thinking 字段;
  * 命中 reasoning_content 协议错误时自动关闭 thinking 重试一次(自愈,线上无需等改配置即可恢复);
  * humanizeApiError 增加该错误的中文话术,避免原样抛出英文协议报错。
- AgentSettings.Llm.thinking 由 boolean 改为三态字符串,默认 disabled:
  本工程属工具密集编排,几乎每轮都带 tools,CoT 收益有限却显著增加延迟与 token,
  且 thinking 模式下 temperature 会被忽略。
- application.yml 补 agent.llm.thinking: disabled 与说明。

新增 ThinkingModeTest(7 例):字段序列化/省略、disabled 与 auto 的请求体、响应解析、
命中协议错误时的自愈重试、以及非协议错误不被误重试。
2026-10-12 12:13:41 +08:00
lijing 0197a9de05 fix(llm): 大模型 api-key 启动自检,缺配/占位符直接 ERROR
build / build-push (push) Successful in 52s
线上容器漏注入 DEEPSEEK_API_KEY 时,api-key 会落到 application.yml 里的中文
占位符,直到某个用户发起一次对话才以 HTTP 401 暴露:
  ResourceAccessException: I/O error on POST ...
  java.net.HttpRetryException: cannot retry due to server authentication, in streaming mode
排查成本很高。

DeepSeekClient 增加 @PostConstruct 自检(可 grep [大模型]):
  - 为空 / 仍含"请替换"占位符 -> ERROR,并写明修法
  - 不以 sk- 开头 -> WARN 提示格式可疑
  - 正常 -> INFO 打长度 + host + model(不打印 key 本体)

修法提示:在 projman 的 /app/config/application-prod.yml 填真实 key,
或给容器注入环境变量 DEEPSEEK_API_KEY(勿写入 public 仓库中的 application.yml)。
2026-10-12 11:57:49 +08:00
lijing 8303b857e9 feat: 提交校园智能助手后端工程源码(Spring Boot 2.7.18 + 平台 starter + JPA + Nacos)
build / build-push (push) Successful in 40s
- com.yunhai.agent,端口 8093,context-path /agent,制品 target/agent.jar;与 NoticeService 同构
- CAS 单点登录 + 三层角色权限(学生/教师/管理员/访客)+ 会话与工具调用审计落库
- DeepSeek 大模型编排 + 7 个业务模块工具(请假/公告/宿舍/活动/作业/资源库/教师发展)
- 浏览器代执行协议(服务端挂起 → 前端用登录态代调 → toolResult 续跑)+ 调用失败深链兜底
- 登出修复:服务端真正 session.invalidate() + 前端两步登出 + logout-guard
- 保留 projman 注入的 .gitea/workflows/build.yml 与 docker/Dockerfile;docker/application-prod.yml、run-app.sh 随工程入库
2026-10-12 11:18:29 +08:00
admin 8589afd69a ci: update build workflow [skip ci] 2026-10-12 11:08:36 +08:00
admin 5850f46e7e ci: init Dockerfile [skip ci] 2026-10-12 11:02:28 +08:00
admin dd850d65b8 ci: init build workflow [skip ci] 2026-10-12 11:02:27 +08:00
admin afd3660e96 Initial commit 2026-10-12 11:02:24 +08:00