114 Commits

Author SHA1 Message Date
ageerle
a8bd4b47a0 chore: 移除项目文档和技术交流链接
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 11:44:07 +08:00
ageerle
a59ddf6070 refactor: 重构Issue模板为通用格式
- 删除企业合作登记模板
- 新增漏洞报告模板
- 新增想法建议模板
- 新增自定义模板

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 11:39:06 +08:00
ageerle
797ecbb054 feat: 新增联系人/联系方式字段并添加填写示例
- 新增联系人/联系方式字段,支持登记后主动联系
- 在可复制模板中添加完整填写示例

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 11:30:15 +08:00
ageerle
b6b78afea9 refactor: 优化企业合作登记模板格式
- 改为评论登记模式,用户在Issue下评论填写
- 提供格式预览和可复制模板
- 新增公司Logo和项目Logo字段
- 移除联系方式模块,保护隐私

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 11:20:31 +08:00
ageerle
02240f3fd0 feat: 添加企业AI应用合作登记Issue模板
- 新增企业合作登记模板,用于收集企业AI应用需求
- 包含基本信息、AI应用需求、联系方式三个模块
- 预设筛选字段便于评估合作匹配度

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 11:07:25 +08:00
ageerle
a916f14efc Merge pull request #268 from onestardao/main
docs: add structured RAG 16-problem troubleshooting guide and README entry
2026-03-03 10:40:32 +08:00
PSBigBig × MiniPS
523628ade6 docs: add structured RAG 16-problem troubleshooting guide and README entry 2026-03-02 19:01:59 +08:00
PSBigBig × MiniPS
2259a2f717 docs: add structured RAG 16-problem troubleshooting guide and README entry
This commit introduces a structured RAG troubleshooting guide based on a fixed 16-problem failure map.

Changes include:

1. Added a dedicated RAG troubleshooting document:
   - docs/troubleshooting/rag-failures.md
   - Includes full 16-problem map (No.1–No.16) with layer tags [IN]/[RE]/[ST]/[OP]
   - Adds symptom-based entry points
   - Adds layer-based diagnostics section
   - Adds issue reporting template referencing No.X labels

2. Updated README.md:
   - Added entry link under the "使用文档" section
   - Direct link to the new RAG troubleshooting guide
   - Keeps README structure and tone consistent

No functional changes.
Documentation only.
2026-03-02 18:51:36 +08:00
PSBigBig × MiniPS
8df37274da docs: add RAG answer troubleshooting guide 2026-03-02 17:44:59 +08:00
PSBigBig × MiniPS
393057ab24 docs: add RAG answer troubleshooting guide 2026-03-02 17:41:47 +08:00
ageerle
ee8c882b6f Merge pull request #256 from StevenJack666/main
修改AI工作流后端逻辑
2026-02-11 17:03:31 +08:00
zhang
69ec2a33a4 init 2026-02-09 17:47:18 +08:00
zhang
1cd8ae1cd9 人机交互节点逻辑修改 2026-02-09 17:43:29 +08:00
ageerle
eb2e8f3ff8 Merge pull request #250 from RobustH/main
feat: 对接ragflow的聊天助手
2025-12-25 04:56:05 +08:00
RobustH
2f7bff0bf0 Merge remote-tracking branch 'origin/main'
# Conflicts:
#	ruoyi-modules/ruoyi-chat/src/main/java/org/ruoyi/chat/service/chat/impl/RagFlowServiceImpl.java
2025-12-22 21:06:51 +08:00
Robust_H
c89f9657f3 feat: 添加RAGFLOW聊天服务实现 2025-12-22 21:06:13 +08:00
Robust_H
588c1730a6 feat: 添加RAGFLOW聊天服务实现 2025-12-19 21:08:19 +08:00
ageerle
3f1506b34b Merge pull request #249 from OpenX123/feature/添加多个实用MCP工具
Feature/添加多个实用mcp工具
2025-12-12 22:51:00 +08:00
OpenX123
deea428bfa 动态加载文件操作、图片搜索、PlantUML生成、网页搜索、终端命令、文档解析等实用MCP工具 2025-12-12 13:09:34 +08:00
OpenX123
66f133f089 Revert "为MCP服务器添加文件操作、图片搜索、PlantUML生成、网页搜索、终端命令、文档解析等实用功能"
This reverts commit 77aeabb4be.
2025-12-12 12:00:46 +08:00
ageerle
e5ed5d0ef6 Merge pull request #241 from stageluo/main
新增知识库、http分支工作流节点
2025-12-12 11:46:29 +08:00
ageerle
f04842ae12 Merge branch 'main' into main 2025-12-12 11:46:19 +08:00
OpenX123
77aeabb4be 为MCP服务器添加文件操作、图片搜索、PlantUML生成、网页搜索、终端命令、文档解析等实用功能 2025-12-11 20:41:04 +08:00
evo
f63ccbe7bd Merge pull request #247 from MuSan-Li/feature_20251207_add_ali_emb
feat: 添加阿里向量模型
2025-12-07 22:35:47 +08:00
evo
1087f86259 feat: 添加阿里向量模型 2025-12-07 22:32:42 +08:00
evo
a041acfdbb Merge pull request #246 from MuSan-Li/feature_20251205_format_code
feat: fix_database
2025-12-06 14:47:48 +08:00
evo
b854885c99 feat: fix_database 2025-12-06 14:44:55 +08:00
evo
777c899651 Merge pull request #245 from MuSan-Li/feature_20251205_format_code
feat: 全局格式化代码
2025-12-06 14:39:41 +08:00
evo
7c7d5838cd feat: 全局格式化代码 2025-12-06 14:38:41 +08:00
stageluo
995507e757 支持本地ollama集成LLM问答分支工作流 2025-11-25 09:28:14 +08:00
stageluo
f155bc284d 新增http分支工作流节点 2025-11-25 09:27:06 +08:00
stageluo
c22c5eac7f 新增知识库分支工作流节点 2025-11-25 09:26:39 +08:00
stageluo
9df246321e 条件分支工作流节点优化 2025-11-24 18:20:10 +08:00
ageerle
96c53390aa Merge pull request #239 from stageluo/main
关键词提取工作流节点
2025-11-20 21:48:34 +08:00
stageluo
8a1ac2264e 优化工作流注册节点以及相关其他代码优化 2025-11-20 10:09:48 +08:00
stageluo
35194457e1 条件分支工作流节点 2025-11-20 10:07:50 +08:00
stageluo
cf9eca34d3 邮件工作流节点 2025-11-19 17:44:51 +08:00
stageluo
f04db38d6c 关键词提取工作流节点 2025-11-19 15:03:24 +08:00
ageerle
53c5076212 feat: 修改默认配置 2025-11-18 10:09:16 +08:00
ageerle
0acee56149 feat: 演示模式下,过滤搜索操作 2025-11-12 11:08:10 +08:00
ageerle
be12ebadbe feat: 更新项目介绍 2025-11-07 18:37:56 +08:00
ageerle
a5fc55f50a feat: 更新项目介绍 2025-11-07 17:15:36 +08:00
ageerle
7186afbbc4 feat(yml): 默认关闭知识图谱功能,移除无用配置 2025-11-07 16:56:40 +08:00
ageerle
1fba109cce Merge pull request #237 from xiaonieli7/main
fix(billing): 当 knowledge.graph.enabled=false 时:所有知识图谱相关的 Bean 都不会被创建…
2025-11-07 16:53:17 +08:00
ageerle
d8382bfb44 feat(sql): 合并sql文件 2025-11-07 16:50:54 +08:00
xiaonieli7
2353b0adf6 Merge branch 'ageerle:main' into main 2025-11-07 16:26:46 +08:00
Administrator
dcacd8753f fix(billing): 当 knowledge.graph.enabled=false 时:所有知识图谱相关的 Bean 都不会被创建Neo4j 配置不会被加载即使没有配置 Neo4j 连接信息,默认禁用了知识图谱功能 2025-11-07 16:15:35 +08:00
ageerle
aca72a5892 Merge pull request #234 from seven-ocean/feature/aihuman
add:添加真人数字人
2025-11-07 14:42:18 +08:00
Maxchen
362307e4ba Merge remote-tracking branch 'origin/feature/aihuman' into feature/aihuman 2025-11-07 14:40:53 +08:00
Maxchen
cb26e452bb 完成火山引擎适配 2025-11-07 11:54:11 +08:00
Maxchen
e402330692 add:添加火山引擎语音合成 2025-11-06 19:43:52 +08:00
Maxchen
f3e1aa6cdd 从Git跟踪中移除application-dev.yml文件,使其不再被提交 2025-10-28 11:36:29 +08:00
Maxchen
c1d830bfd6 Resolve conflicts in application-dev.yml 2025-10-28 11:25:33 +08:00
Maxchen
c06ae8271d 排除generator.yml文件并更新.gitignore 2025-10-28 10:42:52 +08:00
Maxchen
e71d9faf8d 排除application-dev.yml文件并更新.gitignore 2025-10-28 10:32:55 +08:00
evo
f5e22d4c05 Merge pull request #235 from MuSan-Li/main
feat: 更新sql文件
2025-10-28 10:27:04 +08:00
lihao05
1aa5535769 feat: 更新sql文件 2025-10-28 10:17:15 +08:00
Maxchen
0d403b6725 add:添加真人数字人 2025-10-27 14:04:42 +08:00
ageerle
d9a9a7f0f0 feat(docs): 更新docker教程 2025-10-24 10:32:28 +08:00
ageerle
a36d306f40 Update README.md 2025-10-24 10:18:03 +08:00
evo
3164eb0bc9 Merge pull request #233 from MuSan-Li/main
feat: 更新sql文件 添加工作流样式接口
2025-10-24 10:17:11 +08:00
evo
adf04d9a60 Merge branch 'main' into main 2025-10-24 10:17:03 +08:00
lihao05
73e588ac60 feat: 更新sql文件 添加工作流样式接口 2025-10-24 10:13:01 +08:00
ageerle
3235b43a0c Merge pull request #232 from xiaonieli7/main
fix(billing): 解决pom文件冲突
2025-10-23 15:28:05 +08:00
Administrator
ae6edadf4b fix(billing): 解决pom文件冲突 2025-10-23 15:26:12 +08:00
ageerle
0f866ec91b Merge pull request #230 from xiaonieli7/main
fix(billing): 新增知识图谱构
2025-10-23 14:16:11 +08:00
ageerle
8f543380d7 Merge branch 'main' into main 2025-10-23 14:15:54 +08:00
Cyclone
ac570fd45c Merge pull request #231 from Cyclones-Y/main
feat(config): 修改默认向量库为weaviate,并更新数据库连接信息
2025-10-23 11:27:47 +08:00
Yzm
beef9e946a feat(config): 修改默认向量库为weaviate,并更新数据库连接信息 2025-10-23 11:24:47 +08:00
Administrator
3610899f2b fix(billing): 新增知识图谱构
1. 从非结构化文本中自动抽取实体和关系
2. 构建和管理知识图谱
3. 基于图谱的检索增强生成(GraphRAG)
4. 交互式图谱可视化
2025-10-23 09:48:49 +08:00
evo
65d59f4acf Merge pull request #229 from radish15/main
fix/修复工作流的问题
2025-10-22 13:59:55 +08:00
evo
cd4fc4b216 Merge pull request #228 from MuSan-Li/main
feat: 覆盖sql
2025-10-21 19:28:46 +08:00
lihao05
0ce0ce1262 feat: 覆盖sql 2025-10-21 18:49:48 +08:00
radish@2020
6b5fea27e0 fix: 修复工作流执行报错,没有用户消息 2025-10-21 18:00:46 +08:00
radish@2020
35c848b719 fix: 修复sql,mysql5.7的TEXT类型不支持默认值 2025-10-21 16:38:50 +08:00
evo
beaf384f79 Merge pull request #227 from MuSan-Li/feature_20250930_work_flow
Feature 20250930 work flow
2025-10-21 11:20:45 +08:00
lihao05
117faeac10 feat: 修改sql提交名称 2025-10-21 11:08:14 +08:00
lihao05
95951efe7a Merge branch 'feature_20250930_work_flow' of https://github.com/MuSan-Li/ruoyi-ai into main
# Conflicts:
#	pom.xml
#	ruoyi-admin/pom.xml
#	ruoyi-modules/pom.xml
#	ruoyi-modules/ruoyi-chat/src/main/java/org/ruoyi/chat/service/chat/impl/DeepSeekChatImpl.java
2025-10-21 10:17:50 +08:00
lihao05
da2000b4f4 feat: 添加工作流菜单表 2025-10-21 10:11:10 +08:00
lihao05
3c21bf6fd3 feat: 工作流第一版提交 2025-10-21 09:52:33 +08:00
evo
63f6df8af0 Merge pull request #224 from radish15/main
fix(chat):解决依赖冲突导致方法不存在的问题
2025-10-20 20:25:14 +08:00
lihao05
e7d7de79fe feat: 功能优化 2025-10-20 10:12:44 +08:00
ageerle
34a71cfc55 Merge pull request #226 from Cyclones-Y/main
完善Milvus向量存储策略实现
2025-10-18 13:42:32 +08:00
Yzm
e242a67c74 feat(embedding): 添加模型维度支持并重构向量存储策略
- 在ChatModelVo中添加dimension字段用于存储模型维度
- 重构EmbeddingModelFactory以支持按模型名称和维度创建实例
- 修改向量存储策略接口参数顺序并统一维度处理
- 为OpenAI和ZhiPuAI嵌入提供者添加维度配置支持
- 优化知识库服务中模型选择逻辑,添加回退机制
2025-10-17 19:55:24 +08:00
Yzm
9d4a0e0b36 refactor(vector-store): 优化Milvus向量存储策略实现
重构Milvus向量存储策略,引入连接缓存机制减少重复创建连接的开销
将vectorModelName重命名为vectorStoreName以更准确表达用途
移除默认配置值,改为必须显式配置
优化代码结构,减少重复代码
2025-10-17 17:19:01 +08:00
Yzm
962c2b693c refactor(vector-store): 移除VectorStoreStrategy接口并简化策略模式实现
移除VectorStoreStrategy接口,直接使用VectorStoreService作为策略接口
简化VectorStoreStrategyFactory实现,移除冗余方法
更新相关实现类以适配新的接口结构
2025-10-17 16:31:09 +08:00
Yzm
766f6ad266 refactor(milvus): 重构Milvus向量存储策略使用LangChain4j
将原有的直接Milvus客户端调用重构为使用LangChain4j的MilvusEmbeddingStore
简化了集合创建、数据存储和查询的实现逻辑
更新了相关依赖
2025-10-17 15:39:26 +08:00
Yzm
c85deba6a6 refactor(vector): 简化createSchema接口参数并更新相关实现
移除createSchema方法中冗余的modelName参数
更新Milvus向量维度为2048以匹配新模型
添加对embeddingModelName参数的支持
2025-10-17 14:29:29 +08:00
lihao05
9f6d363d55 feat: 代码格式化 2025-10-16 21:39:20 +08:00
lihao05
77ddd169c7 feat: 流程编排init 2025-10-16 21:38:00 +08:00
radish@2020
f384601933 fix(chat):解决依赖冲突导致方法不存在的问题 2025-10-14 10:30:43 +08:00
ageerle
0b1925cc62 fix(sql): 修复sql脚本 2025-10-13 14:50:28 +08:00
ageerle
3c237f45ad fix(chat): 修复依赖版本升级导致缺少类错误 2025-10-13 14:40:05 +08:00
ageerle
9500304b77 fix(chat): 修复依赖版本升级导致缺少类错误 2025-10-13 14:37:44 +08:00
ageerle
dbdacdad5c Merge pull request #165 from Code-Mr-Jiu/main
MCP相关功能----进程管理及mcp_info  CRUD
2025-10-12 19:06:27 +08:00
ageerle
ce52402e4c Merge pull request #196 from zhangyue-mars/add-deepseek-java-files
feat: update ChatRequest and DeepSeekChatImpl for DeepSeek integration
2025-10-12 19:06:09 +08:00
ageerle
559661f498 Merge pull request #221 from seven-ocean/feature/aihuman
Feature/aihuman
2025-10-12 19:04:50 +08:00
ageerle
4bacb4bf27 Merge pull request #222 from Cyclones-Y/main
通过策略模式扩展milvus向量库
2025-10-12 19:04:35 +08:00
Yzm
72337563ea feat(chat): 添加根据会话ID查询聊天消息列表接口,优化会话ID设置逻辑 2025-10-12 18:15:11 +08:00
Yzm
77f7ac0af1 refactor(knowledge): 标记向量存储服务为首选实现
- 添加 @Primary 注解以指定为主要 Bean 实现
- 确保在多个实现存在时优先使用该服务
2025-10-11 20:09:15 +08:00
Yzm
c995c94fca Merge remote-tracking branch 'upstream/main' into feat_vectorStore
# Conflicts:
#	ruoyi-modules-api/ruoyi-knowledge-api/src/main/java/org/ruoyi/service/impl/VectorStoreServiceImpl.java
2025-10-10 18:29:58 +08:00
Maxchen
e12e4c4669 Merge remote-tracking branch 'origin/feature/aihuman' into feature/aihuman 2025-10-10 14:11:43 +08:00
Maxchen
3cbbfdf771 Merge remote-tracking branch 'origin/feature/aihuman' into feature/aihuman 2025-10-10 14:11:30 +08:00
Yzm
17c52e9048 refactor(VectorStoreServiceImpl): 添加@Primary注解以指定主要实现
在多个实现存在时,明确指定VectorStoreServiceImpl作为主要实现类
2025-09-29 21:49:27 +08:00
Yzm
f71cf85dc8 feat(knowledge): 实现Milvus向量库策略并重构配置管理
- 新增Milvus向量库策略实现类MilvusVectorStoreStrategy
- 重构向量库配置管理,使用VectorStoreProperties统一配置
- 修改AbstractVectorStoreStrategy抽象类依赖注入方式
- 更新Weaviate策略实现类适配新的配置方式
- 移除旧的ConfigService配置读取方式
- 添加向量库类型配置项,默认使用weaviate
- 实现Milvus集合创建、数据存储、向量搜索和删除功能
- 优化向量库策略工厂类VectorStoreStrategyFactory初始化逻辑
- 删除已废弃的Milvus实现指南文档
- 升级Milvus SDK版本并调整相关API调用方式
2025-09-29 21:45:01 +08:00
Yzm
ef49429543 feat(milvus): 实现Milvus向量数据库集成
- 添加Milvus Java SDK依赖
- 实现MilvusVectorStoreStrategy核心功能
- 支持集合管理、数据存储、向量搜索和数据删除
- 添加Milvus实现指南文档
- 更新数据库连接配置
- 修改VectorStoreService接口添加异常声明
2025-09-29 18:36:48 +08:00
Yzm
39fe2cc48f Merge remote-tracking branch 'upstream/main' into feat_vectorStore 2025-09-28 16:51:16 +08:00
Yzm
aa1c771e72 feat(knowledge): 实现向量库策略模式支持多向量库
- 新增向量库策略接口及抽象基类
- 实现Weaviate向量库策略- 实现Milvus向量库策略(占位实现)
- 添加向量库策略工厂类动态选择实现
- 修改向量存储服务使用策略模式
- 更新知识信息service调用参数顺序
- 添加文档分段和知识片段ID生成注释
- 修改dev环境数据库配置为github版本
2025-09-25 18:44:19 +08:00
ZhangYue
2ac34e313a fix:修复切换知识库的时候只有ID为1L才能查看所有知识库,改为可以查看自己创建的知识库 2025-09-16 10:26:39 +08:00
ZhangYue
4baa970118 feat: update ChatRequest and DeepSeekChatImpl for DeepSeek integration 2025-09-10 09:55:47 +08:00
酒亦
5631fe92c6 Merge branch 'ageerle:main' into main 2025-08-12 15:25:41 +08:00
酒亦
43dc0f419f feat:基于sse模式 启动mcp服务器 (未测试) 2025-08-12 14:00:18 +08:00
酒亦
bc2eb8fdb9 feat:基于stdio模式 启动mcp服务器 2025-08-11 21:22:12 +08:00
酒亦
9891259452 mcp 信息 增删改查 完成 2025-08-10 20:50:04 +08:00
713 changed files with 43378 additions and 13490 deletions

