liuguancen b83c540018 fix(cas): 接通 CAS 单点登录全链路 + 清理冗余配置
修复链上的 8 个真 bug:
1. UserDetail(UserVO,Set) 漏 setAuthorities → CAS token 构造抛 IllegalArgumentException
   修:CasUserDetailsService.buildGptUserDetail 手动补 empty authorities

2. frontEndUrl 写死内网 IP,localhost 隧道用户跳回时"无法访问此网站"
   修:CasUrlBuilder 用 X-Forwarded-Host / Host 动态拼 service URL

3. vite proxy 没配 /metalinfo/chat_web_backend,CAS 回跳 ticket 被前端路由吞
   修:加一条 proxy(rewrite 去 /metalinfo 前缀)+ X-Forwarded-Host 转发

4. ticket 校验 service URL 跟 entry point 不一致 → CAS server mismatch
   修:自定义 AuthenticationDetailsSource 用同一个动态 URL

5. sendRedirect URL 含 # 经容器编码成 %23,浏览器拿不到 hash → 404
   修:改用 query 参数(/metalinfo/?cas_token=xxx),前端 router beforeEach 拦截

6. CAS 登录后 HttpSession 残留,第二次访问 /cas/login 不触发 entryPoint → 落到
   DispatcherServlet → 找不到映射 → 404 Whitelabel
   修:SuccessHandler 完成后 invalidate session + clear SecurityContext

7. CAS 路径漏写 Redis token,JwtAuthenticationFilter 校验时 LOGIN_TOKEN_KEY 找不到
   → "token已失效" → 前端 axios interceptor 清 token 跳回 login
   修:SuccessHandler 同步写 redisUtils.set,与 LoginController.saveLoginLog 对齐

8. permission.ts 没拦 query 里的 cas_token,hash 路由下 location.search 取不到
   修:router beforeEach 优先消费 cas_token 再走 getSession

清理冗余:
- CasProperties 删 6 个未用字段(enabled/serverLogout/appLogout/appKey/
  appSecret/httpsFlag/frontEndUrl)
- application.yml 同步删,移除写死的 app-secret 等敏感字段
- 删外部 override 文件 chat_web_backend/config/application.yml
- casServiceProperties.setService 改占位符(实际不被读取,只满足
  ServiceProperties.afterPropertiesSet 的非空校验)
- 删 permission.ts 的 [CAS] [GUARD] debug log,保留 catch error 一条

新增:
- CasUrlBuilder 工具类:从请求动态解析 host/scheme,多个地方共用

UI:
- welcome 页面玻璃按钮 + 呼吸光晕/光感动画(用户自己调过,本次保留)
- App.vue:/welcome 路径不渲染 Operates 侧边栏

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 20:22:57 +08:00
2026-04-07 07:01:56 +00:00

钢研院智能问答平台gangyan111

面向冶金行业的 LLM 智能问答系统,提供智能对话、文档撰写、知识库管理、文献检索、翻译等功能。

系统架构

Vue前端(:3000/metalinfo)
    │  proxy /chat_web_backend
    ▼
Java后端(:8099/chat_web_backend)  ──→  Python RAG(:7861)
    │                                      │
    ├── MySQL(:33306)                      ├── Milvus(:19530)
    ├── Redis(:6379)                       ├── Embedding API(bge-m3)
    └── 科协SSO                            └── LLM API(deepseek-v3等)

模块说明

模块 路径 技术栈 说明
前端 chat_web_front/ Vue 3 + TypeScript + Element Plus + Vite 用户界面
Java 后端 chat_web_backend/ Spring Boot 2.3.7 + MyBatis-Plus + JDK 11 业务 API
Python RAG langchain-chat/ Python 3.11 + FastAPI + LangChain LLM 推理 + 知识库检索

功能模块

  • 智能对话 — 多模型对话DeepSeek、Qwen 等),支持流式响应、知识库增强问答
  • 文档撰写 — AI 生成大纲与正文,支持改写、润色、扩写、续写
  • 知识库管理 — 个人知识库,文件上传、文章综述、章节速览、文件对话
  • 文献检索 — 政策库、报告库、期刊论文库、冶金行业系列知识库
  • 翻译 — 文档翻译、文本翻译,多语种支持
  • 应用广场 — 智慧场景、助手收藏

基础设施

服务 端口 部署方式
MySQL 8.4.4 33306 Docker Compose (mysql/docker-compose.yml)
Redis 6379 宿主机 / Docker
Milvus 2.6.4 19530 Docker Compose (milvus/docker-compose.yml)
MinIO 9002/9003 DockerMilvus 依赖)

快速启动

cd /opt/download/oss_files/gangyan-deploy/gangyan

# 1. 启动数据层
cd mysql/mysql-8.4.4 && docker compose up -d && cd ../..
docker start redis-server 2>/dev/null || docker run -d --name redis-server -p 6379:6379 redis:7-alpine
cd milvus && docker compose up -d && cd ..

# 2. 启动 Java 后端
sudo bash backend/start_local.sh

# 3. 启动 Python RAG
source /opt/software/miniconda3/etc/profile.d/conda.sh && conda activate langchain-chat
cd langchain-chat && nohup python startup.py --all-api > langchain.log 2>&1 &

# 4. 启动前端
cd chat_web_front && npm run dev

或一键启动:bash start_all.sh

健康检查

curl -s -o /dev/null -w "Java %{http_code}\n"      http://127.0.0.1:8099/chat_web_backend/app/user
curl -s -o /dev/null -w "Langchain %{http_code}\n"  http://127.0.0.1:7861/docs
curl -s -o /dev/null -w "Frontend %{http_code}\n"   http://127.0.0.1:3000/

项目结构

gangyan/
├── chat_web_front/          # Vue 3 前端
├── chat_web_backend/        # Java Spring Boot 后端
├── langchain-chat/          # Python RAG 服务
├── backend/                 # 后端部署jar + 启动脚本)
├── mysql/                   # MySQL Docker Compose + 数据
├── milvus/                  # Milvus Docker Compose + 数据
├── scripts/                 # 各服务运维脚本
├── docs/                    # 项目文档
├── logs/                    # 运行日志
├── .harness/                # Agent 协同开发上下文
└── start_all.sh             # 一键启动脚本

Agent 协同开发

.harness/ 目录包含 Agent 协同开发所需的项目上下文文件,详见 .harness/CLAUDE.md

Description
No description provided
Readme 54 MiB
Languages
JavaScript 41.5%
Python 26.7%
Java 15.9%
Vue 5.8%
HTML 5%
Other 5.1%