567 Commits
v2.0.1 ... main

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
ageerle
fdddec2f14 Merge pull request #219 from seven-ocean/feature/aihuman
Feature/aihuman
2025-10-10 12:41:19 +08:00
ageerle
57e23be82f Merge branch 'main' into feature/aihuman 2025-10-10 12:41:10 +08:00
ageerle
89f4976b7c Merge pull request #220 from seven-ocean/feature/aihuamn
Feature/aihuamn
2025-10-10 12:39:03 +08:00
Maxchen
a0d93b1ca8 Merge remote-tracking branch 'origin/feature/aihuman' into feature/aihuman 2025-10-10 12:23:55 +08:00
Maxchen
ca8ba6fe48 Merge remote-tracking branch 'origin/feature/aihuman' into feature/aihuman
# Conflicts:
#	script/sql/update/2025-10-10-实时交互数字人集成.sql
2025-10-10 12:23:41 +08:00
Maxchen
7994704c11 Merge remote-tracking branch 'origin/feature/aihuman' into feature/aihuman
# Conflicts:
#	script/sql/update/2025-10-10-实时交互数字人集成.sql
2025-10-10 12:09:17 +08:00
Maxchen
8d4fadc9a2 修改了sql文件 2025-10-10 12:06:10 +08:00
Maxchen
bd8dccf7b2 提交 菜单+字典+字典编码 sql 2025-10-10 12:00:17 +08:00
Maxchen
584cead6bf 提交 pom.xml 模块修改 2025-10-10 11:53:51 +08:00
Maxchen
a52529eefd 编码统一为utf8mb4_general_ci 2025-10-10 11:32:54 +08:00
ageerle
6e433237e0 Merge pull request #218 from seven-ocean/feature/aihuamn
修改了sql文件
2025-10-10 11:23:06 +08:00
Maxchen
abd4f01b69 修改了sql文件 2025-10-10 11:16:42 +08:00
Maxchen
5c430ee1d2 修改了sql文件 2025-10-10 11:10:33 +08:00
ageerle
e23e295d68 Merge pull request #217 from seven-ocean/feature/aihuman
添加数字人菜单sql,建表语句sql
2025-10-10 11:06:38 +08:00
Maxchen
3d6bbad616 添加数字人菜sql,建表语句sql 2025-10-10 11:03:39 +08:00
ageerle
5088c0e6d7 Merge pull request #216 from fangzhh/main
feat: 优化嵌入模型业务,使用策略模型加工厂模式动态加载嵌入模型,支持多供应商多嵌入模型动态接入;
2025-10-09 20:11:40 +08:00
Ariel Overcast
2995b6ddde Merge branch 'ageerle:main' into main 2025-10-09 20:04:50 +08:00
Robust_H
5475776caa feat: 优化通过知识库获取模型配置逻辑,修改为通过模型id查找模型配置,避免多供应商同模型映射错误。 2025-10-09 20:03:34 +08:00
ageerle
08d4977263 Merge pull request #215 from seven-ocean/feature/aihuman
数字人后端
2025-10-09 19:55:09 +08:00
Maxchen
31602cb85e 数字人后端 2025-10-09 18:53:28 +08:00
ageerle
5adc5f0006 Update README.md 2025-10-09 17:40:29 +08:00
ageerle
307d095cf1 Update README.md 2025-10-09 17:38:20 +08:00
Robust_H
2cef4e17dc perf: 优化‘嵌入模型’工厂,添加缓存机制 2025-10-04 18:27:54 +08:00
Robust_H
b47da3f438 feat: 初始化多供应商多嵌入模型集成,采用策略模式和工厂模式实现 2025-10-04 04:50:12 +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
evo
827ac48826 Merge pull request #200 from 20suiWXJB/fix/在-ruoyi-extend-中添加缺失的-ruoyi-ai-copilot-模块
fix(pom): 在 ruoyi-extend 中添加缺失的 ruoyi-ai-copilot 模块
2025-09-27 19:11:32 +08:00
evo
f906645708 Merge pull request #198 from wenxwang/fix/admin-knowledge-remove-error
fix(Knowledge): 知识库删除失败
2025-09-27 19:08:17 +08:00
evo
c17e16dd0f Merge pull request #181 from LM20230311/feat-model-priority
解决问答实现类中重新查询模型逻辑可能导致自动选择的模型被重置问题
2025-09-27 19:07:34 +08:00
evo
837236f1cc Merge pull request #180 from LM20230311/fix-upload-bucket
Fix upload bucket: 修复问答页面文件上传问题;
2025-09-27 19:07:15 +08:00
evo
60793b957a Merge pull request #179 from violateer/featur/remove_limit1_compat
feature: 移除limit 1写法,兼容不同数据库
2025-09-27 19:06:48 +08:00
evo
fa4dc87e76 Merge pull request #212 from MuSan-Li/feature_20250927_fix_oss_logic
feat: 删除oss创建桶配置
2025-09-27 19:06:14 +08:00
evo
4ac63c3268 feat: 删除oss创建桶配置 2025-09-27 19:05:27 +08:00
evo
54e7999fe3 Merge pull request #210 from MuSan-Li/feature_20250926_add_swagger
feat: 添加接口文档测试
2025-09-26 15:07:22 +08:00
lihao05
32fd910584 feat: 添加接口文档测试 2025-09-26 15:06:43 +08:00
evo
25e659dffa Merge pull request #208 from LM20230311/upgrade/upgrade-spring-ai-1.0.0
Upgrade/upgrade spring ai 1.0.0
2025-09-26 13:59:49 +08:00
Yzm
aa1c771e72 feat(knowledge): 实现向量库策略模式支持多向量库
- 新增向量库策略接口及抽象基类
- 实现Weaviate向量库策略- 实现Milvus向量库策略(占位实现)
- 添加向量库策略工厂类动态选择实现
- 修改向量存储服务使用策略模式
- 更新知识信息service调用参数顺序
- 添加文档分段和知识片段ID生成注释
- 修改dev环境数据库配置为github版本
2025-09-25 18:44:19 +08:00
LM20230311
585e5ff0f8 fix: 解决knife4j访问问题-暂未解决; 2025-09-24 20:47:22 +08:00
LM20230311
bd346f1e85 fix: 解决不登陆无法问答问题;修复余额不足后流不关闭问题; 2025-09-24 20:27:55 +08:00
LM20230311
2caf9a47ed upgrade: 放行knife4j需要的路径; 2025-09-24 19:28:34 +08:00
LM20230311
f10f44158c upgrade: 升级knife4j版本为3,4.5.0; 2025-09-24 19:01:33 +08:00
ageerle
76acd4a40b Update README.md 2025-09-24 17:32:19 +08:00
ageerle
6467af1d73 Update README.md 2025-09-24 17:31:44 +08:00
ageerle
35146f3495 Update README.md 2025-09-24 17:31:00 +08:00
likunlong
9e23587fb1 upgrade: 升级spring ai版本为正式1.0.0; 2025-09-24 10:08:51 +08:00
evo
a61bd57e22 Merge pull request #206 from MuSan-Li/feature_20250923_fix_wx_logic
feat:修复缺少的微信逻辑部分
2025-09-23 13:58:38 +08:00
lihao05
6bb7bc6eb5 feat:修复缺少的微信逻辑部分 2025-09-23 13:57:18 +08:00
ageerle
3f9e83a767 Merge pull request #204 from Cyclones-Y/main
feat(wechat): 添加企业微信SDK依赖引入weixin-java-cp4.4.0版本以支持企业微信功能开发
2025-09-21 16:08:12 +08:00
Yzm
0d711b1842 feat(wechat): 添加企业微信SDK依赖引入weixin-java-cp4.4.0版本以支持企业微信功能开发 2025-09-21 15:39:06 +08:00
ageerle
a33159f9a3 移除不必要配置 2025-09-19 14:53:35 +08:00
ageerle
6462752fd6 恢复微信模块,优化知识库切片功能 2025-09-19 14:50:02 +08:00
ageerle
afc1272ff5 恢复微信模块,优化知识库切片功能 2025-09-19 11:15:37 +08:00
ageerle
fa5dc80a93 Merge remote-tracking branch 'origin/mineru/dev'
# Conflicts:
#	ruoyi-admin/src/main/resources/application-dev.yml
#	ruoyi-admin/src/main/resources/application-prod.yml
#	ruoyi-modules-api/ruoyi-knowledge-api/src/main/java/org/ruoyi/chain/loader/ResourceLoaderFactory.java
2025-09-19 10:59:52 +08:00
ageerle
acc2d5d1a8 Merge remote-tracking branch 'origin/pdf-image'
# Conflicts:
#	ruoyi-admin/src/main/resources/application-dev.yml
#	ruoyi-admin/src/main/resources/application-prod.yml
#	ruoyi-modules-api/ruoyi-knowledge-api/pom.xml
#	ruoyi-modules-api/ruoyi-knowledge-api/src/main/java/org/ruoyi/service/PdfImageExtractService.java
#	ruoyi-modules-api/ruoyi-knowledge-api/src/main/java/org/ruoyi/service/impl/PdfImageExtractServiceImpl.java
#	ruoyi-modules-api/ruoyi-knowledge-api/src/main/java/org/ruoyi/service/impl/VectorStoreServiceImpl.java
#	ruoyi-modules/ruoyi-chat/src/main/java/org/ruoyi/chat/controller/knowledge/KnowledgeController.java
#	ruoyi-modules/ruoyi-chat/src/main/java/org/ruoyi/chat/service/knowledge/DealFileService.java
#	ruoyi-modules/ruoyi-chat/src/main/java/org/ruoyi/chat/service/knowledge/KnowledgeInfoServiceImpl.java
#	script/sql/update/202505141010.sql
2025-09-19 10:56:26 +08:00
马宏跃
c22b9fdb9c fix(pom): 在 ruoyi-extend 中添加缺失的 ruoyi-ai-copilot 模块 2025-09-18 09:03:07 +08:00
ageerle
2a45776aeb 新增数据库开发规范 2025-09-17 17:35:51 +08:00
w
ff0a3d1016 fix(Knowledge): 知识库删除失败 2025-09-17 12:00:27 +08:00
ageerle
b2a589ed9c Update README.md 2025-09-16 13:45:27 +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
evo
13da60e151 Merge pull request #189 from MuSan-Li/feature_20250904_fix_sql
feat: 添加session表会话ID
2025-09-04 17:02:06 +08:00
l90215
1f0c0ba0a9 feat: 添加session表会话ID 2025-09-04 17:01:13 +08:00
ageerle
ef3541fe77 Merge pull request #188 from xiaonieli7/feature_20250813_fix_codeOptimization
补充统一计费代理类BillingChatServiceProxy
2025-09-04 16:44:52 +08:00
Administrator
2b5fd810a4 fix(billing): 统一计费代理类BillingChatServiceProxy 2025-09-04 16:41:14 +08:00
Administrator
4a8d21a742 fix(billing): 1. 新增统一计费代理 BillingChatServiceProxy位置:ruoyi-modules/ruoyi-chat/src/main/java/org/ruoyi/chat/service/chat/proxy/BillingChatServiceProxy.java 作用:为所有ChatService实现类提供透明的计费代理包装
核心功能:
  AI回复前余额预检查,避免无效消耗
  自动收集AI回复内容
  统一处理AI回复的保存和计费
   适配多种AI服务的数据格式
  2. 重构工厂类
  ChatServiceFactory
  改进:自动为所有ChatService包装计费代理
 新增方法:getOriginalService() 用于获取未包装的原始服务优势:调用方无需关心计费逻辑,完全透明
 3. 增强计费服务 IChatCostService 接口
   新增方法:checkBalanceSufficient() - 余额预检查
   分离关注点:saveMessage() - 仅保存消息
    publishBillingEvent() - 仅发布计费事件
    deductToken() - 仅执行计费扣费
2025-09-04 16:35:55 +08:00
ageerle
c62530176f Merge pull request #187 from xiaonieli7/feature_20250813_fix_codeOptimization
修改了计费逻辑
2025-09-04 15:43:48 +08:00
Administrator
c7554d7e35 fix(billing): 1. 新增统一计费代理 BillingChatServiceProxy位置:ruoyi-modules/ruoyi-chat/src/main/java/org/ruoyi/chat/service/chat/proxy/BillingChatServiceProxy.java 作用:为所有ChatService实现类提供透明的计费代理包装
核心功能:
  AI回复前余额预检查,避免无效消耗
  自动收集AI回复内容
  统一处理AI回复的保存和计费
   适配多种AI服务的数据格式
  2. 重构工厂类
  ChatServiceFactory
  改进:自动为所有ChatService包装计费代理
 新增方法:getOriginalService() 用于获取未包装的原始服务优势:调用方无需关心计费逻辑,完全透明
 3. 增强计费服务 IChatCostService 接口
   新增方法:checkBalanceSufficient() - 余额预检查
   分离关注点:saveMessage() - 仅保存消息
    publishBillingEvent() - 仅发布计费事件
    deductToken() - 仅执行计费扣费
2025-09-04 15:37:52 +08:00
Administrator
1e4af3d01b fix(billing): 修复Token计费逻辑和消息更新机制
* 修复Token计费算法:按批次计费而非Token数量计费
* 添加ChatRequest.messageId字段支持消息关联更新
* 优化消息保存流程:分离基础信息保存和计费信息更新
* 修复预检查逻辑:统一预检查和实际扣费计算方式
* 调整Token阈值:100 → 1000,减少扣费频次
* 完善事件传递:ChatMessageCreatedEvent增加messageId

Fixes: 余额预检查误判、消息计费信息缺失、Token计费不准确
2025-08-29 15:19:37 +08:00
Administrator
1e3b49c9b8 用户发送消息 → 预检查余额 → 保存用户消息 → 发布计费事件 → 异步扣费 → 保存账单记录
添加了billingType计费类型字段消息保存的时候写入进去
2025-08-27 16:48:48 +08:00
Administrator
9f7f00e50c 用户发送消息 → 预检查余额 → 保存用户消息 → 发布计费事件 → 异步扣费 → 保存账单记录
添加了billingType计费类型字段消息保存的时候写入进去
2025-08-27 15:30:59 +08:00
Administrator
1c721981db Merge remote-tracking branch 'origin/main'
# Conflicts:
#	ruoyi-modules/ruoyi-chat/src/main/java/org/ruoyi/chat/service/chat/impl/DifyServiceImpl.java
#	ruoyi-modules/ruoyi-generator/src/main/java/org/ruoyi/generator/impl/GenTableServiceImpl.java
2025-08-27 10:49:37 +08:00
AmAzing129
6e6ba84fd2 docs: add contributors bubble 2025-08-27 10:47:34 +08:00
likunlong
ef69778bb7 feat: 下掉模型能力逻辑代码; 2025-08-27 10:47:34 +08:00
l90215
7a374d877b feat: 调整知识库问答接入提示词模板 2025-08-27 10:47:34 +08:00
likunlong
43426054ec feat: 兼容不选自动模型时的原先逻辑;封装通用方法,简化创建有监控的SSE,简化流式错误输出并通知重试; 2025-08-27 10:47:31 +08:00
likunlong
ccdbb20935 feat: 不选择模型自动选择时走原始默认逻辑; 2025-08-27 10:47:29 +08:00
likunlong
4b37cfe97d feat: 失败回调器中使用emitter对象的唯一hash作为key,不再使用session,不与业务进行绑定,同时也保证跨线程调用的正确性; 2025-08-27 10:47:26 +08:00
likunlong
c43d4784de feat: 处理在非Web线程中获取Request中token失败的问题; 2025-08-27 10:47:25 +08:00
likunlong
359cee28d5 feat: 修改目前实现类使用统一重试降级逻辑; 2025-08-27 10:47:22 +08:00
likunlong
aa11c1f233 feat: 问答时添加统一重试和降级逻辑; 2025-08-27 10:47:20 +08:00
likunlong
a0d029c142 feat: 自动设置请求参数中的模型名称; 2025-08-27 10:47:20 +08:00
likunlong
6ce52befe2 feat: 根据是否有附件和是否自动,自动选择模型并且获取服务; 2025-08-27 10:47:19 +08:00
likunlong
330bdc3761 feat: 数据库chat_model添加优先级字段; 2025-08-27 10:47:19 +08:00
likunlong
4f7ad59e46 feat: 添加自动获取高优先级模型和服务的逻辑; 2025-08-27 10:47:19 +08:00
l90215
b696fde881 feat: 合并代码 删除不需要的文件 2025-08-27 10:47:19 +08:00
fy53888
00f9a1a55b 修改字典下拉带查找功能 2025-08-27 10:47:19 +08:00
fy53888
a1c7b86e72 备分一下2 2025-08-27 10:47:19 +08:00
fy53888
62676a54fb 备分一下2 2025-08-27 10:47:19 +08:00
fy53888
e51425a951 备分一下 2025-08-27 10:47:17 +08:00
fy53888
268be2d9ec 更新后端生成類型 Integer出錯的問 2025-08-27 10:47:09 +08:00
fy53888
f448a18e44 更新后端生成類型 Integer出錯的問題 2025-08-27 10:47:07 +08:00
lixiang
22e59fe5a1 向量库sql查询去除匹配分值字段 2025-08-27 10:47:01 +08:00
violateer
0780e3b8c9 fix: 修改krole_group_ids字段名 2025-08-27 10:47:01 +08:00
violateer
0cdba56a07 feature: 添加开启知识库角色,用户可见个人知识库及角色分配知识库 2025-08-27 10:47:01 +08:00
l90215
ebc13c06af feat: 更新只是库角色默认不开启 2025-08-27 10:47:00 +08:00
l90215
416f011c73 feat: fix代码生成类型问题 2025-08-27 10:47:00 +08:00
likunlong
bfeb389171 feat: 获取模型接口支持返回模型能力;模型表增加模型能力字段; 2025-08-27 10:47:00 +08:00
violateer
caf7f14781 feature: 新增生成前端文件模板接口 2025-08-27 10:46:51 +08:00
l90215
a6eb98daab feat: fix代码生成类型问题 2025-08-27 10:46:37 +08:00
l90215
4834b615a6 feat: fix代码生成类型问题 2025-08-27 10:46:37 +08:00
l90215
42aabeed96 feat: 添加空格 2025-08-27 10:46:37 +08:00
likunlong
67303cf5be feat: 上传已经确定模型的选择,这里只需要根据名字获取模型直接使用就好; 2025-08-26 09:54:08 +08:00
likunlong
5bd95b496a feat: 默认上传服务修改为本地minio;添加部署时自启动minio服务;添加minio的服务启动docker-compose脚本; 2025-08-25 11:04:52 +08:00
likunlong
8fcaa7c90c feat: 默认上传服务修改为本地minio;添加部署时自启动minio服务;添加minio的服务启动docker-compose脚本; 2025-08-25 10:53:48 +08:00
violateer
27398c1000 feature: 移除limit 1写法,兼容不同数据库 2025-08-23 19:02:51 +08:00
ageerle
bd9ffb10a9 Merge pull request #178 from AmAzing129/main
docs: add contributors bubble
2025-08-22 14:33:27 +08:00
AmAzing129
bb9c85ac3c docs: add contributors bubble 2025-08-22 14:29:03 +08:00
evo
70ca78d935 Merge pull request #176 from LM20230311/feat-model-priority
feat: 下掉模型能力逻辑代码;
2025-08-20 17:55:15 +08:00
evo
1af8c4ee50 Merge pull request #177 from MuSan-Li/feature_20250820_fix_prompt_temp
feat: 调整知识库问答接入提示词模板
2025-08-20 17:55:05 +08:00
l90215
b9276c5dcc feat: 调整知识库问答接入提示词模板 2025-08-20 17:52:51 +08:00
likunlong
d1e98a2001 feat: 下掉模型能力逻辑代码; 2025-08-20 16:09:53 +08:00
evo
baf065a294 Merge pull request #175 from LM20230311/feat-model-priority
Feat model priority:支持自动选择模型;支持模型的重试;
2025-08-20 14:04:17 +08:00
likunlong
842a39d6d2 feat: 兼容不选自动模型时的原先逻辑;封装通用方法,简化创建有监控的SSE,简化流式错误输出并通知重试; 2025-08-19 20:28:53 +08:00
likunlong
9fba91c35f feat: 不选择模型自动选择时走原始默认逻辑; 2025-08-19 18:00:20 +08:00
likunlong
498135b7fd feat: 失败回调器中使用emitter对象的唯一hash作为key,不再使用session,不与业务进行绑定,同时也保证跨线程调用的正确性; 2025-08-19 17:53:27 +08:00
likunlong
c3ab13ae67 feat: 处理在非Web线程中获取Request中token失败的问题; 2025-08-19 17:39:20 +08:00
likunlong
1638b9dd75 feat: 修改目前实现类使用统一重试降级逻辑; 2025-08-19 16:51:51 +08:00
likunlong
4434d8346c feat: 问答时添加统一重试和降级逻辑; 2025-08-19 16:46:25 +08:00
likunlong
119483df86 feat: 自动设置请求参数中的模型名称; 2025-08-19 15:12:24 +08:00
evo
98f7e3ada2 Merge pull request #174 from MuSan-Li/feature_202500819_fix_merge
feat: 合并代码 删除不需要的文件
2025-08-19 12:44:59 +08:00
l90215
50d9e0e843 feat: 合并代码 删除不需要的文件 2025-08-19 12:43:34 +08:00
evo
2871cf7630 Merge pull request #171 from fy53888/main
修改字典功能 和模板生成id 太长19位 改为1,2,3
2025-08-19 12:33:40 +08:00
likunlong
07cb351807 feat: 根据是否有附件和是否自动,自动选择模型并且获取服务; 2025-08-19 10:32:17 +08:00
fy53888
951ee6bd8a 修改字典下拉带查找功能 2025-08-19 09:48:35 +08:00
fy53888
5b6605c345 备分一下2 2025-08-18 22:04:15 +08:00
fy53888
5db116ec88 备分一下2 2025-08-18 22:03:51 +08:00
fy53888
645c754dd0 备分一下 2025-08-18 19:56:26 +08:00
likunlong
8751bb5104 feat: 数据库chat_model添加优先级字段; 2025-08-18 14:49:56 +08:00
likunlong
8d0c557bdb feat: 添加自动获取高优先级模型和服务的逻辑; 2025-08-18 14:30:08 +08:00
evo
5ac785c570 Merge pull request #173 from lixiang-cell/lixiang8.18
向量库sql查询去除匹配分值字段
2025-08-18 12:30:26 +08:00
evo
60145f9291 Merge pull request #170 from violateer/feature_fix_k_role_20280815
feature: 添加开启知识库角色,用户可见个人知识库及角色分配知识库
2025-08-18 12:30:09 +08:00
lixiang
d7b89cd1b3 向量库sql查询去除匹配分值字段 2025-08-18 11:12:06 +08:00
fy53888
5264b47c2f 修改字典功能 和模板生成id 太长19位 改为1,2,3 2025-08-17 09:14:19 +08:00
violateer
e9cd9e84d4 fix: 修改krole_group_ids字段名 2025-08-15 20:43:14 +08:00
violateer
b52f7a7112 feature: 添加开启知识库角色,用户可见个人知识库及角色分配知识库 2025-08-15 20:41:59 +08:00
evo
2abdf762c1 Merge pull request #168 from MuSan-Li/feature_20250815_update_k_role_config
feat: 更新只是库角色默认不开启
2025-08-15 09:58:32 +08:00
l90215
099c94e3cb feat: 更新只是库角色默认不开启 2025-08-15 09:56:47 +08:00
Administrator
affdc5e3a6 问题概述
1.保存消息和计费逻辑存在耦合
2.修改计费逻辑:
按次计费被阈值限制:旧逻辑把 TIMES 分支放在 totalTokens ≥ 100 的大分支里,导致没到100 token时不扣费,违背“每次调用就扣费”的语义。
token累计不当:TIMES 分支只扣费不处理累计,同时在 totalTokens < 100 时不会进入任何TIMES逻辑,累计会无意义增长。
粒度不稳定:TOKEN 计费一旦达阈值就把 total 全扣完并清零,不利于对账与用户体验。
打印方式:使用 System.out.println,不利于生产追踪。

