Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
KnowledgePlanet
road-map
xfg-frame-mvc
提交
66404f3c
xfg-frame-mvc
项目概览
KnowledgePlanet
/
road-map
/
xfg-frame-mvc
通知
561
Star
28
Fork
25
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
xfg-frame-mvc
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
66404f3c
编写于
10月 20, 2025
作者:
L
Linnea Lin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 补充配置类&实体类的提交
上级
dea18221
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
330 addition
and
3 deletion
+330
-3
src/main/java/cn/bugstack/xfg/frame/common/AssistantType.java
...main/java/cn/bugstack/xfg/frame/common/AssistantType.java
+70
-0
src/main/java/cn/bugstack/xfg/frame/config/RagflowProperties.java
.../java/cn/bugstack/xfg/frame/config/RagflowProperties.java
+58
-0
src/main/java/cn/bugstack/xfg/frame/config/Retrofit2Config.java
...in/java/cn/bugstack/xfg/frame/config/Retrofit2Config.java
+1
-3
src/main/java/cn/bugstack/xfg/frame/domain/req/CreateChatReq.java
.../java/cn/bugstack/xfg/frame/domain/req/CreateChatReq.java
+46
-0
src/main/java/cn/bugstack/xfg/frame/domain/req/CreateSessionReq.java
...va/cn/bugstack/xfg/frame/domain/req/CreateSessionReq.java
+22
-0
src/main/java/cn/bugstack/xfg/frame/domain/res/ChatIdRes.java
...main/java/cn/bugstack/xfg/frame/domain/res/ChatIdRes.java
+36
-0
src/main/java/cn/bugstack/xfg/frame/domain/res/SessionRes.java
...ain/java/cn/bugstack/xfg/frame/domain/res/SessionRes.java
+97
-0
未找到文件。
src/main/java/cn/bugstack/xfg/frame/common/AssistantType.java
0 → 100644
浏览文件 @
66404f3c
package
cn.bugstack.xfg.frame.common
;
/**
* 助手类型枚举
* 用于管理不同类型的AI助手及其配置
*/
public
enum
AssistantType
{
/**
* 通用助手 - 适用于一般性问题解答
*/
GENERAL
(
"general"
,
"通用助手"
,
"prompts/general-assistant.txt"
),
/**
* 技术助手 - 专门处理技术相关问题
*/
TECHNICAL
(
"technical"
,
"技术助手"
,
"prompts/technical-assistant.txt"
),
/**
* 客服助手 - 专门处理客户服务相关问题
*/
CUSTOMER_SERVICE
(
"customer-service"
,
"客服助手"
,
"prompts/customer-service.txt"
);
/**
* 配置键名
*/
private
final
String
configKey
;
/**
* 助手描述
*/
private
final
String
description
;
/**
* prompt 文件路径
*/
private
final
String
promptFilePath
;
AssistantType
(
String
configKey
,
String
description
,
String
promptFilePath
)
{
this
.
configKey
=
configKey
;
this
.
description
=
description
;
this
.
promptFilePath
=
promptFilePath
;
}
public
String
getConfigKey
()
{
return
configKey
;
}
public
String
getDescription
()
{
return
description
;
}
public
String
getPromptFilePath
()
{
return
promptFilePath
;
}
/**
* 根据配置键名获取助手类型
* @param configKey 配置键名
* @return 助手类型
*/
public
static
AssistantType
fromConfigKey
(
String
configKey
)
{
for
(
AssistantType
type
:
values
())
{
if
(
type
.
configKey
.
equals
(
configKey
))
{
return
type
;
}
}
throw
new
IllegalArgumentException
(
"Unknown assistant type: "
+
configKey
);
}
}
\ No newline at end of file
src/main/java/cn/bugstack/xfg/frame/config/RagflowProperties.java
0 → 100644
浏览文件 @
66404f3c
package
cn.bugstack.xfg.frame.config
;
import
lombok.Data
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.stereotype.Component
;
import
java.util.Map
;
/**
* RagFlow 配置属性类
* 用于读取 application.yml 中的 ragflow 配置
*/
@Data
@Component
@ConfigurationProperties
(
prefix
=
"ragflow"
)
public
class
RagflowProperties
{
/**
* API 配置
*/
private
Api
api
;
/**
* 多个助手类型的 prompt 配置
*/
private
Map
<
String
,
PromptConfig
>
prompts
;
@Data
public
static
class
Api
{
/**
* API 基础 URL
*/
private
String
baseUrl
;
/**
* API 密钥
*/
private
String
apiKey
;
}
@Data
public
static
class
PromptConfig
{
/**
* prompt 文件路径
*/
private
String
file
;
/**
* 开场白
*/
private
String
opener
;
/**
* 空响应消息
*/
private
String
emptyResponse
;
}
}
\ No newline at end of file
src/main/java/cn/bugstack/xfg/frame/config/Retrofit2Config.java
浏览文件 @
66404f3c
...
...
@@ -21,8 +21,6 @@ public class Retrofit2Config {
@Resource
private
RagflowProperties
ragflowProperties
;
@Resource
private
AuthInterceptor
authInterceptor
;
@Bean
public
Retrofit
retrofit
()
{
...
...
src/main/java/cn/bugstack/xfg/frame/domain/req/CreateChatReq.java
0 → 100644
浏览文件 @
66404f3c
package
cn.bugstack.xfg.frame.domain.req
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.List
;
/**
* 创建聊天请求类
* 用于调用 RagFlow API 创建 AI 助手
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public
class
CreateChatReq
{
/**
* 助手名称
*/
private
String
name
;
/**
* Prompt 配置
*/
@JsonProperty
(
"prompt"
)
private
PromptConfig
promptConfig
;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public
static
class
PromptConfig
{
/**
* 系统提示词
*/
private
String
prompt
;
}
}
\ No newline at end of file
src/main/java/cn/bugstack/xfg/frame/domain/req/CreateSessionReq.java
0 → 100644
浏览文件 @
66404f3c
package
cn.bugstack.xfg.frame.domain.req
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* 创建会话请求类
* 用于在指定的助手下创建新的聊天会话
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public
class
CreateSessionReq
{
/**
* 会话名称
*/
private
String
name
;
}
\ No newline at end of file
src/main/java/cn/bugstack/xfg/frame/domain/res/ChatIdRes.java
0 → 100644
浏览文件 @
66404f3c
package
cn.bugstack.xfg.frame.domain.res
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonSetter
;
import
lombok.Data
;
/**
* 创建聊天响应类
* 用于接收 RagFlow API 创建助手的响应,只提取 chat_id
*/
@Data
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
ChatIdRes
{
/**
* 聊天 ID
*/
private
String
id
;
/**
* 从嵌套的 data 字段中提取 id
* @param data 响应数据
*/
@JsonSetter
(
"data"
)
public
void
setData
(
DataWrapper
data
)
{
if
(
data
!=
null
)
{
this
.
id
=
data
.
getId
();
}
}
@Data
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
static
class
DataWrapper
{
private
String
id
;
}
}
\ No newline at end of file
src/main/java/cn/bugstack/xfg/frame/domain/res/SessionRes.java
0 → 100644
浏览文件 @
66404f3c
package
cn.bugstack.xfg.frame.domain.res
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
lombok.Data
;
import
java.util.List
;
/**
* 创建会话响应类
* 用于接收 RagFlow API 创建会话的响应
*/
@Data
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
SessionRes
{
/**
* 响应码
*/
private
Integer
code
;
/**
* 会话数据
*/
private
SessionData
data
;
@Data
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
static
class
SessionData
{
/**
* 聊天 ID
*/
@JsonProperty
(
"chat_id"
)
private
String
chatId
;
/**
* 创建日期
*/
@JsonProperty
(
"create_date"
)
private
String
createDate
;
/**
* 创建时间戳
*/
@JsonProperty
(
"create_time"
)
private
Long
createTime
;
/**
* 会话 ID
*/
private
String
id
;
/**
* 消息列表
*/
private
List
<
Message
>
messages
;
/**
* 会话名称
*/
private
String
name
;
/**
* 更新日期
*/
@JsonProperty
(
"update_date"
)
private
String
updateDate
;
/**
* 更新时间戳
*/
@JsonProperty
(
"update_time"
)
private
Long
updateTime
;
/**
* 用户 ID
*/
@JsonProperty
(
"user_id"
)
private
String
userId
;
}
@Data
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
static
class
Message
{
/**
* 消息内容
*/
private
String
content
;
/**
* 角色(assistant/user)
*/
private
String
role
;
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录