41
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@@ -0,0 +1,41 @@
---
name: 漏洞报告
about: 报告项目中的Bug或安全问题
title: '[Bug] '
labels: 'bug'
assignees: ''
---
## 问题描述
简要描述遇到的问题:
## 复现步骤
1.
2.
3.
## 期望行为
描述你期望发生的情况:
## 实际行为
描述实际发生的情况:
## 环境信息
| 项目 | 信息 |
|:---|:---|
| 操作系统 | |
| JDK版本 | |
| 项目版本 | |
## 截图/日志
如有相关信息,请在此粘贴:
## 补充说明
其他补充信息:

1
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1 @@
blank_issues_enabled: true

15
.github/ISSUE_TEMPLATE/custom.md vendored Normal file
View File

@@ -0,0 +1,15 @@
---
name: 自定义
about: 其他问题或讨论
title: ''
labels: ''
assignees: ''
---
## 描述
请详细描述你的问题或需求:
## 补充信息
如有其他补充,请在此填写:

View File

@@ -0,0 +1,31 @@
---
name: 想法建议
about: 提出新功能建议或改进想法
title: '[Feature] '
labels: 'enhancement'
assignees: ''
---
## 建议类型
□ 新功能 □ 功能改进 □ 文档完善 □ 其他
## 建议描述
清晰描述你的建议内容:
## 使用场景
描述这个功能在什么场景下会用到:
## 期望效果
描述你期望的效果:
## 参考示例
如有类似的参考实现或产品,请提供链接:
## 补充说明
其他补充信息:

BIN
.gitignore vendored

Binary file not shown.

View File