改动要点
1.新增独立方法
saveMessage(ChatRequest): 只落库。
publishBillingEvent(ChatRequest): 只发布异步计费事件。
保留组合方法 saveMessageAndPublishEvent(ChatRequest) 以便需要一行调用时使用。
调用处已改为“先保存,再发布事件”
SseServiceImpl: 先 saveMessage,再 publishBillingEvent。
SSEEventSourceListener: 同上。
DifyServiceImpl: 同上。

2.计费模式分流:
TIMES:每次调用直接扣费,不累计。
TOKEN:按阈值(100)批量扣费,保留余数,账单颗粒稳定。
保留余数:total = prev + delta;billable = floor(total/threshold)threshold;remainder = total % threshold。
日志替换:统一使用 log.debug。
结构更清晰、可维护。
所有金额计算统一用 BigDecimal,保留两位小数,RoundingMode.HALF_UP
按次计费:每次直接扣费(BigDecimal),边界转 Double
按 token 计费:按阈值批量结算,保留余数;费用=单价(BigDecimal)×可结算token数
1. 消息分类存储
用户消息:role="user", deductCost=null, totalTokens=本次token数, remark="用户消息"
系统账单:role="system", deductCost=实际扣费, totalTokens=计费token数, remark="TIMES_BILLING/TOKEN_BILLING"
2. 数据流程
用户发送消息 → 预检查余额 → 保存用户消息 → 发布计费事件 → 异步扣费 → 保存账单记录
2025-08-14 14:00:48 +08:00
evo
047044eb06 Merge pull request #166 from MuSan-Li/feature_202500807_fix_code_generate
feat: fix代码生成类型问题
2025-08-13 12:39:24 +08:00
l90215
7108727395 feat: fix代码生成类型问题 2025-08-13 12:37:10 +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
evo
d3732a155d Merge pull request #164 from MuSan-Li/feature_20250811_fix_code_generator
Feature 20250811 fix code generator
2025-08-11 22:00:20 +08:00
l90215
a0db91ebe6 Merge branch 'main' of https://github.com/MuSan-Li/ruoyi-ai into feature_20250811_fix_code_generator 2025-08-11 21:59:20 +08:00
l90215
e83d70e9c3 feat: fix代码生成类型问题 2025-08-11 21:59:02 +08:00
evo
5eb166839a Merge pull request #163 from LM20230311/feat-model-switching-association
feat: 获取模型接口支持返回模型能力;模型表增加模型能力字段;
2025-08-11 21:54:08 +08:00
evo
e27a6cb738 Merge pull request #162 from violateer/feature_gen_frontend_model_files
feature: 新增生成前端文件模板接口
2025-08-11 21:53:56 +08:00
酒亦
bc2eb8fdb9 feat:基于stdio模式 启动mcp服务器 2025-08-11 21:22:12 +08:00
likunlong
d964e86b23 feat: 获取模型接口支持返回模型能力;模型表增加模型能力字段; 2025-08-11 09:33:35 +08:00
酒亦
9891259452 mcp 信息 增删改查 完成 2025-08-10 20:50:04 +08:00
violateer
86d7eab5b5 解决冲突 2025-08-10 17:22:48 +08:00
violateer
fa5ad8caf6 Merge remote-tracking branch 'origin/feature_gen_frontend_model_files' into feature_gen_frontend_model_files 2025-08-10 17:20:14 +08:00
violateer
e5011e0dd9 feature: 新增生成前端文件模板接口 2025-08-10 17:19:59 +08:00
violateer
5fe8bd7706 feature: 新增生成前端文件模板接口 2025-08-10 17:06:32 +08:00
evo
0f28e1f3f6 Merge pull request #161 from MuSan-Li/feature_202500807_fix_xx
fix 代码生成逻辑bug
2025-08-10 00:27:56 +08:00
l90215
503f86644e feat: fix代码生成类型问题 2025-08-10 00:25:49 +08:00
fy53888
579beb6833 修复后端生成类型 Integer 出错的问题 2025-08-09 22:03:31 +08:00
fy53888
22c0c733f6 更新获取Java类型后端生成類型 Integer出錯的問 2025-08-09 22:01:29 +08:00
fy53888
9f4a2256b4 更新后端生成類型 Integer出錯的問 2025-08-09 21:56:16 +08:00
fy53888
5a4d76ac09 更新后端生成類型 Integer出錯的問題 2025-08-09 21:55:23 +08:00
Administrator
5a2e08f87d 问题概述
1.保存消息和计费逻辑存在耦合
2.修改计费逻辑:
按次计费被阈值限制:旧逻辑把 TIMES 分支放在 totalTokens ≥ 100 的大分支里,导致没到100 token时不扣费,违背“每次调用就扣费”的语义。
token累计不当:TIMES 分支只扣费不处理累计,同时在 totalTokens < 100 时不会进入任何TIMES逻辑,累计会无意义增长。
粒度不稳定:TOKEN 计费一旦达阈值就把 total 全扣完并清零,不利于对账与用户体验。
打印方式:使用 System.out.println,不利于生产追踪。
3.建议数据库不要存扣除金额和累计消耗token,消息表里不需要存“累计到目前为止多少”,否则每条消息都变成快照,既冗余又易不一致

改动要点
1.新增独立方法
saveMessage(ChatRequest): 只落库。
publishBillingEvent(ChatRequest): 只发布异步计费事件。
保留组合方法 saveMessageAndPublishEvent(ChatRequest) 以便需要一行调用时使用。
调用处已改为“先保存,再发布事件”
SseServiceImpl: 先 saveMessage,再 publishBillingEvent。
SSEEventSourceListener: 同上。
DifyServiceImpl: 同上。

