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 随工程入库
This commit is contained in:
lijing
2026-10-12 11:18:29 +08:00
parent 8589afd69a
commit 8303b857e9
58 changed files with 6883 additions and 2 deletions
+64
View File
@@ -0,0 +1,64 @@
# Agent 生产配置(线上以 nacos 的 agent.yaml 为准,本文件是 nacos 不可达时的兜底)
# 真正上线请在 Nacos 新建 dataId=agent.yaml、group=OA_APP 的配置覆盖以下项
# (尤其 datasource 的库名/账号、yh.sso.client-host-url、agent.modules、agent.llm.api-key)。
server:
port: 8071
servlet:
# 对外经 caddy 暴露为 http://base.yunhaixingtong.com/agent
context-path: /agent
spring:
mvc:
date-format: yyyy-MM-dd HH:mm:ss
jackson:
time-zone: GMT+8
date-format: yyyy-MM-dd HH:mm:ss
datasource:
# 与 UserBase 共用同一台 mysql8;库名为 bsch_agent(需先在 mysql8 上建库)
url: jdbc:mysql://mysql8:3306/bsch_agent?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
username: root
password: 'CVf^x$sW*b6CGHxh'
driver-class-name: com.mysql.cj.jdbc.Driver
min-idle: 10
max-active: 30
jpa:
database: MySQL
show-sql: false
hibernate:
ddl-auto: update
database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
properties:
hibernate.order_by.default_null_ordering: last
open-in-view: true
# 单点登录 / 应用间签名鉴权(基础平台 yh-auth / yh-app-auth)
yh:
sso:
server-url-prefix: http://sso.yunhaixingtong.com
client-host-url: http://base.yunhaixingtong.com/agent
allow-headers: all
allow-origins: all
url-pattern: /api/*
app-auth:
enabled: true
app-key: 100617
app-secret: 2a3b4c5d6e7f8091a2b3c4d5e6f70819
trusted-apps:
100617: 2a3b4c5d6e7f8091a2b3c4d5e6f70819
# 智能体:模块地址与角色映射(生产值由 Nacos agent.yaml 覆盖)
agent:
llm:
host: https://api.deepseek.com/chat/completions
api-key: ${DEEPSEEK_API_KEY:}
model: deepseek-chat
filter-tools-by-authorized-module: false
enforce-role-permission: true
modules:
homeleave: http://base.yunhaixingtong.com/home-leave
campusnotice: http://base.yunhaixingtong.com/campusnotice
dormnotice: http://base.yunhaixingtong.com/dormnotice
familyactivity: http://base.yunhaixingtong.com/familyactivity
coursehomework: http://base.yunhaixingtong.com/coursehomework
resourcelibrary: http://base.yunhaixingtong.com/resourcelibrary
profession: http://base.yunhaixingtong.com/profession
+8
View File
@@ -0,0 +1,8 @@
#!/bin/sh
# Agent 启动入口:配置统一由 Nacos 配置中心在 bootstrap 阶段下发(见 bootstrap.yml)
# 若 nacos 不可达,bootstrap 中 fail-fast=false 会自动回退到镜像内烤好的 application-prod.yml 兜底默认。
set -e
echo "[run-app] starting Agent (profile=prod, nacos=${NACOS_ADDR:-nacos.yunhaixingtong.com:8848}) ..."
exec java ${JAVA_OPTS:--Xms512m -Xmx1024m} -Dfile.encoding=UTF-8 -jar /app/app.jar \
--spring.profiles.active=prod