@@ -18,77 +18,88 @@
<img src="image/00.png" alt="RuoYi AI Logo" width="120" height="120">
### 企业级AI助手平台
*开箱即用的智能AI平台深度集成 FastGPT、扣子(Coze)、DIFY 等主流AI平台提供先进的RAG技术和多模型支持*
*开箱即用的智能AI平台深度集成 FastGPT、扣子(Coze)、DIFY 等主流AI平台提供先进的RAG技术、知识图谱、数字人和AI流程编排能力*
**[🇺🇸 English](README_EN.md)** | **[📖 使用文档](https://doc.pandarobot.chat)** | **[🚀 在线体验](https://web.pandarobot.chat)** | **[🐛 问题反馈](https://github.com/ageerle/ruoyi-ai/issues)** | **[💡 功能建议](https://github.com/ageerle/ruoyi-ai/issues)**
**[🇺🇸 English](README_EN.md)** | **[📖 使用文档](https://doc.pandarobot.chat)** | *
*[🚀 在线体验](https://web.pandarobot.chat)** | **[🐛 问题反馈](https://github.com/ageerle/ruoyi-ai/issues)** | *
*[💡 功能建议](https://github.com/ageerle/ruoyi-ai/issues)**
</div>
## ✨ 核心亮点
### 🤖 智能AI引擎
### 智能AI引擎
- **多模型接入**:支持 OpenAI GPT-4、Azure、ChatGLM、通义千问、智谱AI 等主流模型
- **AI平台集成**:深度集成 **FastGPT**、**扣子(Coze)**、**DIFY** 等主流AI应用平台
- **Spring AI MCP 集成**基于模型上下文协议打造可扩展的AI工具生态系统
- **实时流式对话**:采用 SSE/WebSocket 技术,提供丝滑的对话体验
- **AI 编程助手**:内置智能代码分析和项目脚手架生成能力
### 🌟 AI平台生态集成
### AI平台生态集成
- **FastGPT 深度集成**:原生支持 FastGPT API包括知识库检索、工作流编排和上下文管理
- **扣子(Coze) 官方SDK**集成字节跳动扣子平台官方SDK支持Bot对话和流式响应
- **DIFY 完整兼容**:使用 DIFY Java Client支持应用编排、工作流和知识库管理
- **统一聊天接口**:提供统一的聊天服务接口,支持多平台无缝切换和负载均衡
### 🧠 本地化RAG方案
### 本地化RAG方案
- **私有知识库**:基于 Langchain4j 框架 + BGE-large-zh-v1.5 中文向量模型
- **多种向量库**:支持 Milvus、Weaviate、Qdrant 等主流向量数据库
- **数据安全可控**:支持完全本地部署,保护企业数据隐私
- **灵活模型部署**:兼容 Ollama、vLLM 等本地推理框架
### 🎨 AI创作工具
### AI创作工具
- **AI 绘画创作**:深度集成 DALL·E-3、MidJourney、Stable Diffusion
- **智能PPT生成**:一键将文本内容转换为精美演示文稿
- **多模态理解**:支持文本、图片、文档等多种格式的智能处理
### 知识图谱与智能编排
- **知识图谱构建**:自动从文档和对话中提取实体关系,构建可视化知识网络
- **AI 流程编排**可视化工作流设计器支持复杂AI任务的编排和自动化执行
- **数字人交互**:集成数字人形象,提供更自然的人机交互体验
- **智能推理引擎**:基于知识图谱的智能推理和问答能力
## 🚀 快速体验
### 在线演示
- **用户端体验**[web.pandarobot.chat](https://web.pandarobot.chat) (账号demo 密码demo123)
- **用户端体验**[web.pandarobot.chat](https://web.pandarobot.chat) (账号admin 密码admin123)
- **管理后台**[admin.pandarobot.chat](https://admin.pandarobot.chat) (账号admin 密码admin123)
### 项目源码
| 项目模块 | GitHub 仓库 | Gitee 仓库 | GitCode 仓库 |
|---------|------------|-----------|-------------|
| 🔧 后端服务 | [ruoyi-ai](https://github.com/ageerle/ruoyi-ai) | [ruoyi-ai](https://gitee.com/ageerle/ruoyi-ai) | [ruoyi-ai](https://gitcode.com/ageerle/ruoyi-ai) |
| 🎨 用户前端 | [ruoyi-web](https://github.com/ageerle/ruoyi-web) | [ruoyi-web](https://gitee.com/ageerle/ruoyi-web) | [ruoyi-web](https://gitcode.com/ageerle/ruoyi-web) |
| 项目模块 | GitHub 仓库 | Gitee 仓库 | GitCode 仓库 |
|----------|-------------------------------------------------------|------------------------------------------------------|--------------------------------------------------------|
| 🔧 后端服务 | [ruoyi-ai](https://github.com/ageerle/ruoyi-ai) | [ruoyi-ai](https://gitee.com/ageerle/ruoyi-ai) | [ruoyi-ai](https://gitcode.com/ageerle/ruoyi-ai) |
| 🎨 用户前端 | [ruoyi-web](https://github.com/ageerle/ruoyi-web) | [ruoyi-web](https://gitee.com/ageerle/ruoyi-web) | [ruoyi-web](https://gitcode.com/ageerle/ruoyi-web) |
| 🛠️ 管理后台 | [ruoyi-admin](https://github.com/ageerle/ruoyi-admin) | [ruoyi-admin](https://gitee.com/ageerle/ruoyi-admin) | [ruoyi-admin](https://gitcode.com/ageerle/ruoyi-admin) |
### 合作项目
| 项目介绍 | GitHub 仓库 | Gitee 仓库 |
|:--------:|:----------:|:----------:|
| 项目介绍 | GitHub 仓库 | Gitee 仓库 |
|:-----:|:----------------------------------------------------------------------:|:----------------------------------------------------------------:|
| 前端简化版 | [ruoyi-element-ai](https://github.com/element-plus-x/ruoyi-element-ai) | [ruoyi-element-ai](https://gitee.com/he-jiayue/ruoyi-element-ai) |
## 🛠️ 技术架构
### 🏗️ 核心框架
### 核心框架
- **后端架构**Spring Boot 3.4 + Spring AI + Langchain4j
- **数据存储**MySQL 8.0 + Redis + 向量数据库Milvus/Weaviate/Qdrant
- **前端技术**Vue 3 + Vben Admin + Naive UI
- **安全认证**Sa-Token + JWT 双重保障
### 🔧 系统组件
- **文档处理**PDF、Word、Excel 解析,图像智能分析
- **实时通信**WebSocket 实时通信SSE 流式响应
- **系统监控**:完善的日志体系、性能监控、服务健康检查
### 系统组件
- **文档处理**PDF、Word、Excel 解析,图像智能分析
- **实时通信**WebSocket 实时通信SSE 流式响应
- **系统监控**:完善的日志体系、性能监控、服务健康检查
## 📚 使用文档
@@ -96,11 +107,18 @@
**👉 [完整使用文档](https://doc.pandarobot.chat)**
遇到知识库或 RAG 回答异常问题?
**👉 [RAG 回答异常排查手册](docs/troubleshooting/rag-failures.md)**
---
## 🤝 参与贡献
我们热烈欢迎社区贡献!无论您是资深开发者还是初学者,都可以为项目贡献力量 💪
### 贡献方式
1. **Fork** 项目到您的账户
2. **创建分支** (`git checkout -b feature/新功能名称`)
3. **提交代码** (`git commit -m '添加某某功能'`)
@@ -109,10 +127,6 @@
> 💡 **小贴士**:建议将 PR 提交到 GitHub我们会自动同步到其他代码托管平台
<a href="https://openomy.com/ageerle/ruoyi-ai" target="_blank" style="display: block; width: 100%;" align="center">
<img src="https://openomy.com/svg?repo=ageerle/ruoyi-ai&chart=bubble&latestMonth=3" target="_blank" alt="Contribution Leaderboard" style="display: block; width: 100%;" />
</a>
## 📄 开源协议
本项目采用 **MIT 开源协议**,详情请查看 [LICENSE](LICENSE) 文件。
@@ -121,7 +135,8 @@
感谢以下优秀的开源项目为本项目提供支持:
- [Spring AI Alibaba Copilot](https://github.com/springaialibaba/spring-ai-alibaba-copilot) - 基于spring-ai-alibaba 的智能编码助手
- [Spring AI Alibaba Copilot](https://github.com/springaialibaba/spring-ai-alibaba-copilot) - 基于spring-ai-alibaba
的智能编码助手
- [Spring AI](https://spring.io/projects/spring-ai) - Spring 官方 AI 集成框架
- [Langchain4j](https://github.com/langchain4j/langchain4j) - 强大的 Java LLM 开发框架
- [RuoYi-Vue-Plus](https://gitee.com/dromara/RuoYi-Vue-Plus) - 成熟的企业级快速开发框架
@@ -130,7 +145,8 @@
## 🌐 生态伙伴
- [PPIO 派欧云](https://ppinfra.com/user/register?invited_by=P8QTUY&utm_source=github_ruoyi-ai) - 提供高性价比的 GPU 算力和模型 API 服务
- [PPIO 派欧云](https://ppinfra.com/user/register?invited_by=P8QTUY&utm_source=github_ruoyi-ai) - 提供高性价比的 GPU
算力和模型 API 服务
- [优云智算](https://www.compshare.cn/?ytag=GPU_YY-gh_ruoyi) - 万卡RTX40系GPU+海内外主流模型API服务秒级响应按量计费新客免费用。
- [胜算云](https://www.shengsuanyun.com/?from=CH_3WG71ZOS) - AI模型算力聚合超市云服务。
@@ -151,12 +167,6 @@
<em>技术讨论</em>
</td>
<td align="center">
<img width="200" height="200" alt="95e8b1b3baeadbd24650bfb974ca5a58" src="https://github.com/user-attachments/assets/2a346218-6388-484d-aa75-6e98942193f7" /><br>
<strong>微信技术交流群</strong><br>
<em>技术讨论</em>
</td>
</tr>
</table>
@@ -166,20 +176,32 @@
<div align="center">
**[⭐ 点个Star支持一下](https://github.com/ageerle/ruoyi-ai)** • **[🍴 Fork 开始贡献](https://github.com/ageerle/ruoyi-ai/fork)** • **[📚 English](README_EN.md)** • **[📖 查看完整文档](https://doc.pandarobot.chat)**
**[⭐ 点个Star支持一下](https://github.com/ageerle/ruoyi-ai)** • *
*[🍴 Fork 开始贡献](https://github.com/ageerle/ruoyi-ai/fork)** • **[📚 English](README_EN.md)** • *
*[📖 查看完整文档](https://doc.pandarobot.chat)**
*用 ❤️ 打造,由 RuoYi AI 开源社区维护*
</div>
<!-- Badge Links -->
[contributors-shield]: https://img.shields.io/github/contributors/ageerle/ruoyi-ai.svg?style=flat-square
[contributors-url]: https://github.com/ageerle/ruoyi-ai/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/ageerle/ruoyi-ai.svg?style=flat-square
[forks-url]: https://github.com/ageerle/ruoyi-ai/network/members
[stars-shield]: https://img.shields.io/github/stars/ageerle/ruoyi-ai.svg?style=flat-square
[stars-url]: https://github.com/ageerle/ruoyi-ai/stargazers
[issues-shield]: https://img.shields.io/github/issues/ageerle/ruoyi-ai.svg?style=flat-square
[issues-url]: https://github.com/ageerle/ruoyi-ai/issues
[license-shield]: https://img.shields.io/github/license/ageerle/ruoyi-ai.svg?style=flat-square
[license-url]: https://github.com/ageerle/ruoyi-ai/blob/main/LICENSE

View File

@@ -1,4 +1,3 @@
# RuoYi AI
<div align="center">
@@ -13,16 +12,19 @@
### Enterprise-Grade AI Assistant Platform
*Production-ready AI platform with deep integration of FastGPT, Coze, DIFY and advanced RAG technology*
*Production-ready AI platform with deep integration of FastGPT, Coze, DIFY, featuring advanced RAG technology, knowledge
graphs, digital humans, and AI workflow orchestration*
**[📖 中文文档](README.md)** | **[📚 Documentation](https://doc.pandarobot.chat)** | **[🚀 Live Demo](https://web.pandarobot.chat)** | **[🐛 Report Bug](https://github.com/ageerle/ruoyi-ai/issues)** | **[💡 Request Feature](https://github.com/ageerle/ruoyi-ai/issues)**
**[📖 中文文档](README.md)** | **[📚 Documentation](https://doc.pandarobot.chat)** | *
*[🚀 Live Demo](https://web.pandarobot.chat)** | **[🐛 Report Bug](https://github.com/ageerle/ruoyi-ai/issues)** | *
*[💡 Request Feature](https://github.com/ageerle/ruoyi-ai/issues)**
</div>
## ✨ Key Features
### 🤖 Advanced AI Engine
- **Multi-Model Support**: OpenAI GPT-4, Azure, ChatGLM, Qwen, ZhipuAI
- **AI Platform Integration**: Deep integration with **FastGPT**, **Coze**, **DIFY** and other leading AI platforms
- **Spring AI MCP Integration**: Extensible tool ecosystem with Model Context Protocol
@@ -30,52 +32,69 @@
- **AI Copilot**: Intelligent code analysis and project scaffolding
### 🌟 AI Platform Ecosystem
- **FastGPT Deep Integration**: Native FastGPT API support with knowledge base retrieval, workflow orchestration and context management
- **Coze Official SDK**: Integration with ByteDance Coze platform official SDK, supporting Bot conversations and streaming responses
- **FastGPT Deep Integration**: Native FastGPT API support with knowledge base retrieval, workflow orchestration and
context management
- **Coze Official SDK**: Integration with ByteDance Coze platform official SDK, supporting Bot conversations and
streaming responses
- **DIFY Full Compatibility**: Using DIFY Java Client for app orchestration, workflows and knowledge base management
- **Unified Chat Interface**: Standardized chat service interface supporting seamless platform switching and load balancing
- **Unified Chat Interface**: Standardized chat service interface supporting seamless platform switching and load
balancing
### 🧠 Enterprise RAG Solution
- **Local Knowledge Base**: Langchain4j + BGE-large-zh-v1.5 embeddings
- **Vector Database Support**: Milvus, Weaviate, Qdrant
- **Privacy-First**: On-premise deployment with local LLM support
- **Ollama & vLLM Compatible**: Flexible model deployment options
### 🎨 Creative AI Tools
- **AI Art Generation**: DALL·E-3, MidJourney, Stable Diffusion integration
- **PPT Creation**: Automated slide generation from text input
- **Multi-Modal Processing**: Text, image, and document understanding
### 🧩 Knowledge Graph & Intelligent Orchestration
- **Knowledge Graph Construction**: Automatically extract entities and relationships from documents and conversations to
build visual knowledge networks
- **AI Workflow Orchestration**: Visual workflow designer supporting complex AI task orchestration and automated
execution
- **Digital Human Interaction**: Integrated digital human avatars for more natural human-computer interaction
- **Intelligent Reasoning Engine**: Knowledge graph-based intelligent reasoning and Q&A capabilities
## 🚀 Quick Start
### Live Demo
- **User Portal**: [web.pandarobot.chat](https://web.pandarobot.chat) (demo/demo123)
- **Admin Panel**: [admin.pandarobot.chat](https://admin.pandarobot.chat) (admin/admin123)
### Source Code
| Component | GitHub | Gitee | GitCode |
|-----------|--------|-------|---------|
| Backend API | [ruoyi-ai](https://github.com/ageerle/ruoyi-ai) | [ruoyi-ai](https://gitee.com/ageerle/ruoyi-ai) | [ruoyi-ai](https://gitcode.com/ageerle/ruoyi-ai) |
| User Frontend | [ruoyi-web](https://github.com/ageerle/ruoyi-web) | [ruoyi-web](https://gitee.com/ageerle/ruoyi-web) | [ruoyi-web](https://gitcode.com/ageerle/ruoyi-web) |
| Component | GitHub | Gitee | GitCode |
|----------------|-------------------------------------------------------|------------------------------------------------------|--------------------------------------------------------|
| Backend API | [ruoyi-ai](https://github.com/ageerle/ruoyi-ai) | [ruoyi-ai](https://gitee.com/ageerle/ruoyi-ai) | [ruoyi-ai](https://gitcode.com/ageerle/ruoyi-ai) |
| User Frontend | [ruoyi-web](https://github.com/ageerle/ruoyi-web) | [ruoyi-web](https://gitee.com/ageerle/ruoyi-web) | [ruoyi-web](https://gitcode.com/ageerle/ruoyi-web) |
| Admin Frontend | [ruoyi-admin](https://github.com/ageerle/ruoyi-admin) | [ruoyi-admin](https://gitee.com/ageerle/ruoyi-admin) | [ruoyi-admin](https://gitcode.com/ageerle/ruoyi-admin) |
### Collaborative Projects
| Project Description | GitHub Repository | Gitee Repository |
|:-------------------:|:-----------------:|:----------------:|
| Simplified Frontend | [ruoyi-element-ai](https://github.com/element-plus-x/ruoyi-element-ai) | [ruoyi-element-ai](https://gitee.com/he-jiayue/ruoyi-element-ai) |
| Project Description | GitHub Repository | Gitee Repository |
|:-------------------:|:----------------------------------------------------------------------:|:----------------------------------------------------------------:|
| Simplified Frontend | [ruoyi-element-ai](https://github.com/element-plus-x/ruoyi-element-ai) | [ruoyi-element-ai](https://gitee.com/he-jiayue/ruoyi-element-ai) |
## 🛠️ Tech Stack
### Core Framework
- **Backend**: Spring Boot 3.4, Spring AI, Langchain4j
- **Database**: MySQL 8.0, Redis, Vector Databases (Milvus/Weaviate/Qdrant)
- **Frontend**: Vue 3, Vben Admin, Naive UI
- **Authentication**: Sa-Token, JWT
### System Components
- **File Processing**: PDF, Word, Excel parsing, intelligent image analysis
- **Real-time Communication**: WebSocket real-time communication, SSE streaming
- **System Monitoring**: Comprehensive logging, performance monitoring, health checks
@@ -88,9 +107,11 @@ For detailed setup, configuration, and development guides, visit our comprehensi
## 🤝 Contributing
We welcome contributions from developers of all skill levels! Whether you're fixing bugs, adding features, or improving documentation, your help is appreciated.
We welcome contributions from developers of all skill levels! Whether you're fixing bugs, adding features, or improving
documentation, your help is appreciated.
### How to Contribute
1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
@@ -103,12 +124,12 @@ We welcome contributions from developers of all skill levels! Whether you're fix
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## 🙏 Acknowledgments
Special thanks to these amazing open source projects:
- [Spring AI Alibaba Copilot](https://github.com/springaialibaba/spring-ai-alibaba-copilot) - Intelligent coding assistant based on spring-ai-alibaba with MCP protocol integration for project analysis and code generation
- [Spring AI Alibaba Copilot](https://github.com/springaialibaba/spring-ai-alibaba-copilot) - Intelligent coding
assistant based on spring-ai-alibaba with MCP protocol integration for project analysis and code generation
- [Spring AI](https://spring.io/projects/spring-ai) - Spring's AI integration framework
- [Langchain4j](https://github.com/langchain4j/langchain4j) - Java LLM framework
- [RuoYi-Vue-Plus](https://gitee.com/dromara/RuoYi-Vue-Plus) - Enterprise development framework
@@ -117,7 +138,8 @@ Special thanks to these amazing open source projects:
## 🌐 Ecosystem Partners
- [PPIO Cloud](https://ppinfra.com/user/register?invited_by=P8QTUY&utm_source=github_ruoyi-ai) - Cost-effective GPU containers and model APIs
- [PPIO Cloud](https://ppinfra.com/user/register?invited_by=P8QTUY&utm_source=github_ruoyi-ai) - Cost-effective GPU
containers and model APIs
## 💬 Community
@@ -144,22 +166,33 @@ Special thanks to these amazing open source projects:
<div align="center">
**[⭐ Star this repo](https://github.com/ageerle/ruoyi-ai)** • **[🍴 Fork it](https://github.com/ageerle/ruoyi-ai/fork)** • **[📖 中文文档](README.md)** • **[📚 Documentation](https://doc.pandarobot.chat)**
**[⭐ Star this repo](https://github.com/ageerle/ruoyi-ai)** • **[🍴 Fork it](https://github.com/ageerle/ruoyi-ai/fork)
****[📖 中文文档](README.md)** • **[📚 Documentation](https://doc.pandarobot.chat)**
*Built with ❤️ by the RuoYi AI community*
</div>
<!-- Badge Links -->
[contributors-shield]: https://img.shields.io/github/contributors/ageerle/ruoyi-ai.svg?style=flat-square
[contributors-url]: https://github.com/ageerle/ruoyi-ai/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/ageerle/ruoyi-ai.svg?style=flat-square
[forks-url]: https://github.com/ageerle/ruoyi-ai/network/members
[stars-shield]: https://img.shields.io/github/stars/ageerle/ruoyi-ai.svg?style=flat-square
[stars-url]: https://github.com/ageerle/ruoyi-ai/stargazers
[issues-shield]: https://img.shields.io/github/issues/ageerle/ruoyi-ai.svg?style=flat-square
[issues-url]: https://github.com/ageerle/ruoyi-ai/issues
[license-shield]: https://img.shields.io/github/license/ageerle/ruoyi-ai.svg?style=flat-square
[license-url]: https://github.com/ageerle/ruoyi-ai/blob/main/LICENSE

View File

@@ -0,0 +1,222 @@
## RuoYi-AI 后端部署教程Docker 部署版)
### 一、前置条件
在部署前,请确保系统已满足以下条件:
#### ✅ 系统环境要求
- 操作系统Linux / MacOS推荐 Linux 服务器)
- CPU4 核以上
- 内存:≥ 4GB
- 磁盘空间:≥ 10GB建议 20GB+
#### ✅ 已安装软件
- **Docker**
- **Docker Compose**
验证命令是否可用:
```
docker -v
docker compose version
```
若无输出或提示“command not found”请先安装 Docker 及 Compose。
------
### 二、目录结构配置
#### 1⃣ 创建部署目录
在目标服务器执行以下命令:
```
# 第一级目录
mkdir /ruoyi-ai
cd /ruoyi-ai
# 第二级目录
mkdir deploy
cd deploy
# 第三级目录
mkdir data mysql-init
# 第四级目录
mkdir logs minio minio-config mysql redis weaviate
```
> 💡 `data` 目录用于挂载容器运行期间生成的数据文件。
最终目录结构示例:
```
/ruoyi-ai
└── deploy
├── data/
├── mysql-init/
├── logs/
├── minio/
├── minio-config/
├── mysql/
├── redis/
├── weaviate/
```
------
### 三、上传配置文件
将以下配置文件上传到 `/ruoyi-ai/deploy` 目录:
- `docker-compose.yaml`
- `.env`
- `ruoyi-ai.sql`
- `Dockerfile`
> 📂 这些文件在项目目录 `/script/deploy/deploy` 下。
> 上传后请检查文件路径是否与上方目录结构一致。
------
### 四、构建 Jar 包
1. 打开 IDEA 或其他构建工具
2. 选择 **Maven 构建配置**,勾选 `prod` 环境,取消 `dev` 环境
3. 点击 `package` 进行打包
4. **注意:** 在构建前请将 `application-prod.yml` 拖入
`ruoyi-admin/src/main/resources` 目录中
构建完成后会在:
```
ruoyi-admin/target/ruoyi-admin.jar
```
生成打包文件。
------
### 五、上传 Jar 包至服务器
将生成的 `ruoyi-admin.jar` 上传到服务器 `/ruoyi-ai/deploy` 目录下。
确保与 `Dockerfile` 同目录。
------
### 六、构建 Docker 镜像
`Dockerfile` 内容如下:
```
FROM openjdk:17-jdk
RUN mkdir -p /ruoyi/server/logs \
/ruoyi/server/temp
WORKDIR /ruoyi/server
COPY ruoyi-admin.jar ruoyi-admin.jar
ENTRYPOINT ["java","-jar","ruoyi-admin.jar"]
```
`/ruoyi-ai/deploy` 目录执行以下命令:
```
# 构建镜像
docker build -t ruoyi-ai-backend:v20251013 .
# 查看镜像是否构建成功
docker image ls
```
然后在 `docker-compose.yaml` 文件中,将对应服务的镜像名修改为:
```
image: ruoyi-ai-backend:v20251013
```
------
### 七、启动容器服务
在启动前请确认:
- `.env` 中端口号、数据库密码、环境变量已正确配置
- `docker-compose.yaml` 中 MySQL 的端口已开放(用于导入数据)
如示例:
```
ports:
- "3306:3306"
```
#### 启动命令:
```
cd /ruoyi-ai/deploy
docker compose up -d
```
#### 查看运行状态:
```
docker compose ps
```
#### 查看日志:
```
docker logs -f <容器名称>
```
> ⚠️ 初次启动时可仅运行 `ruoyi-admin`(后端)模块,将前端 `ruoyi-web` 服务暂时注释,确认后端服务正常后再启用前端容器。
------
### 八、数据库初始化
启动 MySQL 容器后,执行以下操作:
```
docker exec -it <mysql_container_name> bash
mysql -uroot -p
source /docker-entrypoint-initdb.d/ruoyi-ai.sql;
```
或手动在客户端中导入 `/ruoyi-ai/deploy/ruoyi-ai.sql` 文件。
------
### 九、常用 Docker 命令
| 功能 | 命令 |
|-----------|-----------------------------------|
| 查看容器状态 | `docker ps -a` |
| 查看日志 | `docker logs -f <容器名>` |
| 停止服务 | `docker compose down` |
| 重启服务 | `docker compose restart` |
| 重新构建镜像 | `docker compose build --no-cache` |
| 清理无用镜像/容器 | `docker system prune -a` |
------
### 🔍 十、部署验证
1. 检查容器是否全部启动成功:
```
docker compose ps
```
2. 访问后端接口:
```
http://<服务器IP>:<后端端口>
```
3. 检查日志输出无异常。

View File

@@ -0,0 +1,352 @@
<a id="top"></a>
# RAG 常见故障排查16 问题清单)
当知识库已经接入,系统也能正常回答,但结果仍然出现命中错误、引用旧内容、推理漂移、跨轮次失忆,或部署后表面可用但实际异常时,最常见的问题不是“模型不行”,而是**不同层的故障被混在一起处理**。
这份页面不重新发明一套新方法。
它直接使用一份固定的 **16 问题清单** 作为排查主轴,让你先把问题标到正确的 **No.X**,再决定下一步查哪里、改哪里,而不是一次性乱改检索、模型、切块、会话和部署配置。
这份清单的核心目的只有一个:
**先把问题放进正确的故障域,再做修复。**
快速导航:
[这页怎么用](#how-to-use) | [标签说明](#legend) | [常见症状入口](#symptoms) | [16 问题清单](#map16) | [按层排查](#by-layer) |
---
<a id="how-to-use"></a>
## 一、这页怎么用
这不是一篇“从头到尾照着做”的传统教程。
它更像一张固定的 RAG 故障地图,作用是先帮助你**判断故障属于哪一种类型**。
建议按下面顺序使用:
### 1. 先看现象,不要先改配置
先回答两个问题:
1. 你看到的故障,最像哪一种症状
2. 这个故障更像发生在输入检索层、推理层、状态层,还是部署层
在还没判断层级之前,不要先一起改这些东西:
- 检索条数
- 切块大小
- 会话配置
- 模型参数
- 部署顺序
- 依赖服务
如果先全部一起动,问题通常只会更难定位。
### 2. 先给问题打上 No.X 标签
这份页面最重要的动作,不是“立刻修好”,而是先做一件小事:
**给当前问题贴上最接近的 No.X。**
例如:
- 检索结果看起来相似,但其实答非所问,先看 `No.1``No.5`
- 切块是对的,但结论还是错,先看 `No.2`
- 系统回答很自信,但没有根据,先看 `No.4`
- 刚部署完就炸,先看 `No.14``No.16`
### 3. 一次只排一个故障域
同一个表面现象,背后可能是不同层的问题。
例如“答案不对”既可能是:
- `No.1` 检索漂移
- `No.2` 理解塌陷
- `No.4` 自信乱答
- `No.8` 根本看不到错误路径
所以这张表的用法不是“多选全改”,而是:
**先挑最接近的一项,优先验证这一项是否成立。**
[返回顶部](#top) | [下一节:标签说明](#legend)
---
<a id="legend"></a>
## 二、标签说明
这份 16 问题清单本身已经带有层级 / 标签结构。
这些标签不是装饰,而是用来帮助你快速判断故障发生在哪一层。
### 1. 层级标签
- `[IN]`:输入与检索
输入、切块、召回、语义匹配、可见性问题
- `[RE]`:推理与规划
理解、推理、归纳、逻辑链、抽象处理问题
- `[ST]`:状态与上下文
会话、记忆、上下文连续性、多代理状态问题
- `[OP]`:基础设施与部署
启动顺序、依赖就绪、部署锁死、预部署状态问题
### 2. `{OBS}` 标签
`{OBS}` 的项,通常都和“**你是否看得见问题是怎么坏掉的**”有关。
它们往往不是单纯回答错误,而是:
- 错误路径不可见
- 漂移过程不可见
- 状态熔化过程不可见
- 多代理覆盖过程不可见
所以一旦你发现“我知道结果错,但我根本看不到它是怎么错的”,通常就已经很接近 `{OBS}` 类问题了。
### 3. 为什么要保留这些标签
因为同样叫“答错了”,实际含义完全不同。
例如:
- `[IN]` 的答错,常常是**拿错材料**
- `[RE]` 的答错,常常是**拿对材料但理解错**
- `[ST]` 的答错,常常是**前文断掉、状态漂移**
- `[OP]` 的答错,常常是**系统根本没在完整状态下运行**
如果不先分层,就会掉进典型的 RAG 地狱:
表面在改答案,实际上在盲修。
[返回顶部](#top) | [下一节:常见症状入口](#symptoms)
---
<a id="symptoms"></a>
## 三、常见症状入口
如果你现在还不知道该从哪一项开始,就先从症状入口反查。
### 1. 检索返回了错误内容,或看起来相关但其实不回答问题
这类问题最常见的是:
“有命中,但命中的不是该用的内容。”
优先看:
- [No.1](#no1) `幻觉与切块漂移`
- [No.5](#no5) `语义 ≠ 向量嵌入`
- [No.8](#no8) `调试是一个黑箱`
### 2. 切块本身是对的,但最终答案还是错的
这类问题不是简单没检索到,而是后面那层坏了。
优先看:
- [No.2](#no2) `解释塌陷`
- [No.4](#no4) `虚张声势 / 过度自信`
- [No.6](#no6) `逻辑塌陷与恢复`
### 3. 多步任务一开始正常,后面越来越偏
这类问题通常不是单点错误,而是中途漂移或熔化。
优先看:
- [No.3](#no3) `长推理链`
- [No.6](#no6) `逻辑塌陷与恢复`
- [No.9](#no9) `熵塌陷`
### 4. 多轮对话后开始失忆,跨轮次接不上
这类问题一般已经进入状态层。
优先看:
- [No.7](#no7) `跨会话记忆断裂`
- [No.9](#no9) `熵塌陷`
- [No.13](#no13) `多代理混乱`
### 5. 遇到抽象、逻辑、规则、符号关系就崩
这类问题通常不是检索空,而是推理结构扛不住。
优先看:
- [No.11](#no11) `符号塌陷`
- [No.12](#no12) `哲学递归`
### 6. 你根本不知道错在哪一层,只知道结果不对
这类问题先不要乱调参数。
先解决“不可见”的问题。
优先看:
- [No.8](#no8) `调试是一个黑箱`
### 7. 刚部署完最容易炸,首轮调用异常,重启后偶尔恢复
这类问题通常不在答案逻辑,而在部署状态。
优先看:
- [No.14](#no14) `引导启动顺序`
- [No.15](#no15) `部署死锁`
- [No.16](#no16) `预部署塌陷`
[返回顶部](#top) | [下一节16 问题清单](#map16)
---
<a id="map16"></a>
## 四、16 问题清单(固定主表)
下面这 16 项按固定顺序使用。
不要先重组,不要先混类,先判断最接近哪一个 **No.X**
| # | 问题域(含层级/标签) | 会坏在哪里 |
|---|---|---|
| <a id="no1"></a> 1 | `[IN] 幻觉与切块漂移 {OBS}` | 检索返回错误/无关内容 |
| <a id="no2"></a> 2 | `[RE] 解释塌陷` | 切块是对的,逻辑是错的 |
| <a id="no3"></a> 3 | `[RE] 长推理链 {OBS}` | 在多步任务中逐步漂移 |
| <a id="no4"></a> 4 | `[RE] 虚张声势 / 过度自信` | 自信但没有根据的回答 |
| <a id="no5"></a> 5 | `[IN] 语义 ≠ 向量嵌入 {OBS}` | 余弦匹配 ≠ 真实语义 |
| <a id="no6"></a> 6 | `[RE] 逻辑塌陷与恢复 {OBS}` | 走入死胡同,需要受控重置 |
| <a id="no7"></a> 7 | `[ST] 跨会话记忆断裂` | 线索丢失,没有连续性 |
| <a id="no8"></a> 8 | `[IN] 调试是一个黑箱 {OBS}` | 看不到故障路径 |
| <a id="no9"></a> 9 | `[ST] 熵塌陷` | 注意力熔化,输出失去连贯性 |
| <a id="no10"></a> 10 | `[RE] 创造力冻结` | 平直、字面化输出 |
| <a id="no11"></a> 11 | `[RE] 符号塌陷` | 抽象/逻辑性提示词失效 |
| <a id="no12"></a> 12 | `[RE] 哲学递归` | 自我引用循环、悖论陷阱 |
| <a id="no13"></a> 13 | `[ST] 多代理混乱 {OBS}` | 代理互相覆盖或使逻辑错位 |
| <a id="no14"></a> 14 | `[OP] 引导启动顺序` | 依赖未就绪时服务先启动 |
| <a id="no15"></a> 15 | `[OP] 部署死锁` | 基础设施中的循环等待 |
| <a id="no16"></a> 16 | `[OP] 预部署塌陷 {OBS}` | 首次调用时版本错配 / 缺少密钥 |
这张表是主表。
如果你时间很少,只做一件事也行:
**先从这 16 项里选出最接近的一项。**
[返回顶部](#top) | [下一节:按层排查](#by-layer)
---
<a id="by-layer"></a>
## 五、按层排查:不要改错层
这一节不重写 16 项,只是告诉你:
当你已经选到某个 No.X 时,第一眼应该优先查哪一层。
### A. `[IN]` 层:先确认你拿到的是不是对的材料
对应编号:
- [No.1](#no1)
- [No.5](#no5)
- [No.8](#no8)
这层最常见的误判是:
“我以为系统理解错了,其实它一开始就拿错了东西。”
如果你命中了弱相关片段、表面相似文本、错误切块,后面推理再强也没用。
所以 `[IN]` 层优先看的是:
1. 原始召回内容到底是什么
2. 命中的片段是否只是“相似”,而不是“正确”
3. 你是否能看到检索过程,还是整个过程像黑箱
这层如果没先排好,后面的推理诊断通常会失真。
### B. `[RE]` 层:材料可能是对的,但系统用错了
对应编号:
- [No.2](#no2)
- [No.3](#no3)
- [No.4](#no4)
- [No.6](#no6)
- [No.10](#no10)
- [No.11](#no11)
- [No.12](#no12)
这层最常见的误判是:
“我以为是检索坏了,其实是后面理解、归纳、逻辑链坏了。”
例如:
- 切块是对的,但结论错了 → 常见是 `No.2`
- 多步任务中途开始偏 → 常见是 `No.3`
- 回答很笃定,但完全站不住 → 常见是 `No.4`
- 遇到抽象规则就崩 → 常见是 `No.11`
- 陷入循环解释 → 常见是 `No.12`
如果 `[IN]` 层已经基本没问题,答案还是不对,就应该优先回到 `[RE]` 层判断是哪一种塌陷。
### C. `[ST]` 层:单轮正常,不代表状态层正常
对应编号:
- [No.7](#no7)
- [No.9](#no9)
- [No.13](#no13)
这层最常见的误判是:
“单轮看起来还行,所以我以为系统没问题。”
其实很多 RAG 地狱不是单轮错误,而是:
- 多轮之后前文断掉
- 上下文越来越乱
- 多角色、多代理之间互相覆盖
如果你发现:
- 第一轮没事,后面越来越歪
- 切换角色后前面的约束消失
- 多个步骤之间状态彼此污染
那就不要再只盯着检索条数了,应该直接回到 `[ST]` 层看 `No.7 / No.9 / No.13`
### D. `[OP]` 层:别把部署问题误诊成回答问题
对应编号:
- [No.14](#no14)
- [No.15](#no15)
- [No.16](#no16)
这层最常见的误判是:
“答案不稳定,所以我先去调模型或检索。”
但如果系统根本没有在完整状态下启动,所有上层表现都会像鬼打墙。
尤其是这些情况:
- 依赖还没就绪,服务先起了 → `No.14`
- 多个组件互相等待,长期半可用 → `No.15`
- 首次调用就因为版本、密钥、环境没对齐而塌陷 → `No.16`
只要你看到“刚部署最容易出事”“首轮异常最严重”“重启后暂时恢复”,就要优先怀疑 `[OP]` 层,而不是先改提示词或参数。
[返回顶部](#top) |
---
<a id="issue-report"></a>
## 六、快速返回
[返回顶部](#top) | [这页怎么用](#how-to-use) | [标签说明](#legend) | [常见症状入口](#symptoms) | [16 问题清单](#map16) | [按层排查](#by-layer)

View File

@@ -0,0 +1,452 @@
# Ruoyi-AI 工作流模块详细说明文档
## 概述
Ruoyi-AI 工作流模块是一个基于 LangGraph4j 的智能工作流引擎支持可视化工作流设计、AI 模型集成、条件分支、人机交互等高级功能。该模块采用微服务架构,提供完整的
RESTful API 和流式响应支持。
## 模块架构
### 1. 模块结构
```
ruoyi-ai/
├── ruoyi-modules/
│ └── ruoyi-workflow/ # 工作流核心模块
│ ├── pom.xml
│ └── src/main/java/org/ruoyi/workflow/
│ └── controller/ # 控制器层
│ ├── WorkflowController.java
│ ├── WorkflowRuntimeController.java
│ └── admin/ # 管理端控制器
│ ├── AdminWorkflowController.java
│ └── AdminWorkflowComponentController.java
└── ruoyi-modules-api/
└── ruoyi-workflow-api/ # 工作流API模块
├── pom.xml
└── src/main/java/org/ruoyi/workflow/
├── entity/ # 实体类
├── dto/ # 数据传输对象
├── service/ # 服务接口
├── mapper/ # 数据访问层
├── workflow/ # 工作流核心逻辑
├── enums/ # 枚举类
├── util/ # 工具类
└── exception/ # 异常处理
```
### 2. 核心依赖
- **LangGraph4j**: 1.5.3 - 工作流图执行引擎
- **LangChain4j**: 1.2.0 - AI 模型集成框架
- **Spring Boot**: 3.x - 应用框架
- **MyBatis Plus**: 数据访问层
- **Redis**: 缓存和状态管理
- **Swagger/OpenAPI**: API 文档
## 核心功能
### 1. 工作流管理
#### 1.1 工作流定义
- **创建工作流**: 支持自定义标题、描述、公开性设置
- **编辑工作流**: 可视化节点编辑、连接线配置
- **版本控制**: 支持工作流的版本管理和回滚
- **权限管理**: 支持公开/私有工作流设置
#### 1.2 工作流执行
- **流式执行**: 基于 SSE 的实时流式响应
- **状态管理**: 完整的执行状态跟踪
- **错误处理**: 详细的错误信息和异常处理
- **中断恢复**: 支持工作流中断和恢复执行
### 2. 节点类型
#### 2.1 基础节点
- **Start**: 开始节点,定义工作流入口
- **End**: 结束节点,定义工作流出口
#### 2.2 AI 模型节点
- **Answer**: 大语言模型问答节点
- **Dalle3**: DALL-E 3 图像生成
- **Tongyiwanx**: 通义万相图像生成
- **Classifier**: 内容分类节点
#### 2.3 数据处理节点
- **DocumentExtractor**: 文档信息提取
- **KeywordExtractor**: 关键词提取
- **FaqExtractor**: 常见问题提取
- **KnowledgeRetrieval**: 知识库检索
#### 2.4 控制流节点
- **Switcher**: 条件分支节点
- **HumanFeedback**: 人机交互节点
#### 2.5 外部集成节点
- **Google**: Google 搜索集成
- **MailSend**: 邮件发送
- **HttpRequest**: HTTP 请求
- **Template**: 模板转换
### 3. 数据流管理
#### 3.1 输入输出定义
```java
// 节点输入输出数据结构
public class NodeIOData {
private String name; // 参数名称
private NodeIODataContent content; // 参数内容
}
// 支持的数据类型
public enum WfIODataTypeEnum {
TEXT, // 文本
NUMBER, // 数字
BOOLEAN, // 布尔值
FILES, // 文件
OPTIONS // 选项
}
```
#### 3.2 参数引用
- **节点间引用**: 支持上游节点输出作为下游节点输入
- **参数映射**: 自动处理参数名称映射
- **类型转换**: 自动进行数据类型转换
## 数据库设计
### 1. 核心表结构
#### 1.1 工作流定义表 (t_workflow)
```sql
CREATE TABLE t_workflow (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
uuid VARCHAR(32) NOT NULL DEFAULT '',
title VARCHAR(100) NOT NULL DEFAULT '',
remark TEXT NOT NULL DEFAULT '',
user_id BIGINT NOT NULL DEFAULT 0,
is_public TINYINT(1) NOT NULL DEFAULT 0,
is_enable TINYINT(1) NOT NULL DEFAULT 1,
create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
is_deleted TINYINT(1) NOT NULL DEFAULT 0
);
```
#### 1.2 工作流节点表 (t_workflow_node)
```sql
CREATE TABLE t_workflow_node (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
uuid VARCHAR(32) NOT NULL DEFAULT '',
workflow_id BIGINT NOT NULL DEFAULT 0,
workflow_component_id BIGINT NOT NULL DEFAULT 0,
user_id BIGINT NOT NULL DEFAULT 0,
title VARCHAR(100) NOT NULL DEFAULT '',
remark VARCHAR(500) NOT NULL DEFAULT '',
input_config JSON NOT NULL DEFAULT ('{}'),
node_config JSON NOT NULL DEFAULT ('{}'),
position_x DOUBLE NOT NULL DEFAULT 0,
position_y DOUBLE NOT NULL DEFAULT 0,
create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
is_deleted TINYINT(1) NOT NULL DEFAULT 0
);
```
#### 1.3 工作流边表 (t_workflow_edge)
```sql
CREATE TABLE t_workflow_edge (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
uuid VARCHAR(32) NOT NULL DEFAULT '',
workflow_id BIGINT NOT NULL DEFAULT 0,
source_node_uuid VARCHAR(32) NOT NULL DEFAULT '',
source_handle VARCHAR(32) NOT NULL DEFAULT '',
target_node_uuid VARCHAR(32) NOT NULL DEFAULT '',
create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
is_deleted TINYINT(1) NOT NULL DEFAULT 0
);
```
#### 1.4 工作流运行时表 (t_workflow_runtime)
```sql
CREATE TABLE t_workflow_runtime (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
uuid VARCHAR(32) NOT NULL DEFAULT '',
user_id BIGINT NOT NULL DEFAULT 0,
workflow_id BIGINT NOT NULL DEFAULT 0,
input JSON NOT NULL DEFAULT ('{}'),
output JSON NOT NULL DEFAULT ('{}'),
status SMALLINT NOT NULL DEFAULT 1,
status_remark VARCHAR(250) NOT NULL DEFAULT '',
create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
is_deleted TINYINT(1) NOT NULL DEFAULT 0
);
```
#### 1.5 工作流组件表 (t_workflow_component)
```sql
CREATE TABLE t_workflow_component (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
uuid VARCHAR(32) DEFAULT '' NOT NULL,
name VARCHAR(32) DEFAULT '' NOT NULL,
title VARCHAR(100) DEFAULT '' NOT NULL,
remark TEXT NOT NULL,
display_order INT DEFAULT 0 NOT NULL,
is_enable TINYINT(1) DEFAULT 0 NOT NULL,
create_time DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL,
update_time DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL,
is_deleted TINYINT(1) DEFAULT 0 NOT NULL
);
```
## API 接口
### 1. 工作流管理接口
#### 1.1 基础操作
```http
#
POST /workflow/add
Content-Type: application/json
{
"title": "",
"remark": "",
"isPublic": false
}
#
POST /workflow/update
Content-Type: application/json
{
"uuid": "UUID",
"title": "",
"remark": ""
}
#
POST /workflow/del/{uuid}
# /
POST /workflow/enable/{uuid}?enable=true
```
#### 1.2 搜索和查询
```http
#
GET /workflow/mine/search?keyword=&isPublic=true&currentPage=1&pageSize=10
#
GET /workflow/public/search?keyword=&currentPage=1&pageSize=10
#
GET /workflow/public/component/list
```
### 2. 工作流执行接口
#### 2.1 流式执行
```http
#
POST /workflow/run
Content-Type: application/json
Accept: text/event-stream
{
"uuid": "UUID",
"inputs": [
{
"name": "input",
"content": {
"type": 1,
"textContent": ""
}
}
]
}
```
#### 2.2 运行时管理
```http
#
POST /workflow/runtime/resume/{runtimeUuid}
Content-Type: application/json
{
"feedbackContent": ""
}
#
GET /workflow/runtime/page?wfUuid=UUID&currentPage=1&pageSize=10
#
GET /workflow/runtime/nodes/{runtimeUuid}
#
POST /workflow/runtime/clear?wfUuid=UUID
```
### 3. 管理端接口
#### 3.1 工作流管理
```http
#
POST /admin/workflow/search
Content-Type: application/json
{
"title": "",
"isPublic": true,
"isEnable": true
}
# /
POST /admin/workflow/enable?uuid=UUID&isEnable=true
```
## 核心实现
### 1. 工作流引擎 (WorkflowEngine)
工作流引擎是整个模块的核心,负责:
- 工作流图的构建和编译
- 节点执行调度
- 状态管理和持久化
- 流式输出处理
```java
public class WorkflowEngine {
// 核心执行方法
public void run(User user, List<ObjectNode> userInputs, SseEmitter sseEmitter) {
// 1. 验证工作流状态
// 2. 创建运行时实例
// 3. 构建状态图
// 4. 执行工作流
// 5. 处理流式输出
}
// 恢复执行方法
public void resume(String userInput) {
// 1. 更新状态
// 2. 继续执行
}
}
```
### 2. 节点工厂 (WfNodeFactory)
节点工厂负责根据组件类型创建对应的节点实例:
```java
public class WfNodeFactory {
public static AbstractWfNode create(WorkflowComponent component,
WorkflowNode node,
WfState wfState,
WfNodeState nodeState) {
// 根据组件类型创建对应的节点实例
switch (component.getName()) {
case "Answer":
return new LLMAnswerNode(component, node, wfState, nodeState);
case "Switcher":
return new SwitcherNode(component, node, wfState, nodeState);
// ... 其他节点类型
}
}
}
```
### 3. 图构建器 (WorkflowGraphBuilder)
图构建器负责将工作流定义转换为可执行的状态图:
```java
public class WorkflowGraphBuilder {
public StateGraph<WfNodeState> build(WorkflowNode startNode) {
// 1. 构建编译节点树
// 2. 转换为状态图
// 3. 添加节点和边
// 4. 处理条件分支
// 5. 处理并行执行
}
}
```
## 流式响应机制
### 1. SSE 事件类型
工作流执行过程中会发送多种类型的 SSE 事件:
```javascript
// 节点开始执行
[NODE_RUN_节点UUID] - 节点执行开始事件
// 节点输入数据
[NODE_INPUT_节点UUID] - 节点输入数据事件
// 节点输出数据
[NODE_OUTPUT_节点UUID] - 节点输出数据事件
// 流式内容块
[NODE_CHUNK_节点UUID] - 流式内容块事件
// 等待用户输入
[NODE_WAIT_FEEDBACK_BY_节点UUID] - 等待用户输入事件
```
### 2. 流式处理流程
1. **初始化**: 创建工作流运行时实例
2. **节点执行**: 逐个执行工作流节点
3. **实时输出**: 通过 SSE 实时推送执行结果
4. **状态更新**: 实时更新节点和工作流状态
5. **错误处理**: 捕获并处理执行过程中的错误
## 扩展开发
### 1. 自定义节点开发
要开发自定义工作流节点,需要:
1. **创建节点类**:继承 `AbstractWfNode`
2. **实现处理逻辑**:重写 `onProcess()` 方法
3. **定义配置类**:创建节点配置类
4. **注册组件**:在组件表中注册新组件
```java
public class CustomNode extends AbstractWfNode {
@Override
protected NodeProcessResult onProcess() {
// 实现自定义处理逻辑
List<NodeIOData> outputs = new ArrayList<>();
// ... 处理逻辑
return NodeProcessResult.success(outputs);
}
}
```
### 2. 自定义组件注册
```sql
-- 在 t_workflow_component 表中添加新组件
INSERT INTO t_workflow_component (uuid, name, title, remark, is_enable)
VALUES (REPLACE(UUID(), '-', ''), 'CustomNode', '自定义节点', '自定义节点描述', true);
```

View File

@@ -0,0 +1,42 @@
## 接口信息
**接口路径**: `POST /resource/oss/upload`
**请求类型**: `multipart/form-data`
**权限要求**: `system:oss:upload`
**业务类型**: [INSERT]
### 接口描述
上传OSS对象存储接口用于将文件上传到对象存储服务。
### 请求参数
| 参数名 | 类型 | 必填 | 说明 |
| ---- | ------------- | ---- | ------ |
| file | MultipartFile | 是 | 要上传的文件 |
### 请求头
- `Content-Type`: `multipart/form-data`
### 返回值
返回 `R<SysOssUploadVo>` 类型,包含以下字段:
| 字段名 | 类型 | 说明 |
| -------- | ------ | ------- |
| url | String | 文件访问URL |
| fileName | String | 原始文件名 |
| ossId | String | 文件ID |
### 响应示例
```json
{
"code": 200,
"msg": "操作成功",
"data": {
"url": "fileid://xxx",
"fileName": "example.jpg",
"ossId": "123"
}
}
```
### 异常情况
- 当上传文件为空时,返回错误信息:"上传文件不能为空"

62
pom.xml
View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -20,7 +20,7 @@
<java.version>17</java.version>
<mysql.version>8.0.33</mysql.version>
<mybatis.version>3.5.16</mybatis.version>
<springdoc.version>2.8.5</springdoc.version>
<springdoc.version>2.8.13</springdoc.version>
<therapi-javadoc.version>0.15.0</therapi-javadoc.version>
<poi.version>5.2.3</poi.version>
<easyexcel.version>3.2.1</easyexcel.version>
@@ -50,6 +50,11 @@
<aliyun.sms.version>2.0.23</aliyun.sms.version>
<tencent.sms.version>3.1.687</tencent.sms.version>
<!-- Neo4j 相关版本 -->
<neo4j-driver.version>5.26.0</neo4j-driver.version>
<neo4j-cypher-dsl.version>2024.1.0</neo4j-cypher-dsl.version>
<langchain4j-neo4j.version>1.2.0-beta8</langchain4j-neo4j.version>
<!-- 插件版本 -->
<maven-jar-plugin.version>3.2.2</maven-jar-plugin.version>
<maven-war-plugin.version>3.2.2</maven-war-plugin.version>
@@ -265,13 +270,6 @@
<version>${lock4j.version}</version>
</dependency>
<!-- xxl-job-core -->
<dependency>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-job-core</artifactId>
<version>${xxl-job.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>transmittable-thread-local</artifactId>
@@ -342,12 +340,52 @@
<version>${revision}</version>
</dependency>
<dependency>
<groupId>org.ruoyi</groupId>
<artifactId>ruoyi-graph</artifactId>
<version>${revision}</version>
</dependency>
<!-- Neo4j Driver -->
<dependency>
<groupId>org.neo4j.driver</groupId>
<artifactId>neo4j-java-driver</artifactId>
<version>${neo4j-driver.version}</version>
</dependency>
<!-- Neo4j Cypher DSL -->
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-cypher-dsl</artifactId>
<version>${neo4j-cypher-dsl.version}</version>
</dependency>
<!-- Langchain4j Neo4j 扩展 -->
<dependency>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-community-neo4j</artifactId>
<version>${langchain4j-neo4j.version}</version>
</dependency>
<dependency>
<groupId>org.ruoyi</groupId>
<artifactId>ruoyi-aihuman</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>org.ruoyi</groupId>
<artifactId>ruoyi-workflow</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>org.ruoyi</groupId>
<artifactId>ruoyi-workflow-api</artifactId>
<version>${revision}</version>
</dependency>
</dependencies>
</dependencyManagement>
@@ -487,6 +525,4 @@
</pluginRepository>
</pluginRepositories>
</project>
</project>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ruoyi-ai</artifactId>
@@ -57,6 +57,16 @@
<artifactId>ruoyi-generator</artifactId>
</dependency>
<!-- 知识图谱模块 -->
<dependency>
<groupId>org.ruoyi</groupId>
<artifactId>ruoyi-graph</artifactId>
</dependency>
<dependency>
<groupId>org.ruoyi</groupId>
<artifactId>ruoyi-workflow</artifactId>
</dependency>
<dependency>
<groupId>org.ruoyi</groupId>
<artifactId>ruoyi-aihuman</artifactId>

View File

@@ -81,6 +81,7 @@ public class AuthController {
/**
* 访客登录
*
* @param loginBody 登录信息
* @return token信息
*/
@@ -119,7 +120,7 @@ public class AuthController {
*/
@PostMapping("/register")
public R<Void> register(@Validated @RequestBody RegisterBody user, HttpServletRequest request) {
String domainName = request.getServerName();
String domainName = request.getServerName();
user.setDomainName(domainName);
registerService.register(user);
return R.ok();

View File

@@ -22,5 +22,4 @@ public class IndexController {
}
}

View File

@@ -1,4 +1,3 @@
--- # 数据源配置
spring:
datasource:
@@ -37,6 +36,8 @@ spring:
connectionTestQuery: SELECT 1
# 多久检查一次连接的活性
keepaliveTime: 30000
mail:
username: xx
--- # redis 单机配置(单机与集群只能开启一个另一个需要注释掉)
spring.data:
@@ -99,8 +100,9 @@ pdf:
conda-env-path: "F:\\ProgramData\\Computer\\Anaconda\\envs\\mineru"
# 是否开启图片OCR
enable-ocr: true
#百炼模型配置
dashscope:
key: sk-xxxx
model: qvq-max

View File

@@ -1,111 +0,0 @@
--- # 监控中心配置
spring.boot.admin.client:
# 增加客户端开关
enabled: false
url: http://localhost:9090/admin
instance:
service-host-type: IP
username: ruoyi
password: 123456
--- # 数据源配置
spring:
datasource:
type: com.zaxxer.hikari.HikariDataSource
# 动态数据源文档 https://www.kancloud.cn/tracy5546/dynamic-datasource/content
dynamic:
# 性能分析插件(有性能损耗 不建议生产环境使用)
p6spy: true
# 设置默认的数据源或者数据源组,默认值即为 master
primary: master
# 严格模式 匹配不到数据源则报错
strict: true
datasource:
# 主库数据源
master:
type: ${spring.datasource.type}
driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/ruoyi-ai?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
username: root
password: root
hikari:
# 最大连接池数量
maxPoolSize: 20
# 最小空闲线程数量
minIdle: 10
# 配置获取连接等待超时的时间
connectionTimeout: 30000
# 校验超时时间
validationTimeout: 5000
# 空闲连接存活最大时间默认10分钟
idleTimeout: 600000
# 此属性控制池中连接的最长生命周期值0表示无限生命周期默认30分钟
maxLifetime: 1800000
# 连接测试query配置检测连接是否有效
connectionTestQuery: SELECT 1
# 多久检查一次连接的活性
keepaliveTime: 30000
--- # redis 单机配置(单机与集群只能开启一个另一个需要注释掉)
spring.data:
redis:
# 地址
host: 127.0.0.1
# 端口默认为6379
port: 6379
# 数据库索引
database: 0
# 密码(如没有密码请注释掉)
password: root
# 连接超时时间
timeout: 10S
# 是否开启ssl
ssl: false
redisson:
# redis key前缀
keyPrefix:
# 线程池数量
threads: 4
# Netty线程池数量
nettyThreads: 8
# 单节点配置
singleServerConfig:
# 客户端名称
clientName: ${ruoyi.name}
# 最小空闲连接数
connectionMinimumIdleSize: 8
# 连接池大小
connectionPoolSize: 32
# 连接空闲超时,单位:毫秒
idleConnectionTimeout: 10000
# 命令等待超时,单位:毫秒
timeout: 3000
# 发布和订阅连接池大小
subscriptionConnectionPoolSize: 50
--- # sms 短信
sms:
enabled: false
# 阿里云 dysmsapi.aliyuncs.com
# 腾讯云 sms.tencentcloudapi.com
endpoint: "dysmsapi.aliyuncs.com"
accessKeyId: xxxxxxx
accessKeySecret: xxxxxx
signName: 测试
# 腾讯专用
sdkAppId:
pdf:
extract:
service:
url: http://localhost:8080
ai-api:
url: https://api.pandarobot.chat/v1/chat/completions
key: sk-xxxx
#百炼模型配置
dashscope:
key: sk-xxxx
model: qvq-max

View File

@@ -156,6 +156,8 @@ security:
# actuator 监控配置
- /actuator
- /actuator/**
- /workflow/**
- /admin/workflow/**
# 多租户配置
tenant:
# 是否开启
@@ -301,6 +303,10 @@ management:
show-details: ALWAYS
logfile:
external-file: ./logs/sys-console.log
health:
# 禁用 Neo4j 健康检查(当知识图谱功能未启用时)
neo4j:
enabled: false
# websocket
# websocket
@@ -328,3 +334,71 @@ spring:
servers-configuration: classpath:mcp-server.json
request-timeout: 300s
# 向量库配置
vector-store:
# 向量存储类型 可选(weaviate/milvus)
# 如需修改向量库类型,请修改此配置值!
type: weaviate
# Weaviate配置
weaviate:
protocol: http
host: 127.0.0.1:6038
classname: LocalKnowledge
# Milvus配置
milvus:
url: http://localhost:19530
collectionname: LocalKnowledge
--- # Neo4j 知识图谱配置
#neo4j:
# uri: bolt://117.72.192.162:7687
# username: neo4j
# password: MySecurePass123!
# database: neo4j
# max-connection-pool-size: 50
# connection-timeout-seconds: 30
# 知识图谱配置
knowledge:
graph:
# 是否启用知识图谱功能
enabled: false
# 图数据库类型: neo4j 或 apache-age
database-type: neo4j
# 是否自动创建索引
auto-create-index: true
# 批量处理大小
batch-size: 1000
# 最大重试次数
max-retry-count: 3
# 实体抽取配置
extraction:
# 置信度阈值(低于此值的实体将被过滤)
confidence-threshold: 0.7
# 最大实体数量(每个文档)
max-entities-per-doc: 100
# 最大关系数量(每个文档)
max-relations-per-doc: 200
# 文本分片大小(用于长文档)
chunk-size: 2000
# 分片重叠大小
chunk-overlap: 200
# 查询配置
query:
# 默认查询限制数量
default-limit: 100
# 最大查询限制数量
max-limit: 1000
# 路径查询最大深度
max-path-depth: 5
# 查询超时时间(秒)
timeout-seconds: 30
# 是否启用查询缓存
cache-enabled: true
# 缓存过期时间(分钟)
cache-expire-minutes: 60

View File

@@ -98,32 +98,32 @@
</appender>
<!-- 整合 skywalking 控制台输出 tid -->
<!-- <appender name="console" class="ch.qos.logback.core.ConsoleAppender">-->
<!-- <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">-->
<!-- <layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">-->
<!-- <pattern>[%tid] ${console.log.pattern}</pattern>-->
<!-- </layout>-->
<!-- <charset>utf-8</charset>-->
<!-- </encoder>-->
<!-- </appender>-->
<!-- <appender name="console" class="ch.qos.logback.core.ConsoleAppender">-->
<!-- <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">-->
<!-- <layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">-->
<!-- <pattern>[%tid] ${console.log.pattern}</pattern>-->
<!-- </layout>-->
<!-- <charset>utf-8</charset>-->
<!-- </encoder>-->
<!-- </appender>-->
<!-- 整合 skywalking 推送采集日志 -->
<!-- <appender name="sky_log" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">-->
<!-- <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">-->
<!-- <layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">-->
<!-- <pattern>[%tid] ${console.log.pattern}</pattern>-->
<!-- </layout>-->
<!-- <charset>utf-8</charset>-->
<!-- </encoder>-->
<!-- </appender>-->
<!-- <appender name="sky_log" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">-->
<!-- <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">-->
<!-- <layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">-->
<!-- <pattern>[%tid] ${console.log.pattern}</pattern>-->
<!-- </layout>-->
<!-- <charset>utf-8</charset>-->
<!-- </encoder>-->
<!-- </appender>-->
<!--系统操作日志-->
<root level="info">
<appender-ref ref="console" />
<appender-ref ref="async_info" />
<appender-ref ref="async_error" />
<appender-ref ref="file_console" />
<!-- <appender-ref ref="sky_log"/>-->
<appender-ref ref="console"/>
<appender-ref ref="async_info"/>
<appender-ref ref="async_error"/>
<appender-ref ref="file_console"/>
<!-- <appender-ref ref="sky_log"/>-->
</root>
</configuration>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.ruoyi</groupId>

View File

@@ -6,7 +6,6 @@ import cn.hutool.core.date.DateUnit;
import lombok.extern.slf4j.Slf4j;
/**
*
* @author https:www.unfbx.com
* @date 2023-03-10
*/
@@ -16,16 +15,14 @@ public class LocalCache {
* 缓存时长
*/
public static final long TIMEOUT = 30 * DateUnit.MINUTE.getMillis();
/**
* 清理间隔
*/
private static final long CLEAN_TIMEOUT = 30 * DateUnit.MINUTE.getMillis();
/**
* 缓存对象
*/
public static final TimedCache<String, Object> CACHE = CacheUtil.newTimedCache(TIMEOUT);
/**
* 清理间隔
*/
private static final long CLEAN_TIMEOUT = 30 * DateUnit.MINUTE.getMillis();
static {
//启动定时任务

View File

@@ -39,10 +39,10 @@ public class WebSocketConfig {
}
// 返回一个WebSocketConfigurer对象用于配置WebSocket
return registry -> registry
// 添加WebSocket处理程序和拦截器到指定路径设置允许的跨域来源
.addHandler(webSocketHandler, webSocketProperties.getPath())
.addInterceptors(handshakeInterceptor)
.setAllowedOrigins(webSocketProperties.getAllowedOrigins());
// 添加WebSocket处理程序和拦截器到指定路径设置允许的跨域来源
.addHandler(webSocketHandler, webSocketProperties.getPath())
.addInterceptors(handshakeInterceptor)
.setAllowedOrigins(webSocketProperties.getAllowedOrigins());
}
@Bean

View File

@@ -23,7 +23,7 @@ public class WebSocketProperties {
private String path;
/**
* 设置访问源地址
* 设置访问源地址
*/
private String allowedOrigins;
}

View File

@@ -1,9 +1,8 @@
package org.ruoyi.common.chat.constant;
/**
*
* @author https:www.unfbx.com
* @since 2023-03-06
* @since 2023-03-06
*/
public class OpenAIConst {

View File

@@ -7,7 +7,6 @@ import lombok.Data;
import java.math.BigDecimal;
/**
*
* @author https:www.unfbx.com
* @since 2023-03-18
*/

View File

@@ -7,7 +7,6 @@ import lombok.Data;
import java.util.List;
/**
*
* @author https:www.unfbx.com
* @since 2023-03-18
*/

View File

@@ -4,9 +4,8 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
/**
*
* @author https:www.unfbx.com
* @since 2023-04-08
* @since 2023-04-08
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)

View File

@@ -7,7 +7,7 @@ import lombok.Data;
* 账户信息
*
* @author https:www.unfbx.com
* @since 2023-04-08
* @since 2023-04-08
*/
@Data
public class Subscription {

View File

@@ -12,7 +12,6 @@ import java.io.Serializable;
import java.util.List;
/**
*
* @author https:www.unfbx.com
* @since 1.1.2
* 2023-03-02
@@ -34,6 +33,7 @@ public class BaseMessage implements Serializable {
/**
* The tool calls generated by the model, such as function calls.
*
* @since 1.1.2
*/
@JsonProperty("tool_calls")

View File

@@ -7,7 +7,6 @@ import lombok.Data;
import java.io.Serializable;
/**
*
* @author https:www.unfbx.com
* @since 2023-03-02
*/

View File

@@ -11,7 +11,7 @@ import java.io.Serializable;
import java.util.List;
/**
* chat模型附带图片的参数
* chat模型附带图片的参数
*
* @author https:www.unfbx.com
* @since 1.1.2

View File

@@ -6,7 +6,6 @@ import lombok.*;
import lombok.extern.slf4j.Slf4j;
/**
*
* @author https://www.unfbx.com
* @since 1.1.2
* 2023-11-10

View File

@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import java.util.List;
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class FastGPTAnswerResponse {

View File

@@ -24,8 +24,9 @@ import java.io.Serializable;
* },
* }
* </pre>
*
* @author https:www.unfbx.com
* @since 2023-06-14
* @since 2023-06-14
*/
@Data
@Builder

View File

@@ -8,7 +8,6 @@ import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
/**
*
* @author https://www.unfbx.com
* 2023-11-10
*/

View File

@@ -10,8 +10,6 @@ import java.io.Serializable;
import java.util.List;
/**
*
*
* @author https:www.unfbx.com
* @since 2023-03-02
*/
@@ -24,10 +22,6 @@ public class Message extends BaseMessage implements Serializable {
@JsonProperty("reasoning_content")
private String reasoningContent;
public static Builder builder() {
return new Builder();
}
/**
* 构造函数
*
@@ -57,6 +51,10 @@ public class Message extends BaseMessage implements Serializable {
super.setToolCallId(builder.toolCallId);
}
public static Builder builder() {
return new Builder();
}
public static final class Builder {
private String role;
private String content;

View File

@@ -25,10 +25,6 @@ public class MessagePicture extends BaseMessage implements Serializable {
private List<Content> content;
public static Builder builder() {
return new Builder();
}
/**
* 构造函数
*
@@ -58,6 +54,10 @@ public class MessagePicture extends BaseMessage implements Serializable {
super.setToolCallId(builder.toolCallId);
}
public static Builder builder() {
return new Builder();
}
public static final class Builder {
private String role;
private List<Content> content;

View File

@@ -5,8 +5,9 @@ import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 方法参数类扩展参数可以继承Parameters自己实现
* 方法参数类扩展参数可以继承Parameters自己实现
* 参考:
* <pre>
* {
@@ -21,8 +22,9 @@ import java.util.List;
* "required": ["location"]
* }
* </pre>
*
* @author https:www.unfbx.com
* @since 2023-06-14
* @since 2023-06-14
*/
@Data
@Builder

View File

@@ -7,9 +7,8 @@ import lombok.Data;
import java.io.Serializable;
/**
*
* @author https:www.unfbx.com
* 2023-02-15
* 2023-02-15
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)

View File

@@ -6,10 +6,8 @@ import lombok.Data;
import java.io.Serializable;
/**
*
*
* @author https:www.unfbx.com
* 2023-02-15
* 2023-02-15
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)

View File

@@ -5,11 +5,10 @@ import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
*
*
* @author https:www.unfbx.com
* 2023-02-15
* 2023-02-15
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)

View File

@@ -7,10 +7,8 @@ import lombok.Data;
import java.io.Serializable;
/**
*
*
* @author https:www.unfbx.com
* 2023-02-15
* 2023-02-15
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)

View File

@@ -10,7 +10,7 @@ import java.util.List;
import java.util.Map;
/**
* 问题类
* 问题类
*
* @author https:www.unfbx.com
* 2023-02-11
@@ -101,7 +101,8 @@ public class Completion implements Serializable {
/**
* 获取当前参数的tokens数
* @return token数量
*
* @return token数量
*/
// public long tokens() {
// if (StrUtil.isBlank(this.prompt) || StrUtil.isBlank(this.model)) {

View File

@@ -9,10 +9,10 @@ import org.ruoyi.common.chat.entity.common.Usage;
import java.io.Serializable;
/**
* 答案类
* 答案类
*
* @author https:www.unfbx.com
* 2023-02-11
* 2023-02-11
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)

View File

@@ -7,10 +7,8 @@ import lombok.extern.slf4j.Slf4j;
import java.io.Serializable;
/**
*
*
* @author https:www.unfbx.com
* 2023-02-15
* 2023-02-15
*/
@Getter
@Builder
@@ -35,7 +33,7 @@ public class Edit implements Serializable {
/**
* 使用什么取样温度0到2之间。较高的值(如0.8)将使输出更加随机,而较低的值(如0.2)将使输出更加集中和确定。
*
* <p>
* We generally recommend altering this or but not both.top_p
*/
@Builder.Default
@@ -43,7 +41,7 @@ public class Edit implements Serializable {
/**
* 使用温度采样的替代方法称为核心采样其中模型考虑具有top_p概率质量的令牌的结果。因此0.1 意味着只考虑包含前 10% 概率质量的代币。
*
* <p>
* 我们通常建议更改此设置但不要同时更改两者。temperature
*/
@JsonProperty("top_p")
@@ -90,6 +88,7 @@ public class Edit implements Serializable {
public void setInstruction(String instruction) {
this.instruction = instruction;
}
@Getter
@AllArgsConstructor
public enum Model {

View File

@@ -9,10 +9,8 @@ import org.ruoyi.common.chat.entity.common.Usage;
import java.io.Serializable;
/**
*
*
* @author https:www.unfbx.com
* 2023-02-15
* 2023-02-15
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)

View File

@@ -9,10 +9,8 @@ import java.util.List;
import java.util.Objects;
/**
*
*
* @author https:www.unfbx.com
* 2023-02-15
* 2023-02-15
*/
@Getter
@Slf4j

View File

@@ -8,10 +8,8 @@ import java.io.Serializable;
import java.util.List;
/**
*
*
* @author https:www.unfbx.com
* 2023-02-15
* 2023-02-15
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)

View File

@@ -6,10 +6,8 @@ import lombok.Data;
import java.io.Serializable;
/**
*
*
* @author https:www.unfbx.com
* 2023-02-15
* 2023-02-15
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)

View File

@@ -6,10 +6,8 @@ import lombok.Data;
import java.io.Serializable;
/**
*
*
* @author https:www.unfbx.com
* 2023-02-15
* 2023-02-15
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)

View File

@@ -6,10 +6,8 @@ import lombok.Data;
import java.io.Serializable;
/**
*
*
* @author https:www.unfbx.com
* 2023-02-15
* 2023-02-15
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)

View File

@@ -30,6 +30,7 @@ public class FineTune implements Serializable {
private String validationFile;
/**
* 参考
*
* @see Model
*/
private String model;
@@ -101,7 +102,7 @@ public class FineTune implements Serializable {
}
public void setSuffix(String suffix) {
if(Objects.nonNull(suffix) && !"".equals(suffix) && suffix.length() > 40){
if (Objects.nonNull(suffix) && !"".equals(suffix) && suffix.length() > 40) {
log.error("后缀长度不能大于40");
throw new BaseException(CommonError.PARAM_ERROR.msg());
}

View File

@@ -11,8 +11,6 @@ import lombok.extern.slf4j.Slf4j;
import java.io.Serializable;
/**
*
*
* @author https:www.unfbx.com
* 2023-02-15
*/

View File

@@ -11,10 +11,8 @@ import java.io.Serializable;
import java.util.Objects;
/**
*
*
* @author https:www.unfbx.com
* 2023-02-15
* 2023-02-15
*/
@Getter
@Slf4j
@@ -48,11 +46,11 @@ public class ImageEdit implements Serializable {
private String user;
public ImageEdit setN(Integer n) {
if(n < 1){
if (n < 1) {
log.warn("n最小值1");
n = 1;
}
if(n > 10){
if (n > 10) {
log.warn("n最大值10");
n = 10;
}
@@ -61,11 +59,11 @@ public class ImageEdit implements Serializable {
}
public ImageEdit setPrompt(String prompt) {
if(Objects.isNull(prompt) || "".equals(prompt)){
if (Objects.isNull(prompt) || "".equals(prompt)) {
log.error("参数异常");
throw new BaseException(CommonError.PARAM_ERROR.msg());
}
if(prompt.length() > 1000){
if (prompt.length() > 1000) {
log.error("长度超过1000");
throw new BaseException(CommonError.PARAM_ERROR.msg());
}
@@ -74,7 +72,7 @@ public class ImageEdit implements Serializable {
}
public ImageEdit setSize(SizeEnum size) {
if(Objects.isNull(size)){
if (Objects.isNull(size)) {
size = SizeEnum.size_512;
}
this.size = size.getName();
@@ -82,7 +80,7 @@ public class ImageEdit implements Serializable {
}
public ImageEdit setResponseFormat(ResponseFormat responseFormat) {
if(Objects.isNull(responseFormat)){
if (Objects.isNull(responseFormat)) {
responseFormat = ResponseFormat.URL;
}
this.responseFormat = responseFormat.getName();

View File

@@ -7,10 +7,8 @@ import java.io.Serializable;
import java.util.List;
/**
*
*
* @author https:www.unfbx.com
* 2023-02-15
* 2023-02-15
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)

View File

@@ -12,10 +12,8 @@ import java.io.Serializable;
import java.util.Objects;
/**
*
*
* @author https:www.unfbx.com
* 2023-02-15
* 2023-02-15
*/
@Getter
@Slf4j

View File

@@ -7,10 +7,8 @@ import lombok.Data;
import java.io.Serializable;
/**
*
*
* @author https:www.unfbx.com
* 2023-02-15
* 2023-02-15
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)

View File

@@ -6,10 +6,8 @@ import lombok.Getter;
import java.io.Serializable;
/**
*
*
* @author https:www.unfbx.com
* 2023-02-15
* 2023-02-15
*/
@AllArgsConstructor
@Getter

View File

@@ -6,10 +6,8 @@ import lombok.Getter;
import java.io.Serializable;
/**
*
*
* @author https:www.unfbx.com
* 2023-02-15
* 2023-02-15
*/
@Getter
@AllArgsConstructor

View File

@@ -1,4 +1,5 @@
package org.ruoyi.common.chat.entity.models;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
@@ -13,8 +14,8 @@ public class LocalModelsSearchResponse {
private List<List<List<Double>>> topKEmbeddings; // 处理三层嵌套数组
// 默认构造函数
public LocalModelsSearchResponse() {}
public LocalModelsSearchResponse() {
}
}

View File

@@ -8,10 +8,8 @@ import java.io.Serializable;
import java.util.List;
/**
*
*
* @author https:www.unfbx.com
* 2023-02-15
* 2023-02-15
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)

View File

@@ -7,10 +7,8 @@ import java.io.Serializable;
import java.util.List;
/**
*
*
* @author https:www.unfbx.com
* 2023-02-15
* 2023-02-15
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)

View File

@@ -7,8 +7,6 @@ import lombok.Data;
import java.io.Serializable;
/**
*
*
* @author https:www.unfbx.com
* 2023-02-15
*/

View File

@@ -7,10 +7,8 @@ import lombok.Data;
import java.io.Serializable;
/**
*
*
* @author https:www.unfbx.com
* 2023-02-15
* 2023-02-15
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)

View File

@@ -8,10 +8,8 @@ import java.io.Serializable;
import java.math.BigDecimal;
/**
*
*
* @author https:www.unfbx.com
* 2023-02-15
* 2023-02-15
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)

View File

@@ -10,10 +10,10 @@ import java.util.List;
import java.util.Objects;
/**
* 文本审核,敏感词鉴别
* 文本审核,敏感词鉴别
*
* @author https:www.unfbx.com
* 2023-02-15
* 2023-02-15
*/
@Getter
@Builder

View File

@@ -7,10 +7,8 @@ import java.io.Serializable;
import java.util.List;
/**
*
*
* @author https:www.unfbx.com
* 2023-02-15
* 2023-02-15
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)

View File

@@ -7,10 +7,8 @@ import lombok.Data;
import java.io.Serializable;
/**
*
*
* @author https:www.unfbx.com
* 2023-02-15
* 2023-02-15
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)

View File

@@ -7,7 +7,7 @@ import lombok.Getter;
import java.io.Serializable;
/**
* 语音转文字
* 语音转文字
*
* @author https:www.unfbx.com
* @since 2023-03-02

View File

@@ -6,8 +6,6 @@ import lombok.Data;
import java.io.Serializable;
/**
*
*
* @author https:www.unfbx.com
* @since 2023-03-02
*/

View File

@@ -47,7 +47,7 @@ public class PlusWebSocketHandler extends AbstractWebSocketHandler {
if (StrUtil.isNotBlank(messageContext)) {
messages = JSONUtil.toList(messageContext, Message.class);
// 上下文长度
int contextSize=10;
int contextSize = 10;
if (messages.size() >= contextSize) {
messages = messages.subList(1, contextSize);
}
@@ -58,13 +58,13 @@ public class PlusWebSocketHandler extends AbstractWebSocketHandler {
messages.add(currentMessage);
}
ChatCompletion chatCompletion = ChatCompletion
.builder()
.model("gpt-4o-mini")
.messages(messages)
.temperature(0.2)
.stream(true)
.build();
OpenAiStreamClient openAiStreamClient=(OpenAiStreamClient) SpringUtils.context().getBean("openAiStreamClient");
.builder()
.model("gpt-4o-mini")
.messages(messages)
.temperature(0.2)
.stream(true)
.build();
OpenAiStreamClient openAiStreamClient = (OpenAiStreamClient) SpringUtils.context().getBean("openAiStreamClient");
openAiStreamClient.streamChatCompletion(chatCompletion, eventSourceListener);
LocalCache.CACHE.put(session.getId(), JSONUtil.toJsonStr(messages), LocalCache.TIMEOUT);
}

View File

@@ -14,7 +14,7 @@ import org.springframework.web.socket.WebSocketSession;
import java.util.Objects;
/**
* OpenAI流式输出Socket接收
* OpenAI流式输出Socket接收
*
* @author https:www.unfbx.com
* @date 2023-03-23
@@ -22,12 +22,11 @@ import java.util.Objects;
@Slf4j
public class WebSocketEventListener extends EventSourceListener {
private WebSocketSession session;
/**
* 消息结束标识
*/
private final String msgEnd = "[DONE]";
private WebSocketSession session;
public WebSocketEventListener(WebSocketSession session) {
this.session = session;
@@ -59,8 +58,8 @@ public class WebSocketEventListener extends EventSourceListener {
String delta = "";
try {
delta = mapper.writeValueAsString(completionResponse.getChoices().get(0).getDelta());
}catch (Exception e){
log.error("转换失败{}",e.getMessage());
} catch (Exception e) {
log.error("转换失败{}", e.getMessage());
}
session.sendMessage(new TextMessage(delta));
}

View File

@@ -40,7 +40,7 @@ import java.time.LocalDate;
import java.util.Map;
/**
* open ai官方api接口
* open ai官方api接口
*
* @author https:www.unfbx.com
* 2023-02-15
@@ -58,7 +58,7 @@ public interface OpenAiApi {
/**
* models 返回的数据id
*
* @param id 模型主键
* @param id 模型主键
* @return Single Model
*/
@GET("v1/models/{id}")
@@ -317,7 +317,7 @@ public interface OpenAiApi {
/**
* 账户信息查询:里面包含总金额(美元)等信息
*
* @return 账户信息
* @return 账户信息
*/
@GET("v1/dashboard/billing/subscription")
Single<Subscription> subscription();

View File

@@ -56,7 +56,7 @@ import java.util.concurrent.TimeUnit;
/**
* open ai 客户端
* open ai 客户端
*
* @author https:www.unfbx.com
* @since 2023-02-11
@@ -100,15 +100,6 @@ public class OpenAiClient {
@Getter
private OpenAiAuthInterceptor authInterceptor;
/**
* 构造器
*
* @return OpenAiClient.Builder
*/
public static Builder builder() {
return new Builder();
}
/**
* 构造
*
@@ -156,6 +147,14 @@ public class OpenAiClient {
.build().create(OpenAiApi.class);
}
/**
* 构造器
*
* @return OpenAiClient.Builder
*/
public static Builder builder() {
return new Builder();
}
/**
* 创建默认OkHttpClient
@@ -681,7 +680,7 @@ public class OpenAiClient {
RequestBody fileBody = RequestBody.create(MediaType.parse("multipart/form-data"), file);
MultipartBody.Part multipartBody = MultipartBody.Part.createFormData("file", file.getName(), fileBody);
//自定义参数
Map<String, RequestBody> requestBodyMap = new HashMap<>(5,1L);
Map<String, RequestBody> requestBodyMap = new HashMap<>(5, 1L);
if (StrUtil.isNotBlank(translations.getModel())) {
requestBodyMap.put(Translations.Fields.model, RequestBody.create(MediaType.parse("multipart/form-data"), translations.getModel()));
@@ -812,6 +811,7 @@ public class OpenAiClient {
Single<Subscription> subscription = this.openAiApi.subscription();
return subscription.blockingGet();
}
/**
* 账户调用接口消耗金额信息查询
* 最多查询100天
@@ -833,7 +833,6 @@ public class OpenAiClient {
private @NotNull List<String> apiKey;
/**
* api请求地址结尾处有斜杠
*
*/
private String apiHost;
/**

View File

@@ -52,7 +52,7 @@ import java.util.*;
import java.util.concurrent.TimeUnit;
/**
* open ai 客户端
* open ai 客户端
*
* @author https:www.unfbx.com
* 2023-02-28
@@ -63,31 +63,27 @@ import java.util.concurrent.TimeUnit;
@Setter
public class OpenAiStreamClient {
private static final String DONE_SIGNAL = "[DONE]";
@NotNull
private List<String> apiKey;
/**
* 自定义api host使用builder的方式构造client
*/
private String apiHost;
/**
* 自定义url 兼容多个平台
*/
private String apiUrl;
/**
* 自定义的okHttpClient
* 如果不自定义 就是用sdk默认的OkHttpClient实例
*/
private OkHttpClient okHttpClient;
/**
* api key的获取策略
*/
private KeyStrategyFunction<List<String>, String> keyStrategy;
private OpenAiApi openAiApi;
/**
* 自定义鉴权处理拦截器<br/>
* 可以不设置默认实现DefaultOpenAiAuthInterceptor <br/>
@@ -98,8 +94,6 @@ public class OpenAiStreamClient {
*/
private OpenAiAuthInterceptor authInterceptor;
private static final String DONE_SIGNAL = "[DONE]";
/**
* 构造实例对象
*
@@ -139,9 +133,9 @@ public class OpenAiStreamClient {
} else {
//自定义的okhttpClient 需要增加api keys
builder.okHttpClient = builder.okHttpClient
.newBuilder()
.addInterceptor(authInterceptor)
.build();
.newBuilder()
.addInterceptor(authInterceptor)
.build();
}
okHttpClient = builder.okHttpClient;
if (apiHost.endsWith("/")) {
@@ -155,6 +149,15 @@ public class OpenAiStreamClient {
}
/**
* 构造
*
* @return Builder
*/
public static Builder builder() {
return new Builder();
}
/**
* 创建默认的OkHttpClient
*/
@@ -165,16 +168,15 @@ public class OpenAiStreamClient {
this.authInterceptor.setApiKey(this.apiKey);
this.authInterceptor.setKeyStrategy(this.keyStrategy);
OkHttpClient okHttpClient = new OkHttpClient
.Builder()
.addInterceptor(this.authInterceptor)
.connectTimeout(10, TimeUnit.SECONDS)
.writeTimeout(50, TimeUnit.SECONDS)
.readTimeout(50, TimeUnit.SECONDS)
.build();
.Builder()
.addInterceptor(this.authInterceptor)
.connectTimeout(10, TimeUnit.SECONDS)
.writeTimeout(50, TimeUnit.SECONDS)
.readTimeout(50, TimeUnit.SECONDS)
.build();
return okHttpClient;
}
/**
* 流式输出最新版的GPT-3.5 chat completion 更加贴近官方网站的问答模型
*
@@ -191,9 +193,9 @@ public class OpenAiStreamClient {
ObjectMapper mapper = new ObjectMapper();
String requestBody = mapper.writeValueAsString(chatCompletion);
Request request = new Request.Builder()
.url(this.apiHost)
.post(RequestBody.create(MediaType.parse(ContentType.JSON.getValue()), requestBody))
.build();
.url(this.apiHost)
.post(RequestBody.create(MediaType.parse(ContentType.JSON.getValue()), requestBody))
.build();
factory.newEventSource(request, eventSourceListener);
} catch (Exception e) {
log.error("请求参数解析异常:{}", e.getMessage());
@@ -238,7 +240,6 @@ public class OpenAiStreamClient {
this.streamChatCompletion(chatCompletion, pluginEventSourceListener);
}
/**
* 插件问答简易版
* 默认取messages最后一个元素构建插件对话
@@ -255,7 +256,6 @@ public class OpenAiStreamClient {
this.streamChatCompletionWithPlugin(chatCompletion, eventSourceListener, pluginEventSourceListener, plugin);
}
/**
* 插件问答简易版
* 默认取messages最后一个元素构建插件对话
@@ -287,7 +287,6 @@ public class OpenAiStreamClient {
this.streamChatCompletionWithPlugin(chatCompletion, eventSourceListener, plugin);
}
/**
* 根据描述生成图片
*
@@ -457,6 +456,7 @@ public class OpenAiStreamClient {
Transcriptions transcriptions = Transcriptions.builder().build();
return this.speechToTextTranscriptions(file, transcriptions);
}
/**
* 文本转语音(异步)
*
@@ -475,12 +475,12 @@ public class OpenAiStreamClient {
* @param textToSpeech 参数
* @since 1.1.3
*/
public ResponseBody textToSpeech(TextToSpeech textToSpeech){
public ResponseBody textToSpeech(TextToSpeech textToSpeech) {
try {
Call<ResponseBody> responseBody = this.openAiApi.textToSpeech(textToSpeech);
return responseBody.execute().body();
} catch (IOException e) {
throw new BaseException("文本转语音(同步)失败: "+e.getMessage());
throw new BaseException("文本转语音(同步)失败: " + e.getMessage());
}
}
@@ -508,13 +508,13 @@ public class OpenAiStreamClient {
// 创建请求对象
Request request = new Request.Builder()
.url(url)
.build();
.url(url)
.build();
// 发送请求并处理响应
try {
return client.newCall(request).execute().body();
} catch (IOException e) {
throw new BaseException("语音克隆失败!{}",e.getMessage());
throw new BaseException("语音克隆失败!{}", e.getMessage());
}
}
@@ -602,16 +602,6 @@ public class OpenAiStreamClient {
return this.chatCompletionWithPlugin(chatCompletion, plugin);
}
/**
* 构造
*
* @return Builder
*/
public static Builder builder() {
return new Builder();
}
public static final class Builder {
private @NotNull List<String> apiKey;
/**

View File

@@ -6,27 +6,27 @@ import java.io.IOException;
public class TestOpenAIAPI {
private final OkHttpClient client = new OkHttpClient();
private static final String API_KEY = "sk-Waea254YSRYVg4FZVCz2CDz73B22xRpmKpJ41kbczVgpPxvg";
private static final String URL = "https://api.gptgod.online/v1/chat/completions";
public void getChatGptResponse(String prompt) throws IOException {
RequestBody body = RequestBody.create(MediaType.get("application/json; charset=utf-8"),
"{\"model\": \"gpt-3.5-turbo\", \"messages\": [{\"role\": \"system\", \"content\": \"You are a helpful assistant.\"}, {\"role\": \"user\", \"content\": \"" + prompt + "\"}]}");
Request request = new Request.Builder()
.url(URL)
.post(body)
.addHeader("Authorization", "Bearer " + API_KEY)
.build();
try (Response response = client.newCall(request).execute()) {
}
}
private final OkHttpClient client = new OkHttpClient();
public static void main(String[] args) throws IOException {
TestOpenAIAPI api = new TestOpenAIAPI();
api.getChatGptResponse("Hello, how are you?");
}
public void getChatGptResponse(String prompt) throws IOException {
RequestBody body = RequestBody.create(MediaType.get("application/json; charset=utf-8"),
"{\"model\": \"gpt-3.5-turbo\", \"messages\": [{\"role\": \"system\", \"content\": \"You are a helpful assistant.\"}, {\"role\": \"user\", \"content\": \"" + prompt + "\"}]}");
Request request = new Request.Builder()
.url(URL)
.post(body)
.addHeader("Authorization", "Bearer " + API_KEY)
.build();
try (Response response = client.newCall(request).execute()) {
}
}
}

View File

@@ -1,10 +1,10 @@
package org.ruoyi.common.chat.openai.exception;
/**
* 错误
* 错误
*
* @author https:www.unfbx.com
* 2023-02-11
* 2023-02-11
*/
public enum CommonError implements IError {
MESSAGE_NOT_NUL(500, "Message 不能为空"),
@@ -15,7 +15,7 @@ public enum CommonError implements IError {
RETRY_ERROR(502, "请求异常,请重试~"),
//官方的错误码列表https://platform.openai.com/docs/guides/error-codes/api-errors
OPENAI_AUTHENTICATION_ERROR(401, "身份验证无效/提供的 API 密钥不正确/您必须是组织的成员才能使用 API"),
OPENAI_LIMIT_ERROR(429 , "达到请求的速率限制/您超出了当前配额,请检查您的计划和帐单详细信息/发动机当前过载,请稍后重试"),
OPENAI_LIMIT_ERROR(429, "达到请求的速率限制/您超出了当前配额,请检查您的计划和帐单详细信息/发动机当前过载,请稍后重试"),
OPENAI_SERVER_ERROR(500, "服务器在处理您的请求时出错"),
;

View File

@@ -1,9 +1,8 @@
package org.ruoyi.common.chat.openai.exception;
/**
*
*
* @author https:www.unfbx.com
* 2023-02-11
* 2023-02-11
*/
public interface IError {
String msg();

View File

@@ -5,7 +5,7 @@ import cn.hutool.core.util.RandomUtil;
import java.util.List;
/**
* 随机策略
* 随机策略
*
* @author https:www.unfbx.com
* @since 2023-04-03

View File

@@ -3,11 +3,11 @@ package org.ruoyi.common.chat.openai.function;
import java.util.function.Function;
/**
* key 的获取策略
* key 的获取策略
* jdk默认实现
* @see Function
*
* @author https:www.unfbx.com
* @see Function
* @since 2023-04-03
*/
@FunctionalInterface

View File

@@ -9,7 +9,7 @@ import java.util.List;
import java.util.Map;
/**
* 请求增加header apikey
* 请求增加header apikey
*
* @author https:www.unfbx.com
* @since 2023-03-23

View File

@@ -16,7 +16,7 @@ import java.util.Objects;
import java.util.stream.Collectors;
/**
* 动态处理key的鉴权拦截器
* 动态处理key的鉴权拦截器
*
* @author https:www.unfbx.com
* @since 2023-04-25
@@ -35,7 +35,6 @@ public class DynamicKeyOpenAiAuthInterceptor extends OpenAiAuthInterceptor {
/**
* 请求头处理
*
*/
public DynamicKeyOpenAiAuthInterceptor() {
this.setWarringConfig(null);

View File

@@ -4,7 +4,7 @@ import lombok.extern.slf4j.Slf4j;
import okhttp3.logging.HttpLoggingInterceptor;
/**
* 日志
* 日志
*
* @author https:www.unfbx.com
* 2023-02-28

View File

@@ -13,10 +13,10 @@ import java.io.IOException;
import java.util.Objects;
/**
* openai 返回值处理Interceptor
* openai 返回值处理Interceptor
*
* @author https:www.unfbx.com
* @since 2023-03-23
* @since 2023-03-23
*/
@Slf4j
public class OpenAiResponseInterceptor implements Interceptor {

View File

@@ -69,6 +69,10 @@ public abstract class PluginAbstract<R extends PluginParam, T> {
setParameters();
}
public abstract T func(R args);
public abstract String content(T t);
@Data
public static class Arg {
private String name;
@@ -81,8 +85,4 @@ public abstract class PluginAbstract<R extends PluginParam, T> {
@JsonIgnore
private boolean required;
}
public abstract T func(R args);
public abstract String content(T t);
}

View File

@@ -7,7 +7,7 @@ import org.ruoyi.common.chat.entity.chat.Message;
import java.util.List;
/**
* 对话请求对象
* 对话请求对象
*
* @author ageerle
* @sine 2023-04-08
@@ -26,11 +26,18 @@ public class ChatRequest {
*/
private String prompt;
/**
* 系统提示词
*/
private String sysPrompt;
/**
* 消息id
*/
private Long messageId;
/**
* 是否开启流式对话
*/
@@ -72,6 +79,11 @@ public class ChatRequest {
*/
private Boolean hasAttachment;
/**
* 是否启用深度思考
*/
private Boolean enableThinking;
/**
* 是否自动切换模型
*/
@@ -82,9 +94,4 @@ public class ChatRequest {
*/
private String token;
/**
* 消息ID保存消息成功后设置用于后续扣费更新
*/
private Long messageId;
}

View File

@@ -4,8 +4,6 @@ import jakarta.validation.constraints.NotEmpty;
import lombok.Data;
/**
*
*
* @author https:www.unfbx.com
* @sine 2023-04-08
*/
@@ -18,15 +16,21 @@ public class Dall3Request {
@NotEmpty(message = "提示词不能为空")
private String prompt;
/** 图片大小 */
/**
* 图片大小
*/
@NotEmpty(message = "图片大小不能为空")
private String size ;
private String size;
/** 图片质量 */
/**
* 图片质量
*/
@NotEmpty(message = "图片质量不能为空")
private String quality;
/** 图片风格 */
/**
* 图片风格
*/
@NotEmpty(message = "图片风格不能为空")
private String style;

View File

@@ -10,7 +10,7 @@ import okhttp3.sse.EventSourceListener;
import java.util.Objects;
/**
* sse
* sse
*
* @author https:www.unfbx.com
* 2023-02-28
@@ -39,7 +39,7 @@ public class ConsoleEventSourceListener extends EventSourceListener {
@SneakyThrows
@Override
public void onFailure(EventSource eventSource, Throwable t, Response response) {
if(Objects.isNull(response)){
if (Objects.isNull(response)) {
log.error("OpenAI sse连接异常:{}", t);
eventSource.cancel();
return;

View File

@@ -7,7 +7,7 @@ import org.ruoyi.common.chat.openai.OpenAiStreamClient;
import org.ruoyi.common.chat.openai.plugin.PluginAbstract;
/**
* 插件开发返回信息收集sse监听器
* 插件开发返回信息收集sse监听器
*
* @author https:www.unfbx.com
* 2023-08-18

View File

@@ -19,7 +19,7 @@ import org.ruoyi.common.chat.openai.plugin.PluginParam;
import java.util.Objects;
/**
* 插件开发返回信息收集sse监听器
* 插件开发返回信息收集sse监听器
*
* @author https:www.unfbx.com
* 2023-08-18
@@ -30,21 +30,10 @@ public abstract class PluginListener<R extends PluginParam, T> extends EventSour
* openAi插件构建的参数
*/
private String arguments = "";
/**
* 获取openAi插件构建的参数
*
* @return arguments
*/
private String getArguments() {
return this.arguments;
}
private OpenAiStreamClient client;
private EventSourceListener eventSourceListener;
private PluginAbstract<R, T> plugin;
private ChatCompletion chatCompletion;
/**
* 构造方法必备四个元素
*
@@ -60,6 +49,15 @@ public abstract class PluginListener<R extends PluginParam, T> extends EventSour
this.chatCompletion = chatCompletion;
}
/**
* 获取openAi插件构建的参数
*
* @return arguments
*/
private String getArguments() {
return this.arguments;
}
/**
* sse关闭后处理第二次请求方法
*/

View File

@@ -15,7 +15,7 @@ import org.ruoyi.common.chat.entity.chat.Message;
import java.util.*;
/**
* token计算工具类
* token计算工具类
*
* @author https:www.unfbx.com
* @since 2023-04-04
@@ -152,7 +152,7 @@ public class TikTokensUtil {
}
Encoding enc = getEncoding(modelName);
if (Objects.isNull(enc)) {
log.warn("[{}]模型不存在或者暂不支持计算tokens直接返回tokens==0",modelName);
log.warn("[{}]模型不存在或者暂不支持计算tokens直接返回tokens==0", modelName);
return new ArrayList<>();
}
return enc.encode(text);
@@ -184,25 +184,25 @@ public class TikTokensUtil {
int tokensPerMessage = 0;
int tokensPerName = 0;
if (modelName.equals(ChatCompletion.Model.GPT_3_5_TURBO_0613.getName())
|| modelName.equals(ChatCompletion.Model.GPT_3_5_TURBO_16K_0613.getName())
|| modelName.equals(ChatCompletion.Model.GPT_4_0613.getName())
|| modelName.equals(ChatCompletion.Model.GPT_4_32K_0613.getName())
|| modelName.equals(ChatCompletion.Model.GPT_4_1106_PREVIEW.getName())
|| modelName.equals(ChatCompletion.Model.GPT_4_VISION_PREVIEW.getName())
|| modelName.equals(ChatCompletion.Model.GPT_3_5_TURBO_16K_0613.getName())
|| modelName.equals(ChatCompletion.Model.GPT_4_0613.getName())
|| modelName.equals(ChatCompletion.Model.GPT_4_32K_0613.getName())
|| modelName.equals(ChatCompletion.Model.GPT_4_1106_PREVIEW.getName())
|| modelName.equals(ChatCompletion.Model.GPT_4_VISION_PREVIEW.getName())
) {
tokensPerMessage = 3;
tokensPerName = 1;
}else if(modelName.contains(ChatCompletion.Model.GPT_3_5_TURBO.getName())){
} else if (modelName.contains(ChatCompletion.Model.GPT_3_5_TURBO.getName())) {
//"gpt-3.5-turbo" in model:
log.warn("Warning: gpt-3.5-turbo may update over time. Returning num tokens assuming gpt-3.5-turbo-0613.");
tokensPerMessage = 3;
tokensPerName = 1;
}else if(modelName.contains(ChatCompletion.Model.GPT_4.getName())){
} else if (modelName.contains(ChatCompletion.Model.GPT_4.getName())) {
log.warn("Warning: gpt-4 may update over time. Returning num tokens assuming gpt-4-0613.");
tokensPerMessage = 3;
tokensPerName = 1;
}else {
log.warn("不支持的model {} 按gpt4计算tokens",modelName);
} else {
log.warn("不支持的model {} 按gpt4计算tokens", modelName);
tokensPerMessage = 3;
tokensPerName = 1;
}

View File

@@ -70,7 +70,7 @@ public class WebSocketUtils {
broadcastMessage.setSessionKeys(unsentSessionKeys);
RedisUtils.publish(WEB_SOCKET_TOPIC, broadcastMessage, consumer -> {
log.info(" WebSocket发送主题订阅消息topic:{} session keys:{} message:{}",
WEB_SOCKET_TOPIC, unsentSessionKeys, webSocketMessage.getMessage());
WEB_SOCKET_TOPIC, unsentSessionKeys, webSocketMessage.getMessage());
});
}
}

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.ruoyi</groupId>

View File

@@ -43,7 +43,7 @@ public class AsyncConfig implements AsyncConfigurer {
throwable.printStackTrace();
StringBuilder sb = new StringBuilder();
sb.append("Exception message - ").append(throwable.getMessage())
.append(", Method name - ").append(method.getName());
.append(", Method name - ").append(method.getName());
if (ArrayUtil.isNotEmpty(objects)) {
sb.append(", Parameter value - ").append(Arrays.toString(objects));
}

View File

@@ -16,31 +16,27 @@ import org.springframework.stereotype.Component;
@ConfigurationProperties(prefix = "ruoyi")
public class RuoYiConfig {
/**
* 项目名称
*/
private String name;
/**
* 版本
*/
private String version;
/**
* 版权年份
*/
private String copyrightYear;
/**
* 实例演示开关
*/
private boolean demoEnabled;
/**
* 获取地址开关
*/
@Getter
private static boolean addressEnabled;
/**
* 项目名称
*/
private String name;
/**
* 版本
*/
private String version;
/**
* 版权年份
*/
private String copyrightYear;
/**
* 实例演示开关
*/
private boolean demoEnabled;
public void setAddressEnabled(boolean addressEnabled) {
RuoYiConfig.addressEnabled = addressEnabled;

View File

@@ -48,8 +48,8 @@ public class ThreadPoolConfig {
public ScheduledExecutorService scheduledExecutorService() {
log.info("====创建定时任务线程池====");
return new ScheduledThreadPoolExecutor(core,
new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build(),
new ThreadPoolExecutor.CallerRunsPolicy()) {
new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build(),
new ThreadPoolExecutor.CallerRunsPolicy()) {
@Override
protected void afterExecute(Runnable r, Throwable t) {
super.afterExecute(r, t);

View File

@@ -0,0 +1,62 @@
package org.ruoyi.common.core.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* 向量库配置属性
*
* @author ageer
*/
@Data
@Component
@ConfigurationProperties(prefix = "vector-store")
public class VectorStoreProperties {
/**
* 向量库类型
*/
private String type;
/**
* Weaviate配置
*/
private Weaviate weaviate = new Weaviate();
/**
* Milvus配置
*/
private Milvus milvus = new Milvus();
@Data
public static class Weaviate {
/**
* 协议
*/
private String protocol;
/**
* 主机地址
*/
private String host;
/**
* 类名
*/
private String classname;
}
@Data
public static class Milvus {
/**
* 连接URL
*/
private String url;
/**
* 集合名称
*/
private String collectionname;
}
}

Some files were not shown because too many files have changed in this diff Show More