2.计费模式分流:
TIMES:每次调用直接扣费,不累计。
TOKEN:按阈值(100)批量扣费,保留余数,账单颗粒稳定。
保留余数:total = prev + delta;billable = floor(total/threshold)threshold;remainder = total % threshold。
日志替换:统一使用 log.debug。
结构更清晰、可维护。
所有金额计算统一用 BigDecimal,保留两位小数,RoundingMode.HALF_UP
按次计费:每次直接扣费(BigDecimal),边界转 Double
按 token 计费:按阈值批量结算,保留余数;费用=单价(BigDecimal)×可结算token数
2025-08-08 13:39:37 +08:00
l90215
838a393abc feat: 添加空格 2025-08-07 21:13:02 +08:00
evo
210a9d9b14 Merge pull request #159 from MuSan-Li/feature_20250807_fix_code_generator
feat: 代码生成模板优化
2025-08-07 09:03:08 +08:00
l90215
66518925c1 feat: 代码生成模板优化 2025-08-07 09:02:16 +08:00
evo
19d3f018b8 Merge pull request #158 from MuSan-Li/feature_20250805_fix_data_model_del
feat: 优化删除数据模型也删除模型字段sql条件
2025-08-05 22:11:00 +08:00
l90215
450ec6db44 feat: 优化删除数据模型也删除模型字段sql条件 2025-08-05 22:06:05 +08:00
evo
0bb897de1f Merge pull request #157 from MuSan-Li/feature_20250805_fix_data_model_del
feat: 优化删除数据模型也删除模型字段&添加mapper文件注解
2025-08-05 19:51:28 +08:00
l90215
ab9ff52200 feat: 优化删除数据模型也删除模型字段&添加mapper文件注解 2025-08-05 19:50:29 +08:00
evo
d94bcf250e Merge pull request #156 from MuSan-Li/feature_20250804_fix_bug
feat: 优化空指针bug&格式化代码&初始化用户知识库角色配置
2025-08-04 20:54:27 +08:00
l90215
10708b7625 feat: 优化空指针bug&格式化代码&初始化用户知识库角色配置 2025-08-04 20:50:49 +08:00
ageerle
5e032a68d5 Merge pull request #154 from violateer/feature/knowledge-role
添加删除知识库角色组时关联删除数据
2025-08-03 09:59:50 +08:00
violateer
bd41ff0f28 添加删除知识库角色组时关联删除数据 2025-08-02 22:29:02 +08:00
evo
3ffba456f4 Merge pull request #153 from MuSan-Li/feature_20250802_fix_k_sql
feat: 调整知识库角色sql
2025-08-02 21:25:52 +08:00
l90215
993346534e feat: 调整知识库角色sql 2025-08-02 21:25:16 +08:00
evo
38169ba90d 修复查询字段名称
feat: 修复一些逻辑问题
2025-08-02 19:39:23 +08:00
l90215
b003e1b3bb feat: 修复查询字段名称 2025-08-02 19:38:50 +08:00
l90215
f36dda74a1 feat: 修复一些逻辑问题 2025-08-02 19:37:07 +08:00
evo
c609095c69 Merge pull request #151 from MuSan-Li/feature_20250801_fix_menu_sql
feat: 调整菜单结构sql
2025-08-02 18:37:47 +08:00
l90215
93e34b3f03 feat: 调整菜单结构sql 2025-08-02 18:36:50 +08:00
ageerle
cc4ca69640 Merge pull request #143 from violateer/feature/knowledge-role
添加知识库权限控制功能
2025-08-02 15:56:42 +08:00
ageerle
85930f4b12 Merge pull request #132 from HHANG52/main
feat(chat): 修复仅非管理员设置根据用户 ID查询聊天记录
2025-08-02 15:56:31 +08:00
ageerle
3c19a2b7a4 Merge pull request #142 from keke-cxn/main
修复:请求地址'/system/role/authUser/selectAll',发生未知异常:cn.dev33.satoken.exce…
2025-08-02 15:56:16 +08:00
keke
21c390c4d6 修复:1.在使用dify的时候,发送1+1=?模型返回2,但是第二次问他为什么等于2的时候,模型无法获取上下文信息,经过排查,发现缺少conversationId,session表需要添加conversationId字段
2.在使用dify的时候message表中并没有存储模型返回的消息,并且扣除费用、
2025-08-02 13:18:30 +08:00
ageerle
cdef9e1c89 feat: 增加演示模式 2025-07-31 14:58:29 +08:00
evo
3c60f43daa Merge pull request #147 from MuSan-Li/feature_20250721_generate_code
feat: 调整生成代码结构
2025-07-30 09:31:04 +08:00
l90215
a24fa7a2b4 feat: 调整生成代码结构 2025-07-30 09:24:31 +08:00
ageerle
21f8462ebb Merge pull request #146 from MuSan-Li/feature_20250721_generate_code
feat: 调整生成代码结构
2025-07-30 09:10:32 +08:00
l90215
897222c41c feat: 调整生成代码结构 2025-07-29 23:34:39 +08:00
ageerle
227670df9d Merge pull request #145 from MuSan-Li/feature_20250721_generate_code
feat: 提交替换代码生成sql
2025-07-29 09:43:29 +08:00
l90215
6b2cf1a3c3 feat: 提交替换代码生成sql 2025-07-28 17:47:12 +08:00
ageerle
37f832c31c Merge pull request #144 from MuSan-Li/feature_20250721_generate_code
替换代码生成
2025-07-28 09:32:19 +08:00
l90215
25cf1f9744 feat: 更新数据库密码... 2025-07-27 22:47:55 +08:00
l90215
a48178685c feat: 更新代码生成功能-优化逻辑 2025-07-27 22:37:26 +08:00
l90215
7e60cb357f feat: 更新代码生成功能-优化逻辑 2025-07-27 00:33:33 +08:00
l90215
915a393427 feat: 更新代码生成功能-优化取数逻辑 2025-07-24 12:36:26 +08:00
l90215
de323d8c45 feat: 更新代码生成功能-添加数据模型批量添加字段数据 2025-07-23 10:46:29 +08:00
l90215
ffe4867d40 feat: 更新代码生成功能-二阶段 2025-07-22 18:50:37 +08:00
l90215
8b3c0b4134 feat: 更新代码生成功能-一阶段 2025-07-21 16:03:08 +08:00
violateer
999282210e 添加知识库权限控制功能 2025-07-20 10:17:50 +08:00
violateer
a99344813f 添加知识库权限控制功能 2025-07-20 10:05:38 +08:00
ageerle
63ec00cd71 Merge pull request #136 from Administratos-User/main
修复token不扣费和扣费异常的问题
2025-07-16 15:53:56 +08:00
ageerle
7eebd87cc8 Merge pull request #141 from lixiang-cell/lixiang
存储向量库同时存储元数据的fid和docId,提供根据fid docId删除
2025-07-16 15:52:19 +08:00
keke
9a816bb0c7 修复:当前用户【如果没有绑定任何部门的情况下】在查询用户列表分页的时候 调用 SysUserMapper 的 selectPageUserList() 时候报错:sql错误 2025-07-15 00:02:44 +08:00
keke
bc6ed508b0 修复:1.用户原本绑定了岗位,若想要取消所有的岗位,没有进行逻辑实现
2.用户原本绑定了角色,若想要取消所有的角色,没有进行逻辑实现
2025-07-14 23:47:47 +08:00
keke
d64abaaed3 修复:请求地址'/system/role/authUser/selectAll',发生未知异常:cn.dev33.satoken.exception.NotWebContextException: 非Web上下文无法获取Request 2025-07-14 23:39:47 +08:00
lixiang
285aa2ae62 存储向量库同时存储元数据的fid和docId,提供根据fid docId删除 2025-07-14 17:15:29 +08:00
Administratos-User
99114d3301 修复token不扣费和扣费异常的问题
1.本次提交的token数+未付费token数 判断大于100token的时候就进行扣费,当然这里还可以改成更多,我觉得100合适。
2.不需要进行扣费的地方屏蔽了相关代码。
3.SessionId传递异常 建议前端传递uuid,也就是每次会话的id。
2025-07-11 11:59:20 +08:00
HHANG
e857f0345b Merge branch 'ageerle:main' into main 2025-07-11 10:32:12 +08:00
ageerle
138fa5f0e9 Merge pull request #133 from MuSan-Li/feature_20250516_add_dept_error
feat: 修复打开岗位管理爆错
2025-07-11 09:49:55 +08:00
l90215
241c6dc57a feat: 修复打开岗位管理爆粗 2025-07-10 23:53:17 +08:00
ageerle
6005339ec8 upadate md 2025-07-10 23:00:04 +08:00
ageerle
db892d35fb feat: 更新项目说明 2025-07-10 17:12:20 +08:00
HHANG
605b223985 feat(chat): 修复仅非管理员设置根据用户 ID查询聊天记录
- 在 ChatMessageServiceImpl 类中,仅当用户不是超级管理员时,才自动设置消息的用户 ID,确保了超级管理员可以查看对话聊天
2025-07-09 16:19:48 +08:00
ageerle
e117ec8e27 feat: 更新项目说明 2025-07-09 14:27:55 +08:00
ageerle
5e8db861ea feat: 更新项目说明 2025-07-08 15:30:25 +08:00
ageerle
fa2791e2e3 feat: 更新项目说明 2025-07-08 14:31:01 +08:00
ageerle
f1f7cb1084 feat: 更新项目说明 2025-07-08 12:26:24 +08:00
ageerle
acb1f27c37 feat: 更新项目说明 2025-07-08 12:10:03 +08:00
ageerle
e46245d97d feat: 更新项目说明 2025-07-07 13:44:55 +08:00
ageerle
0eff37fa51 ai编程助手 2025-07-07 12:36:53 +08:00
ageerle
c1a178c0be Merge remote-tracking branch 'origin/main' 2025-07-07 12:33:21 +08:00
ageerle
94d4446321 feat: 编程助手 2025-07-07 12:33:06 +08:00
lindaxia
d7930ad713 修复导包问题 2025-07-06 08:12:38 +08:00
lindaxia
48270add01 Merge branch 'main' of https://github.com/ageerle/ruoyi-ai 2025-07-06 07:52:25 +08:00
lindaxia
3786644a25 新增小程序接口 2025-07-06 07:51:38 +08:00
ageerle
53532681d3 Merge pull request #131 from Cyclones-Y/main
[fix][feat](chat): 修复“自动注入警告 => 用户未登录”; 添加会话中SaToken-token值传递和使用;
2025-07-05 21:29:24 +08:00
Yzm
daa7b7315b [fix][feat](chat): 添加会话中SaToken-token值传递和使用;修复“自动注入警告 => 用户未登录”
- 新增 BaseContext 类,用于保存和获取当前登录用户的 token
- 在 OpenAIServiceImpl 和 imageServiceImpl 中获取当前会话 token
- 将 token 作为参数传递给 SSEEventSourceListener
- 在 SSEEventSourceListener 中使用 token 进行用户身份验证和权限控制
- 修改 LoginHelper,增加根据 token 获取登录用户信息的方法
- 更新 InjectionMetaObjectHandler,使用 BaseContext 获取当前 token
- 修复对话时出先”自动注入警告 => 用户未登录“
2025-07-05 19:12:33 +08:00
ageerle
df3b687be4 Merge pull request #129 from MuSan-Li/feature_20250703_add_model_category_select
feat: 模型管理增加模型分类下拉框
2025-07-03 10:48:43 +08:00
l90215
ecb5ef32fc feat: 模型管理增加模型分类下拉框 2025-07-03 10:29:25 +08:00
evo
e5116472ed Merge branch 'ageerle:main' into main 2025-07-03 09:50:59 +08:00
lindaxia
e58aeb5361 更新README.md 2025-07-02 11:04:35 +08:00
lindaxia
b4306289f0 fix weaviate向量库根据数据类进行删除 2025-07-01 18:50:12 +08:00
lindaxia
d9c47bd983 修复删除知识库清空相关表 2025-07-01 18:06:49 +08:00
evo
8ddbb43dde Merge branch 'ageerle:main' into main 2025-07-01 10:02:32 +08:00
ageerle
dfe8c7dc85 Merge pull request #127 from Cyclones-Y/main
feat(chat): 集成 FastGPT 聊天模型
2025-06-30 23:21:31 +08:00
Yzm
fd94a1772f feat(chat): 集成 FastGPT 聊天模型- 在 ChatModeType 枚举中添加 FASTGPT 选项- 新增 FastGPT 相关的实体类和请求响应类
- 实现 FastGPT聊天服务接口
- 添加 FastGPT SSE 事件监听器
2025-06-30 22:03:31 +08:00
ageerle
c105d47d99 Merge pull request #125 from MuSan-Li/feature_20250626_fix_update_role
修复修改角色时候报错
2025-06-27 10:45:32 +08:00
l90215
4e2ec2dc82 feat: 修复修改角色时候报错&优化一些代码风格 2025-06-26 10:19:08 +08:00
evo
614280d8ea Merge branch 'ageerle:main' into main 2025-06-25 12:57:49 +08:00
ageerle
2fae8d0ad0 feat: 更新任务规划演示 2025-06-24 14:21:43 +08:00
ageerle
d7c2d1bcf3 feat: 更新任务规划演示 2025-06-24 14:16:40 +08:00
ageerle
122f63dfbd Merge remote-tracking branch 'origin/main' 2025-06-24 13:52:01 +08:00
ageerle
719e968192 feat: 更新任务规划演示 2025-06-24 13:51:51 +08:00
evo
bf790ceb51 Merge branch 'ageerle:main' into main 2025-06-24 11:43:08 +08:00
ageerle
de5488bd8c Merge pull request #123 from abin0515/one-step-script
one-step-script: 修改MacOS上运行快速启动脚本遇到的bug
2025-06-24 10:30:49 +08:00
GH Action - Upstream Sync
c77a245a4d Merge branch 'main' of https://github.com/ageerle/ruoyi-ai 2025-06-24 01:57:42 +00:00
Bin Xiao
6dcd8823cd one-step-script: 修改MacOS上运行快速启动脚本遇到的bug 2025-06-23 18:21:01 -04:00
ageerle
8be480e06c Update README.md 2025-06-23 16:49:13 +08:00
ageerle
11286de676 Merge pull request #118 from MuSan-Li/feature_20250610_add_prompt_template
Feature 20250610 add prompt template
2025-06-23 16:36:40 +08:00
MuSan-Li
5aaf0a672c feat: 删除fork文件 2025-06-12 17:55:19 +08:00
MuSan-Li
0089706336 添加提示词模板字典相关SQL 2025-06-12 17:37:04 +08:00
MuSan-Li
cc129801b9 添加提示词模板 2025-06-12 17:06:06 +08:00
zhouweiyi
6a73e09ac7 refactor(DashscopeServiceImpl): 移除静态变量并改进日志输出逻辑
将静态变量改为实例变量以避免并发问题
重构日志输出逻辑,仅在最后响应时输出完整内容
添加异常堆栈打印以方便调试
2025-06-09 18:01:51 +08:00
GH Action - Upstream Sync
e1dc22348c Merge branch 'main' of https://github.com/ageerle/ruoyi-ai 2025-06-07 01:53:26 +00:00
ageerle
f37e4da669 feat: 更新二维码 2025-06-06 10:13:02 +08:00
GH Action - Upstream Sync
3e097d9a68 Merge branch 'main' of https://github.com/ageerle/ruoyi-ai 2025-06-06 01:54:02 +00:00
ageerle
97ae5a46cd feat: 调整sql脚本 2025-06-05 16:16:32 +08:00
ageerle
baa664ac4f feat: 图片识别功能优化 2025-06-05 16:00:06 +08:00
ageerle
353fbf26b8 Merge pull request #115 from Code-Mr-Jiu/main
上传图片支持使用后台image分类下通义千问模型
2025-06-05 13:53:20 +08:00
ageerle
f79b4ec012 Merge pull request #114 from Code-Mr-Jiu/jiuyi-dev
上传图片支持使用后台image分类模型
2025-06-05 13:53:09 +08:00
酒亦
0a73cb4e17 上传图片支持使用后台image分类下通义千问模型 2025-06-05 12:05:28 +08:00
zhouweiyi
cbe882af66 chore: 更新百炼模型配置的API密钥
将开发环境和本地环境的百炼模型配置中的API密钥统一更新为占位符'sk-xxxx'
2025-06-04 18:02:26 +08:00
zhouweiyi
1d51a103d0 feat: 集成阿里百炼API实现图片内容识别功能
添加DashscopeService接口及实现,用于调用阿里百炼API进行图片内容识别
修改PdfImageExtractService增加基于百炼API的图片处理逻辑
新增OSS服务方法支持临时文件处理和删除
更新配置文件添加百炼模型相关配置
2025-06-04 17:55:47 +08:00
酒亦
d635e30b4a 上传图片支持使用后台image分类模型 2025-06-02 08:11:22 +08:00
evo
ca50d1ddfb Create main.yml 2025-05-30 16:05:04 +08:00
ageerle
bd94a3eae8 Merge remote-tracking branch 'origin/main' 2025-05-27 17:55:44 +08:00
ageerle
fcdcf534f1 fix: 修复脱敏后的apikey也被更新了 2025-05-27 17:55:34 +08:00
lindaxia
deefb6cc0b Merge branch 'main' of https://github.com/ageerle/ruoyi-ai 2025-05-26 22:45:18 +08:00
lindaxia
fa96c3d12f feat: 更新deploy脚本 2025-05-26 22:43:54 +08:00
ageerle
77069fdecd feat: 移除聊天、会话角色校验 2025-05-26 22:41:55 +08:00
ageerle
db4a264a52 Merge remote-tracking branch 'origin/main' 2025-05-26 22:40:17 +08:00
ageerle
70ae7ea8f1 feat: 向量库查询删除逻辑调整 2025-05-26 22:40:01 +08:00
lindaxia
6a93856d90 feat: 更新deploy脚本 2025-05-26 22:24:17 +08:00
lindaxia
71cae94815 Revert "lindaxia"
This reverts commit a2905d08f9.
2025-05-26 22:20:51 +08:00
lindaxia
a2905d08f9 lindaxia
feat: 更新deploy
2025-05-26 22:16:23 +08:00
ageerle
463ad6c583 Merge remote-tracking branch 'origin/main' 2025-05-26 12:56:45 +08:00
ageerle
abcde9e36e refactor: 1. 移除图片附件模块 2. 优化import 2025-05-26 12:56:28 +08:00
ageerle
8e723f5b78 Update README.md 2025-05-26 10:21:09 +08:00
ageerle
2021fb5071 feat: 修改项目介绍 2025-05-26 10:15:19 +08:00
ageerle
ecbab7df7b Update README.md 2025-05-26 10:10:00 +08:00
ageerle
d6fcaa0a11 Update README.md 2025-05-26 10:09:28 +08:00
ageerle
58faded4ff Update README.md 2025-05-26 10:09:02 +08:00
ageerle
7cc7af70f0 Update README.md 2025-05-26 10:07:47 +08:00
ageerle
4312a729a2 feat: 会话管理返回创建时间 2025-05-26 09:32:53 +08:00
ageer
5d972d66f4 fix: 代码优化 2025-05-25 14:42:22 +08:00
ageerle
1bff2791a6 Merge pull request #108 from liudalian/20250520
集成国产大模型 ds、zhipu、qianwen
2025-05-25 14:36:23 +08:00
菩提取一叶
a76769e540 add:集成国产大模型 ds、zhipu、qianwen 2025-05-25 14:30:05 +08:00
ageer
bedffffd86 fix: 修复对话时无法上传文件 2025-05-24 23:59:40 +08:00
ageer
2884c37599 feat: 移除微信支付 2025-05-24 23:07:59 +08:00
ageer
c25749c9ca feat: 更新sql脚本 2025-05-24 23:02:59 +08:00
ageer
147b3fd8f5 feat: 查询ppt apikey 2025-05-24 20:06:19 +08:00
ageerle
373424bd01 feat(更新日志):
更新日志

1. 移除个人微信模块
2. 移除直播模块
3. 移除gpts模块
4. 移除应用商店模块
5. 移除套餐管理模块
6. 移除兑换管理模块

## 微信相关
小程序相关功能迁移至企业版
微信公众号/微信机器人迁移至企业版
微信支付迁移至企业版

## 功能模块
智能体模块迁移至企业版
插件管理改为MCP应用并迁移至企业版

