mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-22 07:03:53 +08:00
refactor(knowledge):重构知识库模块架构并优化DTO结构
- 将BotController暂时注释以重新设计Agent集成方案 - 在多个DTO类中添加@JsonIgnoreProperties注解提升JSON序列化兼容性- 修改ChunkDTO中positions字段类型为嵌套列表并添加token字段 -为DatasetDTO和DocumentDTO添加更多时间日期字段映射 -重构KnowledgeBaseAdapter接口参数结构使用统一的请求对象 - 实现DocumentStatusSyncTask定时任务同步文档处理状态 -优化KnowledgeBaseService统计信息更新机制 - 修复数据集删除时的级联删除逻辑防止孤儿数据 - 统一本地实体ID与RAGFlow ID避免前端调用错误
This commit is contained in:
@@ -104,18 +104,6 @@ public class Oauth2Filter extends AuthenticatingFilter {
|
||||
if (StringUtils.isNotBlank(authorization) && authorization.startsWith("Bearer ")) {
|
||||
token = authorization.replace("Bearer ", "");
|
||||
}
|
||||
|
||||
// 开发环境:如果知识库接口没有 token,返回一个开发专用的 dummy token
|
||||
if (StringUtils.isBlank(token)) {
|
||||
String path = httpRequest.getRequestURI();
|
||||
String contextPath = httpRequest.getContextPath();
|
||||
if (StringUtils.isNotBlank(contextPath) && path.startsWith(contextPath)) {
|
||||
path = path.substring(contextPath.length());
|
||||
}
|
||||
if (path.equals("/datasets") || path.startsWith("/datasets/") || path.startsWith("/api/v1/")) {
|
||||
token = "DEV_TEST_TOKEN";
|
||||
}
|
||||
}
|
||||
return token;
|
||||
}
|
||||
}
|
||||
@@ -76,17 +76,6 @@ public class Oauth2Realm extends AuthorizingRealm {
|
||||
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
|
||||
String accessToken = (String) token.getPrincipal();
|
||||
|
||||
// 开发环境:处理 dummy token
|
||||
if ("DEV_TEST_TOKEN".equals(accessToken)) {
|
||||
UserDetail userDetail = new UserDetail();
|
||||
userDetail.setId(1L);
|
||||
userDetail.setUsername("test");
|
||||
userDetail.setSuperAdmin(SuperAdminEnum.YES.value()); // 赋予超级管理员权限以绕过所有权限检查
|
||||
userDetail.setToken(accessToken);
|
||||
userDetail.setStatus(1);
|
||||
return new SimpleAuthenticationInfo(userDetail, accessToken, getName());
|
||||
}
|
||||
|
||||
// 根据accessToken,查询用户信息
|
||||
SysUserTokenEntity tokenEntity = shiroService.getByToken(accessToken);
|
||||
// token失效
|
||||
|
||||
@@ -25,16 +25,13 @@ public class SecurityUser {
|
||||
*/
|
||||
public static UserDetail getUser() {
|
||||
Subject subject = getSubject();
|
||||
UserDetail user = null;
|
||||
if (subject != null) {
|
||||
user = (UserDetail) subject.getPrincipal();
|
||||
if (subject == null) {
|
||||
return new UserDetail();
|
||||
}
|
||||
|
||||
UserDetail user = (UserDetail) subject.getPrincipal();
|
||||
if (user == null) {
|
||||
user = new UserDetail();
|
||||
user.setId(1L);
|
||||
user.setUsername("test");
|
||||
user.setSuperAdmin(1);
|
||||
return new UserDetail();
|
||||
}
|
||||
|
||||
return user;
|
||||
|
||||
Reference in New Issue
Block a user