知识库:
excel解析迁移至企业版
pdf图片解析迁移至企业版
milvus qdrant扩展 迁移至企业版
2025-05-24 16:18:18 +08:00
ageerle
287a0b3d70 Update README.md 2025-05-23 10:28:42 +08:00
ageerle
cd7e07bea6 Update README.md 2025-05-23 10:26:48 +08:00
ageerle
7edfae09bc Update README.md 2025-05-23 10:24:32 +08:00
ageer
a1759ddf5a perf(wechat,live): 移除个人/企业微信,直播模块
1. 个人微信移除原因:功能不稳定,且有封号风险 2. 直播模块移除原因:使用频率低
2025-05-22 18:36:35 +08:00
ageerle
5517a5d19b feat: 新增聊天时返回消息id 2025-05-22 17:24:56 +08:00
ageerle
8fb72ba4fe feat: 修改配置 2025-05-22 17:19:00 +08:00
ageerle
24511fac8f refactor: 移除个人微信模块,移除直播模 2025-05-22 17:13:49 +08:00
ageerle
ce9f2a82da feat: 新增会话返回会话id 2025-05-22 17:11:39 +08:00
张鹏翔
0f82711199 perf: 1.优化文件输出路径,避免其他盘符权限问题。
2.采用线程池异步调用多模板OCR图片识别。
2025-05-22 14:05:21 +08:00
ageerle
b81fb7cb3f feat: 修改项目介绍 2025-05-22 11:37:45 +08:00
ageerle
676a63c0d6 feat: 修改项目介绍 2025-05-22 11:30:34 +08:00
ageerle
427736271c feat: 修改项目介绍 2025-05-22 11:28:32 +08:00
ageerle
c39dd7a917 feat: 修改项目介绍 2025-05-22 11:24:17 +08:00
ageerle
ed85fef0de Merge pull request #97 from zhangpengxiang/mineru/dev
feat:结合mineru新增pdf转换结构化数据功能
2025-05-21 14:42:47 +08:00
张鹏翔
22d9d9ba85 新增pdf转md后是否进行图片OCR判断 2025-05-21 14:37:51 +08:00
张鹏翔
86825eeb2e 结合mineru新增pdf转换结构化数据功能 2025-05-21 14:25:44 +08:00
ageerle
c491a98dc7 Merge pull request #95 from MuSan-Li/feature_20250520_fix_email_config
修复用户端注册发送邮件报错
2025-05-21 09:40:11 +08:00
MuSan-Li
2a4978c668 修复用户端注册发送邮件报错 2025-05-20 23:10:27 +08:00
lh
5b4eeee756 更新readme.md 2025-05-20 11:00:21 +08:00
ageerle
53e3180658 Merge pull request #93 from janzhou123/pdf-image
feat:增加knowledge_attach_pic表结构sql
2025-05-20 09:29:40 +08:00
zhouweiyi
e43e14454d feat:增加knowledge_attach_pic表结构sql 2025-05-20 09:22:41 +08:00
ageerle
93ddcd53b1 feat: 对话时记录对话角色 2025-05-19 16:41:55 +08:00
ageerle
0ee47a5c00 feat: 对话时记录对话角色 2025-05-19 16:35:21 +08:00
ageerle
3ceef41ab0 feat: 知识库上传逻辑调整 2025-05-19 16:11:37 +08:00
ageerle
a4e995d46c feat: 新增pdf图片解析分支 2025-05-19 15:33:29 +08:00
ageerle
57693059a1 Merge pull request #91 from xingjisen/main
fix: 自动上传向量时间改为三分钟;修复根据条件删除向量数据报错问题;
2025-05-19 09:21:35 +08:00
邢继森
d18e307e10 fix: 自动上传向量时间改为三分钟;修复根据条件删除向量数据报错问题; 2025-05-19 00:45:32 +08:00
ageerle
eed708c6d3 Merge pull request #90 from alanpeng/main
Add one-step auto-deployment script
2025-05-18 22:11:01 +08:00
root
1093888889 fix the deploy-en.sh by dos2unix command 2025-05-18 15:58:34 +08:00
Alan Peng
e58a420f9f Update README.md 2025-05-18 21:48:36 +08:00
root
4a0c3d132a Update README.md 2025-05-18 15:48:47 +08:00
root
0d81aa640e Add one-step auto-deployment script 2025-05-18 15:48:20 +08:00
ageer
951524bff7 Merge remote-tracking branch 'origin/main' 2025-05-17 12:51:54 +08:00
ageer
c7d0e9337a fix: 修复聊天记录保存异常 2025-05-17 12:51:29 +08:00
ageerle
6955f3c7dc Merge pull request #87 from alanpeng/main
Add weaviate database service
2025-05-17 11:20:10 +08:00
root
a52b017e1a Add weaviate database service 2025-05-17 10:11:16 +08:00
ageer
158a0190b5 feat: 优化会话管理查询逻辑 2025-05-16 23:52:43 +08:00
ageerle
096fc11313 Merge pull request #86 from alanpeng/main
Containerized service package/imagese build and deploy
2025-05-16 22:36:21 +08:00
root
e9ac795d23 Add manual 2025-05-16 22:31:14 +08:00
root
32f1a6bab1 Containerized service package/imagese build and deploy 2025-05-16 22:29:36 +08:00
ageerle
052069a2df Merge pull request #85 from MuSan-Li/feature_20250516_fix_auth
修复未登录也可以访问接口
2025-05-16 22:11:41 +08:00
MuSan-Li
e1c997883f 修复未登录也可以访问接口 2025-05-16 21:01:37 +08:00
ageerle
031b7da198 Merge pull request #84 from janzhou123/main
feat:pdf文件解析图片和分析图片,上传向量数据库都修改成 成异步处理
2025-05-16 16:29:21 +08:00
zhouweiyi
931af963b1 feat:pdf文件解析图片和分析图片,上传向量数据库都修改成 成异步处理 2025-05-16 13:50:12 +08:00
Albert
f5fa7d5da8 Merge branch 'ageerle:main' into main 2025-05-15 17:49:09 +08:00
zhouweiyi
c6ffbcb3cf feat:pdf文件解析图片和分析图片,上传向量数据库都修改成 成异步处理 2025-05-15 17:46:38 +08:00
ageerle
05ae200ff5 Merge pull request #82 from chenwei1015/fix-20250514-knowledge_info
fix- 20250514.sql, alter单词错误
2025-05-14 17:42:21 +08:00
weizhangfz
e745f772ef fix- 20250514.sql, alter单词错误 2025-05-14 17:23:34 +08:00
zhouweiyi
584212c569 Merge remote-tracking branch 'origin/main'
# Conflicts:
#	ruoyi-modules/ruoyi-chat/src/main/java/org/ruoyi/chat/service/knowledge/KnowledgeInfoServiceImpl.java
2025-05-14 16:13:07 +08:00
zhouweiyi
dc9bf3e25d pdf文件解析成异步处理 2025-05-14 15:41:57 +08:00
ageerle
da84a26c47 feat: 更新sql脚本 2025-05-14 13:56:09 +08:00
ageerle
7d3282c347 feat: 修复知识库上传失败 2025-05-14 13:53:49 +08:00
ageerle
4454be44c3 Update README.md 2025-05-13 14:40:27 +08:00
zhouweiyi
52e0feda01 修改方法描述 2025-05-13 13:44:31 +08:00
ageerle
c89f5d07fb Merge pull request #80 from janzhou123/main
Extract the image from the PDF and call the large model to identify the image content and return it
2025-05-13 11:08:20 +08:00
zhouweiyi
778a7bc21b 提取PDF中的图片并调用大模型,识别图片内容并返回 2025-05-13 11:01:33 +08:00
zhouweiyi
50f5f38996 提取PDF中的图片并调用大模型,识别图片内容并返回 2025-05-13 10:56:05 +08:00
zhouweiyi
32da85daab 提取PDF中的图片并调用大模型,识别图片内容并返回 2025-05-13 10:55:39 +08:00
Albert
3666157d14 Merge pull request #1 from ageerle/main
new
2025-05-13 09:59:36 +08:00
ageer
1a178d0ef8 Merge remote-tracking branch 'origin/main' 2025-05-11 21:38:01 +08:00
ageer
b64b758263 feat: 小助手wx 2025-05-11 21:37:55 +08:00
ageerle
a68c6481ba Update README.md 2025-05-11 21:37:09 +08:00
ageerle
3cbacb5ed9 Update README.md 2025-05-11 21:35:53 +08:00
ageerle
38667797d3 Update README.md 2025-05-11 21:34:42 +08:00
ageerle
9a6acb84a4 Update README.md 2025-05-11 21:33:59 +08:00
ageerle
e3c8a84849 Update README.md 2025-05-11 21:32:39 +08:00
ageerle
cc349f5954 Update README.md 2025-05-11 21:31:01 +08:00
ageerle
e4b78e0510 Update README.md 2025-05-11 21:30:08 +08:00
ageerle
15c6cd272e Update README.md 2025-05-11 21:28:59 +08:00
ageerle
1614eff008 Update README.md 2025-05-11 21:27:49 +08:00
ageerle
c86e88ebd1 Update README.md 2025-05-11 21:26:57 +08:00
ageerle
39ebd85f58 Update README.md 2025-05-11 21:25:50 +08:00
ageer
bde82fe516 feat: 忽略README.md 2025-05-11 19:45:57 +08:00
ageer
2ca650db76 feat: 代码优化 2025-05-11 19:37:52 +08:00
ageer
e3da640737 feat: 代码优化 2025-05-11 18:37:51 +08:00
ageer
e1dea1d9e2 Merge remote-tracking branch 'origin/main' 2025-05-11 17:25:08 +08:00
ageer
84b8d6f675 feat: 支持coze,dify,派欧云等三方模型调用 2025-05-11 17:25:02 +08:00
ageerle
8563428bf9 Merge pull request #77 from zhangpengxiang/ExcelFileLader/dev
feat:补充Excel文档加载类
2025-05-11 14:55:44 +08:00
zhangpengxiang
7b3b727c0e 补充Excel文档加载类 2025-05-11 14:50:11 +08:00
ageerle
08098ff3f3 Merge pull request #76 from zhangpengxiang/ExcelFileLader/dev
增加Excel文档加载功能,处理向量库管理createSchema方法报错问题
2025-05-11 14:31:55 +08:00
zhangpengxiang
fb492d41f3 增加Excel文档加载功能,处理向量库管理createSchema方法WeaviateEmbeddingStore.builder().build();直接构建报错问题。 2025-05-11 10:55:33 +08:00
ageerle
9c2586ab43 Update README.md 2025-05-09 17:24:55 +08:00
ageerle
1bddf5df3b feat: 兼容多平台模型 2025-05-09 16:45:41 +08:00
ageer
57b2f833f8 feat: 修复向量库初始化失败导致程序启动失败 2025-05-08 23:56:40 +08:00
ageer
7907cbeb7f feat: 修复向量库初始化失败导致程序启动失败 2025-05-08 19:31:46 +08:00
ageer
9cfcdd2b9b feat: 代码优化 2025-05-08 19:00:48 +08:00
ageerle
980df20752 feat: 支持milvus、qdrant向量库 2025-05-08 16:09:02 +08:00
ageerle
aa92d232bb feat: Weaviate操作向量库功能优化 2025-05-08 10:41:01 +08:00
ageer
81c0bb5738 feat: Weaviate改为langchain4j方式调用 2025-05-07 22:53:21 +08:00
ageerle
1a645c6e10 feat: 接入langchain4j操作向量库 2025-05-07 17:33:22 +08:00
ageer
731f6ceb6e feat: sql脚本 2025-05-05 15:10:53 +08:00
ageer
8e21245348 feat: sql脚本 2025-05-05 15:04:02 +08:00
ageer
936e157e4a feat: sql脚本 2025-05-05 15:02:57 +08:00
ageer
256f72c487 feat: 支付模块引用 2025-05-03 15:37:56 +08:00
ageer
009aa5f1a5 feat: 添加接口说明 2025-05-03 15:27:46 +08:00
ageer
d22d2cb708 fix(接口文档): 修复接口文档/v3/api-docs无法正常访问 2025-05-03 14:31:20 +08:00
ageer
59104028b6 feat: 会话管理 2025-05-03 10:45:29 +08:00
ageer
c2f6a8321a feat: 会话管理 2025-05-03 10:41:50 +08:00
ageer
5476a4b0b7 fix: 公众号登录功能同步 2025-04-30 19:34:09 +08:00
ageerle
cd490aa0e5 feat: 新增wechat模块 2025-04-30 11:29:23 +08:00
ageerle
b1ff44df4b feat: sse对话样式优化 2025-04-29 11:44:47 +08:00
ageerle
dc6d00f0fc feat: 查询gpts无需登录 2025-04-29 11:00:34 +08:00
ageerle
990da8da6f feat: 增加工具调用超时时间配置 2025-04-24 17:09:52 +08:00
ageerle
8fc7ad0359 feat: mcp开启后才执行工具调用 2025-04-24 10:31:58 +08:00
ageer
8a89d9eb9c fix: 1.合并知识库对话接口 2.修复web无法查询套餐信息 2025-04-23 23:10:31 +08:00
ageer
abfa9ae97b fix: 1.合并知识库对话接口 2.修复web无法查询套餐信息 2025-04-23 23:09:56 +08:00
ageer
bde2e8ff8e fix: 1.合并知识库对话接口 2.修复web无法查询套餐信息 2025-04-23 23:09:22 +08:00
ageer
4d8eb1850f feat: 附件上传逻辑调整 2025-04-22 21:43:40 +08:00
ageer
5aaa3a5662 fix: 1. 修复No static resource tool/gen/list. 2. 修复新增数据库校验异常 2025-04-22 21:24:00 +08:00
ageerle
8fec96f5b2 feat: 默认关闭mcp功能 2025-04-22 18:01:40 +08:00
ageerle
15c306eca2 fix: 根据不同的模型构建对话客户端 2025-04-22 11:28:10 +08:00
ageerle
620ea1fc76 fix: 系统提示词非必填 2025-04-22 11:06:38 +08:00
ageerle
c5c375dc6d fix: 扣费时无法获取用户id 2025-04-22 10:43:54 +08:00
ageerle
1b793e822a fix: 扣费时无法获取用户id 2025-04-22 10:40:36 +08:00
ageerle
6281840f36 fix: 修复后台管理系统登录异常 2025-04-22 09:12:56 +08:00
ageer
f5daa7eb78 feat: 设置server-filesystem默认路径为D盘 防止启动报错 2025-04-21 20:34:05 +08:00
ageer
52cb563383 fix(1.修复/store/appList404 2.修复无法查询数据库 3.修复请求地址'/chat/config/configKey/logoImage',发生系统异常): 2025-04-21 20:16:53 +08:00
ageerle
69efc3261e Merge branch 'dev' 2025-04-21 09:44:09 +08:00
ageerle
fb19fb29cc feat: 移除文件 2025-04-21 09:43:09 +08:00
ageer
9f257cf712 feat: mcp升级依赖 2025-04-20 22:52:09 +08:00
ageer
4af26fe4b4 feat: mcp升级依赖 2025-04-20 22:52:00 +08:00
ageerle
ab2a118ee9 feat: 更新项目说明 2025-04-18 11:11:48 +08:00
ageerle
9cd97a4dc5 feat: mcp支持远程调用 2025-04-18 10:55:42 +08:00
ageerle
788b372e32 feat: mcp支持远程调用 2025-04-17 16:23:32 +08:00
lh
744f9b6c7f 更新readme.md 2025-04-17 11:09:00 +08:00
ageer
761d954ef1 feat: mcp 1.0.0 2025-04-16 21:56:05 +08:00
ageerle
d1006f50ad feat: mcp-1.0.0 2025-04-16 10:25:10 +08:00
ageerle
f24ff5bbdd feat: mcp 测试版本 2025-04-15 17:34:21 +08:00
ageer
a4314dbbde feat: mcp测试版 2025-04-14 23:10:17 +08:00
ageerle
188dc1e55e feat: mcp 测试版本 2025-04-14 17:23:33 +08:00
ageer
731352fd04 feat: mcp测试版 2025-04-14 00:22:21 +08:00
ageer
4b53939002 feat: mcp支持,模块重构 2025-04-12 15:18:16 +08:00
lh
b50c15755d 更新readme.md 2025-04-12 14:19:51 +08:00
ageer
0dc6262b39 feat: mcp支持 2025-04-12 10:09:01 +08:00
ageer
9b32e3b3b2 feat: mcp支持 2025-04-12 10:08:51 +08:00
ageerle
37a8b7dad3 feat: 对话模块重构 2025-04-11 15:47:05 +08:00
ageerle
efeb0bd6fb fix: ollama兼容联网查询 知识库检索 2025-04-11 12:05:13 +08:00
ageerle
af33040117 fix: 语音功能无法使用 2025-04-11 10:45:02 +08:00
ageerle
ac4c037634 feat: 重构模块 2025-04-11 09:51:23 +08:00
ageerle
9734ec53f7 feat: 重构模块 2025-04-11 09:34:37 +08:00
ageer
2b8a92c7d6 fix: 重构模块 2025-04-10 22:18:44 +08:00
ageer
adb4538317 fix: 修复使用本地向量模型只能检索到一条知识内容 2025-04-10 21:39:31 +08:00
ageerle
2509099146 feat: 重构模块 2025-04-10 17:25:23 +08:00
ageerle
3be9005f95 feat: 调整知识库模块 2025-04-09 17:41:29 +08:00
ageerle
be6d027cad feat: 删除代码生成脚本 2025-04-09 09:42:14 +08:00
ageerle
3d679f8749 Merge remote-tracking branch 'origin/dev' into dev 2025-04-09 09:40:28 +08:00
ageer
5a5a48e153 feat: ruoyi-chat-api模块调整 2025-04-09 09:40:17 +08:00
ageer
e5da648941 feat: 代码生成脚本 2025-04-08 21:30:01 +08:00
ageerle
d2755f00bc feat: 测试版本提交 2025-04-08 16:48:06 +08:00
lh
09abc0b5af 新增讨论群信息 2025-04-08 14:05:05 +08:00
ageerle
00f362acf1 Merge remote-tracking branch 'origin/main' 2025-04-08 11:11:10 +08:00
ageerle
65d479458e fix: 修复部门树无法加载 2025-04-08 11:11:00 +08:00
ageerle
57e17e0dda Merge pull request #58 from winkeylucky/winkey-0407-02
修改应用使用,通过配置的应用的appid modelname字段关联 0407 02
2025-04-08 09:12:50 +08:00
winkey
691d1735fc 数据库更新 2025-04-07 22:42:06 +08:00
winkey
360984bc4b 应用增加系统角色提示词 2025-04-07 22:41:56 +08:00
winkey
0153f004f4 修改应用使用,通过配置的应用的appid modelname字段关联 2025-04-07 22:41:33 +08:00
ageerle
cc23508527 Merge pull request #57 from winkeylucky/winkey_0407
向量模型通过模型管理获取配置
2025-04-07 16:00:33 +08:00
winkey
c884f4f2d3 向量模型插入模型库sql 2025-04-07 15:27:20 +08:00
winkey
fab6de1f5c 知识库对话修改 2025-04-07 15:16:50 +08:00
winkey
c02f66636d 向量模型通过模型管理获取配置 2025-04-07 15:16:31 +08:00
ageerle
c1162148b1 Merge pull request #50 from winkeylucky/winkey-0502
解决登录异常_和公共资源例外 0502
2025-04-07 14:02:35 +08:00
ageerle
f76fdbf3ad Merge pull request #46 from winkeylucky/winkey-main
增加deepseek深度思考返回
2025-04-07 14:02:18 +08:00
winkey
feca08b3ec 获取公告和版权信息权限例外 2025-04-02 15:13:53 +08:00
winkey
72675b17c4 解决登录异常问题 2025-04-02 15:13:39 +08:00
ageerle
9ea5186f49 feat: 微信机器人应用脚本 2025-04-02 10:51:53 +08:00
winkey
d0a2eadc38 增加deepseek深度思考返回 2025-04-01 13:34:31 +08:00
ageer
ae141a6591 feat: 更新SQL脚本(本次更新范围较大,请先备份再拉取代码) 2025-03-31 20:12:31 +08:00
ageer
d3f4d7b8ca feat: 配置信息数据脱敏 2025-03-31 19:55:44 +08:00
ageer
b8e7a406d3 feat: 1. 调整项目结构 2.增加插件管理 2025-03-31 19:14:55 +08:00
ageer
412e8bdc10 feat: 1. 调整项目结构 2.增加插件管理 2025-03-31 19:13:27 +08:00
1856 changed files with 73995 additions and 190139 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.

378
README.md
View File

@@ -1,10 +1,6 @@
# RuoYi AI
<!-- PROJECT SHIELDS -->
<div align="center">
[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
@@ -13,227 +9,199 @@
[![MIT License][license-shield]][license-url]
<!-- PROJECT LOGO -->
<br />
<img style="text-align: center;" src="image/00.png" alt="Logo" width="150" height="150">
<h3 style="text-align: center;">快速搭建属于自己的 AI 助手平台</h3>
<p style="text-align: center;">
全新升级,开箱即用,简单高效
<br />
<a href="https://doc.pandarobot.chat"><strong>探索本项目的文档 »</strong></a>
<br />
<br />
<a href="https://web.pandarobot.chat">项目预览</a>
·
<a href="https://github.com/ageerle/ruoyi-ai/issues">报告Bug</a>
·
<a href="https://github.com/ageerle/ruoyi-ai/issues">提出新特性</a>
<p align="center">
<a href="https://trendshift.io/repositories/13209">
<img src="https://trendshift.io/api/badge/repositories/13209" alt="GitHub Trending">
</a>
</p>
## 目录
- [源码地址](#源码地址)
- [特色功能](#特色功能)
- [项目演示](#项目演示)
- [后台管理](#后台管理)
- [用户端](#用户端)
- [小程序端](#小程序端)
- [开发前的配置要求](#开发前的配置要求)
- [文件目录说明](#文件目录说明)
- [使用到的框架](#使用到的框架)
- [贡献者](#贡献者)
- [如何参与开源项目](#如何参与开源项目)
- [版本控制](#版本控制)
- [作者](#作者)
- [鸣谢](#鸣谢)
<img src="image/00.png" alt="RuoYi AI Logo" width="120" height="120">
### 源码地址
- 项目文档: https://doc.pandarobot.chat
- 前端-后台管理: https://github.com/ageerle/ruoyi-admin
- 前端-用户端: https://github.com/ageerle/ruoyi-web
- 小程序端: https://github.com/ageerle/ruoyi-uniapp
- 演示地址: https://web.pandarobot.chat
- 后台管理: https://admin.pandarobot.chat
- 用户名: admin 密码admin123
-
### gitcode源码地址
- https://gitcode.com/ageerle/ruoyi-ai
- https://gitcode.com/ageerle/ruoyi-web
- https://gitcode.com/ageerle/ruoyi-admin
- https://gitcode.com/ageerle/ruoyi-uniapp
### 企业级AI助手平台
### 特色功能
1. 全套开源系统提供完整的前端应用、后台管理以及小程序应用基于MIT协议开箱即用。
2. 本地RAG方案集成Milvus/Weaviate向量库、本地向量化模型与Ollama实现本地化RAG
3. 丰富插件功能支持联网、SQL查询插件及Text2API插件扩展系统能力与应用场景。
4. 内置SSE、websocket等网络协议支持对接多种大语言模型同时还集成了MidJourney和DALLE AI绘画功能
5. 强大的多媒体功能支持AI翻译、PPT制作、语音克隆和翻唱等
6. 扩展功能:支持将大模型接入个人或企业微信
7. 支付功能:支持易支付、微信支付等多种支付方式
*开箱即用的智能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)**
#### 后台管理
<div style="display: flex; flex-wrap: wrap; gap: 20px; justify-content: center;">
<img src="image/02.png" alt="drawing" style="width: 600px; height: 300px; border: 2px solid #ddd; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.1);"/>
<img src="image/03.png" alt="drawing" style="width: 600px; height: 300px; border: 2px solid #ddd; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.1);"/>
<img src="image/04.png" alt="drawing" style="width: 600px; height: 300px; border: 2px solid #ddd; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.1);"/>
<img src="image/05.png" alt="drawing" style="width: 600px; height: 300px; border: 2px solid #ddd; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.1);"/>
</div>
## ✨ 核心亮点
### 智能AI引擎
- **多模型接入**:支持 OpenAI GPT-4、Azure、ChatGLM、通义千问、智谱AI 等主流模型
- **AI平台集成**:深度集成 **FastGPT**、**扣子(Coze)**、**DIFY** 等主流AI应用平台
- **Spring AI MCP 集成**基于模型上下文协议打造可扩展的AI工具生态系统
- **实时流式对话**:采用 SSE/WebSocket 技术,提供丝滑的对话体验
- **AI 编程助手**:内置智能代码分析和项目脚手架生成能力
### AI平台生态集成
- **FastGPT 深度集成**:原生支持 FastGPT API包括知识库检索、工作流编排和上下文管理
- **扣子(Coze) 官方SDK**集成字节跳动扣子平台官方SDK支持Bot对话和流式响应
- **DIFY 完整兼容**:使用 DIFY Java Client支持应用编排、工作流和知识库管理
- **统一聊天接口**:提供统一的聊天服务接口,支持多平台无缝切换和负载均衡
### 本地化RAG方案
- **私有知识库**:基于 Langchain4j 框架 + BGE-large-zh-v1.5 中文向量模型
- **多种向量库**:支持 Milvus、Weaviate、Qdrant 等主流向量数据库
- **数据安全可控**:支持完全本地部署,保护企业数据隐私
- **灵活模型部署**:兼容 Ollama、vLLM 等本地推理框架
### AI创作工具
- **AI 绘画创作**:深度集成 DALL·E-3、MidJourney、Stable Diffusion
- **智能PPT生成**:一键将文本内容转换为精美演示文稿
- **多模态理解**:支持文本、图片、文档等多种格式的智能处理
### 知识图谱与智能编排
- **知识图谱构建**:自动从文档和对话中提取实体关系,构建可视化知识网络
- **AI 流程编排**可视化工作流设计器支持复杂AI任务的编排和自动化执行
- **数字人交互**:集成数字人形象,提供更自然的人机交互体验
- **智能推理引擎**:基于知识图谱的智能推理和问答能力
## 🚀 快速体验
### 在线演示
- **用户端体验**[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) |
| 🛠️ 管理后台 | [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 仓库 |
|:-----:|:----------------------------------------------------------------------:|:----------------------------------------------------------------:|
| 前端简化版 | [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 流式响应
- **系统监控**:完善的日志体系、性能监控、服务健康检查
## 📚 使用文档
想要深入了解安装部署、功能配置和二次开发?
**👉 [完整使用文档](https://doc.pandarobot.chat)**
遇到知识库或 RAG 回答异常问题?
**👉 [RAG 回答异常排查手册](docs/troubleshooting/rag-failures.md)**
---
## 🤝 参与贡献
我们热烈欢迎社区贡献!无论您是资深开发者还是初学者,都可以为项目贡献力量 💪
### 贡献方式
1. **Fork** 项目到您的账户
2. **创建分支** (`git checkout -b feature/新功能名称`)
3. **提交代码** (`git commit -m '添加某某功能'`)
4. **推送分支** (`git push origin feature/新功能名称`)
5. **发起 Pull Request**
> 💡 **小贴士**:建议将 PR 提交到 GitHub我们会自动同步到其他代码托管平台
## 📄 开源协议
本项目采用 **MIT 开源协议**,详情请查看 [LICENSE](LICENSE) 文件。
## 🙏 特别鸣谢
感谢以下优秀的开源项目为本项目提供支持:
- [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) - 成熟的企业级快速开发框架
- [Vben Admin](https://github.com/vbenjs/vue-vben-admin) - 现代化的 Vue 后台管理模板
- [chatgpt-java](https://github.com/Grt1228/chatgpt-java) - 优秀的 ChatGPT Java SDK
## 🌐 生态伙伴
- [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模型算力聚合超市云服务。
## 💬 社区交流
<div align="center">
<table>
<tr>
<td align="center">
<img src="image/wx.png" alt="微信二维码" width="200" height="200"><br>
<strong>扫码添加作者微信</strong><br>
<em>邀请进群学习</em>
</td>
<td align="center">
<img src="image/qq.png" alt="QQ群二维码" width="200" height="200"><br>
<strong>QQ技术交流群</strong><br>
<em>技术讨论</em>
</td>
</tr>
</table>
#### 用户端
<div style="display: flex; flex-wrap: wrap; gap: 20px; justify-content: center;">
<img src="image/08.png" alt="drawing" style="width: 600px; height: 300px; border: 2px solid #ddd; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.1);"/>
<img src="image/09.png" alt="drawing" style="width: 600px; height: 300px; border: 2px solid #ddd; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.1);"/>
<img src="image/10.png" alt="drawing" style="width: 600px; height: 300px; border: 2px solid #ddd; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.1);"/>
<img src="image/11.png" alt="drawing" style="width: 600px; height: 300px; border: 2px solid #ddd; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.1);"/>
</div>
#### 小程序端
<div style="display: flex; flex-wrap: wrap; gap: 20px; justify-content: flex-start;">
<img src="image/06.png" alt="drawing" style="width: 320px; height: 600px; border: 2px solid #ddd; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.1);"/>
<img src="image/07.png" alt="drawing" style="width: 320px; height: 600px; border: 2px solid #ddd; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.1);"/>
---
<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)**
*用 ❤️ 打造,由 RuoYi AI 开源社区维护*
</div>
### 开发前的配置要求
<!-- Badge Links -->
1. jdk 17
2. mysql 5.7、8.0
3. redis 版本必须 >= 5.X
4. maven 3.8+
5. nodejs 20+ & pnpm
### 文件目录说明
RuoYi-AI
```
├─ ruoyi-admin // 管理模块
│ └─ RuoYiApplication // 启动类
│ └─ RuoYiServletInitializer // 容器部署初始化类
│ └─ resources // 资源文件
│ └─ i18n/messages.properties // 国际化配置文件
│ └─ application.yml // 框架总配置文件
│ └─ application-dev.yml // 开发环境配置文件
│ └─ application-prod.yml // 生产环境配置文件
│ └─ banner.txt // 框架启动图标
│ └─ logback-plus.xml // 日志配置文件
│ └─ ip2region.xdb // IP区域地址库
├─ ruoyi-common // 通用模块
│ └─ ruoyi-common-bom // common依赖包管理
└─ ruoyi-common-chat // 聊天模块
│ └─ ruoyi-common-core // 核心模块
│ └─ ruoyi-common-doc // 系统接口模块
│ └─ ruoyi-common-encrypt // 数据加解密模块
│ └─ ruoyi-common-excel // excel模块
│ └─ ruoyi-common-idempotent // 幂等功能模块
│ └─ ruoyi-common-json // 序列化模块
│ └─ ruoyi-common-log // 日志模块
│ └─ ruoyi-common-mail // 邮件模块
│ └─ ruoyi-common-mybatis // 数据库模块
│ └─ ruoyi-common-oss // oss服务模块
│ └─ ruoyi-common-pay // 支付模块
│ └─ ruoyi-common-ratelimiter // 限流功能模块
│ └─ ruoyi-common-redis // 缓存服务模块
│ └─ ruoyi-common-satoken // satoken模块
│ └─ ruoyi-common-security // 安全模块
│ └─ ruoyi-common-sensitive // 脱敏模块
│ └─ ruoyi-common-sms // 短信模块
│ └─ ruoyi-common-tenant // 租户模块
│ └─ ruoyi-common-translation // 通用翻译模块
│ └─ ruoyi-common-web // web模块
├─ ruoyi-modules // 模块组
│ └─ ruoyi-demo // 演示模块
│ └─ ruoyi-system // 业务模块
├─ .run // 执行脚本文件
├─ .editorconfig // 编辑器编码格式配置
├─ LICENSE // 开源协议
├─ pom.xml // 公共依赖
├─ README.md // 框架说明文件
```
### 版本控制
该项目使用Git进行版本管理。您可以在repository参看当前可用版本。
### 版权说明
该项目使用了MIT授权许可详情请参阅 [LICENSE.txt](https://github.com/ageerle/ruoyi-ai/blob/main/LICENSE)
### 作者寄语
最近我们的项目意外地受到了广泛关注甚至被许多人误以为是一个已经成熟且能够快速落地的项目。然而事实并非如此。这个项目是我个人在业余时间进行的研究主要目的是学习和探索。它是一个以人工智能AI为核心的平台旨在帮助企业通过配置的方式快速构建AI应用。
#### 项目现状
目前项目还处于早期阶段距离成熟还有很长的路要走。由于个人精力有限项目的发展速度受到了一定的限制。为了加快项目的进度我真诚地希望更多人能够参与到项目中来。无论是经验丰富的开发者还是刚刚入门的小白我都热烈欢迎你们提交Pull RequestPR。即使代码修改得很少或者存在一些错误都没有关系。我会认真审核每一位贡献者的代码并和大家一起完善项目。
#### 开发计划
- 智能体管理
通过设置提示词、插件、知识库等用户可以快速构建一个AI应用。这将极大地简化AI应用的开发流程降低开发门槛使更多企业能够轻松地利用AI技术。
<div>
<img src="image/13.png" alt="drawing" width="600px" height="300px"/>
</div>
- 流程编排
通过流程编排功能,用户可以将不同的模型按照业务逻辑进行有序连接。这将解决单一模型能力不足的问题,充分发挥多个模型的协同作用,从而更好地满足企业的复杂业务需求。
- 感谢
最后我要感谢RuoYi-Vue-Plus、chatgpt-java、chatgpt-web-midjourney-proxy等优秀框架。正是因为这些项目的开源和共享我才能够在这个基础上进行开发使我们的项目能够取得今天的成果。再次感谢这些项目及其背后的开发者们
希望更多志同道合的朋友能够加入我们共同推动这个项目的发展。让我们一起努力将这个项目打造成一个真正成熟、实用的AI平台
#### 如何参与开源项目
贡献使开源社区成为一个学习、激励和创造的绝佳场所。你所作的任何贡献都是**非常感谢**的。
1. Fork 这个项目
2. 创建你的功能分支 (`git checkout -b feature/dev`)
3. 提交你的更改 (`git commit -m 'Add some dev'`)
4. 推送到分支 (`git push origin feature/dev`)
5. 打开拉取请求
6. pr请提交到GitHub上会定时同步到gitee
#### 项目文档
1. 项目文档基于vitepress构建
2. 按照[如何参与开源项目](#如何参与开源项目)拉取 https://github.com/ageerle/ruoyi-doc
3. 安装依赖npm install
4. 启动项目npm run docs:dev
5. 主页路径docs/guide/introduction/index.md
### 鸣谢
- [chatgpt-java](https://github.com/Grt1228/chatgpt-java)
- [RuoYi-Vue-Plus](https://gitee.com/dromara/RuoYi-Vue-Plus)
- [chatgpt-web-midjourney-proxy](https://github.com/Dooy/chatgpt-web-midjourney-proxy)
- [Vben Admin](https://github.com/vbenjs/vue-vben-admin)
- [Naive UI](https://www.naiveui.com)
<!-- links -->
[your-project-path]:https://github.com/ageerle/ruoyi-ai
[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://img.shields.io/github/issues/ageerle/ruoyi-ai.svg
[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/master/LICENSE.txt
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=flat-square&logo=linkedin&colorB=555
[license-url]: https://github.com/ageerle/ruoyi-ai/blob/main/LICENSE

200
README_EN.md Normal file
View File

@@ -0,0 +1,200 @@
# RuoYi AI
<div align="center">
[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![MIT License][license-shield]][license-url]
<img src="image/00.png" alt="RuoYi AI Logo" width="120" height="120">
### Enterprise-Grade AI Assistant Platform
*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)**
</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
- **Streaming Chat**: Real-time SSE/WebSocket communication
- **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
- **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
### 🧠 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) |
| 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) |
## 🛠️ 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
## 📚 Documentation
For detailed setup, configuration, and development guides, visit our comprehensive documentation:
**[📖 Official Documentation](https://doc.pandarobot.chat)**
## 🤝 Contributing
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'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request
*Please submit PRs to GitHub - they will be synchronized to other platforms automatically.*
## 📄 License
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](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
- [Vben Admin](https://github.com/vbenjs/vue-vben-admin) - Vue admin template
- [chatgpt-java](https://github.com/Grt1228/chatgpt-java) - ChatGPT Java SDK
## 🌐 Ecosystem Partners
- [PPIO Cloud](https://ppinfra.com/user/register?invited_by=P8QTUY&utm_source=github_ruoyi-ai) - Cost-effective GPU
containers and model APIs
## 💬 Community
<div align="center">
<table>
<tr>
<td align="center">
<img src="image/wx.png" alt="WeChat" width="200" height="200"><br>
<strong>Add Author WeChat</strong><br>
<em>Scan to join learning group</em>
</td>
<td align="center">
<img src="image/qq.png" alt="QQ Group" width="200" height="200"><br>
<strong>QQ Group</strong><br>
<em>Technical discussion</em>
</td>
</tr>
</table>
</div>
---
<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)**
*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"
}
}
```
### 异常情况
- 当上传文件为空时,返回错误信息:"上传文件不能为空"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 232 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 329 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 284 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 674 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 KiB

BIN
image/qq.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 KiB

BIN
image/wx.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

163
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>
@@ -14,52 +14,53 @@
<properties>
<revision>1.0.0</revision>
<spring-boot.version>3.0.6</spring-boot.version>
<spring-boot.version>3.4.4</spring-boot.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>17</java.version>
<spring-boot.mybatis>3.0.1</spring-boot.mybatis>
<springdoc.version>2.1.0</springdoc.version>
<mysql.version>8.0.33</mysql.version>
<mybatis.version>3.5.16</mybatis.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>
<velocity.version>2.3</velocity.version>
<satoken.version>1.34.0</satoken.version>
<mybatis-plus.version>3.5.3.1</mybatis-plus.version>
<mybatis-plus.version>3.5.11</mybatis-plus.version>
<p6spy.version>3.9.1</p6spy.version>
<hutool.version>5.8.18</hutool.version>
<hutool.version>5.8.35</hutool.version>
<okhttp.version>4.10.0</okhttp.version>
<dynamic-ds.version>4.3.1</dynamic-ds.version>
<spring-boot-admin.version>3.0.3</spring-boot-admin.version>
<redisson.version>3.20.1</redisson.version>
<lock4j.version>2.2.4</lock4j.version>
<dynamic-ds.version>3.6.1</dynamic-ds.version>
<alibaba-ttl.version>2.14.2</alibaba-ttl.version>
<xxl-job.version>2.4.0</xxl-job.version>
<mapstruct-plus.version>1.2.1</mapstruct-plus.version>
<mapstruct-plus.lombok.version>0.2.0</mapstruct-plus.lombok.version>
<lombok.version>1.18.26</lombok.version>
<bouncycastle.version>1.72</bouncycastle.version>
<!-- Apache Commons Compress 版本 -->
<commons-compress.version>1.26.2</commons-compress.version>
<!-- 离线IP地址定位库 -->
<ip2region.version>2.7.0</ip2region.version>
<!-- 临时修复 snakeyaml 漏洞 -->
<snakeyaml.version>1.33</snakeyaml.version>
<!-- OSS 配置 -->
<aws-java-sdk-s3.version>1.12.400</aws-java-sdk-s3.version>
<!-- SMS 配置 -->
<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>
<maven-compiler-plugin.verison>3.11.0</maven-compiler-plugin.verison>
<maven-surefire-plugin.version>3.0.0</maven-surefire-plugin.version>
<flatten-maven-plugin.version>1.3.0</flatten-maven-plugin.version>
<weixin-java-miniapp.version>4.5.0</weixin-java-miniapp.version>
<weixin-java-pay.version>4.6.0</weixin-java-pay.version>
<weixin-java-cp.version>4.6.0</weixin-java-cp.version>
</properties>
<profiles>
@@ -96,6 +97,12 @@
<dependencyManagement>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
<!-- SpringBoot的依赖配置-->
<dependency>
<groupId>org.springframework.boot</groupId>
@@ -194,22 +201,22 @@
<version>${satoken.version}</version>
</dependency>
<!-- dynamic-datasource 多数据源-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
<version>${dynamic-ds.version}</version>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>${spring-boot.mybatis}</version>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>${mybatis.version}</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
<version>${mybatis-plus.version}</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-jsqlparser</artifactId>
<version>${mybatis-plus.version}</version>
</dependency>
@@ -219,6 +226,13 @@
<version>${mybatis-plus.version}</version>
</dependency>
<!-- dynamic-datasource 多数据源-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot3-starter</artifactId>
<version>${dynamic-ds.version}</version>
</dependency>
<!-- sql性能分析插件 -->
<dependency>
<groupId>p6spy</groupId>
@@ -244,18 +258,6 @@
<version>${tencent.sms.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>de.codecentric</groupId>-->
<!-- <artifactId>spring-boot-admin-starter-server</artifactId>-->
<!-- <version>${spring-boot-admin.version}</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>de.codecentric</groupId>-->
<!-- <artifactId>spring-boot-admin-starter-client</artifactId>-->
<!-- <version>${spring-boot-admin.version}</version>-->
<!-- </dependency>-->
<!--redisson-->
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson-spring-boot-starter</artifactId>
@@ -268,26 +270,12 @@
<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>
<version>${alibaba-ttl.version}</version>
</dependency>
<!-- 临时修复 snakeyaml 漏洞 -->
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>${snakeyaml.version}</version>
</dependency>
<!-- 加密包引入 -->
<dependency>
<groupId>org.bouncycastle</groupId>
@@ -295,6 +283,13 @@
<version>${bouncycastle.version}</version>
</dependency>
<!-- Apache Commons Compress -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>${commons-compress.version}</version>
</dependency>
<dependency>
<groupId>io.github.linpeilie</groupId>
<artifactId>mapstruct-plus-spring-boot-starter</artifactId>
@@ -317,14 +312,25 @@
<dependency>
<groupId>org.ruoyi</groupId>
<artifactId>ruoyi-fusion</artifactId>
<artifactId>ruoyi-chat</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>org.ruoyi</groupId>
<artifactId>ruoyi-knowledge-api</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>org.ruoyi</groupId>
<artifactId>ruoyi-knowledge</artifactId>
<artifactId>ruoyi-chat-api</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>org.ruoyi</groupId>
<artifactId>ruoyi-system-api</artifactId>
<version>${revision}</version>
</dependency>
@@ -336,7 +342,47 @@
<dependency>
<groupId>org.ruoyi</groupId>
<artifactId>ruoyi-demo</artifactId>
<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>
@@ -344,10 +390,13 @@
</dependencyManagement>
<modules>
<module>ruoyi-admin</module>
<module>ruoyi-common</module>
<module>ruoyi-modules</module>
<module>ruoyi-modules-api</module>
<module>ruoyi-admin</module>
<module>ruoyi-extend</module>
</modules>
<packaging>pom</packaging>
<build>
@@ -476,6 +525,4 @@
</pluginRepository>
</pluginRepositories>
</project>
</project>

View File

@@ -1,35 +0,0 @@
#基础镜像
FROM findepi/graalvm:java17-native
# 设置环境变量
ENV LANG C.UTF-8
ENV LANGUAGE C.UTF-8
ENV LC_ALL C.UTF-8
ENV SERVER_PORT=6039
MAINTAINER ageerle
RUN mkdir -p /ruoyi/server/logs \
/ruoyi/server/temp \
/ruoyi/skywalking/agent
#工作空间
WORKDIR /ruoyi/server
EXPOSE ${SERVER_PORT}
ADD ./target/ruoyi-admin.jar ./app.jar
ENTRYPOINT ["java", \
"-Djava.security.egd=file:/dev/./urandom", \
"-Dserver.port=${SERVER_PORT}", \
# 应用名称 如果想区分集群节点监控 改成不同的名称即可
# "-Dskywalking.agent.service_name=ruoyi-server", \
# "-javaagent:/ruoyi/skywalking/agent/skywalking-agent.jar", \
"-jar", "app.jar"]

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>
@@ -42,11 +42,6 @@
<artifactId>mssql-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.ruoyi</groupId>
<artifactId>ruoyi-common-doc</artifactId>
</dependency>
<dependency>
<groupId>org.ruoyi</groupId>
<artifactId>ruoyi-system</artifactId>
@@ -54,12 +49,7 @@
<dependency>
<groupId>org.ruoyi</groupId>
<artifactId>ruoyi-fusion</artifactId>
</dependency>
<dependency>
<groupId>org.ruoyi</groupId>
<artifactId>ruoyi-knowledge</artifactId>
<artifactId>ruoyi-chat</artifactId>
</dependency>
<dependency>
@@ -67,29 +57,19 @@
<artifactId>ruoyi-generator</artifactId>
</dependency>
<!-- demo模块 -->
<!-- 知识图谱模块 -->
<dependency>
<groupId>org.ruoyi</groupId>
<artifactId>ruoyi-demo</artifactId>
<artifactId>ruoyi-graph</artifactId>
</dependency>
<dependency>
<groupId>org.ruoyi</groupId>
<artifactId>ruoyi-workflow</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- 添加thumbnailator依赖 -->
<dependency>
<groupId>net.coobird</groupId>
<artifactId>thumbnailator</artifactId>
<version>0.4.11</version>
</dependency>
<dependency>
<groupId>io.github.ollama4j</groupId>
<artifactId>ollama4j</artifactId>
<version>1.0.79</version>
<scope>compile</scope>
<groupId>org.ruoyi</groupId>
<artifactId>ruoyi-aihuman</artifactId>
</dependency>
</dependencies>

View File

@@ -3,13 +3,17 @@ package org.ruoyi;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.metrics.buffering.BufferingApplicationStartup;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
/**
* 启动程序
*
* @author Lion Li
*/
@SpringBootApplication
@SpringBootApplication(scanBasePackages = {"org.ruoyi", "org.ruoyi.aihuman"})
@EnableScheduling
@EnableAsync
public class RuoYiAIApplication {
public static void main(String[] args) {
@@ -18,4 +22,4 @@ public class RuoYiAIApplication {
application.run(args);
System.out.println("(♥◠‿◠)ノ゙ RuoYiAI启动成功 ლ(´ڡ`ლ)゙");
}
}
}

View File

@@ -2,16 +2,11 @@ package org.ruoyi.controller;
import cn.dev33.satoken.annotation.SaIgnore;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.json.JSONUtil;
import cn.hutool.json.ObjectMapper;
import me.chanjar.weixin.common.error.WxErrorException;
import jakarta.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor;
import org.ruoyi.common.core.constant.Constants;
import org.ruoyi.common.core.domain.R;
import org.ruoyi.common.core.domain.model.EmailLoginBody;
import org.ruoyi.common.core.domain.model.LoginBody;
import org.ruoyi.common.core.domain.model.RegisterBody;
import org.ruoyi.common.core.domain.model.SmsLoginBody;
import org.ruoyi.common.core.domain.model.VisitorLoginBody;
import org.ruoyi.common.core.domain.model.*;
import org.ruoyi.common.core.utils.MapstructUtils;
import org.ruoyi.common.core.utils.StreamUtils;
import org.ruoyi.common.core.utils.StringUtils;
@@ -19,16 +14,12 @@ import org.ruoyi.common.satoken.utils.LoginHelper;
import org.ruoyi.common.tenant.helper.TenantHelper;
import org.ruoyi.system.domain.bo.SysTenantBo;
import org.ruoyi.system.domain.vo.LoginTenantVo;
import org.ruoyi.system.domain.vo.LoginVo;
import org.ruoyi.system.domain.vo.SysTenantVo;
import org.ruoyi.system.domain.vo.TenantListVo;
import org.ruoyi.system.service.ISysTenantService;
import org.ruoyi.system.service.SysLoginService;
import org.ruoyi.system.service.SysRegisterService;
import org.ruoyi.system.domain.vo.LoginVo;
import jakarta.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@@ -51,15 +42,6 @@ public class AuthController {
private final SysRegisterService registerService;
private final ISysTenantService tenantService;
@PostMapping("/xcxLogin")
public R<LoginVo> login(@Validated @RequestBody String xcxCode) throws WxErrorException {
String openidFromCode = loginService.getOpenidFromCode((String) JSONUtil.parseObj(xcxCode).get("xcxCode"));
LoginVo loginVo = loginService.mpLogin(openidFromCode);
return R.ok(loginVo);
}
/**
* 登录方法
*
@@ -76,6 +58,8 @@ public class AuthController {
body.getUsername(), body.getPassword(),
body.getCode(), body.getUuid());
loginVo.setToken(token);
// 兼容后台管理登录
loginVo.setAccess_token(token);
loginVo.setUserInfo(LoginHelper.getLoginUser());
return R.ok(loginVo);
}

View File

@@ -5,10 +5,13 @@ import cn.hutool.captcha.AbstractCaptcha;
import cn.hutool.captcha.generator.CodeGenerator;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.RandomUtil;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.ruoyi.common.core.constant.Constants;
import org.ruoyi.common.core.constant.GlobalConstants;
import org.ruoyi.common.core.domain.R;
import org.ruoyi.common.core.exception.ServiceException;
import org.ruoyi.common.core.service.ConfigService;
import org.ruoyi.common.core.utils.SpringUtils;
import org.ruoyi.common.core.utils.StringUtils;
@@ -22,10 +25,6 @@ import org.ruoyi.common.web.config.properties.CaptchaProperties;
import org.ruoyi.common.web.enums.CaptchaType;
import org.ruoyi.system.domain.request.EmailRequest;
import org.ruoyi.system.domain.vo.CaptchaVo;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.expression.Expression;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.standard.SpelExpressionParser;
@@ -36,7 +35,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import java.time.Duration;
import java.util.*;
import java.util.HashMap;
import java.util.Map;
/**
* 验证码操作处理
@@ -67,7 +67,7 @@ public class CaptchaController {
String key = GlobalConstants.CAPTCHA_CODE_KEY + phonenumber;
String code = RandomUtil.randomNumbers(4);
RedisUtils.setCacheObject(key, code, Duration.ofMinutes(Constants.CAPTCHA_EXPIRATION));
// 验证码模板id 自行处理 (查数据库或写死均可)
// 验证码模板id
String templateId = "";
Map<String, String> map = new HashMap<>(1);
map.put("code", code);
@@ -90,18 +90,6 @@ public class CaptchaController {
String key = GlobalConstants.CAPTCHA_CODE_KEY + emailRequest.getUsername();
String code = RandomUtil.randomNumbers(4);
RedisUtils.setCacheObject(key, code, Duration.ofMinutes(Constants.CAPTCHA_EXPIRATION));
// 检验邮箱后缀
String suffix = configService.getConfigValue("mail", "suffix");
String prompt = configService.getConfigValue("mail", "prompt");
if(StringUtils.isNotEmpty(suffix)){
// 动态的域名列表
String[] invalidDomains = suffix.split(",");
for (String domain : invalidDomains) {
if (emailRequest.getUsername().endsWith(domain)) {
throw new ServiceException(prompt);
}
}
}
// 自定义邮箱模板
String model = configService.getConfigValue("mail", "mailModel");
String mailTitle = configService.getConfigValue("mail", "mailTitle");

View File

@@ -1,7 +1,6 @@
package org.ruoyi.controller;
import cn.dev33.satoken.annotation.SaIgnore;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -11,7 +10,6 @@ import org.springframework.web.bind.annotation.RestController;
* @author Lion Li
*/
@SaIgnore
@RequiredArgsConstructor
@RestController
public class IndexController {
@@ -20,7 +18,8 @@ public class IndexController {
*/
@GetMapping("/")
public String index() {
return "RuoYi-AI 启动成功";
return "RuoYi AI启动成功";
}
}

View File

@@ -1,208 +0,0 @@
package org.ruoyi.controller;
import cn.dev33.satoken.stp.StpUtil;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.ruoyi.common.chat.config.ChatConfig;
import org.ruoyi.common.chat.domain.request.ChatRequest;
import org.ruoyi.common.chat.entity.chat.ChatCompletion;
import org.ruoyi.common.chat.entity.chat.Message;
import org.ruoyi.common.chat.openai.OpenAiStreamClient;
import org.ruoyi.common.core.domain.R;
import org.ruoyi.common.core.validate.AddGroup;
import org.ruoyi.common.excel.utils.ExcelUtil;
import org.ruoyi.common.log.annotation.Log;
import org.ruoyi.common.log.enums.BusinessType;
import org.ruoyi.common.mybatis.core.page.PageQuery;
import org.ruoyi.common.mybatis.core.page.TableDataInfo;
import org.ruoyi.common.satoken.utils.LoginHelper;
import org.ruoyi.common.web.core.BaseController;
import org.ruoyi.knowledge.domain.bo.KnowledgeAttachBo;
import org.ruoyi.knowledge.domain.bo.KnowledgeFragmentBo;
import org.ruoyi.knowledge.domain.bo.KnowledgeInfoBo;
import org.ruoyi.knowledge.domain.req.KnowledgeInfoUploadRequest;
import org.ruoyi.knowledge.domain.vo.KnowledgeAttachVo;
import org.ruoyi.knowledge.domain.vo.KnowledgeFragmentVo;
import org.ruoyi.knowledge.domain.vo.KnowledgeInfoVo;
import org.ruoyi.knowledge.service.EmbeddingService;
import org.ruoyi.knowledge.service.IKnowledgeAttachService;
import org.ruoyi.knowledge.service.IKnowledgeFragmentService;
import org.ruoyi.knowledge.service.IKnowledgeInfoService;
import org.ruoyi.system.listener.SSEEventSourceListener;
import org.ruoyi.system.service.ISseService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.ruoyi.knowledge.chain.vectorstore.VectorStore;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
import java.util.List;
/**
* 知识库
*
* @author Lion Li
* @date 2024-10-21
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/knowledge")
public class KnowledgeController extends BaseController {
private final IKnowledgeInfoService knowledgeInfoService;
private final VectorStore vectorStore;
private final IKnowledgeAttachService attachService;
private final IKnowledgeFragmentService fragmentService;
private final EmbeddingService embeddingService;
private OpenAiStreamClient openAiStreamClient;
private final ChatConfig chatConfig;
private final ISseService sseService;
/**
* 知识库对话
*/
@PostMapping("/send")
public SseEmitter send(@RequestBody @Valid ChatRequest chatRequest) {
openAiStreamClient = chatConfig.getOpenAiStreamClient();
SseEmitter sseEmitter = new SseEmitter(0L);
SSEEventSourceListener openAIEventSourceListener = new SSEEventSourceListener(sseEmitter);
List<Message> messages = chatRequest.getMessages();
String content = messages.get(messages.size() - 1).getContent().toString();
List<String> nearestList;
List<Double> queryVector = embeddingService.getQueryVector(content, chatRequest.getKid());
nearestList = vectorStore.nearest(queryVector,chatRequest.getKid());
for (String prompt : nearestList) {
Message sysMessage = Message.builder().content(prompt).role(Message.Role.USER).build();
messages.add(sysMessage);
}
Message userMessage = Message.builder().content(content + (nearestList.size() > 0 ? "\n\n注意回答问题时须严格根据我给你的系统上下文内容原文进行回答请不要自己发挥,回答时保持原来文本的段落层级" : "") ).role(Message.Role.USER).build();
messages.add(userMessage);
if (chatRequest.getModel().startsWith("ollama")) {
return sseService.ollamaChat(chatRequest);
}
ChatCompletion completion = ChatCompletion
.builder()
.messages(messages)
.model(chatRequest.getModel())
.temperature(chatRequest.getTemperature())
.topP(chatRequest.getTop_p())
.stream(true)
.build();
openAiStreamClient.streamChatCompletion(completion, openAIEventSourceListener);
return sseEmitter;
}
/**
* 根据用户信息查询本地知识库
*/
@GetMapping("/list")
public TableDataInfo<KnowledgeInfoVo> list(KnowledgeInfoBo bo, PageQuery pageQuery) {
if(!StpUtil.isLogin()){
return null;
}
bo.setUid(LoginHelper.getUserId());
return knowledgeInfoService.queryPageList(bo, pageQuery);
}
/**
* 新增知识库
*/
@Log(title = "知识库", businessType = BusinessType.INSERT)
@PostMapping("/save")
public R<Void> save(@Validated(AddGroup.class) @RequestBody KnowledgeInfoBo bo) {
knowledgeInfoService.saveOne(bo);
return R.ok();
}
/**
* 删除知识库
*/
@PostMapping("/remove/{id}")
public R<String> remove(@PathVariable String id){
knowledgeInfoService.removeKnowledge(id);
return R.ok("删除知识库成功!");
}
/**
* 修改知识库
*/
@Log(title = "知识库", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
public R<Void> edit( @RequestBody KnowledgeInfoBo bo) {
return toAjax(knowledgeInfoService.updateByBo(bo));
}
/**
* 导出知识库列表
*/
@Log(title = "知识库", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(KnowledgeInfoBo bo, HttpServletResponse response) {
List<KnowledgeInfoVo> list = knowledgeInfoService.queryList(bo);
ExcelUtil.exportExcel(list, "知识库", KnowledgeInfoVo.class, response);
}
/**
* 查询知识附件信息
*/
@GetMapping("/detail/{kid}")
public TableDataInfo<KnowledgeAttachVo> attach(KnowledgeAttachBo bo, PageQuery pageQuery,@PathVariable String kid){
bo.setKid(kid);
return attachService.queryPageList(bo, pageQuery);
}
/**
* 上传知识库附件
*/
@PostMapping(value = "/attach/upload")
public R<String> upload(KnowledgeInfoUploadRequest request){
knowledgeInfoService.upload(request);
return R.ok("上传知识库附件成功!");
}
/**
* 获取知识库附件详细信息
*
* @param id 主键
*/
@GetMapping("attach/info/{id}")
public R<KnowledgeAttachVo> getAttachInfo(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
return R.ok(attachService.queryById(id));
}
/**
* 删除知识库附件
*
*/
@PostMapping("attach/remove/{docId}")
public R<Void> removeAttach(@NotEmpty(message = "主键不能为空") @PathVariable String docId) {
attachService.removeKnowledgeAttach(docId);
return R.ok();
}
/**
* 查询知识片段
*/
@GetMapping("/fragment/list/{docId}")
public TableDataInfo<KnowledgeFragmentVo> fragmentList(KnowledgeFragmentBo bo, PageQuery pageQuery, @PathVariable String docId) {
bo.setDocId(docId);
return fragmentService.queryPageList(bo, pageQuery);
}
}

View File

@@ -1,13 +1,3 @@
--- # 监控中心配置
spring.boot.admin.client:
# 增加客户端开关
enabled: false
url: http://localhost:9090/admin
instance:
service-host-type: IP
username: ruoyi
password: 123456
--- # 数据源配置
spring:
datasource:
@@ -25,10 +15,9 @@ spring:
master:
type: ${spring.datasource.type}
driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://43.139.70.230:3306/ruoyi-ai?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
username: ruoyi-ai
password: ruoyi-ai
url: jdbc:mysql://127.0.0.1:3306/ruoyi-ai?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
username: root
password: root
hikari:
# 最大连接池数量
@@ -47,6 +36,8 @@ spring:
connectionTestQuery: SELECT 1
# 多久检查一次连接的活性
keepaliveTime: 30000
mail:
username: xx
--- # redis 单机配置(单机与集群只能开启一个另一个需要注释掉)
spring.data:
@@ -61,9 +52,6 @@ spring.data:
# password: 123456
# 连接超时时间
timeout: 10S
# 是否开启ssl
ssl: false
redisson:
# redis key前缀
keyPrefix:
@@ -97,3 +85,24 @@ sms:
signName: 测试
# 腾讯专用
sdkAppId:
pdf:
extract:
service:
url: http://localhost:8080
ai-api:
url: https://api.pandarobot.chat/v1/chat/completions
key: sk-xxxx
transition:
# 是否开启mineru
enable-minerU: true
# mineru conda环境路径
conda-env-path: "F:\\ProgramData\\Computer\\Anaconda\\envs\\mineru"
# 是否开启图片OCR
enable-ocr: true

View File

@@ -1,16 +1,13 @@
# 项目相关配置
ruoyi:
# 名称
name: "ruoyi"
name: "ruoyi-ai"
# 版本
version: ${revision}
# 版权年份
copyrightYear: 2025
# 实例演示开关
demoEnabled: true
# 获取ip地址开关
addressEnabled: false
demoEnabled: false
captcha:
enable: false
@@ -51,6 +48,8 @@ logging:
level:
org.ruoyi: @logging.level@
org.springframework: warn
org.mybatis.spring.mapper: error
org.apache.fury: warn
config: classpath:logback-plus.xml
# 用户配置
@@ -118,6 +117,8 @@ sa-token:
security:
# 排除路径
excludes:
# 获取模型信息
- /system/model/modelList
# 支付回调
- /pay/returnUrl
- /pay/notifyUrl
@@ -126,7 +127,12 @@ security:
# 重置密码
- /auth/reset/password
# 聊天接口
- /chat
- /chat/send
# 文件上传
- /chat/upload
# 代码生成调用
- /tool/gen/getByTableName
- /tool/gen/batchGenCode
# 静态资源
- /*.html
- /**/*.html
@@ -138,9 +144,20 @@ security:
# swagger 文档配置
- /*/api-docs
- /*/api-docs/**
- /v3/api-docs
- /v3/api-docs/**
- /v3/api-docs/swagger-config
- /swagger-ui.html
- /swagger-ui/**
- /doc.html
- /webjars/**
- /swagger-resources
- /swagger-resources/**
# actuator 监控配置
- /actuator
- /actuator/**
- /workflow/**
- /admin/workflow/**
# 多租户配置
tenant:
# 是否开启
@@ -155,6 +172,9 @@ tenant:
- sys_user_post
- sys_user_role
knowledge-role:
enable: false
# MyBatisPlus配置
# https://baomidou.com/config/
mybatis-plus:
@@ -179,7 +199,7 @@ mybatis-plus:
# 更详细的日志输出 会有性能损耗 org.apache.ibatis.logging.stdout.StdOutImpl
# 关闭日志记录 (可单纯使用 p6spy 分析) org.apache.ibatis.logging.nologging.NoLoggingImpl
# 默认日志输出 org.apache.ibatis.logging.slf4j.Slf4jImpl
logImpl: org.apache.ibatis.logging.nologging.NoLoggingImpl
logImpl: org.apache.ibatis.logging.slf4j.Slf4jImpl
global-config:
# 是否打印 Logo banner
banner: true
@@ -213,13 +233,18 @@ mybatis-encryptor:
publicKey:
privateKey:
# Swagger配置
swagger:
springdoc:
api-docs:
# 是否开启接口文档
enabled: true
# swagger-ui:
# # 持久化认证数据
# persistAuthorization: true
info:
# 标题
title: '标题:${ruoyi.name}多租户管理系统_接口文档'
title: '标题ruoyi-ai 接口文档'
# 描述
description: '描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...'
description: ''
# 版本
version: '版本号: ${ruoyi.version}'
# 作者信息
@@ -234,31 +259,20 @@ swagger:
type: APIKEY
in: HEADER
name: ${sa-token.token-name}
springdoc:
api-docs:
# 是否开启接口文档
enabled: true
swagger-ui:
# 持久化认证数据
persistAuthorization: true
#这里定义了两个分组,可定义多个,也可以不定义
group-configs:
- group: 1.演示模块
packages-to-scan: org.ruoyi.demo
- group: 2.通用模块
packages-to-scan: org.ruoyi.web
- group: 3.系统模块
packages-to-scan: org.ruoyi.system
- group: 4.代码生成模块
packages-to-scan: org.ruoyi.generator
packages-to-scan: org.ruoyi
knife4j:
enable: true
setting:
language: zh_cn
# 防止XSS攻击
xss:
# 过滤开关
enabled: true
# 排除链接(多个用逗号分隔)
excludes: /system/notice
excludes: /system/notice,/v3/api-docs/**,/doc.html,/swagger-ui/**,/swagger-ui.html,/swagger-resources/**,/webjars/**,/druid/**,/actuator/**,/favicon.ico
# 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/*
@@ -289,7 +303,12 @@ management:
show-details: ALWAYS
logfile:
external-file: ./logs/sys-console.log
health:
# 禁用 Neo4j 健康检查(当知识图谱功能未启用时)
neo4j:
enabled: false
# websocket
# websocket
websocket:
enabled: true
@@ -298,25 +317,88 @@ websocket:
# 设置访问源地址
allowedOrigins: '*'
# 微信小程序配置信息
wx:
miniapp:
configs:
- appid: # 你的appid
secret: # 你的secret
token: #微信小程序消息服务器配置的token
aesKey: #微信小程序消息服务器配置的EncodingAESKey
msgDataFormat: JSON
spring:
ai:
openai:
api-key: sk-xx
base-url: https://api.pandarobot.chat/
mcp:
client:
enabled: false
name: ruoyi-ai-mcp
sse:
connections:
server:
url: http://127.0.0.1:8081
stdio:
servers-configuration: classpath:mcp-server.json
request-timeout: 300s
# 企业微信应用
wechat:
cp:
corpId:
appConfigs:
- agentId:
secret: ''
token: ''
aesKey: ''
# 向量库配置
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

@@ -0,0 +1,22 @@
{
"mcpServers": {
"fileSystem": {
"command": "C:\\Program Files\\nodejs\\npx.cmd",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"D:\\"
]
},
"search1api": {
"command": "C:\\Program Files\\nodejs\\npx.cmd",
"args": [
"-y",
"search1api-mcp"
],
"env": {
"SEARCH1API_KEY": "xx"
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

View File

@@ -1,14 +1,21 @@
<?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>
<artifactId>ruoyi-ai</artifactId>
<groupId>org.ruoyi</groupId>
<version>${revision}</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ruoyi-common</artifactId>
<packaging>pom</packaging>
<description>
common 通用模块
</description>
<modules>
<module>ruoyi-common-bom</module>
@@ -33,14 +40,6 @@
<module>ruoyi-common-tenant</module>
<module>ruoyi-common-chat</module>
<module>ruoyi-common-pay</module>
<module>ruoyi-common-wechat</module>
</modules>
<artifactId>ruoyi-common</artifactId>
<packaging>pom</packaging>
<description>
common 通用模块
</description>
</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">
<modelVersion>4.0.0</modelVersion>
@@ -166,14 +166,6 @@
<version>${revision}</version>
</dependency>
<!-- AI绘画 -->
<dependency>
<groupId>org.ruoyi</groupId>
<artifactId>ruoyi-fusion</artifactId>
<version>${revision}</version>
</dependency>
<!-- 支付模块 -->
<dependency>
@@ -182,6 +174,7 @@
<version>${revision}</version>
</dependency>
</dependencies>
</dependencyManagement>
</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>
<groupId>org.ruoyi</groupId>
@@ -18,6 +18,10 @@
<properties>
<retrofit2.version>2.9.0</retrofit2.version>
<azure.version>1.0.0-beta.12</azure.version>
<chatglm.version>release-V4-2.3.0</chatglm.version>
<okhttp.version>2.7.5</okhttp.version>
<jtokkit.version>0.5.0</jtokkit.version>
</properties>
<dependencies>
@@ -26,38 +30,22 @@
<artifactId>ruoyi-common-core</artifactId>
</dependency>
<!-- 序列化模块 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.33</version>
<groupId>org.ruoyi</groupId>
<artifactId>ruoyi-common-json</artifactId>
</dependency>
<!-- redis模块 -->
<dependency>
<groupId>org.ruoyi</groupId>
<artifactId>ruoyi-common-redis</artifactId>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-ai-openai</artifactId>
<version>1.0.0-beta.12</version>
</dependency>
<dependency>
<groupId>io.github.ollama4j</groupId>
<artifactId>ollama4j</artifactId>
<version>1.0.79</version>
</dependency>
<!-- 序列化模块 -->
<dependency>
<groupId>org.ruoyi</groupId>
<artifactId>ruoyi-common-json</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.ruoyi</groupId>
<artifactId>ruoyi-common-redis</artifactId>
</dependency>
<dependency>
<groupId>org.ruoyi</groupId>
<artifactId>ruoyi-common-satoken</artifactId>
<version>${azure.version}</version>
</dependency>
<dependency>
@@ -79,13 +67,7 @@
<dependency>
<groupId>com.knuddels</groupId>
<artifactId>jtokkit</artifactId>
<version>0.5.0</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.12</version>
<version>${jtokkit.version}</version>
</dependency>
<dependency>
@@ -98,21 +80,18 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>cn.bigmodel.openapi</groupId>
<artifactId>oapi-java-sdk</artifactId>
<version>release-V4-2.3.0</version>
<version>${chatglm.version}</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp</groupId>
<artifactId>okhttp</artifactId>
<version>2.7.5</version>
<scope>compile</scope>
<version>${okhttp.version}</version>
</dependency>
</dependencies>
</project>

View File

@@ -6,8 +6,6 @@ import cn.hutool.core.date.DateUnit;
import lombok.extern.slf4j.Slf4j;
/**
* 描述:
*
* @author https:www.unfbx.com
* @date 2023-03-10
*/
@@ -17,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

@@ -12,6 +12,9 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@Data
public class WebSocketProperties {
/**
* 是否开启
*/
private Boolean enabled;
/**
@@ -20,7 +23,7 @@ public class WebSocketProperties {
private String path;
/**
* 设置访问源地址
* 设置访问源地址
*/
private String allowedOrigins;
}

View File

@@ -1,15 +1,15 @@
package org.ruoyi.common.chat.constant;
/**
* 描述:
*
* @author https:www.unfbx.com
* @since 2023-03-06
* @since 2023-03-06
*/
public class OpenAIConst {
public final static String OPENAI_HOST = "https://api.openai.com/";
public final static String apiUrl = "v1/chat/completions";
public final static int SUCCEED_CODE = 200;
}

View File

@@ -1,73 +0,0 @@
package org.ruoyi.common.chat.demo;
import cn.hutool.json.JSONUtil;
import lombok.Getter;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import okhttp3.Response;
import okhttp3.ResponseBody;
import okhttp3.sse.EventSource;
import okhttp3.sse.EventSourceListener;
import org.ruoyi.common.chat.entity.chat.ChatCompletionResponse;
import java.util.Objects;
import java.util.concurrent.CountDownLatch;
/**
* 描述: sse
*
* @author https:www.unfbx.com
* 2023-06-15
*/
@Slf4j
public class ConsoleEventSourceListenerV2 extends EventSourceListener {
@Getter
String args = "";
final CountDownLatch countDownLatch;
public ConsoleEventSourceListenerV2(CountDownLatch countDownLatch) {
this.countDownLatch = countDownLatch;
}
@Override
public void onOpen(EventSource eventSource, Response response) {
log.info("OpenAI建立sse连接...");
}
@Override
public void onEvent(EventSource eventSource, String id, String type, String data) {
log.info("OpenAI返回数据{}", data);
if (data.equals("[DONE]")) {
log.info("OpenAI返回数据结束了");
countDownLatch.countDown();
return;
}
ChatCompletionResponse chatCompletionResponse = JSONUtil.toBean(data, ChatCompletionResponse.class);
if(Objects.nonNull(chatCompletionResponse.getChoices().get(0).getDelta().getFunctionCall())){
args += chatCompletionResponse.getChoices().get(0).getDelta().getFunctionCall().getArguments();
}
}
@Override
public void onClosed(EventSource eventSource) {
log.info("OpenAI关闭sse连接...");
}
@SneakyThrows
@Override
public void onFailure(EventSource eventSource, Throwable t, Response response) {
if(Objects.isNull(response)){
log.error("OpenAI sse连接异常:{}", t);
eventSource.cancel();
return;
}
ResponseBody body = response.body();
if (Objects.nonNull(body)) {
log.error("OpenAI sse连接异常data{},异常:{}", body.string(), t);
} else {
log.error("OpenAI sse连接异常data{},异常:{}", response, t);
}
eventSource.cancel();
}
}

View File

@@ -1,92 +0,0 @@
package org.ruoyi.common.chat.demo;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.json.JSONUtil;
import lombok.Getter;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import okhttp3.Response;
import okhttp3.ResponseBody;
import okhttp3.sse.EventSource;
import okhttp3.sse.EventSourceListener;
import org.ruoyi.common.chat.entity.chat.ChatCompletionResponse;
import org.ruoyi.common.chat.entity.chat.Message;
import org.ruoyi.common.chat.entity.chat.tool.ToolCallFunction;
import org.ruoyi.common.chat.entity.chat.tool.ToolCalls;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.CountDownLatch;
/**
* 描述: demo测试实现类仅供思路参考
*
* @author https:www.unfbx.com
* 2023-11-12
*/
@Slf4j
public class ConsoleEventSourceListenerV3 extends EventSourceListener {
@Getter
List<ToolCalls> choices = new ArrayList<>();
@Getter
ToolCalls toolCalls = new ToolCalls();
@Getter
ToolCallFunction toolCallFunction = ToolCallFunction.builder().name("").arguments("").build();
final CountDownLatch countDownLatch;
public ConsoleEventSourceListenerV3(CountDownLatch countDownLatch) {
this.countDownLatch = countDownLatch;
}
@Override
public void onOpen(EventSource eventSource, Response response) {
log.info("OpenAI建立sse连接...");
}
@Override
public void onEvent(EventSource eventSource, String id, String type, String data) {
log.info("OpenAI返回数据{}", data);
if (data.equals("[DONE]")) {
log.info("OpenAI返回数据结束了");
return;
}
ChatCompletionResponse chatCompletionResponse = JSONUtil.toBean(data, ChatCompletionResponse.class);
Message delta = chatCompletionResponse.getChoices().get(0).getDelta();
if (CollectionUtil.isNotEmpty(delta.getToolCalls())) {
choices.addAll(delta.getToolCalls());
}
}
@Override
public void onClosed(EventSource eventSource) {
if(CollectionUtil.isNotEmpty(choices)){
toolCalls.setId(choices.get(0).getId());
toolCalls.setType(choices.get(0).getType());
choices.forEach(e -> {
toolCallFunction.setName(e.getFunction().getName());
toolCallFunction.setArguments(toolCallFunction.getArguments() + e.getFunction().getArguments());
toolCalls.setFunction(toolCallFunction);
});
}
log.info("OpenAI关闭sse连接...");
countDownLatch.countDown();
}
@SneakyThrows
@Override
public void onFailure(EventSource eventSource, Throwable t, Response response) {
if(Objects.isNull(response)){
log.error("OpenAI sse连接异常:{}", t);
eventSource.cancel();
return;
}
ResponseBody body = response.body();
if (Objects.nonNull(body)) {
log.error("OpenAI sse连接异常data{},异常:{}", body.string(), t);
} else {
log.error("OpenAI sse连接异常data{},异常:{}", response, t);
}
eventSource.cancel();
}
}

View File

@@ -1,417 +0,0 @@
package org.ruoyi.common.chat.demo;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.Builder;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import org.junit.Before;
import org.junit.Test;
import org.ruoyi.common.chat.entity.chat.*;
import org.ruoyi.common.chat.entity.chat.tool.ToolCallFunction;
import org.ruoyi.common.chat.entity.chat.tool.ToolCalls;
import org.ruoyi.common.chat.entity.chat.tool.Tools;
import org.ruoyi.common.chat.entity.chat.tool.ToolsFunction;
import org.ruoyi.common.chat.openai.OpenAiClient;
import org.ruoyi.common.chat.openai.OpenAiStreamClient;
import org.ruoyi.common.chat.openai.function.KeyRandomStrategy;
import org.ruoyi.common.chat.openai.interceptor.DynamicKeyOpenAiAuthInterceptor;
import org.ruoyi.common.chat.openai.interceptor.OpenAILogger;
import org.ruoyi.common.chat.openai.interceptor.OpenAiResponseInterceptor;
import org.ruoyi.common.chat.openai.plugin.PluginAbstract;
import org.ruoyi.common.chat.plugin.CmdPlugin;
import org.ruoyi.common.chat.plugin.CmdReq;
import org.ruoyi.common.chat.sse.ConsoleEventSourceListener;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
/**
* 描述:
*
* @author ageerle@163.com
* date 2025/3/8
*/
@Slf4j
public class PluginTest {
private OpenAiClient openAiClient;
private OpenAiStreamClient openAiStreamClient;
@Before
public void before() {
//可以为null
// Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", 7890));
HttpLoggingInterceptor httpLoggingInterceptor = new HttpLoggingInterceptor(new OpenAILogger());
//千万别再生产或者测试环境打开BODY级别日志
//生产或者测试环境建议设置为这三种级别NONE,BASIC,HEADERS,
httpLoggingInterceptor.setLevel(HttpLoggingInterceptor.Level.HEADERS);
OkHttpClient okHttpClient = new OkHttpClient
.Builder()
// .proxy(proxy)
.addInterceptor(httpLoggingInterceptor)
.addInterceptor(new OpenAiResponseInterceptor())
.connectTimeout(10, TimeUnit.SECONDS)
.writeTimeout(30, TimeUnit.SECONDS)
.readTimeout(30, TimeUnit.SECONDS)
.build();
openAiClient = OpenAiClient.builder()
//支持多key传入请求时候随机选择
.apiKey(Arrays.asList("sk-xx"))
//自定义key的获取策略默认KeyRandomStrategy
//.keyStrategy(new KeyRandomStrategy())
.keyStrategy(new KeyRandomStrategy())
.okHttpClient(okHttpClient)
//自己做了代理就传代理地址,没有可不不传,(关注公众号回复openai ,获取免费的测试代理地址)
.apiHost("https://api.pandarobot.chat/")
.build();
openAiStreamClient = OpenAiStreamClient.builder()
//支持多key传入请求时候随机选择
.apiKey(Arrays.asList("sk-xx"))
//自定义key的获取策略默认KeyRandomStrategy
.keyStrategy(new KeyRandomStrategy())
.authInterceptor(new DynamicKeyOpenAiAuthInterceptor())
.okHttpClient(okHttpClient)
//自己做了代理就传代理地址,没有可不不传,(关注公众号回复openai ,获取免费的测试代理地址)
.apiHost("https://api.pandarobot.chat/")
.build();
}
@Test
public void chatFunction() {
//模型GPT_3_5_TURBO_16K_0613
Message message = Message.builder().role(Message.Role.USER).content("给我输出一个长度为2的中文词语并解释下词语对应物品的用途").build();
//属性一
JSONObject wordLength = new JSONObject();
wordLength.put("type", "number");
wordLength.put("description", "词语的长度");
//属性二
JSONObject language = new JSONObject();
language.put("type", "string");
language.put("enum", Arrays.asList("zh", "en"));
language.put("description", "语言类型例如zh代表中文、en代表英语");
//参数
JSONObject properties = new JSONObject();
properties.put("wordLength", wordLength);
properties.put("language", language);
Parameters parameters = Parameters.builder()
.type("object")
.properties(properties)
.required(Collections.singletonList("wordLength")).build();
Functions functions = Functions.builder()
.name("getOneWord")
.description("获取一个指定长度和语言类型的词语")
.parameters(parameters)
.build();
ChatCompletion chatCompletion = ChatCompletion
.builder()
.messages(Collections.singletonList(message))
.functions(Collections.singletonList(functions))
.functionCall("auto")
.model(ChatCompletion.Model.GPT_4_1106_PREVIEW.getName())
.build();
ChatCompletionResponse chatCompletionResponse = openAiClient.chatCompletion(chatCompletion);
ChatChoice chatChoice = chatCompletionResponse.getChoices().get(0);
log.info("构造的方法值:{}", chatChoice.getMessage().getFunctionCall());
log.info("构造的方法名称:{}", chatChoice.getMessage().getFunctionCall().getName());
log.info("构造的方法参数:{}", chatChoice.getMessage().getFunctionCall().getArguments());
WordParam wordParam = JSONUtil.toBean(chatChoice.getMessage().getFunctionCall().getArguments(), WordParam.class);
String oneWord = getOneWord(wordParam);
FunctionCall functionCall = FunctionCall.builder()
.arguments(chatChoice.getMessage().getFunctionCall().getArguments())
.name("getOneWord")
.build();
Message message2 = Message.builder().role(Message.Role.ASSISTANT).content("方法参数").functionCall(functionCall).build();
String content
= "{ " +
"\"wordLength\": \"3\", " +
"\"language\": \"zh\", " +
"\"word\": \"" + oneWord + "\"," +
"\"用途\": [\"直接吃\", \"做沙拉\", \"售卖\"]" +
"}";
Message message3 = Message.builder().role(Message.Role.FUNCTION).name("getOneWord").content(content).build();
List<Message> messageList = Arrays.asList(message, message2, message3);
ChatCompletion chatCompletionV2 = ChatCompletion
.builder()
.messages(messageList)
.model(ChatCompletion.Model.GPT_4_1106_PREVIEW.getName())
.build();
ChatCompletionResponse chatCompletionResponseV2 = openAiClient.chatCompletion(chatCompletionV2);
log.info("自定义的方法返回值:{}",chatCompletionResponseV2.getChoices().get(0).getMessage().getContent());
}
@Test
public void plugin() {
CmdPlugin plugin = new CmdPlugin(CmdReq.class);
// 插件名称
plugin.setName("命令行工具");
// 方法名称
plugin.setFunction("openCmd");
// 方法说明
plugin.setDescription("提供一个命令行指令,比如<记事本>,指令使用中文,以function返回结果为准");
PluginAbstract.Arg arg = new PluginAbstract.Arg();
// 参数名称
arg.setName("cmd");
// 参数说明
arg.setDescription("命令行指令");
// 参数类型
arg.setType("string");
arg.setRequired(true);
plugin.setArgs(Collections.singletonList(arg));
Message message2 = Message.builder().role(Message.Role.USER).content("帮我打开计算器,结合上下文判断指令是否执行成功,只用回复成功或者失败").build();
List<Message> messages = new ArrayList<>();
messages.add(message2);
//有四个重载方法,都可以使用
ChatCompletionResponse response = openAiClient.chatCompletionWithPlugin(messages,"gpt-4o-mini",plugin);
log.info("自定义的方法返回值:{}", response.getChoices().get(0).getMessage().getContent());
}
/**
* 自定义返回数据格式
*/
@Test
public void diyReturnDataModelChat() {
Message message = Message.builder().role(Message.Role.USER).content("随机输出10个单词使用json输出").build();
ChatCompletion chatCompletion = ChatCompletion
.builder()
.messages(Collections.singletonList(message))
.responseFormat(ResponseFormat.builder().type(ResponseFormat.Type.JSON_OBJECT.getName()).build())
.model(ChatCompletion.Model.GPT_4_1106_PREVIEW.getName())
.build();
ChatCompletionResponse chatCompletionResponse = openAiClient.chatCompletion(chatCompletion);
chatCompletionResponse.getChoices().forEach(e -> System.out.println(e.getMessage()));
}
@Test
public void streamPlugin() {
WeatherPlugin plugin = new WeatherPlugin(WeatherReq.class);
plugin.setName("知心天气");
plugin.setFunction("getLocationWeather");
plugin.setDescription("提供一个地址,方法将会获取该地址的天气的实时温度信息。");
PluginAbstract.Arg arg = new PluginAbstract.Arg();
arg.setName("location");
arg.setDescription("地名");
arg.setType("string");
arg.setRequired(true);
plugin.setArgs(Collections.singletonList(arg));
// Message message1 = Message.builder().role(Message.Role.USER).content("秦始皇统一了哪六国。").build();
Message message2 = Message.builder().role(Message.Role.USER).content("获取上海市的天气现在多少度然后再给出3个推荐的户外运动。").build();
List<Message> messages = new ArrayList<>();
// messages.add(message1);
messages.add(message2);
//默认模型GPT_3_5_TURBO_16K_0613
//有四个重载方法,都可以使用
openAiStreamClient.streamChatCompletionWithPlugin(messages, ChatCompletion.Model.GPT_4_1106_PREVIEW.getName(), new ConsoleEventSourceListener(), plugin);
CountDownLatch countDownLatch = new CountDownLatch(1);
try {
countDownLatch.await();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
/**
* tools使用示例
*/
@Test
public void toolsChat() {
Message message = Message.builder().role(Message.Role.USER).content("给我输出一个长度为2的中文词语并解释下词语对应物品的用途").build();
//属性一
JSONObject wordLength = new JSONObject();
wordLength.put("type", "number");
wordLength.put("description", "词语的长度");
//属性二
JSONObject language = new JSONObject();
language.put("type", "string");
language.put("enum", Arrays.asList("zh", "en"));
language.put("description", "语言类型例如zh代表中文、en代表英语");
//参数
JSONObject properties = new JSONObject();
properties.put("wordLength", wordLength);
properties.put("language", language);
Parameters parameters = Parameters.builder()
.type("object")
.properties(properties)
.required(Collections.singletonList("wordLength")).build();
Tools tools = Tools.builder()
.type(Tools.Type.FUNCTION.getName())
.function(ToolsFunction.builder().name("getOneWord").description("获取一个指定长度和语言类型的词语").parameters(parameters).build())
.build();
ChatCompletion chatCompletion = ChatCompletion
.builder()
.messages(Collections.singletonList(message))
.tools(Collections.singletonList(tools))
.model(ChatCompletion.Model.GPT_4_1106_PREVIEW.getName())
.build();
ChatCompletionResponse chatCompletionResponse = openAiClient.chatCompletion(chatCompletion);
ChatChoice chatChoice = chatCompletionResponse.getChoices().get(0);
log.info("构造的方法值:{}", chatChoice.getMessage().getToolCalls());
ToolCalls openAiReturnToolCalls = chatChoice.getMessage().getToolCalls().get(0);
WordParam wordParam = JSONUtil.toBean(openAiReturnToolCalls.getFunction().getArguments(), WordParam.class);
String oneWord = getOneWord(wordParam);
ToolCallFunction tcf = ToolCallFunction.builder().name("getOneWord").arguments(openAiReturnToolCalls.getFunction().getArguments()).build();
ToolCalls tc = ToolCalls.builder().id(openAiReturnToolCalls.getId()).type(ToolCalls.Type.FUNCTION.getName()).function(tcf).build();
//构造tool call
Message message2 = Message.builder().role(Message.Role.ASSISTANT).content("方法参数").toolCalls(Collections.singletonList(tc)).build();
String content
= "{ " +
"\"wordLength\": \"3\", " +
"\"language\": \"zh\", " +
"\"word\": \"" + oneWord + "\"," +
"\"用途\": [\"直接吃\", \"做沙拉\", \"售卖\"]" +
"}";
Message message3 = Message.builder().toolCallId(openAiReturnToolCalls.getId()).role(Message.Role.TOOL).name("getOneWord").content(content).build();
List<Message> messageList = Arrays.asList(message, message2, message3);
ChatCompletion chatCompletionV2 = ChatCompletion
.builder()
.messages(messageList)
.model(ChatCompletion.Model.GPT_4_1106_PREVIEW.getName())
.build();
ChatCompletionResponse chatCompletionResponseV2 = openAiClient.chatCompletion(chatCompletionV2);
log.info("自定义的方法返回值:{}", chatCompletionResponseV2.getChoices().get(0).getMessage().getContent());
}
/**
* tools流式输出使用示例
*/
@Test
public void streamToolsChat() {
CountDownLatch countDownLatch = new CountDownLatch(1);
ConsoleEventSourceListenerV3 eventSourceListener = new ConsoleEventSourceListenerV3(countDownLatch);
Message message = Message.builder().role(Message.Role.USER).content("给我输出一个长度为2的中文词语并解释下词语对应物品的用途").build();
//属性一
JSONObject wordLength = new JSONObject();
wordLength.put("type", "number");
wordLength.put("description", "词语的长度");
//属性二
JSONObject language = new JSONObject();
language.put("type", "string");
language.put("enum", Arrays.asList("zh", "en"));
language.put("description", "语言类型例如zh代表中文、en代表英语");
//参数
JSONObject properties = new JSONObject();
properties.put("wordLength", wordLength);
properties.put("language", language);
Parameters parameters = Parameters.builder()
.type("object")
.properties(properties)
.required(Collections.singletonList("wordLength")).build();
Tools tools = Tools.builder()
.type(Tools.Type.FUNCTION.getName())
.function(ToolsFunction.builder().name("getOneWord").description("获取一个指定长度和语言类型的词语").parameters(parameters).build())
.build();
ChatCompletion chatCompletion = ChatCompletion
.builder()
.messages(Collections.singletonList(message))
.tools(Collections.singletonList(tools))
.model(ChatCompletion.Model.GPT_4_1106_PREVIEW.getName())
.build();
openAiStreamClient.streamChatCompletion(chatCompletion, eventSourceListener);
try {
countDownLatch.await();
} catch (InterruptedException e) {
e.printStackTrace();
}
ToolCalls openAiReturnToolCalls = eventSourceListener.getToolCalls();
WordParam wordParam = JSONUtil.toBean(openAiReturnToolCalls.getFunction().getArguments(), WordParam.class);
String oneWord = getOneWord(wordParam);
ToolCallFunction tcf = ToolCallFunction.builder().name("getOneWord").arguments(openAiReturnToolCalls.getFunction().getArguments()).build();
ToolCalls tc = ToolCalls.builder().id(openAiReturnToolCalls.getId()).type(ToolCalls.Type.FUNCTION.getName()).function(tcf).build();
//构造tool call
Message message2 = Message.builder().role(Message.Role.ASSISTANT).content("方法参数").toolCalls(Collections.singletonList(tc)).build();
String content
= "{ " +
"\"wordLength\": \"3\", " +
"\"language\": \"zh\", " +
"\"word\": \"" + oneWord + "\"," +
"\"用途\": [\"直接吃\", \"做沙拉\", \"售卖\"]" +
"}";
Message message3 = Message.builder().toolCallId(openAiReturnToolCalls.getId()).role(Message.Role.TOOL).name("getOneWord").content(content).build();
List<Message> messageList = Arrays.asList(message, message2, message3);
ChatCompletion chatCompletionV2 = ChatCompletion
.builder()
.messages(messageList)
.model(ChatCompletion.Model.GPT_4_1106_PREVIEW.getName())
.build();
CountDownLatch countDownLatch1 = new CountDownLatch(1);
openAiStreamClient.streamChatCompletion(chatCompletionV2, new ConsoleEventSourceListenerV3(countDownLatch));
try {
countDownLatch1.await();
} catch (InterruptedException e) {
e.printStackTrace();
}
try {
countDownLatch1.await();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
@Data
@Builder
static class WordParam {
private int wordLength;
@Builder.Default
private String language = "zh";
}
/**
* 获取一个词语(根据语言和字符长度查询)
* @param wordParam
* @return
*/
public String getOneWord(WordParam wordParam) {
List<String> zh = Arrays.asList("大香蕉", "哈密瓜", "苹果");
List<String> en = Arrays.asList("apple", "banana", "cantaloupe");
if (wordParam.getLanguage().equals("zh")) {
for (String e : zh) {
if (e.length() == wordParam.getWordLength()) {
return e;
}
}
}
if (wordParam.getLanguage().equals("en")) {
for (String e : en) {
if (e.length() == wordParam.getWordLength()) {
return e;
}
}
}
return "西瓜";
}
}

View File

@@ -1,24 +0,0 @@
package org.ruoyi.common.chat.demo;
import org.ruoyi.common.chat.openai.plugin.PluginAbstract;
public class WeatherPlugin extends PluginAbstract<WeatherReq, WeatherResp> {
public WeatherPlugin(Class<?> r) {
super(r);
}
@Override
public WeatherResp func(WeatherReq args) {
WeatherResp weatherResp = new WeatherResp();
weatherResp.setTemp("25到28摄氏度");
weatherResp.setLevel(3);
return weatherResp;
}
@Override
public String content(WeatherResp weatherResp) {
return "当前天气温度:" + weatherResp.getTemp() + ",风力等级:" + weatherResp.getLevel();
}
}

View File

@@ -1,13 +0,0 @@
package org.ruoyi.common.chat.demo;
import lombok.Data;
import org.ruoyi.common.chat.openai.plugin.PluginParam;
@Data
public class WeatherReq extends PluginParam {
/**
* 城市
*/
private String location;
}

View File

@@ -1,15 +0,0 @@
package org.ruoyi.common.chat.demo;
import lombok.Data;
@Data
public class WeatherResp {
/**
* 温度
*/
private String temp;
/**
* 风力等级
*/
private Integer level;
}

View File

@@ -1,223 +0,0 @@
package org.ruoyi.common.chat.demo;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.zhipu.oapi.ClientV4;
import com.zhipu.oapi.Constants;
import com.zhipu.oapi.service.v4.tools.*;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import com.zhipu.oapi.service.v4.model.*;
import io.reactivex.Flowable;
import java.util.HashMap;
import java.util.Map;
public class WebSearchToolsTest {
private final static Logger logger = LoggerFactory.getLogger(WebSearchToolsTest.class);
private static final String API_SECRET_KEY = "xx";
private static final ClientV4 client = new ClientV4.Builder(API_SECRET_KEY)
.networkConfig(300, 100, 100, 100, TimeUnit.SECONDS)
.connectionPool(new okhttp3.ConnectionPool(8, 1, TimeUnit.SECONDS))
.build();
private static final ObjectMapper mapper = new ObjectMapper();
// 请自定义自己的业务id
private static final String requestIdTemplate = "mycompany-%d";
@Test
public void test1() throws JsonProcessingException {
// json 转换 ArrayList<SearchChatMessage>
String jsonString = "[\n" +
" {\n" +
" \"content\": \"今天武汉天气怎么样\",\n" +
" \"role\": \"user\"\n" +
" }\n" +
" ]";
ArrayList<SearchChatMessage> messages = new ObjectMapper().readValue(jsonString, new TypeReference<ArrayList<SearchChatMessage>>() {
});
String requestId = String.format(requestIdTemplate, System.currentTimeMillis());
WebSearchParamsRequest chatCompletionRequest = WebSearchParamsRequest.builder()
.model("web-search-pro")
.stream(Boolean.TRUE)
.messages(messages)
.requestId(requestId)
.build();
WebSearchApiResponse webSearchApiResponse = client.webSearchProStreamingInvoke(chatCompletionRequest);
if (webSearchApiResponse.isSuccess()) {
AtomicBoolean isFirst = new AtomicBoolean(true);
List<ChoiceDelta> choices = new ArrayList<>();
AtomicReference<WebSearchPro> lastAccumulator = new AtomicReference<>();
webSearchApiResponse.getFlowable().map(result -> result)
.doOnNext(accumulator -> {
{
if (isFirst.getAndSet(false)) {
logger.info("Response: ");
}
ChoiceDelta delta = accumulator.getChoices().get(0).getDelta();
if (delta != null && delta.getToolCalls() != null) {
logger.info("tool_calls: {}", mapper.writeValueAsString(delta.getToolCalls()));
}
choices.add(delta);
lastAccumulator.set(accumulator);
}
})
.doOnComplete(() -> System.out.println("Stream completed."))
.doOnError(throwable -> System.err.println("Error: " + throwable)) // Handle errors
.blockingSubscribe();// Use blockingSubscribe instead of blockingGet()
WebSearchPro chatMessageAccumulator = lastAccumulator.get();
webSearchApiResponse.setFlowable(null);// 打印前置空
webSearchApiResponse.setData(chatMessageAccumulator);
}
logger.info("model output: {}", mapper.writeValueAsString(webSearchApiResponse));
client.getConfig().getHttpClient().dispatcher().executorService().shutdown();
client.getConfig().getHttpClient().connectionPool().evictAll();
// List all active threads
for (Thread t : Thread.getAllStackTraces().keySet()) {
logger.info("Thread: " + t.getName() + " State: " + t.getState());
}
}
@Test
public void test2() throws JsonProcessingException {
// json 转换 ArrayList<SearchChatMessage>
String jsonString = "[\n" +
" {\n" +
" \"content\": \"今天天气怎么样\",\n" +
" \"role\": \"user\"\n" +
" }\n" +
" ]";
ArrayList<SearchChatMessage> messages = new ObjectMapper().readValue(jsonString, new TypeReference<ArrayList<SearchChatMessage>>() {
});
String requestId = String.format(requestIdTemplate, System.currentTimeMillis());
WebSearchParamsRequest chatCompletionRequest = WebSearchParamsRequest.builder()
.model("web-search-pro")
.stream(Boolean.FALSE)
.messages(messages)
.requestId(requestId)
.build();
WebSearchApiResponse webSearchApiResponse = client.invokeWebSearchPro(chatCompletionRequest);
logger.info("model output: {}", mapper.writeValueAsString(webSearchApiResponse));
}
@Test
public void testFunctionSSE() throws JsonProcessingException {
List<ChatMessage> messages = new ArrayList<>();
ChatMessage chatMessage = new ChatMessage(ChatMessageRole.USER.value(), "成都到北京要多久,天气如何");
messages.add(chatMessage);
String requestId = String.format(requestIdTemplate, System.currentTimeMillis());
// 函数调用参数构建部分
List<ChatTool> chatToolList = new ArrayList<>();
ChatTool chatTool = new ChatTool();
chatTool.setType(ChatToolType.FUNCTION.value());
ChatFunctionParameters chatFunctionParameters = new ChatFunctionParameters();
chatFunctionParameters.setType("object");
Map<String, Object> properties = new HashMap<>();
properties.put("location", new HashMap<String, Object>() {{
put("type", "string");
put("description", "城市,如:北京");
}});
properties.put("unit", new HashMap<String, Object>() {{
put("type", "string");
put("enum", new ArrayList<String>() {{
add("celsius");
add("fahrenheit");
}});
}});
chatFunctionParameters.setProperties(properties);
ChatFunction chatFunction = ChatFunction.builder()
.name("get_weather")
.description("Get the current weather of a location")
.parameters(chatFunctionParameters)
.build();
chatTool.setFunction(chatFunction);
chatToolList.add(chatTool);
HashMap<String, Object> extraJson = new HashMap<>();
extraJson.put("temperature", 0.5);
extraJson.put("max_tokens", 50);
ChatCompletionRequest chatCompletionRequest = ChatCompletionRequest.builder()
.model(Constants.ModelChatGLM4)
.stream(Boolean.TRUE)
.messages(messages)
.requestId(requestId)
.tools(chatToolList)
.toolChoice("auto")
.extraJson(extraJson)
.build();
ModelApiResponse sseModelApiResp = client.invokeModelApi(chatCompletionRequest);
if (sseModelApiResp.isSuccess()) {
AtomicBoolean isFirst = new AtomicBoolean(true);
List<Choice> choices = new ArrayList<>();
ChatMessageAccumulator chatMessageAccumulator = mapStreamToAccumulator(sseModelApiResp.getFlowable())
.doOnNext(accumulator -> {
{
if (isFirst.getAndSet(false)) {
logger.info("Response: ");
}
if (accumulator.getDelta() != null && accumulator.getDelta().getTool_calls() != null) {
String jsonString = mapper.writeValueAsString(accumulator.getDelta().getTool_calls());
logger.info("tool_calls: {}", jsonString);
}
if (accumulator.getDelta() != null && accumulator.getDelta().getContent() != null) {
logger.info(accumulator.getDelta().getContent());
}
choices.add(accumulator.getChoice());
}
})
.doOnComplete(System.out::println)
.lastElement()
.blockingGet();
ModelData data = new ModelData();
data.setChoices(choices);
data.setUsage(chatMessageAccumulator.getUsage());
data.setId(chatMessageAccumulator.getId());
data.setCreated(chatMessageAccumulator.getCreated());
data.setRequestId(chatCompletionRequest.getRequestId());
sseModelApiResp.setFlowable(null);// 打印前置空
sseModelApiResp.setData(data);
}
logger.info("model output: {}", mapper.writeValueAsString(sseModelApiResp));
}
public static Flowable<ChatMessageAccumulator> mapStreamToAccumulator(Flowable<ModelData> flowable) {
return flowable.map(chunk -> {
return new ChatMessageAccumulator(chunk.getChoices().get(0).getDelta(), null, chunk.getChoices().get(0), chunk.getUsage(), chunk.getCreated(), chunk.getId());
});
}
}

View File

@@ -1,65 +0,0 @@
package org.ruoyi.common.chat.domain.request;
import org.ruoyi.common.chat.entity.chat.Message;
import jakarta.validation.constraints.NotEmpty;
import lombok.Data;
import java.util.List;
/**
* 描述:
*
* @author https:www.unfbx.com
* @sine 2023-04-08
*/
@Data
public class ChatRequest {
private String frequency_penalty;
private String max_tokens;
@NotEmpty(message = "对话消息不能为空")
List<Message> messages;
@NotEmpty(message = "传入的模型不能为空")
private String model;
private String presence_penalty;
private String stream;
private double temperature;
private double top_p = 1;
/**
* 知识库id
*/
private String kid;
private String userId;
//
//
// /**
// * gpt的默认设置
// */
// private String systemMessage = "";
//
//
//
// private double temperature = 0.2;
//
// /**
// * 上下文的条数
// */
// private Integer contentNumber = 10;
//
// /**
// * 是否携带上下文
// */
// private Boolean usingContext = Boolean.TRUE;
}

View File

@@ -1,33 +0,0 @@
package org.ruoyi.common.chat.domain.request;
import jakarta.validation.constraints.NotEmpty;
import lombok.Data;
/**
* 描述:
*
* @author https:www.unfbx.com
* @sine 2023-04-08
*/
@Data
public class Dall3Request {
@NotEmpty(message = "传入的模型不能为空")
private String model;
@NotEmpty(message = "提示词不能为空")
private String prompt;
/** 图片大小 */
@NotEmpty(message = "图片大小不能为空")
private String size ;
/** 图片质量 */
@NotEmpty(message = "图片质量不能为空")
private String quality;
/** 图片风格 */
@NotEmpty(message = "图片风格不能为空")
private String style;
}

View File

@@ -8,7 +8,7 @@ import java.math.BigDecimal;
import java.util.List;
/**
* 描述:金额消耗信息
* 金额消耗信息
*
* @author https:www.unfbx.com
* @since 2023-04-08

View File

@@ -8,7 +8,7 @@ import java.io.Serializable;
import java.math.BigDecimal;
/**
* 描述:余额查询接口返回值
* 余额查询接口返回值
*
* @author https:www.unfbx.com
* @since 2023-03-18

View File

@@ -7,7 +7,7 @@ import lombok.Data;
import java.util.List;
/**
* 描述:金额消耗列表
* 金额消耗列表
*
* @author https:www.unfbx.com
* @since 2023-04-08

View File

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

View File

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

View File

@@ -6,7 +6,7 @@ import lombok.Data;
import java.math.BigDecimal;
/**
* 描述:金额消耗列表
* 金额消耗列表
*
* @author https:www.unfbx.com
* @since 2023-04-08

View File

@@ -4,10 +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

@@ -4,10 +4,10 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
/**
* 描述:账户信息
* 账户信息
*
* @author https:www.unfbx.com
* @since 2023-04-08
* @since 2023-04-08
*/
@Data
public class Subscription {

View File

@@ -13,7 +13,7 @@ import java.util.Map;
import static org.ruoyi.common.chat.entity.chat.BaseChatCompletion.Model.GPT_3_5_TURBO;
/**
* 描述: chat模型基础类
* chat模型基础类
*
* @author https:www.unfbx.com
* @since 1.1.2

View File

@@ -12,8 +12,6 @@ import java.io.Serializable;
import java.util.List;
/**
* 描述:
*
* @author https:www.unfbx.com
* @since 1.1.2
* 2023-03-02
@@ -35,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,8 +7,6 @@ import lombok.Data;
import java.io.Serializable;
/**
* 描述:
*
* @author https:www.unfbx.com
* @since 2023-03-02
*/

View File

@@ -12,7 +12,7 @@ import java.io.Serializable;
import java.util.List;
/**
* 描述: chat模型参数
* chat模型参数
*
* @author https:www.unfbx.com
* 2023-03-02

View File

@@ -8,7 +8,7 @@ import java.io.Serializable;
import java.util.List;
/**
* 描述: chat答案类
* chat答案类
*
* @author https:www.unfbx.com
* 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,8 +6,6 @@ import lombok.*;
import lombok.extern.slf4j.Slf4j;
/**
* 描述:
*
* @author https://www.unfbx.com
* @since 1.1.2
* 2023-11-10

View File

@@ -0,0 +1,16 @@
package org.ruoyi.common.chat.entity.chat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import java.util.List;
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class FastGPTAnswerResponse {
private String id;
private String object;
private long created;
private String model;
private List<FastGPTChatChoice> choices;
}

View File

@@ -1,4 +1,4 @@
package tech.ordinaryroad.live.chat.client.douyu.client;
package org.ruoyi.common.chat.entity.chat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -6,15 +6,9 @@ import lombok.Data;
import java.io.Serializable;
/**
* 描述
*
* @author https:www.unfbx.com
* @since 2023-03-02
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class ChatChoice implements Serializable {
public class FastGPTChatChoice implements Serializable {
private long index;
/**
* 请求参数stream为true返回是delta
@@ -28,4 +22,4 @@ public class ChatChoice implements Serializable {
private Message message;
@JsonProperty("finish_reason")
private String finishReason;
}
}

View File

@@ -0,0 +1,41 @@
package org.ruoyi.common.chat.entity.chat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.io.Serializable;
@Data
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
public class FastGPTChatCompletion extends ChatCompletion implements Serializable {
/**
* 是否使用FastGPT提供的上下文
*/
private String chatId;
/**
* 是否返回详细信息;stream模式下会通过event进行区分非stream模式结果保存在responseData中.
*/
private boolean detail;
/**
* 运行时变量
* 模块变量一个对象会替换模块中输入fastgpt框内容里的{{key}}
*/
private Variables variables;
/**
* responseChatItemId: string | undefined 。
* 如果传入,则会将该值作为本次对话的响应消息的 ID
* FastGPT 会自动将该 ID 存入数据库。请确保,
* 在当前chatId下responseChatItemId是唯一的。
*/
private String responseChatItemId;
}

View File

@@ -6,7 +6,7 @@ import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 描述:函数调用返回值
* 函数调用返回值
*
* @author https://www.unfbx.com
* @since 2023-06-14

View File

@@ -6,7 +6,7 @@ import lombok.Data;
import java.io.Serializable;
/**
* 描述:方法参数实体类,实例数据如下
* 方法参数实体类,实例数据如下
* <pre>
* {
* "name": "get_current_weather",
@@ -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,8 +8,6 @@ import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
/**
* 描述:
*
* @author https://www.unfbx.com
* 2023-11-10
*/

View File

@@ -2,6 +2,7 @@ package org.ruoyi.common.chat.entity.chat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import org.ruoyi.common.chat.entity.chat.tool.ToolCalls;
@@ -9,8 +10,6 @@ import java.io.Serializable;
import java.util.List;
/**
* 描述:
*
* @author https:www.unfbx.com
* @since 2023-03-02
*/
@@ -20,10 +19,8 @@ import java.util.List;
public class Message extends BaseMessage implements Serializable {
private Object content;
public static Builder builder() {
return new Builder();
}
@JsonProperty("reasoning_content")
private String reasoningContent;
/**
* 构造函数
@@ -54,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

@@ -10,8 +10,6 @@ import java.io.Serializable;
import java.util.List;
/**
* 描述:
*
* @author https:www.unfbx.com
* @since 2023-03-02
*/
@@ -27,10 +25,6 @@ public class MessagePicture extends BaseMessage implements Serializable {
private List<Content> content;
public static Builder builder() {
return new Builder();
}
/**
* 构造函数
*
@@ -60,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

@@ -0,0 +1,20 @@
package org.ruoyi.common.chat.entity.chat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class Variables implements Serializable {
private String uid;
private String name;
}

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.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)

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