chore: initialize qiming workspace repository
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<groupId>com.xspaceagi</groupId>
|
||||
<artifactId>app-platform-agent</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>app-platform-agent-core-adapter</artifactId>
|
||||
<name>app-platform-agent-core-adapter</name>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.xspaceagi</groupId>
|
||||
<artifactId>app-platform-agent-core-spec</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.ai</groupId>
|
||||
<artifactId>spring-ai-client-chat</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.ai</groupId>
|
||||
<artifactId>spring-ai-ollama</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.xspaceagi</groupId>
|
||||
<artifactId>app-platform-mcp-sdk</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.xspaceagi</groupId>
|
||||
<artifactId>app-platform-custom-page-sdk</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.xspaceagi</groupId>
|
||||
<artifactId>system-application</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,241 @@
|
||||
package com.xspaceagi.agent.core.adapter.application;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.dto.AgentDetailDto;
|
||||
import com.xspaceagi.agent.core.adapter.dto.CardDto;
|
||||
import com.xspaceagi.agent.core.adapter.dto.UserAgentDto;
|
||||
import com.xspaceagi.agent.core.adapter.dto.config.AgentComponentConfigDto;
|
||||
import com.xspaceagi.agent.core.adapter.dto.config.AgentConfigDto;
|
||||
import com.xspaceagi.agent.core.adapter.dto.config.Arg;
|
||||
import com.xspaceagi.agent.core.adapter.dto.config.ModelConfigDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface AgentApplicationService {
|
||||
|
||||
/**
|
||||
* 新增智能体
|
||||
*
|
||||
* @param agent
|
||||
*/
|
||||
Long add(AgentConfigDto agent);
|
||||
|
||||
/**
|
||||
* 更新智能体基础配置,AgentConfig上有的字段
|
||||
*/
|
||||
void update(AgentConfigDto agentConfigDto);
|
||||
|
||||
/**
|
||||
* 删除智能体,含配置以及发布信息、统计信息、用户收藏点赞信息
|
||||
*
|
||||
* @param agentId
|
||||
*/
|
||||
void delete(Long agentId);
|
||||
|
||||
/**
|
||||
* 复制智能体
|
||||
*
|
||||
* @param userId
|
||||
* @param agentId
|
||||
* @return
|
||||
*/
|
||||
Long copyAgent(Long userId, Long agentId);
|
||||
|
||||
/**
|
||||
* 复制智能体
|
||||
*
|
||||
* @param userId
|
||||
* @param agentConfigDto
|
||||
* @param targetSpaceId
|
||||
* @return
|
||||
*/
|
||||
Long copyAgent(Long userId, AgentConfigDto agentConfigDto, Long targetSpaceId);
|
||||
|
||||
Long importAgent(Long userId, AgentConfigDto agentConfigDto, Long targetSpaceId);
|
||||
|
||||
/**
|
||||
* 移动智能体到其他空间
|
||||
*/
|
||||
void transfer(Long userId, Long agentId, Long targetSpaceId);
|
||||
|
||||
/**
|
||||
* 删除空间下的所有智能体
|
||||
*
|
||||
* @param spaceId
|
||||
*/
|
||||
void deleteBySpaceId(Long spaceId);
|
||||
|
||||
/**
|
||||
* 获取空间下的智能体列表
|
||||
*/
|
||||
List<AgentConfigDto> queryListBySpaceId(Long spaceId);
|
||||
|
||||
/**
|
||||
* 根据ID获取智能体列表
|
||||
*
|
||||
* @param agentIds
|
||||
* @return
|
||||
*/
|
||||
List<AgentConfigDto> queryListByIds(List<Long> agentIds);
|
||||
|
||||
/**
|
||||
* 根据ID获取智能体配置
|
||||
*
|
||||
* @param agentId
|
||||
* @return
|
||||
*/
|
||||
AgentConfigDto queryById(Long agentId);
|
||||
|
||||
AgentConfigDto queryByUid(String agentUid);
|
||||
|
||||
AgentConfigDto queryAgentByIdWithStatics(Long agentId);
|
||||
|
||||
/**
|
||||
* 添加组件配置
|
||||
*/
|
||||
void addComponentConfig(AgentComponentConfigDto agentComponentConfigDto);
|
||||
|
||||
/**
|
||||
* 更新组件配置
|
||||
*
|
||||
* @param agentComponentConfigDto
|
||||
*/
|
||||
void updateComponentConfig(AgentComponentConfigDto agentComponentConfigDto);
|
||||
|
||||
/**
|
||||
* 删除组件配置
|
||||
*
|
||||
* @param id 组件配置ID
|
||||
*/
|
||||
void deleteComponentConfig(Long id);
|
||||
|
||||
/**
|
||||
* 获取组件配置列表
|
||||
*/
|
||||
List<AgentComponentConfigDto> queryComponentConfigList(Long agentId);
|
||||
|
||||
/**
|
||||
* 获取组件配置
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
AgentComponentConfigDto queryComponentConfig(Long id);
|
||||
|
||||
List<Arg> getAgentNoneSystemVariables(Long agentId, Long spaceId);
|
||||
|
||||
/**
|
||||
* 获取完整的智能体配置,可选发布状态;执行使用
|
||||
*/
|
||||
AgentConfigDto queryPublishedConfigForExecute(Long agentId);
|
||||
|
||||
AgentConfigDto queryPublishedConfig(Long agentId, boolean execute);
|
||||
|
||||
/**
|
||||
* 获取完整的智能体配置;测试使用
|
||||
*/
|
||||
AgentConfigDto queryConfigForTestExecute(Long agentId);
|
||||
|
||||
AgentDetailDto queryAgentDetail(Long agentId, boolean isPublished);
|
||||
|
||||
/**
|
||||
* 获取卡片列表
|
||||
*/
|
||||
List<CardDto> queryCardList();
|
||||
|
||||
/**
|
||||
* 收藏
|
||||
*/
|
||||
void collect(Long userId, Long agentId);
|
||||
|
||||
/**
|
||||
* 取消收藏
|
||||
*/
|
||||
void unCollect(Long userId, Long agentId);
|
||||
|
||||
void devCollect(Long userId, Long agentId);
|
||||
|
||||
void unDevCollect(Long userId, Long agentId);
|
||||
|
||||
/**
|
||||
* 点赞
|
||||
*/
|
||||
void like(Long userId, Long agentId);
|
||||
|
||||
/**
|
||||
* 取消点赞
|
||||
*/
|
||||
void unLike(Long userId, Long agentId);
|
||||
|
||||
/**
|
||||
* 添加或更新最近使用的智能体
|
||||
*
|
||||
* @param userId
|
||||
* @param agentId
|
||||
*/
|
||||
void addOrUpdateRecentUsed(Long userId, Long agentId);
|
||||
|
||||
void addOrUpdateRecentUsed(Long userId, Long agentId, Long conversationId);
|
||||
|
||||
/**
|
||||
* 获取用户最近编辑的智能体列表
|
||||
*/
|
||||
List<UserAgentDto> queryRecentEditList(Long userId, Integer size);
|
||||
|
||||
/**
|
||||
* 获取用户最近使用过的智能体列表
|
||||
*/
|
||||
List<UserAgentDto> queryRecentUseList(Long userId, String kw, Integer size, Integer pageIndex);
|
||||
|
||||
/**
|
||||
* 获取用户最近使用过的智能体列表
|
||||
*/
|
||||
List<UserAgentDto> queryRecentUseList(Long userId, Integer size);
|
||||
|
||||
UserAgentDto queryUserAgentRecentUse(Long userId, Long agentId);
|
||||
|
||||
/**
|
||||
* 获取用户收藏的智能体列表
|
||||
*/
|
||||
List<UserAgentDto> queryCollectionList(Long userId, Integer page, Integer size);
|
||||
|
||||
/**
|
||||
* 开发收藏
|
||||
*
|
||||
* @param userId
|
||||
* @param page
|
||||
* @param size
|
||||
* @return
|
||||
*/
|
||||
List<UserAgentDto> queryDevCollectionList(Long userId, Integer page, Integer size);
|
||||
|
||||
/**
|
||||
* 为通用智能体构建MCP用于代理执行插件工作流知识库数据表
|
||||
*/
|
||||
void buildProxyMcp(AgentConfigDto agentConfigDto, boolean isDev);
|
||||
|
||||
|
||||
void updateAccessControlStatus(Long agentId, Integer status);
|
||||
|
||||
/**
|
||||
* 统计用户创建的智能体数量
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
Long countUserCreatedAgent(Long userId);
|
||||
|
||||
/**
|
||||
* 统计用户创建的网页应用数量
|
||||
*/
|
||||
Long countUserCreatedPageApp(Long userId);
|
||||
|
||||
/**
|
||||
* 获取用户可选择的模型列表
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param agentId 智能体ID
|
||||
* @return 模型列表
|
||||
*/
|
||||
List<ModelConfigDto> queryUserCanSelectModelListForAgent(Long userId, Long agentId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.xspaceagi.agent.core.adapter.application;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.dto.AgentTempChatDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface AgentTempChatApplicationService {
|
||||
|
||||
/**
|
||||
* 创建临时链接
|
||||
*
|
||||
* @param agentId
|
||||
* @return
|
||||
*/
|
||||
AgentTempChatDto createTempChat(Long agentId);
|
||||
|
||||
/**
|
||||
* 删除临时链接
|
||||
*
|
||||
* @param agentId
|
||||
* @param id
|
||||
*/
|
||||
void deleteTempChat(Long agentId, Long id);
|
||||
|
||||
/**
|
||||
* 修改临时链接
|
||||
*
|
||||
* @param agentTempChatDto
|
||||
*/
|
||||
void updateTempChat(AgentTempChatDto agentTempChatDto);
|
||||
|
||||
/**
|
||||
* 查询临时链接
|
||||
*
|
||||
* @param agentId
|
||||
* @return
|
||||
*/
|
||||
List<AgentTempChatDto> queryTempChatList(Long agentId);
|
||||
|
||||
/**
|
||||
* 根据chatKey查询临时链接
|
||||
*
|
||||
* @param chatKey
|
||||
* @return
|
||||
*/
|
||||
AgentTempChatDto queryTempChatByChatKey(String chatKey);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.xspaceagi.agent.core.adapter.application;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.dto.AddSkillsToWorkspaceDto;
|
||||
import com.xspaceagi.agent.core.adapter.dto.CreateWorkspaceDto;
|
||||
|
||||
public interface AgentWorkspaceApplicationService {
|
||||
|
||||
|
||||
/**
|
||||
* 创建/重置工作空间(不会重复创建,只重置skill/subagent,不会清除用户文件)
|
||||
* 如果传了技能id列表,会同时推送技能文件
|
||||
* 如果传了subagent列表,会同时推送subagent文件
|
||||
*/
|
||||
void createWorkspace(CreateWorkspaceDto createWorkspaceDto);
|
||||
|
||||
/**
|
||||
* 动态添加技能到工作空间
|
||||
* 支持传多个技能 id,动态增加的技能在重置工作空间时不会被清除
|
||||
*/
|
||||
void addSkillsToWorkspace(AddSkillsToWorkspaceDto addSkillsToWorkspaceDto);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.xspaceagi.agent.core.adapter.application;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.dto.PublishedDto;
|
||||
import com.xspaceagi.agent.core.adapter.repository.entity.Published;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CollectApplicationService {
|
||||
|
||||
|
||||
/**
|
||||
* 收藏
|
||||
*/
|
||||
void collect(Long userId, Published.TargetType targetType, Long targetId);
|
||||
|
||||
/**
|
||||
* 取消收藏
|
||||
*/
|
||||
void unCollect(Long userId, Published.TargetType targetType, Long targetId);
|
||||
|
||||
|
||||
/**
|
||||
* 查询收藏列表
|
||||
* @param userId
|
||||
* @param targetType
|
||||
* @param spaceId
|
||||
* @return
|
||||
*/
|
||||
List<PublishedDto> queryCollectList(Long userId, Published.TargetType targetType, Long spaceId);
|
||||
|
||||
/**
|
||||
* 查询收藏列表
|
||||
*/
|
||||
List<PublishedDto> queryCollectList(Long userId, Published.TargetType targetType, List<Long> spaceIds);
|
||||
|
||||
/**
|
||||
* 查询收藏列表
|
||||
*/
|
||||
List<PublishedDto> queryCollectListWithoutConfig(Long userId, Published.TargetType targetType, List<Long> spaceIds);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.xspaceagi.agent.core.adapter.application;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.dto.ComponentDto;
|
||||
|
||||
public interface ComponentApplicationService {
|
||||
|
||||
List<ComponentDto> getComponentListBySpaceId(Long spaceId);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.xspaceagi.agent.core.adapter.application;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.dto.ComputerPodResultDto;
|
||||
|
||||
/**
|
||||
* 容器应用服务
|
||||
*/
|
||||
public interface ComputerPodApplicationService {
|
||||
|
||||
/**
|
||||
* 启动容器
|
||||
*/
|
||||
ComputerPodResultDto ensurePod(Long cId);
|
||||
|
||||
/**
|
||||
* 容器保活
|
||||
*/
|
||||
ComputerPodResultDto keepalive(Long cId);
|
||||
|
||||
/**
|
||||
* 重启容器(销毁后重建)
|
||||
*/
|
||||
ComputerPodResultDto restart(Long cId);
|
||||
|
||||
/**
|
||||
* 查询容器 VNC 服务状态
|
||||
*/
|
||||
ComputerPodResultDto getVncStatus(Long cId);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.xspaceagi.agent.core.adapter.application;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.dto.ConfigHistoryDto;
|
||||
import com.xspaceagi.agent.core.adapter.repository.entity.Published;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ConfigHistoryApplicationService {
|
||||
|
||||
List<ConfigHistoryDto> queryConfigHistoryList(Published.TargetType targetType, Long targetId);
|
||||
|
||||
|
||||
ConfigHistoryDto queryConfigHistory(Long id);
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
package com.xspaceagi.agent.core.adapter.application;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.dto.*;
|
||||
import com.xspaceagi.agent.core.adapter.repository.entity.Conversation;
|
||||
import org.springframework.ai.chat.messages.Message;
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface ConversationApplicationService {
|
||||
|
||||
/**
|
||||
* 创建会话,返回会话
|
||||
*/
|
||||
ConversationDto createConversation(Long userId, Long agentId, boolean devMode);
|
||||
|
||||
ConversationDto createConversation(Long userId, Long agentId, boolean devMode, Map<String, Object> variables);
|
||||
|
||||
ConversationDto createConversation(Long userId, Long agentId, boolean devMode, boolean tempChat, Map<String, Object> variables);
|
||||
|
||||
ConversationDto createConversation(Long userId, Long agentId, boolean devMode, boolean tempChat);
|
||||
|
||||
void createConversationForPageApp(Long userId, Long agentId);
|
||||
|
||||
ConversationDto createConversationForTaskCenter(Long tenantId, Long userId, Long agentId);
|
||||
|
||||
/**
|
||||
* 创建任务会话,返回会话
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
ConversationDto createTaskConversation(Long userId, TaskConversationAddOrUpdateDto taskConversationAddOrUpdateDto);
|
||||
|
||||
|
||||
/**
|
||||
* 取消任务会话
|
||||
*
|
||||
* @param conversationId
|
||||
*/
|
||||
void cancelTaskConversation(Long userId, Long conversationId);
|
||||
|
||||
/**
|
||||
* 更新任务会话
|
||||
*/
|
||||
void updateTaskConversation(Long userId, TaskConversationAddOrUpdateDto taskConversationAddOrUpdateDto);
|
||||
|
||||
void updateConversationSandboxServerId(Long cid, String sandboxServerId);
|
||||
|
||||
|
||||
void updateConversationStatus(Long cid, Conversation.ConversationTaskStatus status);
|
||||
|
||||
/**
|
||||
* 删除会话
|
||||
*
|
||||
* @param userId
|
||||
* @param id
|
||||
*/
|
||||
void deleteConversation(Long userId, Long id);
|
||||
|
||||
/**
|
||||
* 更新会话
|
||||
*/
|
||||
void updateConversationTopic(Long userId, ConversationUpdateDto conversationUpdateDto);
|
||||
|
||||
/**
|
||||
* 查询会话
|
||||
*
|
||||
* @param userId
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
ConversationDto getConversation(Long userId, Long id);
|
||||
|
||||
ConversationDto getConversationByCid(Long cid);
|
||||
|
||||
ConversationDto getConversationByUid(Long userId, String uid);
|
||||
|
||||
ConversationDto getConversationByUid(String uid);
|
||||
|
||||
|
||||
/**
|
||||
* 查询会话列表
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<ConversationDto> queryConversationList(Long userId, Long agentId);
|
||||
|
||||
List<ConversationDto> queryConversationList(Long userId, Long agentId, Long lastId, Integer limit, String topic);
|
||||
|
||||
|
||||
/**
|
||||
* 根据sandboxServerId查询会话列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<ConversationDto> queryConversationListBySandboxServerId(Long sandboxServerId);
|
||||
|
||||
/**
|
||||
* 查询任务会话列表
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<ConversationDto> queryTaskConversationList(Long userId, Long agentId, Conversation.ConversationTaskStatus taskStatus);
|
||||
|
||||
/**
|
||||
* 查询会话消息
|
||||
*/
|
||||
List<ChatMessageDto> queryConversationMessageList(Long userId, Long conversationId, Long index, int size);
|
||||
|
||||
/**
|
||||
* 总结会话
|
||||
*/
|
||||
void summaryConversation(Long conversationId);
|
||||
|
||||
/**
|
||||
* 放进会话总结队列
|
||||
*
|
||||
* @param conversationId 会话id
|
||||
*/
|
||||
void pushToSummaryQueue(Long conversationId);
|
||||
|
||||
String queryMemory(Long tenantId, Long userId, Long agentId, String inputMessage, String context, boolean justKeywordSearch, boolean filterSensitive);
|
||||
|
||||
Flux<AgentOutputDto> chat(TryReqDto tryReqDto, Map<String, String> headersFromRequest, boolean isTempChat);
|
||||
|
||||
Flux<AgentOutputDto> chat(TryReqDto tryReqDto, Map<String, String> headersFromRequest, boolean isTempChat, Boolean devMode);
|
||||
|
||||
List<AgentUserDto> queryAgentUserList(Long agentId, Long cursorUserId);
|
||||
|
||||
Long nextConversationId(Long agentId, String sandboxServerId);
|
||||
|
||||
Collection<? extends Message> getRoundMessages(String conversationId, int i);
|
||||
|
||||
void addRoundMessage(String conversationId, Message message);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.xspaceagi.agent.core.adapter.application;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.dto.ComputerFileInfo;
|
||||
import com.xspaceagi.system.spec.common.UserContext;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 通用文件应用服务
|
||||
*/
|
||||
public interface IComputerFileApplicationService {
|
||||
|
||||
/**
|
||||
* 查询文件列表
|
||||
*/
|
||||
Map<String, Object> getFileList(Long userId, Long cId, String proxyPath, UserContext userContext);
|
||||
|
||||
/**
|
||||
* 更新文件
|
||||
*/
|
||||
Map<String, Object> filesUpdate(Long userId, Long cId, List<ComputerFileInfo> files, UserContext userContext);
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
*/
|
||||
Map<String, Object> uploadFile(Long userId, Long cId, String filePath, MultipartFile file, UserContext userContext);
|
||||
|
||||
/**
|
||||
* 批量上传文件
|
||||
*/
|
||||
Map<String, Object> uploadFiles(Long userId, Long cId, List<String> filePaths, List<MultipartFile> files, UserContext userContext);
|
||||
|
||||
/**
|
||||
* 获取静态文件
|
||||
*/
|
||||
ResponseEntity<StreamingResponseBody> getStaticFile(Long cId, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 下载全部文件(zip)
|
||||
*/
|
||||
ResponseEntity<StreamingResponseBody> downloadAllFiles(Long userId, Long cId, UserContext userContext);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
package com.xspaceagi.agent.core.adapter.application;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.dto.CodeCheckResultDto;
|
||||
import com.xspaceagi.agent.core.adapter.dto.ModelQueryDto;
|
||||
import com.xspaceagi.agent.core.adapter.dto.config.ModelConfigDto;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ModelApplicationService {
|
||||
|
||||
/**
|
||||
* 添加或更新模型配置
|
||||
*
|
||||
* @param modelDto
|
||||
*/
|
||||
void addOrUpdate(ModelConfigDto modelDto);
|
||||
|
||||
|
||||
/**
|
||||
* 更新模型访问控制状态
|
||||
*
|
||||
* @param id
|
||||
* @param status
|
||||
*/
|
||||
void updateAccessControlStatus(Long id, Integer status);
|
||||
|
||||
/**
|
||||
* 删除模型配置
|
||||
*
|
||||
* @param modelId
|
||||
*/
|
||||
void delete(Long modelId);
|
||||
|
||||
/**
|
||||
* 查询空间下的模型列表
|
||||
*/
|
||||
List<ModelConfigDto> queryModelConfigLisBySpaceId(Long spaceId);
|
||||
|
||||
/**
|
||||
* 查询可使用的模型列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<ModelConfigDto> queryModelConfigList(ModelQueryDto modelQueryDto);
|
||||
|
||||
/**
|
||||
* 获取商家全局模型
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<ModelConfigDto> queryTenantModelConfigList(Integer accessControlStatus);
|
||||
|
||||
/**
|
||||
* 根据ID查询模型配置
|
||||
*
|
||||
* @param modelId
|
||||
* @return
|
||||
*/
|
||||
ModelConfigDto queryModelConfigById(Long modelId);
|
||||
|
||||
List<ModelConfigDto> queryModelConfigListByIds(List<Long> modelIds);
|
||||
|
||||
ModelConfigDto queryDefaultModelConfig();
|
||||
|
||||
ModelConfigDto queryDefaultModelConfig(Long tenantId);
|
||||
|
||||
/**
|
||||
* 检查模型使用权限
|
||||
*
|
||||
* @param modelId
|
||||
*/
|
||||
void checkModelUsePermission(Long modelId);
|
||||
|
||||
/**
|
||||
* 检查模型管理权限
|
||||
*
|
||||
* @param modelId
|
||||
*/
|
||||
void checkModelManagePermission(Long modelId);
|
||||
|
||||
|
||||
/**
|
||||
* 通过提示词给到模型执行,返回结果根据实际定义的Bean
|
||||
*
|
||||
* @param sysPrompt 系统提示词
|
||||
* @param userPrompt 用户输入
|
||||
* @param type 类型
|
||||
* @return
|
||||
*/
|
||||
<T> T call(String sysPrompt, String userPrompt, ParameterizedTypeReference<T> type);
|
||||
|
||||
/**
|
||||
* 通过提示词给到模型执行,返回结果根据实际定义的Bean
|
||||
*
|
||||
* @param modelId 模型ID
|
||||
* @param sysPrompt 系统提示词
|
||||
* @param userPrompt 用户输入
|
||||
* @param type 类型
|
||||
* @return
|
||||
*/
|
||||
<T> T call(Long modelId, String sysPrompt, String userPrompt, ParameterizedTypeReference<T> type);
|
||||
|
||||
/**
|
||||
* 通过提示词给到模型执行,返回结果为定义的Bean
|
||||
*
|
||||
* @param userPrompt 用户输入
|
||||
* @param type 类型
|
||||
* @return
|
||||
*/
|
||||
<T> T call(String userPrompt, ParameterizedTypeReference<T> type);
|
||||
|
||||
/**
|
||||
* 通过提示词给到模型执行,返回结果为文本
|
||||
*
|
||||
* @param userPrompt 用户输入
|
||||
* @return
|
||||
*/
|
||||
String call(String userPrompt);
|
||||
|
||||
/**
|
||||
* 向量化
|
||||
*
|
||||
* @param texts
|
||||
* @return
|
||||
*/
|
||||
List<float[]> embeddings(List<String> texts, Long modelId);
|
||||
|
||||
ModelConfigDto getDefaultEmbedModel();
|
||||
|
||||
void checkUserModelPermission(Long userId, Long modelId);
|
||||
|
||||
CodeCheckResultDto codeSaleCheck(String code);
|
||||
|
||||
/**
|
||||
* 测试模型连通性
|
||||
*
|
||||
* @param modelConfig
|
||||
* @param testPrompt
|
||||
* @return
|
||||
*/
|
||||
String testModelConnectivity(ModelConfigDto modelConfig, String testPrompt);
|
||||
|
||||
List<ModelConfigDto> getMySystemModels(Long userId, String tab);
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.xspaceagi.agent.core.adapter.application;
|
||||
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.dto.*;
|
||||
import com.xspaceagi.agent.core.adapter.dto.config.Arg;
|
||||
import com.xspaceagi.agent.core.adapter.dto.config.plugin.PluginDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface PluginApplicationService {
|
||||
|
||||
|
||||
/**
|
||||
* 新增插件
|
||||
*/
|
||||
Long add(PluginAddDto pluginAddDto);
|
||||
|
||||
/**
|
||||
* 更新插件
|
||||
*/
|
||||
void update(PluginUpdateDto pluginUpdateDto);
|
||||
|
||||
List<Arg> analysisPluginOutput(AnalysisHttpPluginOutputDto analysisHttpPluginOutputDto);
|
||||
|
||||
/**
|
||||
* 删除插件
|
||||
*/
|
||||
void delete(Long pluginId);
|
||||
|
||||
/**
|
||||
* 复制插件
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Long copyPlugin(Long userId, Long pluginId);
|
||||
|
||||
Long copyPlugin(Long userId, PluginDto pluginDto, Long targetSpaceId);
|
||||
|
||||
/**
|
||||
* 删除空间下的所有插件
|
||||
*
|
||||
* @param spaceId
|
||||
*/
|
||||
void deleteBySpaceId(Long spaceId);
|
||||
|
||||
/**
|
||||
* 获取空间下的插件列表
|
||||
*/
|
||||
List<PluginDto> queryListBySpaceId(Long spaceId);
|
||||
|
||||
/**
|
||||
* 根据ID获取插件列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<PluginDto> queryListByIds(List<Long> pluginIds);
|
||||
|
||||
/**
|
||||
* 根据ID获取插件配置
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
PluginDto queryById(Long pluginId);
|
||||
|
||||
/**
|
||||
* 获取发布状态的插件配置
|
||||
*
|
||||
* @param pluginId
|
||||
* @return
|
||||
*/
|
||||
PluginDto queryPublishedPluginConfig(Long pluginId, Long spaceId);
|
||||
|
||||
/**
|
||||
* 测试插件执行
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
PluginExecuteResultDto execute(PluginExecuteRequestDto pluginExecuteRequestDto, PluginDto pluginDto);
|
||||
|
||||
/**
|
||||
* 检查空间插件权限
|
||||
*
|
||||
* @param spaceId
|
||||
* @param pluginId
|
||||
*/
|
||||
void checkSpacePluginPermission(Long spaceId, Long pluginId);
|
||||
|
||||
/**
|
||||
* 检查插件配置完整性
|
||||
*
|
||||
* @param pluginDto
|
||||
* @return
|
||||
*/
|
||||
List<String> validatePluginConfig(PluginDto pluginDto);
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.xspaceagi.agent.core.adapter.application;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.xspaceagi.agent.core.adapter.dto.*;
|
||||
import com.xspaceagi.agent.core.adapter.repository.entity.Published;
|
||||
import com.xspaceagi.system.spec.dto.PageQueryVo;
|
||||
import com.xspaceagi.system.spec.page.SuperPage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface PublishApplicationService {
|
||||
|
||||
/**
|
||||
* 获取已发布分页结果
|
||||
*/
|
||||
SuperPage<PublishedDto> queryPublishedList(PublishedQueryDto publishedQueryDto);
|
||||
|
||||
SuperPage<PublishedDto> queryPublishedListForAt(PublishedQueryDto publishedQueryDto);
|
||||
|
||||
List<PublishedDto> queryPublishedList(Published.TargetType targetType, List<Long> targetIds);
|
||||
|
||||
List<PublishedDto> queryPublishedListWithoutConfig(Published.TargetType targetType, List<Long> targetIds, String kw);
|
||||
|
||||
List<PublishedDto> queryPublishedList(Published.TargetType targetType, List<Long> targetIds, String kw);
|
||||
|
||||
IPage<PublishedDto> queryPublishedListForManage(PublishedQueryDto publishedQueryDto);
|
||||
|
||||
/**
|
||||
* 获取已发布详情
|
||||
*/
|
||||
PublishedDto queryPublished(Published.TargetType targetType, Long targetId);
|
||||
|
||||
PublishedDto queryPublished(Published.TargetType targetType, Long targetId, boolean loadConfig);
|
||||
|
||||
PublishedDto queryPublishedWithSpaceId(Published.TargetType targetType, Long targetId, Long spaceId);
|
||||
|
||||
/**
|
||||
* 发布申请
|
||||
*/
|
||||
Long publishApply(PublishApplyDto publishApplyDto);
|
||||
|
||||
/**
|
||||
* 通过发布
|
||||
*/
|
||||
void publish(Long applyId);
|
||||
|
||||
|
||||
void publish(Published.TargetType targetType, Long targetId, Published.PublishScope scope, List<PublishApplyDto> publishApplies);
|
||||
|
||||
/**
|
||||
* 复制发布信息到指定空间
|
||||
*/
|
||||
Long copyPublish(Long userId, Published.TargetType targetType, Long targetId, Long originalSpaceId, Long targetSpaceId);
|
||||
|
||||
/**
|
||||
* 拒绝发布
|
||||
*/
|
||||
void rejectPublish(PublishRejectDto publishRejectDto);
|
||||
|
||||
/**
|
||||
* 下架
|
||||
*/
|
||||
void offShelf(OffShelfDto offShelfDto);
|
||||
|
||||
/**
|
||||
* 查询发布申请列表
|
||||
*
|
||||
* @param pageQueryVo
|
||||
* @return
|
||||
*/
|
||||
IPage<PublishApplyDto> queryPublishApplyList(PageQueryVo<PublishApplyQueryDto> pageQueryVo);
|
||||
|
||||
/**
|
||||
* 根据ID查询发布申请
|
||||
*
|
||||
* @param applyId
|
||||
* @return
|
||||
*/
|
||||
PublishApplyDto queryPublishApplyById(Long applyId);
|
||||
|
||||
/**
|
||||
* 根据publishId查询数据
|
||||
*/
|
||||
PublishedDto queryPublishedById(Long publishId);
|
||||
|
||||
/**
|
||||
* 增加统计数量
|
||||
*
|
||||
* @param targetType
|
||||
* @param targetId
|
||||
* @param key
|
||||
* @param inc
|
||||
*/
|
||||
void incStatisticsCount(Published.TargetType targetType, Long targetId, String key, Long inc);
|
||||
|
||||
/**
|
||||
* 删除发布申请
|
||||
*/
|
||||
void deletePublishedApply(Published.TargetType type, Long targetId);
|
||||
|
||||
StatisticsDto queryStatistics(Published.TargetType type, Long targetId);
|
||||
|
||||
|
||||
void deleteBySpaceId(Long spaceId);
|
||||
|
||||
PublishedPermissionDto hasPermission(Published.TargetType targetType, Long targetId);
|
||||
|
||||
void updateAccessControlStatus(Published.TargetType targetType, Long targetId, Integer status);
|
||||
|
||||
void updatePublishName(Published.TargetType targetType, Long targetId, String name);
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.xspaceagi.agent.core.adapter.application;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.dto.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
public interface SkillApplicationService {
|
||||
|
||||
/**
|
||||
* 添加技能
|
||||
*/
|
||||
Long add(SkillConfigDto skillConfigDto);
|
||||
|
||||
/**
|
||||
* 更新技能
|
||||
*/
|
||||
void update(SkillConfigDto skillConfigDto, boolean isReplaceFiles);
|
||||
|
||||
/**
|
||||
* 删除技能
|
||||
*/
|
||||
void delete(Long skillId);
|
||||
|
||||
/**
|
||||
* 根据ID查询技能
|
||||
*/
|
||||
SkillConfigDto queryById(Long skillId, boolean loadFiles);
|
||||
|
||||
/**
|
||||
* 根据ID查询技能
|
||||
*/
|
||||
SkillConfigDto queryById(Long skillId);
|
||||
|
||||
/**
|
||||
* 查询已发布的技能配置
|
||||
*/
|
||||
SkillConfigDto queryPublishedSkillConfig(Long skillId, Long spaceId, boolean loadFiles);
|
||||
|
||||
/**
|
||||
* 解析已发布技能配置(兼容新旧格式)
|
||||
*/
|
||||
SkillConfigDto parsePublishedSkillConfig(String config, Object ext);
|
||||
|
||||
/**
|
||||
* 查询用户相关的已发布的技能,过滤掉没有权限的技能
|
||||
*/
|
||||
List<SkillConfigDto> queryUserRelatedPublishedSkillConfigs(Long userId, List<Long> skillIds);
|
||||
|
||||
/**
|
||||
* 查询技能列表
|
||||
*/
|
||||
List<SkillConfigDto> queryList(SkillQueryDto queryDto);
|
||||
|
||||
/**
|
||||
* 导出技能
|
||||
*/
|
||||
SkillExportResultDto exportSkill(Long skillId);
|
||||
|
||||
/**
|
||||
* 导出技能
|
||||
*/
|
||||
SkillExportResultDto exportSkill(SkillConfigDto skillConfigDto);
|
||||
|
||||
/**
|
||||
* 导入技能
|
||||
*/
|
||||
Long importSkill(MultipartFile file, SkillConfigDto existSkill, Long targetSpaceId, SkillExtDto ext);
|
||||
|
||||
/**
|
||||
* 复制技能
|
||||
*/
|
||||
Long copySkill(SkillConfigDto skillConfigDto, Long targetSpaceId);
|
||||
|
||||
/**
|
||||
* 查询技能模板
|
||||
*/
|
||||
SkillConfigDto getSkillTemplate(InputStream inputStream);
|
||||
|
||||
/**
|
||||
* 校验空间技能权限
|
||||
*/
|
||||
void checkSpaceSkillPermission(Long spaceId, Long skillId);
|
||||
|
||||
/**
|
||||
* 处理上传的文件并上传到文件服务,返回文件索引
|
||||
*/
|
||||
SkillFileDto processUploadFile(MultipartFile file, String filePath, Long skillId);
|
||||
|
||||
/**
|
||||
* 记录最近使用的技能
|
||||
*/
|
||||
void saveRecentlyUsedSkills(List<Long> skillIds);
|
||||
|
||||
/**
|
||||
* 查询最近使用的技能
|
||||
*/
|
||||
List<PublishedDto> queryRecentlyUsedSkills(String kw, Integer size);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.xspaceagi.agent.core.adapter.application;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.dto.ExportTemplateDto;
|
||||
import com.xspaceagi.agent.core.adapter.repository.entity.Published;
|
||||
import com.xspaceagi.system.application.dto.UserDto;
|
||||
|
||||
public interface TemplateExportOrImportService {
|
||||
|
||||
ExportTemplateDto queryTemplateConfig(Published.TargetType targetType, Long targetId);
|
||||
|
||||
Long importTemplateConfig(UserDto user, Long spaceId, Published.TargetType targetType, String templateConfig);
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
package com.xspaceagi.agent.core.adapter.application;
|
||||
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.xspaceagi.agent.core.adapter.dto.*;
|
||||
import com.xspaceagi.agent.core.adapter.dto.config.workflow.WorkflowConfigDto;
|
||||
import com.xspaceagi.agent.core.adapter.dto.config.workflow.WorkflowNodeDto;
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface WorkflowApplicationService {
|
||||
|
||||
|
||||
/**
|
||||
* 新增工作流
|
||||
*/
|
||||
Long add(WorkflowConfigDto workflowConfig);
|
||||
|
||||
/**
|
||||
* 整体保存工作流
|
||||
*/
|
||||
void save(JSONObject workflowConfigJson, WorkflowConfigDto oldWorkflowConfigDto);
|
||||
|
||||
/**
|
||||
* 更新工作流
|
||||
*/
|
||||
void update(WorkflowConfigDto workflowConfig);
|
||||
|
||||
/**
|
||||
* 删除工作流
|
||||
*/
|
||||
void delete(Long workflowId);
|
||||
|
||||
/**
|
||||
* 复制工作流
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Long copyWorkflow(Long userId, Long workflowId);
|
||||
|
||||
/**
|
||||
* 复制工作流
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Long copyWorkflow(Long userId, WorkflowConfigDto workflowConfigDto, Long targetSpaceId);
|
||||
|
||||
void restoreWorkflow(WorkflowConfigDto workflowConfigDto);
|
||||
|
||||
void restoreWorkflow(String historyConfig);
|
||||
|
||||
/**
|
||||
* 移动工作流到其他空间
|
||||
*/
|
||||
void transfer(Long workflowId, Long targetSpaceId);
|
||||
|
||||
/**
|
||||
* 删除空间下的所有工作流
|
||||
*
|
||||
* @param spaceId
|
||||
*/
|
||||
void deleteBySpaceId(Long spaceId);
|
||||
|
||||
/**
|
||||
* 获取空间下的工作流列表
|
||||
*/
|
||||
List<WorkflowConfigDto> queryListBySpaceId(Long spaceId);
|
||||
|
||||
/**
|
||||
* 根据ID获取工作流列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<WorkflowConfigDto> queryListByIds(List<Long> workflowIds);
|
||||
|
||||
/**
|
||||
* 根据ID获取工作流配置
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
WorkflowConfigDto queryById(Long workflowId);
|
||||
|
||||
WorkflowConfigDto queryByIdWithoutNodes(Long workflowId);
|
||||
|
||||
//查询已发布的工作流配置
|
||||
WorkflowConfigDto queryPublishedWorkflowConfig(Long workflowId, Long spaceId, boolean forExecute);
|
||||
|
||||
WorkflowConfigDto queryPublishedWorkflowConfig(Long workflowId, Long spaceId);
|
||||
|
||||
/**
|
||||
* 添加节点
|
||||
*/
|
||||
Long addWorkflowNode(WorkflowNodeAddDto workflowNodeAddDto);
|
||||
|
||||
/**
|
||||
* 更新节点配置
|
||||
*/
|
||||
<T> void updateWorkflowNodeConfig(WorkflowNodeUpdateDto<T> workflowNodeDto);
|
||||
|
||||
/**
|
||||
* 删除节点
|
||||
*/
|
||||
void deleteWorkflowNode(Long id);
|
||||
|
||||
/**
|
||||
* 获取节点列表
|
||||
*/
|
||||
List<WorkflowNodeDto> queryWorkflowNodeList(Long workflowId);
|
||||
|
||||
/**
|
||||
* 获取节点列表
|
||||
*/
|
||||
List<WorkflowNodeDto> queryWorkflowNodeListForTestExecute(Long workflowId);
|
||||
|
||||
/**
|
||||
* 获取上级节点列表
|
||||
*/
|
||||
PreviousDto queryPreviousNodes(Long nodeId);
|
||||
|
||||
/**
|
||||
* 获取节点配置
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
WorkflowNodeDto queryWorkflowNode(Long id);
|
||||
|
||||
Long copyWorkflowNode(Long id);
|
||||
|
||||
void updateNextIds(Long nodeId, List<Long> nextIds);
|
||||
|
||||
/**
|
||||
* 检查用户工作流权限
|
||||
*
|
||||
* @param spaceId
|
||||
* @param workflowId
|
||||
*/
|
||||
void checkSpaceWorkflowPermission(Long spaceId, Long workflowId);
|
||||
|
||||
/**
|
||||
* 梳理出工作流节点层级关系,输出给前端配置使用
|
||||
*
|
||||
* @param workflowNodeDtos
|
||||
* @return
|
||||
*/
|
||||
List<WorkflowNodeDto> organizeNodeHierarchicalRelationship(List<WorkflowNodeDto> workflowNodeDtos);
|
||||
|
||||
/**
|
||||
* 校验工作流节点配置是否正确,用于发布和试运行之前
|
||||
*
|
||||
* @param workflowId
|
||||
* @return
|
||||
*/
|
||||
List<WorkflowNodeCheckDto> validWorkflow(Long workflowId);
|
||||
|
||||
WorkflowNodeCheckDto validWorkflowNode(WorkflowNodeDto workflowNodeDto);
|
||||
|
||||
void updateLoopInnerNodes(Long loopNodeId, List<JSONObject> innerNodes);
|
||||
|
||||
|
||||
Flux<WorkflowExecutingDto> executeWorkflow(WorkflowExecuteRequestDto workflowExecuteRequestDto, WorkflowConfigDto workflowConfigDto);
|
||||
|
||||
Long workflowEditVersion(Long workflowId, boolean inc);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.xspaceagi.agent.core.adapter.constant;
|
||||
|
||||
public final class SkillFileFormatConstants {
|
||||
|
||||
private SkillFileFormatConstants() {
|
||||
}
|
||||
|
||||
public static final String SKILL_FILES_V2 = "skill_files_v2";
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@Schema(description = "动态增加技能到工作空间请求DTO")
|
||||
public class AddSkillsToWorkspaceDto implements Serializable {
|
||||
|
||||
@Schema(description = "用户ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long userId;
|
||||
|
||||
@NotNull
|
||||
@JsonProperty("cId")
|
||||
@Schema(description = "会话ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long cId;
|
||||
|
||||
@Schema(description = "技能ID列表", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<SkillConfigDto> skillConfigs;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class AgentAddDto implements Serializable {
|
||||
|
||||
@Schema(description = "空间ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "Space ID is required")
|
||||
private Long spaceId; // 空间ID
|
||||
|
||||
@Schema(description = "Agent名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "Agent name is required")
|
||||
private String name; // Agent名称
|
||||
|
||||
@Schema(description = "Agent描述")
|
||||
private String description; // Agent描述
|
||||
|
||||
@Schema(description = "图标地址")
|
||||
private String icon; // 图标地址
|
||||
|
||||
@Schema(description = "类型,ChatBot 对话智能体;TaskAgent 任务型智能体", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String type;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.repository.entity.AgentComponentConfig;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class AgentComponentConfigAddDto {
|
||||
|
||||
@Schema(description = "关联的AgentID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "agentId is required")
|
||||
private Long agentId; // AgentID
|
||||
|
||||
@Schema(description = "组件类型", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "type is required")
|
||||
private AgentComponentConfig.Type type;
|
||||
|
||||
@Schema(description = "关联的组件ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "targetId is required")
|
||||
private Long targetId; // 关联的组件ID
|
||||
|
||||
@Schema(description = "工具名称,选择MCP时有用")
|
||||
private String toolName;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class AgentComponentConfigUpdateDto<T> {
|
||||
|
||||
@Schema(description = "组件配置ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long id; // 组件配置ID
|
||||
|
||||
@Schema(description = "组件名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "组件图标")
|
||||
private String icon;
|
||||
|
||||
@Schema(description = "组件描述")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "目标组件ID")
|
||||
private Long targetId;
|
||||
|
||||
@Schema(description = "绑定组件配置,不同组件配置不一样")
|
||||
private T bindConfig; //绑定组件配置
|
||||
|
||||
private Integer exceptionOut; // 异常是否抛出,中断主要流程
|
||||
|
||||
private String fallbackMsg; // 异常时兜底内容
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.repository.entity.AgentConfig;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class AgentConfigUpdateDto implements Serializable {
|
||||
|
||||
@Schema(description = "智能体ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "id is required")
|
||||
private Long id; // 智能体ID
|
||||
|
||||
@Schema(description = "Agent名称")
|
||||
private String name; // Agent名称
|
||||
|
||||
@Schema(description = "Agent描述")
|
||||
private String description; // Agent描述
|
||||
|
||||
@Schema(description = "图标地址")
|
||||
private String icon; // 图标地址
|
||||
|
||||
@Schema(description = "系统提示词")
|
||||
private String systemPrompt; // 系统提示词
|
||||
|
||||
@Schema(description = "用户消息提示词")
|
||||
private String userPrompt; // 用户消息提示词,{{AGENT_USER_MSG}}引用用户消息
|
||||
|
||||
@Schema(description = "是否开启问题建议")
|
||||
private AgentConfig.OpenStatus openSuggest; // 是否开启问题建议
|
||||
|
||||
@Schema(description = "问题建议提示词")
|
||||
private String suggestPrompt; // 用户问题建议
|
||||
|
||||
@Schema(description = "首次打开聊天框自动回复消息")
|
||||
private String openingChatMsg; // 首次打开聊天框自动回复消息
|
||||
|
||||
@Schema(description = "首次打开引导问题(弃用)")
|
||||
private List<String> openingGuidQuestions; // 开场引导问题
|
||||
|
||||
@Schema(description = "引导问题")
|
||||
private List<GuidQuestionDto> guidQuestionDtos;
|
||||
|
||||
@Schema(description = "是否开启长期记忆")
|
||||
private AgentConfig.OpenStatus openLongMemory; // 是否开启长期记忆
|
||||
|
||||
@Schema(description = "是否开启定时任务")
|
||||
private AgentConfig.OpenStatus openScheduledTask;
|
||||
|
||||
@Schema(description = "是否隐藏远程桌面,1 隐藏;0 不隐藏")
|
||||
private Integer hideDesktop;
|
||||
|
||||
@Schema(description = "是否允许用户在对话框中选择其他模型, 1 允许,其他不允许")
|
||||
private Integer allowOtherModel;
|
||||
|
||||
@Schema(description = "是否允许用户在对话框中@技能, 1 允许,其他不允许")
|
||||
private Integer allowAtSkill;
|
||||
|
||||
@Schema(description = "是否允许用户在对话框中选择自己的电脑, 1 允许,其他不允许")
|
||||
private Integer allowPrivateSandbox;
|
||||
|
||||
@Schema(description = "是否默认展开扩展页面区域, 1 展开;0 不展开")
|
||||
private Integer expandPageArea;
|
||||
|
||||
@Schema(description = "是否隐藏聊天区域,1 隐藏;0 不隐藏")
|
||||
private Integer hideChatArea;
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.dto.config.AgentConfigDto;
|
||||
import com.xspaceagi.agent.core.adapter.dto.config.Arg;
|
||||
import com.xspaceagi.agent.core.adapter.dto.config.bind.EventBindConfigDto;
|
||||
import com.xspaceagi.agent.core.adapter.repository.entity.AgentConfig;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class AgentDetailDto implements Serializable {
|
||||
|
||||
private Long spaceId;
|
||||
|
||||
private Long creatorId;
|
||||
|
||||
@Schema(description = "智能体ID")
|
||||
private Long agentId;
|
||||
|
||||
@Schema(description = "agent唯一标识")
|
||||
private String uid; // agent唯一标识
|
||||
|
||||
@Schema(description = "智能体类型,ChatBot 对话智能体;PageApp 网页应用智能体")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "智能体名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "智能体介绍信息")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "图标")
|
||||
private String icon;
|
||||
|
||||
@Schema(description = "发布备注信息")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "智能体发布时间")
|
||||
private Date publishDate;
|
||||
|
||||
@Schema(description = "统计信息")
|
||||
private StatisticsDto statistics;
|
||||
|
||||
@Schema(description = "发布者信息")
|
||||
private PublishUserDto publishUser;
|
||||
|
||||
@Schema(description = "当前登录用户是否收藏")
|
||||
private boolean isCollect;
|
||||
|
||||
@Schema(description = "智能体分类名称")
|
||||
private String category;
|
||||
|
||||
@Schema(description = "是否开启问题建议")
|
||||
private AgentConfig.OpenStatus openSuggest;
|
||||
@Schema(description = "开场白文案")
|
||||
private String openingChatMsg;
|
||||
|
||||
@Schema(description = "引导问题(弃用)")
|
||||
private List<String> openingGuidQuestions;
|
||||
|
||||
@Schema(description = "引导问题")
|
||||
private List<GuidQuestionDto> guidQuestionDtos;
|
||||
|
||||
@Schema(description = "是否开启定时任务")
|
||||
private AgentConfig.OpenStatus openScheduledTask;
|
||||
|
||||
@Schema(description = "用户手动填写的变量参数")
|
||||
private List<Arg> variables;
|
||||
|
||||
@Schema(description = "分享链接")
|
||||
private String shareLink;
|
||||
|
||||
@Schema(description = "可手动选择的组件列表")
|
||||
private List<AgentManualComponentDto> manualComponents;
|
||||
|
||||
@Schema(description = "是否允许复制, 1 允许")
|
||||
private Integer allowCopy;
|
||||
|
||||
@Schema(description = "会话ID")
|
||||
private Long conversationId;
|
||||
|
||||
@Schema(description = "沙盒ID")
|
||||
private Long sandboxId;
|
||||
|
||||
@Schema(description = "是否拥有权限")
|
||||
private boolean hasPermission;
|
||||
|
||||
@Schema(description = "是否默认展开扩展页面区域, 1 展开;0 不展开")
|
||||
private Integer expandPageArea;
|
||||
|
||||
@Schema(description = "是否隐藏聊天区域,1 隐藏;0 不隐藏")
|
||||
private Integer hideChatArea;
|
||||
|
||||
@Schema(description = "是否隐藏远程桌面, 1 隐藏;0 不隐藏")
|
||||
private Integer hideDesktop;
|
||||
|
||||
@Schema(description = "是否允许用户在对话框中选择其他模型, 1 允许,其他不允许")
|
||||
private Integer allowOtherModel;
|
||||
|
||||
@Schema(description = "是否允许用户在对话框中@技能, 1 允许,其他不允许")
|
||||
private Integer allowAtSkill;
|
||||
|
||||
@Schema(description = "是否允许用户在对话框中选择自己的电脑, 1 允许,其他不允许")
|
||||
private Integer allowPrivateSandbox;
|
||||
|
||||
@Schema(description = "扩展页面首页")
|
||||
private String pageHomeIndex;
|
||||
|
||||
@Schema(description = "扩展页面菜单")
|
||||
private List<AgentConfigDto.CustomPageMenu> customPageMenus;
|
||||
|
||||
@Schema(description = "事件绑定配置")
|
||||
private EventBindConfigDto eventBindConfig;
|
||||
|
||||
@Schema(description = "是否需要付费")
|
||||
private boolean paymentRequired;
|
||||
|
||||
@Schema(description = "可试用次数,0=不支持试用")
|
||||
private Integer trialCount;
|
||||
|
||||
@Schema(description = "已调用的试用次数")
|
||||
private Integer calledTrialCount;
|
||||
|
||||
@Schema(description = "是否已订阅,对智能体和技能有效")
|
||||
private boolean subscribed;
|
||||
|
||||
@Schema(description = "超出调用限制提示")
|
||||
private boolean overCallLimit;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.repository.entity.AgentComponentConfig;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class AgentManualComponentDto {
|
||||
|
||||
@Schema(description = "组件ID")
|
||||
private Long id; // 组件配置ID
|
||||
|
||||
@Schema(description = "组件名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "组件图标")
|
||||
private String icon;
|
||||
|
||||
@Schema(description = "组件描述")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "组件类型")
|
||||
private AgentComponentConfig.Type type; // 组件类型,可选值:Plugin, Workflow, Trigger, Knowledge, Variable, Database
|
||||
|
||||
@Schema(description = "是否默认选中,0-否,1-是")
|
||||
private Integer defaultSelected;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class AgentOutputDto implements Serializable {
|
||||
|
||||
private String requestId;
|
||||
|
||||
private EventTypeEnum eventType;
|
||||
|
||||
private String error;
|
||||
|
||||
private Object data;
|
||||
|
||||
private boolean completed;
|
||||
|
||||
public enum EventTypeEnum {
|
||||
// 执行过程
|
||||
PROCESSING,
|
||||
|
||||
// 过程消息输出
|
||||
PROCESSING_MESSAGE,
|
||||
// 输出消息
|
||||
MESSAGE,
|
||||
// 最终统计等消息
|
||||
FINAL_RESULT,
|
||||
|
||||
// 心跳
|
||||
HEART_BEAT,
|
||||
// 异常信息
|
||||
ERROR
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class AgentTempChatDto {
|
||||
|
||||
@Schema(description = "链接ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long id;
|
||||
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "智能体ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long agentId;
|
||||
|
||||
@Schema(description = "链接Key", hidden = true)
|
||||
private String chatKey;
|
||||
|
||||
@Schema(description = "链接地址")
|
||||
private String chatUrl;
|
||||
|
||||
@Schema(description = "二维码地址")
|
||||
private String qrCodeUrl;
|
||||
|
||||
@Schema(description = "是否需要登录")
|
||||
private Integer requireLogin;
|
||||
|
||||
@Schema(description = "链接过期时间")
|
||||
private Date expire;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AgentUserDto {
|
||||
|
||||
@Schema(description = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "用户昵称")
|
||||
private String nickName;
|
||||
|
||||
@Schema(description = "用户头像")
|
||||
private String avatar;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class AnalysisHttpPluginOutputDto implements Serializable {
|
||||
|
||||
@Schema(description = "插件ID")
|
||||
@NotNull(message = "Plugin ID is required")
|
||||
private Long pluginId;
|
||||
|
||||
private Map<String, Object> params;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class AttachmentDto implements Serializable {
|
||||
|
||||
private String fileKey;
|
||||
|
||||
@Schema(description = "文件URL", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String fileUrl;
|
||||
|
||||
private String fileName;
|
||||
|
||||
@Schema(description = "文件类型", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String mimeType;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class CardArgsBindConfigDto {
|
||||
|
||||
@Schema(description = "卡片参数名称key")
|
||||
private String key;
|
||||
|
||||
@Schema(description = "卡片参数引用信息,例如插件的出参 data.xxx")
|
||||
private String bindValue;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class CardBindDto implements Serializable {
|
||||
|
||||
@Schema(description = "卡片ID")
|
||||
private Long cardId;
|
||||
|
||||
@Schema(description = "卡片唯一标识")
|
||||
private String cardKey;
|
||||
|
||||
@Schema(description = "卡片参数绑定信息")
|
||||
private List<CardArgsBindConfigDto> cardArgsBindConfigs;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class CardDto {
|
||||
|
||||
@Schema(description = "卡片ID")
|
||||
private Long id; // 卡片ID
|
||||
|
||||
@Schema(description = "卡片唯一标识")
|
||||
private String cardKey; // 卡片唯一标识,与前端组件做关联
|
||||
|
||||
@Schema(description = "卡片名称")
|
||||
private String name; // 卡片名称
|
||||
|
||||
@Schema(description = "卡片示例图片地址")
|
||||
private String imageUrl; // 卡片示例图片地址
|
||||
|
||||
@Schema(description = "卡片参数")
|
||||
private List<CardArgsDto> argList; // 卡片参数
|
||||
|
||||
@Data
|
||||
public static class CardArgsDto {
|
||||
@Schema(description = "卡片参数名称key")
|
||||
private String key;
|
||||
|
||||
@Schema(description = "卡片参数引用绑定提示信息")
|
||||
private String placeholder;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
|
||||
import com.xspaceagi.agent.core.spec.enums.AgentCategoryEnum;
|
||||
import com.xspaceagi.agent.core.spec.enums.PageAppCategoryEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Data
|
||||
public class CategoryDto implements Serializable {
|
||||
|
||||
@Schema(description = "类别名称")
|
||||
@JsonPropertyDescription("类别名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "类别描述")
|
||||
@JsonPropertyDescription("类别描述")
|
||||
private String description;
|
||||
|
||||
public static List<CategoryDto> convertAgentCategoryList() {
|
||||
AgentCategoryEnum[] agentCategoryEnums = AgentCategoryEnum.values();
|
||||
//agentCategoryEnums转List<AgentCategoryDto>
|
||||
return List.of(agentCategoryEnums).stream().map(agentCategoryEnum -> {
|
||||
CategoryDto agentCategoryDto = new CategoryDto();
|
||||
agentCategoryDto.setName(agentCategoryEnum.getName());
|
||||
agentCategoryDto.setDescription(agentCategoryEnum.getDesc());
|
||||
return agentCategoryDto;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static List<CategoryDto> convertPageAppCategoryList() {
|
||||
PageAppCategoryEnum[] agentCategoryEnums = PageAppCategoryEnum.values();
|
||||
//agentCategoryEnums转List<AgentCategoryDto>
|
||||
return List.of(agentCategoryEnums).stream().map(agentCategoryEnum -> {
|
||||
CategoryDto agentCategoryDto = new CategoryDto();
|
||||
agentCategoryDto.setName(agentCategoryEnum.getName());
|
||||
agentCategoryDto.setDescription(agentCategoryEnum.getDesc());
|
||||
return agentCategoryDto;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static List<CategoryDto> convertPluginCategoryList() {
|
||||
PluginCategoryEnum[] pluginCategoryEnums = PluginCategoryEnum.values();
|
||||
return List.of(pluginCategoryEnums).stream().map(pluginCategoryEnum -> {
|
||||
CategoryDto categoryDto = new CategoryDto();
|
||||
categoryDto.setName(pluginCategoryEnum.getName());
|
||||
categoryDto.setDescription(pluginCategoryEnum.getDesc());
|
||||
return categoryDto;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public enum PluginCategoryEnum {
|
||||
//智能硬件
|
||||
Hardware("Hardware", "智能硬件"),
|
||||
NewsReading("NewsReading", "新闻阅读"),
|
||||
Life("Life", "便利生活"),
|
||||
Image("Image", "图像"),
|
||||
Utility("Utility", "实用工具"),
|
||||
WebSearch("WebSearch", "网页搜索"),
|
||||
ScienceAndEducation("ScienceAndEducation", "科学与教育"),
|
||||
Social("Social", "社交"),
|
||||
GameAndEntertainment("GameAndEntertainment", "游戏与娱乐"),
|
||||
FinanceAndCommerce("FinanceAndCommerce", "金融与商业"),
|
||||
Video("Video", "音视频"),
|
||||
Other("Other", "其他");
|
||||
private String name;
|
||||
private String desc;
|
||||
|
||||
PluginCategoryEnum(String name, String desc) {
|
||||
this.name = name;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.xspaceagi.agent.core.spec.enums.MessageTypeEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.ai.chat.messages.Message;
|
||||
import org.springframework.ai.chat.messages.MessageType;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ChatMessageDto implements Message {
|
||||
|
||||
private Long index;
|
||||
|
||||
private Long tenantId;
|
||||
|
||||
@Schema(description = "消息发送方类型, User、Agent")
|
||||
private SenderType senderType;
|
||||
|
||||
@Schema(description = "消息发送方ID")
|
||||
private String senderId;
|
||||
|
||||
@Schema(description = "关联用户ID")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "关联的agentID")
|
||||
private Long agentId;
|
||||
|
||||
@Schema(description = "消息ID")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "assistant 模型回复;user 用户消息")
|
||||
private Role role;
|
||||
|
||||
private MessageTypeEnum type;
|
||||
|
||||
@Schema(description = "消息内容")
|
||||
private String text;
|
||||
|
||||
@Schema(description = "消息时间")
|
||||
private Date time;
|
||||
|
||||
@Schema(description = "消息附件")
|
||||
private List<AttachmentDto> attachments;
|
||||
|
||||
@Schema(description = "思考内容")
|
||||
private String think;
|
||||
|
||||
@Schema(description = "引用消息内容")
|
||||
private String quotedText;
|
||||
|
||||
private boolean finished;
|
||||
|
||||
private String finishReason;
|
||||
|
||||
@Schema(description = "执行过程输出数据")
|
||||
private List<Object> componentExecutedList;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getMetadata() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageType getMessageType() {
|
||||
return MessageType.valueOf(role.name());
|
||||
}
|
||||
|
||||
public enum Role {
|
||||
USER,
|
||||
ASSISTANT,
|
||||
SYSTEM,
|
||||
FUNCTION,
|
||||
}
|
||||
|
||||
public enum SenderType {
|
||||
USER,
|
||||
AGENT
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CodeCheckResultDto {
|
||||
|
||||
@JsonPropertyDescription("是否通过检测,只要没有违反Goals中列出的范围,就通过并返回true")
|
||||
private Boolean pass;
|
||||
|
||||
@JsonPropertyDescription("通过或不通过的原因")
|
||||
private String reason;
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.repository.entity.Published;
|
||||
import com.xspaceagi.agent.core.spec.enums.ComponentTypeEnum;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ComponentDto implements Serializable {
|
||||
|
||||
@Schema(description = "组件ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "空间ID")
|
||||
private Long spaceId;
|
||||
|
||||
@Schema(description = "组件类型")
|
||||
private ComponentTypeEnum type;
|
||||
|
||||
@Schema(description = "组件名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "组件描述")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "图标地址")
|
||||
private String icon;
|
||||
|
||||
@Schema(description = "发布状态,工作流、插件有效")
|
||||
private Published.PublishStatus publishStatus;
|
||||
|
||||
@Schema(description = "最后编辑时间")
|
||||
private Date modified;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private Date created;
|
||||
|
||||
private Long creatorId;
|
||||
|
||||
@Schema(description = "创建者信息")
|
||||
private CreatorDto creator;
|
||||
|
||||
@Schema(description = "扩展字段")
|
||||
private Object ext;
|
||||
|
||||
@Schema(description = "权限列表")
|
||||
private List<String> permissions;
|
||||
|
||||
@Schema(description = "是否启用")
|
||||
private Integer enabled;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ComputerFileInfo {
|
||||
|
||||
@Schema(description = "文件名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "是否为二进制文件")
|
||||
private boolean binary;
|
||||
|
||||
@Schema(description = "文件大小是否超过限制")
|
||||
private boolean sizeExceeded;
|
||||
|
||||
@Schema(description = "文件内容")
|
||||
private String contents;
|
||||
|
||||
@Schema(description = "重命名前的文件名")
|
||||
private String renameFrom;
|
||||
|
||||
//create | delete | rename | modify
|
||||
@Schema(description = "操作类型")
|
||||
private String operation;
|
||||
|
||||
@Schema(description = "是否目录")
|
||||
private Boolean isDir = false;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 容器操作结果 DTO
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ComputerPodResultDto {
|
||||
|
||||
/**
|
||||
* 状态码,0000 表示成功
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 消息
|
||||
*/
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* 返回数据(包含 container_info 等信息)
|
||||
*/
|
||||
private Map<String, Object> data;
|
||||
|
||||
/**
|
||||
* 跟踪唯一标识
|
||||
*/
|
||||
private String tid;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.xspaceagi.agent.core.adapter.repository.entity.ConfigHistory;
|
||||
import com.xspaceagi.agent.core.adapter.repository.entity.Published;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("agent_config_history")
|
||||
public class ConfigHistoryDto {
|
||||
private Long id;
|
||||
private Published.TargetType targetType;
|
||||
private Long targetId;
|
||||
@Schema(description = "操作类型,Add 新增, Edit 编辑, Publish 发布")
|
||||
private ConfigHistory.Type type;
|
||||
|
||||
@Schema(description = "当时的配置信息")
|
||||
private Object config;
|
||||
|
||||
@Schema(description = "操作描述")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "操作人")
|
||||
private OpUser opUser;
|
||||
|
||||
private Date modified;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private Date created;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public static class OpUser {
|
||||
@Schema(description = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "用户名")
|
||||
private String userName;
|
||||
|
||||
@Schema(description = "昵称")
|
||||
private String nickName;
|
||||
|
||||
@Schema(description = "头像")
|
||||
private String avatar;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.repository.entity.Conversation;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ConversationDto {
|
||||
|
||||
@Schema(description = "会话ID")
|
||||
private Long id;
|
||||
|
||||
private Long tenantId;
|
||||
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "会话UUID")
|
||||
private String uid;
|
||||
|
||||
@Schema(description = "智能体ID")
|
||||
private Long agentId;
|
||||
|
||||
@Schema(description = "会话主题")
|
||||
private String topic;
|
||||
|
||||
@Schema(description = "会话摘要,当开启长期记忆时,会对每次会话进行总结")
|
||||
private String summary;
|
||||
|
||||
@Schema(description = "用户填写的会话变量内容")
|
||||
private Map<String, Object> variables;
|
||||
|
||||
private Date modified;
|
||||
|
||||
private Date created;
|
||||
|
||||
@Schema(description = "Agent信息,已发布过的agent才有此信息")
|
||||
private AgentDetailDto agent;
|
||||
|
||||
@Schema(description = "会话消息列表,会话列表查询时不会返回该字段值")
|
||||
private List<ChatMessageDto> messageList;
|
||||
|
||||
private Conversation.ConversationType type;
|
||||
|
||||
private String taskId;
|
||||
|
||||
@Schema(description = "任务状态,只针对 EXECUTING(执行中) 做展示")
|
||||
private Conversation.ConversationTaskStatus taskStatus;
|
||||
|
||||
private String taskCron;
|
||||
|
||||
private String taskCronDesc;
|
||||
|
||||
private Integer devMode;
|
||||
|
||||
private Integer topicUpdated;
|
||||
|
||||
private String sandboxServerId;
|
||||
|
||||
private String sandboxSessionId;
|
||||
|
||||
@Schema(description = "已分享的URI地址,比对上了则不需要认证")
|
||||
private List<String> sharedUris;
|
||||
|
||||
public Integer getDevMode() {
|
||||
return devMode == null ? 0 : devMode;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.repository.entity.Conversation;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class ConversationQueryDto implements Serializable {
|
||||
|
||||
@Schema(description = "智能体ID,可选")
|
||||
private Long agentId;
|
||||
|
||||
@Schema(description = "会话ID,可选")
|
||||
private Long lastId;
|
||||
|
||||
@Schema(description = "返回会话数量,可选")
|
||||
private Integer limit;
|
||||
|
||||
@Schema(description = "定时会话状态,可选")
|
||||
private Conversation.ConversationTaskStatus taskStatus;
|
||||
|
||||
@Schema(description = "会话主题,可选")
|
||||
private String topic;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class ConversationUpdateDto implements Serializable {
|
||||
|
||||
@Schema(description = "会话ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户第一条消息")
|
||||
@NotNull(message = "User first message is required")
|
||||
private String firstMessage;
|
||||
|
||||
@Schema(description = "会话主题,可以不传,firstMessage与topic二选一")
|
||||
private String topic;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
@Schema(description = "创建工作空间请求DTO")
|
||||
public class CreateWorkspaceDto implements Serializable {
|
||||
|
||||
@Schema(description = "用户ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long userId;
|
||||
|
||||
@NotNull
|
||||
@JsonProperty("cId")
|
||||
@Schema(description = "会话ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long cId;
|
||||
|
||||
@Schema(description = "技能ID列表")
|
||||
private List<Long> skillIds;
|
||||
|
||||
@Schema(description = "子代理列表")
|
||||
private List<SubagentDto> subagents;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CreatorDto {
|
||||
|
||||
@Schema(description = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "用户名")
|
||||
private String userName;
|
||||
|
||||
@Schema(description = "昵称")
|
||||
private String nickName;
|
||||
|
||||
@Schema(description = "头像")
|
||||
private String avatar;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ExportTemplateDto {
|
||||
|
||||
private String type;
|
||||
private String name;
|
||||
private Object templateConfig;
|
||||
private Long spaceId;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.dto.config.Arg;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class GuidQuestionDto {
|
||||
|
||||
@Schema(description = "问题类型")
|
||||
private GuidQuestionType type;
|
||||
|
||||
@Schema(description = "问题信息")
|
||||
private String info;
|
||||
|
||||
@Schema(description = "图标")
|
||||
private String icon;
|
||||
|
||||
@Schema(description = "链接地址,type类型为Link时有效")
|
||||
private String url;
|
||||
|
||||
@Schema(description = "页面ID,type类型为Page时有效")
|
||||
private Long pageId;
|
||||
|
||||
@Schema(description = "页面基础路径,type类型为Page时有效")
|
||||
private String basePath;
|
||||
|
||||
@Schema(description = "页面路径,type类型为Page时有效")
|
||||
private String pageUri;
|
||||
|
||||
@Schema(description = "页面地址,配置更新时不需要传递,type类型为Page时有效,完整的页面地址,前端需要使用 BASE_URL+pageUrl")
|
||||
private String pageUrl;
|
||||
|
||||
@Schema(description = "参数配置")
|
||||
private List<Arg> args;
|
||||
|
||||
@Schema(description = "参数值,配置更新时不需要传递,用户点击跳转时直接使用,type类型为Page时有效")
|
||||
private Map<String, Object> params;
|
||||
|
||||
public enum GuidQuestionType {
|
||||
Question,
|
||||
Page,
|
||||
Link
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class HostExtractDto {
|
||||
|
||||
@JsonPropertyDescription("域名列表")
|
||||
private List<String> domains;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.repository.entity.Published;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ImportTemplateResultDto {
|
||||
|
||||
@Schema(description = "导入类型")
|
||||
private Published.TargetType targetType;
|
||||
|
||||
@Schema(description = "导入生成ID")
|
||||
private Long targetId;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.dto.config.bind.KnowledgeBaseBindConfigDto;
|
||||
import com.xspaceagi.agent.core.spec.enums.SearchStrategyEnum;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class KnowledgeSearchConfigDto implements Serializable {
|
||||
|
||||
private SearchStrategyEnum searchStrategy;
|
||||
|
||||
private Integer maxRecallCount;
|
||||
|
||||
private Double matchingDegree;
|
||||
|
||||
private KnowledgeBaseBindConfigDto.NoneRecallReplyTypeEnum noneRecallReplyType;
|
||||
|
||||
private String noneRecallReply;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class MemoryDto implements Serializable {
|
||||
|
||||
private String topic;
|
||||
|
||||
private String content;
|
||||
|
||||
private String date;
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.dto.config.ModelConfigDto;
|
||||
import com.xspaceagi.agent.core.adapter.repository.entity.ModelConfig;
|
||||
import com.xspaceagi.agent.core.spec.enums.ModelApiProtocolEnum;
|
||||
import com.xspaceagi.agent.core.spec.enums.ModelCapabilityEnum;
|
||||
import com.xspaceagi.agent.core.spec.enums.ModelFunctionCallEnum;
|
||||
import com.xspaceagi.agent.core.spec.enums.ModelTypeEnum;
|
||||
import com.xspaceagi.agent.core.spec.enums.UsageScenarioEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ModelConfigAddDto implements Serializable {
|
||||
|
||||
@Schema(description = "模型ID(可选,不传递为新增,传递了为更新)")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "空间ID(可选,在空间中添加模型组件时传递该参数)")
|
||||
private Long spaceId;
|
||||
|
||||
@Schema(description = "模型名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "Model name is required")
|
||||
private String name; // 模型名称
|
||||
|
||||
@Schema(description = "模型描述")
|
||||
private String description; // 模型描述
|
||||
|
||||
@Schema(description = "模型标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "gpt-3.5-turbo")
|
||||
@NotNull(message = "Model key is required")
|
||||
private String model; // 模型标识
|
||||
|
||||
@Schema(description = "模型类型,可选值:Completions, Chat, Edits, Images, Embeddings, Audio, Other", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private ModelTypeEnum type; // 模型类型,可选值:Completions, Chat, Edits, Images, Embeddings, Audio, Other
|
||||
|
||||
@Schema(description = "提供商ID")
|
||||
private String pid;
|
||||
|
||||
@Schema(description = "模型能力类型列表,可选值:Text-文本生成、Image-图像理解、Audio-语音识别、Video-视频理解、TextEmbedding-文本向量、MultiEmbedding-多模态向量、Reasoning-深度思考")
|
||||
private List<ModelCapabilityEnum> types;
|
||||
|
||||
@Schema(description = "最大输出token数")
|
||||
private Integer maxTokens; // token上限
|
||||
|
||||
@Schema(description = "上下文最大输出token数")
|
||||
private Integer maxContextTokens; // 上下文token上限
|
||||
|
||||
@Schema(description = "模型接口协议,可选值:OpenAI, Ollama", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private ModelApiProtocolEnum apiProtocol; // 模型接口协议,可选值:OpenAI, Ollama
|
||||
|
||||
@Schema(description = "API列表", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "API list is required")
|
||||
private List<ModelConfigDto.ApiInfo> apiInfoList; // API列表 [{"url":"","key":"","weight":1}]
|
||||
|
||||
@Schema(description = "接口调用策略,可选值:RoundRobin, WeightedRoundRobin, LeastConnections, WeightedLeastConnections, Random, ResponseTime", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private ModelConfig.ModelStrategyEnum strategy; // 接口调用策略,可选值:RoundRobin, WeightedRoundRobin, LeastConnections, WeightedLeastConnections, Random, ResponseTime
|
||||
|
||||
@Schema(description = "向量维度")
|
||||
private Integer dimension; // 向量维度
|
||||
|
||||
@Schema(description = "函数调用支持,可选范围:CallSupported 支持普通函数调用; StreamCallSupported 支持流式函数调用;Unsupported 不支持函数调用")
|
||||
private ModelFunctionCallEnum functionCall;
|
||||
|
||||
@Schema(description = "是否为推理模型,0 否;1 是")
|
||||
private Integer isReasonModel;
|
||||
|
||||
@Schema(description = "是否启用,1-启用,0-禁用")
|
||||
private Integer enabled;
|
||||
|
||||
@Schema(description = "访问控制,可选值:0-不管控,1-管控")
|
||||
private Integer accessControl;
|
||||
|
||||
@Schema(description = "可使用的业务场景")
|
||||
private List<UsageScenarioEnum> usageScenarios;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.xspaceagi.agent.core.spec.enums.ModelApiProtocolEnum;
|
||||
import com.xspaceagi.agent.core.spec.enums.ModelTypeEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ModelDto implements Serializable {
|
||||
|
||||
@Schema(description = "模型ID")
|
||||
private Long modelId;
|
||||
|
||||
@Schema(description = "模型标识")
|
||||
private String model;
|
||||
|
||||
@Schema(description = "模型接口地址")
|
||||
private String host;
|
||||
|
||||
@Schema(description = "模型APIKEY,数组")
|
||||
private List<String> apiKeys;
|
||||
|
||||
@Schema(description = "模型备注(名称)")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "最大支持token数")
|
||||
private Integer maxTokens;
|
||||
|
||||
@Schema(description = "模型类型")
|
||||
private ModelTypeEnum type;
|
||||
|
||||
@Schema(description = "模型调用接口协议")
|
||||
private ModelApiProtocolEnum apiProtocol;
|
||||
|
||||
@Schema(description = "向量维度,模型类型为 Embeddings 时有效")
|
||||
private Integer dimension;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.repository.entity.ModelConfig;
|
||||
import com.xspaceagi.agent.core.spec.enums.ModelApiProtocolEnum;
|
||||
import com.xspaceagi.agent.core.spec.enums.ModelTypeEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ModelQueryDto {
|
||||
|
||||
@Schema(description = "模型类型")
|
||||
private ModelTypeEnum modelType;
|
||||
|
||||
@Schema(description = "接口协议类型")
|
||||
private ModelApiProtocolEnum apiProtocol;
|
||||
|
||||
@Schema(description = "模型范围,不传则返回所有有权限的模型")
|
||||
private ModelConfig.ModelScopeEnum scope;
|
||||
|
||||
@Schema(description = "空间ID,可选,传递后会返回当前空间管理的模型")
|
||||
private Long spaceId;
|
||||
|
||||
@Schema(description = "是否启用")
|
||||
private Integer enabled;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class OffShelfDto implements Serializable {
|
||||
|
||||
@Schema(description = "发布ID", hidden = true)
|
||||
private Long publishId;
|
||||
|
||||
@Schema(description = "下架原因")
|
||||
private String reason;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.xspaceagi.agent.core.spec.enums.CodeLanguageEnum;
|
||||
import com.xspaceagi.agent.core.spec.enums.PluginTypeEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class PluginAddDto implements Serializable {
|
||||
|
||||
@Schema(description = "空间ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "Space ID is required")
|
||||
private Long spaceId;
|
||||
|
||||
@Schema(description = "创建人ID")
|
||||
private Long creatorId;
|
||||
|
||||
@Schema(description = "插件名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "Plugin name is required")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "插件描述")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "插件图标")
|
||||
private String icon;
|
||||
|
||||
@Schema(description = "插件类型")
|
||||
private PluginTypeEnum type;
|
||||
|
||||
@Schema(description = "插件代码语言")
|
||||
private CodeLanguageEnum codeLang;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class PluginExecuteRequestDto implements Serializable {
|
||||
|
||||
@Schema(description = "请求ID")
|
||||
private String requestId;
|
||||
|
||||
private Long agentId;
|
||||
|
||||
@Schema(description = "插件ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long pluginId;
|
||||
|
||||
@Schema(description = "插件参数")
|
||||
private Map<String, Object> params;
|
||||
|
||||
private boolean test;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PluginExecuteResultDto implements Serializable {
|
||||
|
||||
@Schema(description = "执行结果状态")
|
||||
private boolean success;
|
||||
|
||||
@Schema(description = "执行结果")
|
||||
private Object result;
|
||||
|
||||
@Schema(description = "执行日志")
|
||||
private List<String> logs;
|
||||
|
||||
@Schema(description = "执行错误信息")
|
||||
private String error;
|
||||
|
||||
@Schema(description = "请求ID")
|
||||
private String requestId;
|
||||
|
||||
@Schema(description = "请求耗时")
|
||||
private Long costTime;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class PluginUpdateDto<T> implements Serializable {
|
||||
|
||||
@Schema(description = "插件ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "Plugin ID is required")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "插件名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "插件描述")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "插件图标")
|
||||
private String icon;
|
||||
|
||||
@Schema(description = "插件配置")
|
||||
private T config;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.dto.config.Arg;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PreviousDto implements Serializable {
|
||||
|
||||
@Schema(description = "所有上级节点列表")
|
||||
private List<PreviousNodeDto> previousNodes;
|
||||
|
||||
@Schema(description = "循环节点内部节点列表")
|
||||
private List<PreviousNodeDto> innerPreviousNodes;
|
||||
|
||||
@Schema(description = "所有上级节点的输出参数Map")
|
||||
private Map<String, Arg> argMap;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.dto.config.Arg;
|
||||
import com.xspaceagi.agent.core.adapter.repository.entity.WorkflowNodeConfig;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class PreviousNodeDto implements Serializable {
|
||||
|
||||
@Schema(description = "节点ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "节点名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "节点图标地址")
|
||||
private String icon;
|
||||
|
||||
@Schema(description = "节点类型")
|
||||
private WorkflowNodeConfig.NodeType type;
|
||||
|
||||
@Schema(description = "节点输出参数")
|
||||
private List<Arg> outputArgs;
|
||||
|
||||
private Long loopNodeId;
|
||||
|
||||
private Integer sort;
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof PreviousNodeDto) {
|
||||
PreviousNodeDto node = (PreviousNodeDto) obj;
|
||||
return this.id.equals(node.id);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.repository.entity.Published;
|
||||
import com.xspaceagi.agent.core.spec.enums.PluginTypeEnum;
|
||||
|
||||
import com.xspaceagi.system.application.dto.UserDto;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PublishApplyDto implements Serializable {
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "所属空间ID")
|
||||
private Long spaceId;
|
||||
|
||||
@Schema(description = "目标对象类型")
|
||||
private Published.TargetType targetType;
|
||||
|
||||
@Schema(description = "子类型")
|
||||
private Published.TargetSubType targetSubType;
|
||||
|
||||
@Schema(description = "目标对象ID,智能体ID、插件ID、工作流ID")
|
||||
private Long targetId;
|
||||
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "描述")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "图标")
|
||||
private String icon;
|
||||
|
||||
@Schema(description = "扩展字段")
|
||||
private Object ext;
|
||||
|
||||
//该字段已没有实际作用,后续弃用
|
||||
@Schema(description = "发布渠道")
|
||||
private List<Published.PublishChannel> channels;
|
||||
|
||||
private Published.PublishScope scope;
|
||||
|
||||
@Schema(description = "发布状态")
|
||||
private Published.PublishStatus publishStatus;
|
||||
|
||||
@Schema(description = "目标配置", hidden = true)
|
||||
private Object targetConfig;
|
||||
|
||||
@Schema(description = "发布记录")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "发布修改时间")
|
||||
private Date modified;
|
||||
|
||||
@Schema(description = "发布创建时间")
|
||||
private Date created;
|
||||
|
||||
@Schema(description = "发布申请用户")
|
||||
private UserDto applyUser;
|
||||
|
||||
private PluginTypeEnum pluginType;
|
||||
|
||||
private Integer allowCopy;
|
||||
|
||||
private Integer onlyTemplate;
|
||||
|
||||
private String category;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.repository.entity.Published;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class PublishApplyQueryDto implements Serializable {
|
||||
|
||||
@Schema(description = "发布类型")
|
||||
@NotNull(message = "targetType is required; use Agent for agents and apps, or omit")
|
||||
private Published.TargetType targetType;
|
||||
|
||||
@Schema(description = "发布子类型类型:PageApp 和 Agent")
|
||||
private Published.TargetSubType targetSubType;
|
||||
|
||||
@Schema(description = "发布状态")
|
||||
private Published.PublishStatus publishStatus;
|
||||
|
||||
@Schema(description = "关键字搜索")
|
||||
private String kw;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.repository.entity.Published;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class PublishApplySubmitDto implements Serializable {
|
||||
|
||||
@Schema(description = "发布目标类型:目前可发布的类型有:Agent,Plugin,Workflow")
|
||||
private Published.TargetType targetType;
|
||||
|
||||
@Schema(description = "发布目标ID,例如智能体ID;工作流ID;插件ID")
|
||||
private Long targetId;
|
||||
|
||||
@Schema(description = "发布记录")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "发布分类")
|
||||
private String category;
|
||||
|
||||
@Schema(description = "发布项")
|
||||
private List<PublishItem> items;
|
||||
|
||||
@Data
|
||||
public static class PublishItem {
|
||||
|
||||
@Schema(description = "发布范围,可选范围:Space 空间,Tenant 系统")
|
||||
private Published.PublishScope scope;
|
||||
|
||||
@Schema(description = "发布空间ID")
|
||||
private Long spaceId;
|
||||
|
||||
@Schema(description = "是否允许复制,0不允许;1允许")
|
||||
private Integer allowCopy;
|
||||
|
||||
@Schema(description = "仅展示模板, 0 否,1 是")
|
||||
private Integer onlyTemplate;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.repository.entity.Published;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class PublishChannelDto implements Serializable {
|
||||
|
||||
@Schema(description = "发布渠道")
|
||||
private Published.PublishChannel channel;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class PublishRejectDto implements Serializable {
|
||||
|
||||
@Schema(description = "发布申请ID", hidden = true)
|
||||
private Long applyId;
|
||||
|
||||
@Schema(description = "拒绝原因")
|
||||
private String reason;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PublishUserDto implements Serializable {
|
||||
@Schema(description = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "用户名")
|
||||
private String userName;
|
||||
|
||||
@Schema(description = "昵称")
|
||||
private String nickName;
|
||||
|
||||
@Schema(description = "头像")
|
||||
private String avatar;
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.repository.entity.Published;
|
||||
import com.xspaceagi.agent.core.spec.enums.PluginTypeEnum;
|
||||
import com.xspaceagi.agent.core.spec.enums.UsageScenarioEnum;
|
||||
import com.xspaceagi.custompage.sdk.dto.SourceTypeEnum;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PublishedDto implements Serializable {
|
||||
|
||||
@Schema(description = "发布ID")
|
||||
private Long id;
|
||||
|
||||
private Long tenantId;
|
||||
|
||||
private Long spaceId;
|
||||
|
||||
@Schema(description = "目标对象(智能体、工作流、插件)ID")
|
||||
private Published.TargetType targetType;
|
||||
|
||||
@Schema(description = "目标对象子类型", hidden = true)
|
||||
private Published.TargetSubType targetSubType;
|
||||
|
||||
@Schema(description = "目标对象(智能体、工作流、插件)ID")
|
||||
private Long targetId;
|
||||
|
||||
@Schema(description = "发布名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "描述")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "图标")
|
||||
private String icon;
|
||||
|
||||
@Schema(description = "扩展字段")
|
||||
private Object ext;
|
||||
|
||||
@Schema(description = "适用场景列表,如 [TaskAgent, PageApp]")
|
||||
private List<UsageScenarioEnum> usageScenarios;
|
||||
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "配置", hidden = true)
|
||||
private String config;
|
||||
|
||||
@Schema(description = "智能体发布修改时间")
|
||||
private Date modified;
|
||||
|
||||
@Schema(description = "智能体发布创建时间")
|
||||
private Date created;
|
||||
|
||||
@Schema(description = "统计信息")
|
||||
private StatisticsDto statistics;
|
||||
|
||||
@Schema(description = "发布者信息")
|
||||
private PublishUserDto publishUser;
|
||||
|
||||
@Schema(description = "当前登录用户是否收藏")
|
||||
private boolean isCollect;
|
||||
|
||||
@Schema(description = "发布范围", hidden = true)
|
||||
private Published.PublishScope scope;
|
||||
|
||||
@Schema(description = "分类名称")
|
||||
private String category;
|
||||
|
||||
@Schema(description = "是否允许复制, 1 允许")
|
||||
private Integer allowCopy;
|
||||
|
||||
@Schema(description = "是否只允许模板使用, 1 允许", hidden = true)
|
||||
private Integer onlyTemplate;
|
||||
|
||||
@Schema(description = "访问控制, 0 不走权限管控;1 走权限管控")
|
||||
private Integer accessControl;
|
||||
|
||||
private PluginTypeEnum pluginType;
|
||||
|
||||
@Schema(description = "已发布的空间ID", hidden = true)
|
||||
private List<Long> publishedSpaceIds;
|
||||
|
||||
@Schema(description = "智能体类型")
|
||||
private String agentType;
|
||||
|
||||
@Schema(description = "封面图")
|
||||
private String coverImg;
|
||||
|
||||
@Schema(description = "封面图片来源")
|
||||
private SourceTypeEnum coverImgSourceType;
|
||||
|
||||
@Schema(description = "是否需要付费")
|
||||
private boolean paymentRequired;
|
||||
|
||||
@Schema(description = "价格")
|
||||
private BigDecimal price;
|
||||
|
||||
@Schema(description = "是否已订阅,对智能体和技能有效")
|
||||
private boolean subscribed;
|
||||
|
||||
@Schema(description = "是否超出调用限制")
|
||||
private boolean overCallLimit;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PublishedPermissionDto {
|
||||
|
||||
//可否查看
|
||||
private boolean view;
|
||||
|
||||
//可否执行
|
||||
private boolean execute;
|
||||
|
||||
//是否可以复制
|
||||
private boolean copy;
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.repository.entity.Published;
|
||||
import com.xspaceagi.agent.core.spec.enums.UsageScenarioEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PublishedQueryDto implements Serializable {
|
||||
|
||||
@Schema(description = "目标类型,Agent,Plugin,Workflow")
|
||||
private Published.TargetType targetType;
|
||||
|
||||
@Schema(description = "子类型")
|
||||
private Published.TargetSubType targetSubType;
|
||||
|
||||
@Schema(description = "页码")
|
||||
private Integer page;
|
||||
|
||||
@Schema(description = "每页数量")
|
||||
private Integer pageSize;
|
||||
|
||||
@Schema(description = "分类名称")
|
||||
private String category;
|
||||
|
||||
@Schema(description = "关键字搜索")
|
||||
private String kw;
|
||||
|
||||
@Schema(description = "空间ID(可选)需要通过空间过滤时有用")
|
||||
private Long spaceId;
|
||||
|
||||
@Schema(description = "空间IDs", hidden = true)
|
||||
private List<Long> spaceIds;
|
||||
|
||||
@Schema(description = "只返回空间的组件")
|
||||
private Boolean justReturnSpaceData;
|
||||
|
||||
@Schema(description = "空间ID列表(可选),查询用户有权限的空间,限制访问空间,比如工作流查询全部知识库,要限制用户有权限的空间下的知识库", hidden = true)
|
||||
private List<Long> authSpaceIds;
|
||||
|
||||
@Schema(description = "是否显示推荐", hidden = true)
|
||||
private Boolean showRecommend;
|
||||
|
||||
@Schema(description = "允许复制过滤(模板),1 允许", hidden = true)
|
||||
private Integer allowCopy;
|
||||
|
||||
@Schema(description = "只允许模板使用过滤,1 允许", hidden = true)
|
||||
private Integer onlyTemplate;
|
||||
|
||||
@Schema(description = "更新统计数据", hidden = true)
|
||||
private Boolean updateStatics;
|
||||
|
||||
@Schema(description = "访问控制过滤,0 无需过滤,1 过滤出需要权限管控的内容")
|
||||
private Integer accessControl;
|
||||
|
||||
@Schema(description = "查询的ID范围,比如只查看推荐、官方标识的组件等", hidden = true)
|
||||
private List<Long> targetIds;
|
||||
|
||||
@Schema(description = "是否只返回官方标识的内容")
|
||||
private Boolean official;
|
||||
|
||||
@Schema(description = "适用场景筛选参数,如 [TaskAgent, PageApp]")
|
||||
private List<UsageScenarioEnum> usageScenarios;
|
||||
|
||||
/**
|
||||
* 获取页码
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
public Integer obtainPage() {
|
||||
Integer current = this.getPage();
|
||||
if (current == null || current <= 0) {
|
||||
current = 1;
|
||||
}
|
||||
return current;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取每页数量
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Integer obtainPageSize() {
|
||||
Integer size = this.getPageSize();
|
||||
if (size == null || size <= 0) {
|
||||
size = 10;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class QaDto implements Serializable {
|
||||
|
||||
private int askTimes;
|
||||
|
||||
private String originMessage;
|
||||
|
||||
private String question;
|
||||
|
||||
private String answer;
|
||||
|
||||
private String requestId;
|
||||
|
||||
private Long nodeId;
|
||||
|
||||
private Long workflowId;
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.repository.entity.Published;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SkillConfigDto implements Serializable {
|
||||
|
||||
private Long id; // 主键ID
|
||||
|
||||
private String name; // 技能名称
|
||||
|
||||
private String enName; // 技能英文名称
|
||||
|
||||
private String description; // 技能描述
|
||||
|
||||
private String icon; // 技能图标
|
||||
|
||||
private List<SkillFileDto> files; // 文件内容
|
||||
|
||||
@Schema(description = "扩展字段,例如 supportTaskAgent/supportPageApp")
|
||||
private SkillExtDto ext;
|
||||
|
||||
private Published.PublishStatus publishStatus; // 发布状态
|
||||
|
||||
private Long spaceId; // 空间ID
|
||||
|
||||
private Date created; // 创建时间
|
||||
|
||||
private Long creatorId; // 创建人ID
|
||||
|
||||
private String creatorName; // 创建人
|
||||
|
||||
private Date modified; // 更新时间
|
||||
|
||||
private Long modifiedId; // 最后修改人ID
|
||||
|
||||
private String modifiedName; // 最后修改人
|
||||
|
||||
@Schema(description = "已发布的范围,用于发布时做默认选中")
|
||||
private Published.PublishScope scope;
|
||||
|
||||
@Schema(description = "发布时间,如果不为空,与当前modified时间做对比,如果发布时间小于modified,则前端显示:有更新未发布")
|
||||
private Date publishDate;
|
||||
|
||||
@Schema(description = "已发布的空间ID", hidden = true)
|
||||
private List<Long> publishedSpaceIds;
|
||||
|
||||
@Schema(description = "已发布的分类")
|
||||
private String category;
|
||||
|
||||
@Schema(description = "技能发布zip代理下载地址")
|
||||
private String zipFileUrl;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 技能导出结果
|
||||
*/
|
||||
@Data
|
||||
public class SkillExportResultDto {
|
||||
|
||||
/**
|
||||
* 导出文件名,包含后缀
|
||||
*/
|
||||
private String fileName;
|
||||
|
||||
/**
|
||||
* 文件字节内容
|
||||
*/
|
||||
private byte[] data;
|
||||
|
||||
/**
|
||||
* 文件类型
|
||||
*/
|
||||
private String contentType;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Schema(description = "Skill extension config")
|
||||
public class SkillExtDto implements Serializable {
|
||||
|
||||
@Schema(description = "Support task agent: 0-no, 1-yes")
|
||||
private Integer supportTaskAgent;
|
||||
|
||||
@Schema(description = "Support page app development: 0-no, 1-yes")
|
||||
private Integer supportPageApp;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SkillFileDto {
|
||||
|
||||
@Schema(description = "文件名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "文件内容")
|
||||
private String contents;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@Schema(description = "文件代理下载地址")
|
||||
private String fileProxyUrl;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@Schema(description = "重命名前的文件名")
|
||||
private String renameFrom;
|
||||
|
||||
//create | delete | rename | modify
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@Schema(description = "操作类型")
|
||||
private String operation;
|
||||
|
||||
@Schema(description = "是否目录")
|
||||
private Boolean isDir = false;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SkillPublishedConfigDto {
|
||||
|
||||
@Schema(description = "配置格式标记")
|
||||
private String format;
|
||||
|
||||
private Long id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String description;
|
||||
|
||||
private String icon;
|
||||
|
||||
private List<SkillFileDto> files;
|
||||
|
||||
@Schema(description = "技能发布zip代理下载地址")
|
||||
private String zipFileUrl;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.repository.entity.Published;
|
||||
import com.xspaceagi.agent.core.spec.enums.UsageScenarioEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Schema(description = "技能列表请求DTO")
|
||||
public class SkillQueryDto implements Serializable {
|
||||
|
||||
@NotNull(message = "spaceId is required")
|
||||
@Schema(description = "空间ID")
|
||||
private Long spaceId;
|
||||
|
||||
@Schema(description = "技能名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "发布状态")
|
||||
private List<Published.PublishStatus> publishStatus;
|
||||
|
||||
@Schema(description = "适用场景筛选参数,如 [TaskAgent, PageApp]")
|
||||
private List<UsageScenarioEnum> usageScenarios;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Schema(description = "统计信息(智能体、插件、工作流相关的统计都在该结构里,根据实际情况取值)")
|
||||
public class StatisticsDto {
|
||||
|
||||
private Long targetId;
|
||||
|
||||
@Schema(description = "用户人数")
|
||||
private Long userCount; // 用户人数
|
||||
|
||||
@Schema(description = "会话次数")
|
||||
private Long convCount; // 会话次数
|
||||
|
||||
@Schema(description = "收藏次数")
|
||||
private Long collectCount; // 收藏次数
|
||||
|
||||
@Schema(description = "点赞次数")
|
||||
private Long likeCount; // 点赞次数
|
||||
|
||||
@Schema(description = "引用次数")
|
||||
private Long referenceCount;
|
||||
|
||||
@Schema(description = "调用总次数")
|
||||
private Long callCount;
|
||||
|
||||
@Schema(description = "失败调用次数")
|
||||
private Long failCallCount;
|
||||
|
||||
@Schema(description = "调用总时长")
|
||||
private Long totalCallDuration;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SubagentDto implements Serializable {
|
||||
|
||||
@Schema(description = "名称,非必传,如果不传则从content中提取name")
|
||||
private String name;
|
||||
|
||||
// @Schema(description = "描述")
|
||||
// private String description;
|
||||
|
||||
@Schema(description = "内容")
|
||||
private String content;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class SummaryDto implements Serializable {
|
||||
|
||||
@JsonPropertyDescription("内容压缩,压缩率控制在80%以上,但最大不能超过2000token")
|
||||
private String content;
|
||||
|
||||
@JsonPropertyDescription("符合上下文交流的标题,控制在5到15字,禁止生成与主题意义不想干的标题,对于毫无意义的上下文,例如用户输入错误或者随意输入的内容不用总结,返回空即可")
|
||||
private String topic;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TaskConversationAddOrUpdateDto {
|
||||
|
||||
@Schema(description = "会话ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "任务会话主题")
|
||||
@NotNull(message = "Task conversation subject is required")
|
||||
private String topic;
|
||||
|
||||
@Schema(description = "任务会话内容")
|
||||
@NotNull(message = "Task conversation content is required")
|
||||
private String summary;
|
||||
|
||||
@Schema(description = "任务会话定时配置")
|
||||
@NotNull(message = "Task conversation schedule configuration is required")
|
||||
private String taskCron;
|
||||
|
||||
@Schema(description = "智能体ID")
|
||||
@NotNull(message = "Agent ID is required")
|
||||
private Long agentId;
|
||||
|
||||
@Schema(description = "开发模式")
|
||||
private boolean devMode;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class TopicGenDto implements Serializable {
|
||||
|
||||
@JsonPropertyDescription("Contextually appropriate titles, ≤50 characters. Do not generate titles unrelated to the topic. For meaningless contexts, such as user input errors or arbitrary content, no summary is needed; return empty. Output language based on the <content>")
|
||||
private String topic;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.dto.config.TriggerConfigDto;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TriggerConfigAddDto extends TriggerConfigDto {
|
||||
|
||||
@Schema(description = "agentId", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "agentId is required")
|
||||
private Long agentId;
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.repository.entity.AgentComponentConfig;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class TryReqDto implements Serializable {
|
||||
|
||||
@Schema(description = "会话唯一标识")
|
||||
@NotNull(message = "conversationId is required")
|
||||
private Long conversationId;
|
||||
|
||||
@Schema(description = "变量参数,前端需要根据agent配置组装参数")
|
||||
private Map<String, Object> variableParams;
|
||||
|
||||
@Schema(description = "chat消息")
|
||||
private String message;
|
||||
|
||||
@Schema(description = "附件列表")
|
||||
private List<AttachmentDto> attachments;
|
||||
|
||||
@Schema(description = "是否调试模式")
|
||||
private boolean debug;
|
||||
|
||||
@Schema(description = "来源", hidden = true)
|
||||
private String from;
|
||||
|
||||
@Schema(description = "用户选择的沙盒(我的电脑)ID")
|
||||
private Long sandboxId;
|
||||
|
||||
private List<SelectedComponentDto> selectedComponents;
|
||||
|
||||
@Schema(description = "前端选中的技能ID列表")
|
||||
private List<Long> skillIds;
|
||||
|
||||
@Schema(description = "长期记忆中是否过滤敏感信息")
|
||||
private Boolean filterSensitive;
|
||||
|
||||
@Schema(description = "用户选择的模型ID")
|
||||
private Long modelId;
|
||||
|
||||
@Schema(description = "请求ID", hidden = true)
|
||||
private String requestId;
|
||||
|
||||
@Data
|
||||
public static class SelectedComponentDto {
|
||||
@Schema(description = "组件ID")
|
||||
private Long id; // 组件配置ID
|
||||
|
||||
@Schema(description = "组件类型")
|
||||
private AgentComponentConfig.Type type; // 组件类型,可选值:Plugin, Workflow, Trigger, Knowledge, Variable, Database
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class UserAgentDto extends UserTargetRelationDto implements Serializable {
|
||||
|
||||
@Schema(description = "智能体ID")
|
||||
private Long agentId; // 智能体ID
|
||||
|
||||
@Schema(description = "所属空间ID")
|
||||
private Long spaceId;
|
||||
|
||||
@Schema(description = "统计信息", hidden = true)
|
||||
private StatisticsDto statistics;
|
||||
|
||||
@Schema(description = "发布者信息", hidden = true)
|
||||
private PublishUserDto publishUser;
|
||||
|
||||
@Schema(description = "智能体类型,只关注 ChatBot和PageApp")
|
||||
private String agentType;
|
||||
|
||||
@Schema(description = "最后一次会话ID")
|
||||
private Long lastConversationId;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class UserAgentSortDto {
|
||||
private Long id;
|
||||
private Long tenantId;
|
||||
private Long userId;
|
||||
private String category;
|
||||
private Integer sort;
|
||||
private List<Long> agentSortConfig;
|
||||
private String modified;
|
||||
private String created;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class UserTargetRelationDto implements Serializable {
|
||||
|
||||
private Long id; // 关系ID
|
||||
|
||||
private Long userId; // 用户ID
|
||||
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "图标")
|
||||
private String icon;
|
||||
|
||||
@Schema(description = "描述")
|
||||
private String description;
|
||||
|
||||
private Date modified; // 更新时间
|
||||
|
||||
private Date created; // 创建时间
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class UserWorkflowDto extends UserTargetRelationDto implements Serializable {
|
||||
|
||||
@Schema(description = "工作流ID")
|
||||
private Long workflowId;
|
||||
|
||||
@Schema(description = "所属空间ID")
|
||||
private Long spaceId;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class WorkflowAddDto {
|
||||
|
||||
@Schema(description = "空间ID")
|
||||
@NotNull(message = "Space ID is required")
|
||||
private Long spaceId;
|
||||
|
||||
@Schema(description = "工作流名称")
|
||||
@NotNull(message = "Workflow name is required")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "工作流描述")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "图标地址")
|
||||
private String icon;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class WorkflowExecuteRequestDto implements Serializable {
|
||||
|
||||
@Schema(description = "请求ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "Request ID is required")
|
||||
private String requestId;
|
||||
|
||||
@Schema(description = "工作流ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "Workflow ID is required")
|
||||
private Long workflowId;
|
||||
|
||||
@Schema(description = "工作流参数", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Map<String, Object> params;
|
||||
|
||||
@Schema(description = "问答回复")
|
||||
private String answer;
|
||||
|
||||
@Schema(description = "AgentID")
|
||||
private Long agentId;
|
||||
|
||||
@Schema(description = "来源")
|
||||
private String from;
|
||||
|
||||
private boolean test;
|
||||
|
||||
public Map<String, Object> getParams() {
|
||||
return params == null ? params = new HashMap<>() : params;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class WorkflowExecutingDto implements Serializable {
|
||||
|
||||
@Schema(description = "执行结果状态")
|
||||
private boolean success;
|
||||
|
||||
@Schema(description = "执行结果")
|
||||
private Object data;
|
||||
|
||||
@Schema(description = "执行结果码")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "执行错误信息")
|
||||
private String message;
|
||||
|
||||
@Schema(description = "请求ID")
|
||||
private String requestId;
|
||||
|
||||
// 各个节点执行结果信息
|
||||
private Object nodeExecuteResultMap;
|
||||
|
||||
@Schema(description = "请求耗时")
|
||||
private Long costTime;
|
||||
|
||||
@Schema(description = "工作流是否执行完成")
|
||||
private boolean isComplete;
|
||||
|
||||
public String getCode() {
|
||||
return success ? "0000" : "0001";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.dto.config.workflow.AddNodeConfigDto;
|
||||
import com.xspaceagi.agent.core.adapter.repository.entity.WorkflowNodeConfig;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class WorkflowNodeAddDto implements Serializable {
|
||||
|
||||
@Schema(description = "工作流ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "Workflow ID is required")
|
||||
private Long workflowId;
|
||||
|
||||
@Schema(description = "可选,循环节点ID,如果在循环体里添加节点,需要传该参数")
|
||||
private Long loopNodeId;
|
||||
|
||||
@Schema(description = "节点类型")
|
||||
private WorkflowNodeConfig.NodeType type;
|
||||
|
||||
@Schema(description = "可选,节点类型对应的目标配置ID(工作流、插件为必传字段)")
|
||||
private Long typeId;
|
||||
|
||||
@Schema(description = "扩展字段,用于前端存储画布位置等相关配置")
|
||||
private Map<String, Object> extension;
|
||||
|
||||
@Schema(description = "可选,节点ID,如果为空则新增节点,不为空则更新节点", requiredMode = Schema.RequiredMode.NOT_REQUIRED, hidden = true)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "节点配置信息,新增时,前端传的节点配置")
|
||||
private AddNodeConfigDto nodeConfigDto;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class WorkflowNodeCheckDto implements Serializable {
|
||||
|
||||
private Long nodeId;
|
||||
|
||||
private boolean success;
|
||||
|
||||
private List<String> messages;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class WorkflowNodeExecuteRequestDto implements Serializable {
|
||||
|
||||
@Schema(description = "请求ID")
|
||||
private String requestId;
|
||||
|
||||
@Schema(description = "工作流节点ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long nodeId;
|
||||
|
||||
@Schema(description = "工作流节点参数")
|
||||
private Map<String, Object> params;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.xspaceagi.agent.core.adapter.dto.config.workflow.WorkflowNodeDto;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class WorkflowNodeUpdateDto<T> implements Serializable {
|
||||
|
||||
@Schema(description = "节点ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long nodeId;
|
||||
|
||||
@Schema(description = "节点名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "节点描述")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "上级循环节点ID,针对循环节点有效")
|
||||
private Long loopNodeId;
|
||||
|
||||
@Schema(description = "内部起始节点ID,针对循环节点有效")
|
||||
private Long innerStartNodeId;
|
||||
|
||||
@Schema(description = "内部结束节点ID,针对循环节点有效")
|
||||
private Long innerEndNodeId;
|
||||
|
||||
@Schema(description = "下级节点ID列表")
|
||||
private List<Long> nextNodeIds;
|
||||
|
||||
@Schema(description = "下级节点ID列表,针对更新节点有效")
|
||||
private List<Long> updateNextNodeIds;
|
||||
|
||||
@Schema(description = "节点详细配置信息,可以不传,但是传则需要传全部配置")
|
||||
private T nodeConfig;
|
||||
|
||||
@Schema(description = "内部节点列表更新,针对循环节点有效", hidden = true)
|
||||
private List<JSONObject> innerNodes;
|
||||
|
||||
@Schema(description = "节点更新之前的节点信息", hidden = true)
|
||||
private WorkflowNodeDto lastWorkflowNodeDto;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class WorkflowSaveDto {
|
||||
|
||||
@Schema(description = "工作流整体配置json", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "Workflow JSON configuration is required")
|
||||
private JSONObject workflowConfig;
|
||||
|
||||
@Schema(description = "强制提交", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private boolean forceCommit;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class WorkflowUpdateDto {
|
||||
|
||||
@Schema(description = "工作流ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "id is required")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "工作流名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "工作流描述")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "图标地址")
|
||||
private String icon;
|
||||
|
||||
@Schema(description = "扩展字段,用于前端存储画布位置等相关配置")
|
||||
private Map<String, Object> extension;
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto.config;
|
||||
|
||||
import com.xspaceagi.agent.core.adapter.repository.entity.AgentComponentConfig;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class AgentComponentConfigDto {
|
||||
|
||||
@Schema(description = "组件配置ID")
|
||||
private Long id; // 组件配置ID
|
||||
|
||||
@Schema(description = "商户ID")
|
||||
private Long tenantId; // 商户ID
|
||||
|
||||
@Schema(description = "组件名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "组件图标")
|
||||
private String icon;
|
||||
|
||||
@Schema(description = "组件描述")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "关联的AgentID")
|
||||
private Long agentId; // AgentID
|
||||
|
||||
@Schema(description = "组件类型")
|
||||
private AgentComponentConfig.Type type; // 组件类型,可选值:Plugin, Workflow, Trigger, Knowledge, Variable, Database
|
||||
|
||||
@Schema(description = "绑定组件配置,不同组件配置不一样")
|
||||
private Object bindConfig; //绑定组件配置
|
||||
|
||||
@Schema(description = "关联的组件ID")
|
||||
private Long targetId; // 关联的组件ID
|
||||
|
||||
@Schema(description = "组件原始配置")
|
||||
private Object targetConfig; // 组件原始配置
|
||||
|
||||
private Integer exceptionOut; // 异常是否抛出,中断主要流程
|
||||
|
||||
private String fallbackMsg; // 异常时兜底内容
|
||||
|
||||
private Date modified; // 更新时间
|
||||
|
||||
private Date created; // 创建时间
|
||||
|
||||
@Schema(description = "是否删除", hidden = true)
|
||||
private boolean deleted; // 是否删除
|
||||
|
||||
@Schema(description = "空间id", hidden = true)
|
||||
private Long spaceId;
|
||||
|
||||
@Schema(description = "分组名称")
|
||||
private String groupName;
|
||||
|
||||
@Schema(description = "分组描述")
|
||||
private String groupDescription;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,353 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto.config;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.xspaceagi.agent.core.adapter.dto.CreatorDto;
|
||||
import com.xspaceagi.agent.core.adapter.dto.GuidQuestionDto;
|
||||
import com.xspaceagi.agent.core.adapter.dto.PublishUserDto;
|
||||
import com.xspaceagi.agent.core.adapter.dto.StatisticsDto;
|
||||
import com.xspaceagi.agent.core.adapter.dto.config.bind.*;
|
||||
import com.xspaceagi.agent.core.adapter.repository.entity.AgentComponentConfig;
|
||||
import com.xspaceagi.agent.core.adapter.repository.entity.AgentConfig;
|
||||
import com.xspaceagi.agent.core.adapter.repository.entity.Published;
|
||||
import com.xspaceagi.system.application.dto.SpaceDto;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class AgentConfigDto implements Serializable {
|
||||
|
||||
@Schema(description = "智能体ID")
|
||||
private Long id; // 智能体ID
|
||||
|
||||
@Schema(description = "agent唯一标识")
|
||||
private String uid; // agent唯一标识
|
||||
|
||||
@Schema(description = "类型,ChatBot 对话智能体;PageApp 网页应用智能体, TaskAgent 任务型智能体")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "商户ID")
|
||||
private Long tenantId; // 商户ID
|
||||
|
||||
@Schema(description = "空间ID")
|
||||
private Long spaceId; // 空间ID
|
||||
|
||||
@Schema(description = "创建者ID")
|
||||
private Long creatorId; // 创建者ID
|
||||
|
||||
@Schema(description = "Agent名称")
|
||||
private String name; // Agent名称
|
||||
|
||||
@Schema(description = "Agent描述")
|
||||
private String description; // Agent描述
|
||||
|
||||
@Schema(description = "图标地址")
|
||||
private String icon; // 图标地址
|
||||
|
||||
@Schema(description = "系统提示词")
|
||||
private String systemPrompt; // 系统提示词
|
||||
|
||||
@Schema(description = "用户消息提示词")
|
||||
private String userPrompt; // 用户消息提示词,{{AGENT_USER_MSG}}引用用户消息
|
||||
|
||||
@Schema(description = "是否开启问题建议")
|
||||
private AgentConfig.OpenStatus openSuggest; // 是否开启问题建议
|
||||
|
||||
@Schema(description = "问题建议提示词")
|
||||
private String suggestPrompt; // 用户问题建议
|
||||
|
||||
@Schema(description = "首次打开聊天框自动回复消息")
|
||||
private String openingChatMsg; // 首次打开聊天框自动回复消息
|
||||
|
||||
@Schema(description = "首次打开引导问题(弃用)")
|
||||
private List<String> openingGuidQuestions; // 开场引导问题
|
||||
|
||||
@Schema(description = "引导问题")
|
||||
private List<GuidQuestionDto> guidQuestionDtos;
|
||||
|
||||
@Schema(description = "是否开启长期记忆")
|
||||
private AgentConfig.OpenStatus openLongMemory; // 是否开启长期记忆
|
||||
|
||||
@Schema(description = "发布状态")
|
||||
private Published.PublishStatus publishStatus; // Agent发布状态
|
||||
|
||||
@Schema(description = "最后编辑时间")
|
||||
private Date modified; // 更新时间
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private Date created; // 创建时间
|
||||
|
||||
@Schema(description = "模型信息")
|
||||
private AgentComponentConfigDto modelComponentConfig; // 模型
|
||||
|
||||
@Schema(description = "组件配置列表", hidden = true)
|
||||
private List<AgentComponentConfigDto> agentComponentConfigList;
|
||||
|
||||
@Schema(description = "统计信息")
|
||||
private StatisticsDto agentStatistics;
|
||||
|
||||
@Schema(description = "发布者信息(若已发布)")
|
||||
private PublishUserDto publishUser;
|
||||
|
||||
@Schema(description = "创建者信息")
|
||||
private CreatorDto creator;
|
||||
|
||||
@Schema(description = "空间信息")
|
||||
private SpaceDto space;
|
||||
|
||||
@Schema(description = "是否开发收藏")
|
||||
private boolean isDevCollected;
|
||||
|
||||
@Schema(description = "是否收藏", hidden = true)
|
||||
private boolean isCollected;
|
||||
|
||||
@Schema(description = "开发会话ID")
|
||||
private Long devConversationId;
|
||||
|
||||
@Schema(description = "发布时间,如果不为空,与当前modified时间做对比,如果发布时间小于modified,则前端显示:有更新未发布")
|
||||
private Date publishDate;
|
||||
|
||||
@Schema(description = "发布备注")
|
||||
private String publishRemark;
|
||||
|
||||
@Schema(description = "智能体分类名称")
|
||||
private String category;
|
||||
|
||||
@Schema(description = "是否允许复制, 1 允许", hidden = true)
|
||||
private Integer allowCopy;
|
||||
|
||||
@Schema(description = "是否开启定时任务")
|
||||
private AgentConfig.OpenStatus openScheduledTask;
|
||||
|
||||
@Schema(description = "权限列表")
|
||||
private List<String> permissions;
|
||||
|
||||
@Schema(description = "是否默认展开扩展页面区域, 1 展开;0 不展开")
|
||||
private Integer expandPageArea;
|
||||
|
||||
@Schema(description = "是否隐藏聊天区域,1 隐藏;0 不隐藏")
|
||||
private Integer hideChatArea;
|
||||
|
||||
@Schema(description = "扩展页面首页")
|
||||
private String pageHomeIndex;
|
||||
|
||||
@Schema(description = "扩展信息", hidden = true)
|
||||
private Map<String, Object> extra;
|
||||
|
||||
@Schema(description = "访问控制, 0 不受管控;1 管控")
|
||||
private Integer accessControl;
|
||||
|
||||
@Schema(description = "是否隐藏远程桌面, 1 隐藏;0 不隐藏")
|
||||
private Integer hideDesktop;
|
||||
|
||||
@Schema(description = "代理MCP SSE地址", hidden = true)
|
||||
private String proxyMcpServerConfig;
|
||||
|
||||
@Schema(description = "是否允许用户在对话框中选择其他模型, 1 允许,其他不允许")
|
||||
private Integer allowOtherModel;
|
||||
|
||||
@Schema(description = "是否允许用户在对话框中@技能, 1 允许,其他不允许")
|
||||
private Integer allowAtSkill;
|
||||
|
||||
@Schema(description = "是否允许用户在对话框中选择自己的电脑, 1 允许,其他不允许")
|
||||
private Integer allowPrivateSandbox;
|
||||
|
||||
public String getPageHomeIndex() {
|
||||
//设置默认页面首页
|
||||
if (getAgentComponentConfigList() != null) {
|
||||
Optional<AgentComponentConfigDto> first = getAgentComponentConfigList().stream().filter(componentConfig -> componentConfig.getType().equals(AgentComponentConfig.Type.Page)).findFirst();
|
||||
if (first.isPresent()) {
|
||||
PageBindConfigDto pageBindConfigDto = (PageBindConfigDto) first.get().getBindConfig();
|
||||
if (pageBindConfigDto != null) {
|
||||
//没有设置默认首页时,第一个为首页
|
||||
setPageHomeIndex("/page" + pageBindConfigDto.getBasePath() + "-" + getId() + "/prod/");
|
||||
}
|
||||
}
|
||||
for (AgentComponentConfigDto componentConfigDto : getAgentComponentConfigList()) {
|
||||
if (componentConfigDto.getType().equals(AgentComponentConfig.Type.Page)) {
|
||||
PageBindConfigDto pageBindConfigDto = (PageBindConfigDto) componentConfigDto.getBindConfig();
|
||||
if (pageBindConfigDto != null && pageBindConfigDto.getHomeIndex() == 1) {
|
||||
setPageHomeIndex("/page" + pageBindConfigDto.getBasePath() + "-" + getId() + "/prod/");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return pageHomeIndex;
|
||||
}
|
||||
|
||||
public List<CustomPageMenu> getCustomPageMenus() {
|
||||
List<CustomPageMenu> customPageMenus = new ArrayList<>();
|
||||
//设置默认页面首页
|
||||
if (getAgentComponentConfigList() != null) {
|
||||
for (AgentComponentConfigDto componentConfigDto : getAgentComponentConfigList()) {
|
||||
if (componentConfigDto.getType().equals(AgentComponentConfig.Type.Page)) {
|
||||
PageBindConfigDto pageBindConfigDto = (PageBindConfigDto) componentConfigDto.getBindConfig();
|
||||
if (pageBindConfigDto != null) {
|
||||
CustomPageMenu customPageMenu = buildCustomPageMenu(componentConfigDto, pageBindConfigDto);
|
||||
customPageMenus.add(customPageMenu);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return customPageMenus;
|
||||
}
|
||||
|
||||
private @NotNull CustomPageMenu buildCustomPageMenu(AgentComponentConfigDto componentConfigDto, PageBindConfigDto pageBindConfigDto) {
|
||||
CustomPageMenu customPageMenu = new CustomPageMenu();
|
||||
customPageMenu.setName(componentConfigDto.getName());
|
||||
customPageMenu.setIcon(componentConfigDto.getIcon());
|
||||
customPageMenu.setDescription(componentConfigDto.getDescription());
|
||||
customPageMenu.setPath("/page" + pageBindConfigDto.getBasePath() + "-" + getId() + "/prod/");
|
||||
if (pageBindConfigDto.getHomeIndex() == 1) {
|
||||
customPageMenu.setSelected(true);
|
||||
}
|
||||
return customPageMenu;
|
||||
}
|
||||
|
||||
public static void convertBindConfig(AgentComponentConfigDto componentConfig) {
|
||||
if (componentConfig.getType() == null) {
|
||||
return;
|
||||
}
|
||||
if (componentConfig.getBindConfig() instanceof JSONObject) {
|
||||
switch (componentConfig.getType()) {
|
||||
case Model -> {
|
||||
ModelBindConfigDto modelBindConfigDto = JSON.parseObject(componentConfig.getBindConfig().toString(), ModelBindConfigDto.class);
|
||||
componentConfig.setBindConfig(modelBindConfigDto);
|
||||
}
|
||||
case Plugin -> {
|
||||
PluginBindConfigDto pluginBindConfigDto = JSON.parseObject(componentConfig.getBindConfig().toString(), PluginBindConfigDto.class);
|
||||
componentConfig.setBindConfig(pluginBindConfigDto);
|
||||
}
|
||||
case Workflow -> {
|
||||
WorkflowBindConfigDto workflowBindConfigDto = JSON.parseObject(componentConfig.getBindConfig().toString(), WorkflowBindConfigDto.class);
|
||||
componentConfig.setBindConfig(workflowBindConfigDto);
|
||||
}
|
||||
case Table -> {
|
||||
TableBindConfigDto tableBindConfigDto = JSON.parseObject(componentConfig.getBindConfig().toString(), TableBindConfigDto.class);
|
||||
componentConfig.setBindConfig(tableBindConfigDto);
|
||||
}
|
||||
case Knowledge -> {
|
||||
KnowledgeBaseBindConfigDto knowledgeBaseBindConfigDto = JSON.parseObject(componentConfig.getBindConfig().toString(), KnowledgeBaseBindConfigDto.class);
|
||||
componentConfig.setBindConfig(knowledgeBaseBindConfigDto);
|
||||
}
|
||||
case Trigger -> {
|
||||
TriggerConfigDto triggerConfigDto = JSON.parseObject(componentConfig.getBindConfig().toString(), TriggerConfigDto.class);
|
||||
componentConfig.setBindConfig(triggerConfigDto);
|
||||
}
|
||||
case Variable -> {
|
||||
VariableConfigDto variableConfigDto = JSON.parseObject(componentConfig.getBindConfig().toString(), VariableConfigDto.class);
|
||||
componentConfig.setBindConfig(variableConfigDto);
|
||||
}
|
||||
case Mcp -> {
|
||||
McpBindConfigDto mcpBindConfigDto = JSON.parseObject(componentConfig.getBindConfig().toString(), McpBindConfigDto.class);
|
||||
componentConfig.setBindConfig(mcpBindConfigDto);
|
||||
}
|
||||
case Page -> {
|
||||
PageBindConfigDto pageBindConfigDto = JSON.parseObject(componentConfig.getBindConfig().toString(), PageBindConfigDto.class);
|
||||
componentConfig.setBindConfig(pageBindConfigDto);
|
||||
}
|
||||
case Event -> {
|
||||
EventBindConfigDto eventBindConfigDto = JSON.parseObject(componentConfig.getBindConfig().toString(), EventBindConfigDto.class);
|
||||
componentConfig.setBindConfig(eventBindConfigDto);
|
||||
}
|
||||
case Skill -> {
|
||||
SkillBindConfigDto skillBindConfigDto = JSON.parseObject(componentConfig.getBindConfig().toString(), SkillBindConfigDto.class);
|
||||
componentConfig.setBindConfig(skillBindConfigDto);
|
||||
}
|
||||
case SubAgent -> {
|
||||
SubAgentBindConfigDto subAgentBindConfigDto = JSON.parseObject(componentConfig.getBindConfig().toString(), SubAgentBindConfigDto.class);
|
||||
componentConfig.setBindConfig(subAgentBindConfigDto);
|
||||
}
|
||||
}
|
||||
} else if (!(componentConfig.getBindConfig() instanceof String)) {
|
||||
//处理一些脏数据导致异常的问题
|
||||
switch (componentConfig.getType()) {
|
||||
case Model -> {
|
||||
if (!(componentConfig.getBindConfig() instanceof ModelBindConfigDto)) {
|
||||
componentConfig.setBindConfig(new ModelBindConfigDto());
|
||||
}
|
||||
}
|
||||
case Plugin -> {
|
||||
if (!(componentConfig.getBindConfig() instanceof PluginBindConfigDto)) {
|
||||
componentConfig.setBindConfig(new PluginBindConfigDto());
|
||||
}
|
||||
}
|
||||
case Workflow -> {
|
||||
if (!(componentConfig.getBindConfig() instanceof WorkflowBindConfigDto)) {
|
||||
componentConfig.setBindConfig(new WorkflowBindConfigDto());
|
||||
}
|
||||
}
|
||||
case Table -> {
|
||||
if (!(componentConfig.getBindConfig() instanceof TableBindConfigDto)) {
|
||||
componentConfig.setBindConfig(new TableBindConfigDto());
|
||||
}
|
||||
}
|
||||
case Knowledge -> {
|
||||
if (!(componentConfig.getBindConfig() instanceof KnowledgeBaseBindConfigDto)) {
|
||||
componentConfig.setBindConfig(new KnowledgeBaseBindConfigDto());
|
||||
}
|
||||
}
|
||||
case Trigger -> {
|
||||
if (!(componentConfig.getBindConfig() instanceof TriggerConfigDto)) {
|
||||
componentConfig.setBindConfig(new TriggerConfigDto());
|
||||
}
|
||||
}
|
||||
case Variable -> {
|
||||
if (!(componentConfig.getBindConfig() instanceof VariableConfigDto)) {
|
||||
componentConfig.setBindConfig(new VariableConfigDto());
|
||||
}
|
||||
}
|
||||
case Mcp -> {
|
||||
if (!(componentConfig.getBindConfig() instanceof McpBindConfigDto)) {
|
||||
componentConfig.setBindConfig(new McpBindConfigDto());
|
||||
}
|
||||
}
|
||||
case Page -> {
|
||||
if (!(componentConfig.getBindConfig() instanceof PageBindConfigDto)) {
|
||||
componentConfig.setBindConfig(new PageBindConfigDto());
|
||||
}
|
||||
}
|
||||
case Event -> {
|
||||
if (!(componentConfig.getBindConfig() instanceof EventBindConfigDto)) {
|
||||
componentConfig.setBindConfig(new EventBindConfigDto());
|
||||
}
|
||||
}
|
||||
case Skill -> {
|
||||
if (!(componentConfig.getBindConfig() instanceof SkillBindConfigDto)) {
|
||||
componentConfig.setBindConfig(new SkillBindConfigDto());
|
||||
}
|
||||
}
|
||||
case SubAgent -> {
|
||||
if (!(componentConfig.getBindConfig() instanceof SubAgentBindConfigDto)) {
|
||||
componentConfig.setBindConfig(new SubAgentBindConfigDto());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class CustomPageMenu {
|
||||
@Schema(description = "菜单名称")
|
||||
private String name;
|
||||
@Schema(description = "菜单图标")
|
||||
private String icon;
|
||||
@Schema(description = "菜单描述")
|
||||
private String description;
|
||||
@Schema(description = "菜单路径")
|
||||
private String path;
|
||||
@Schema(description = "是否选中")
|
||||
private boolean selected;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,240 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto.config;
|
||||
|
||||
import com.xspaceagi.agent.core.spec.enums.DataTypeEnum;
|
||||
import com.xspaceagi.agent.core.spec.enums.GlobalVariableEnum;
|
||||
import com.xspaceagi.system.spec.annotation.I18n;
|
||||
import com.xspaceagi.system.spec.annotation.I18nField;
|
||||
import com.xspaceagi.system.spec.utils.I18nUtil;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@I18n(module = "Args")
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Schema(description = "参数")
|
||||
public class Arg implements Serializable {
|
||||
|
||||
@Schema(description = "参数key,唯一标识,不需要前端传递,后台根据配置自动生成")
|
||||
private String key;
|
||||
|
||||
@I18nField(keyPrefix = true)
|
||||
@Schema(description = "参数名称,符合函数命名规则")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "参数展示名称,供前端展示使用")
|
||||
private String displayName;
|
||||
|
||||
@Schema(description = "参数详细描述信息")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "数据类型")
|
||||
private DataTypeEnum dataType;
|
||||
|
||||
@Schema(description = "原始数据类型,用于避免循环引用内部参数调整类型时误更新", hidden = true)
|
||||
private DataTypeEnum originDataType;
|
||||
|
||||
@Schema(description = "是否必须")
|
||||
private boolean require;
|
||||
|
||||
@Schema(description = "是否为开启,如果不开启,插件使用者和大模型均看不见该参数;如果bindValueType为空且require为true时,该参数必须开启")
|
||||
private Boolean enable;
|
||||
|
||||
@Schema(description = "是否为系统内置变量参数,内置变量前端只可展示不可修改")
|
||||
private boolean systemVariable;
|
||||
|
||||
@Schema(description = "值引用类型,Input 输入;Reference 变量引用")
|
||||
private BindValueType bindValueType;
|
||||
|
||||
@Schema(description = "参数值,当类型为引用时,示例 1.xxx 绑定节点ID为1的xxx字段;当类型为输入时,该字段为最终使用的值")
|
||||
private String bindValue;
|
||||
|
||||
@Schema(description = "下级参数")
|
||||
private List<Arg> subArgs;
|
||||
|
||||
@Schema(description = "输入类型, 单行文本 Text, 多行段落 Paragraph, 下拉单选 Select, 下拉多选 MultipleSelect, 数字 Number, 智能识别 AutoRecognition")
|
||||
private InputTypeEnum inputType;
|
||||
|
||||
@Schema(description = "下拉参数配置")
|
||||
private SelectConfig selectConfig;
|
||||
|
||||
private Long loopId;
|
||||
|
||||
public void setSubArgs(List<Arg> subArgs) {
|
||||
if (this.subArgs != null) {
|
||||
return;
|
||||
}
|
||||
this.subArgs = subArgs;
|
||||
}
|
||||
|
||||
public List<Arg> getSubArgs() {
|
||||
return subArgs;
|
||||
}
|
||||
|
||||
//配合前端组件使用
|
||||
public List<Arg> getChildren() {
|
||||
return subArgs;
|
||||
}
|
||||
|
||||
public DataTypeEnum getDataType() {
|
||||
return dataType == null ? DataTypeEnum.String : dataType;
|
||||
}
|
||||
|
||||
//配合前端组件使用
|
||||
public void setChildren(List<Arg> subArgs) {
|
||||
if (this.subArgs != null) {
|
||||
return;
|
||||
}
|
||||
this.subArgs = subArgs;
|
||||
}
|
||||
|
||||
public enum BindValueType {
|
||||
Input, // 输入
|
||||
Reference, // 引用
|
||||
}
|
||||
|
||||
public enum InputTypeEnum {
|
||||
Query,
|
||||
Body,
|
||||
Header,
|
||||
Path,
|
||||
//以下用于其他前端输入组件,包含 单行文本、多行段落、下拉单选、下拉多选、智能识别
|
||||
//单行文本
|
||||
Text,
|
||||
//多行段落
|
||||
Paragraph,
|
||||
//下拉单选
|
||||
Select,
|
||||
//下拉多选
|
||||
MultipleSelect,
|
||||
//数字
|
||||
Number,
|
||||
//自动识别
|
||||
AutoRecognition,
|
||||
|
||||
}
|
||||
|
||||
public static List<Arg> updateBindConfigArgs(String startKey, List<Arg> bindConfigArgs, List<Arg> configInputArgs) {
|
||||
List<Arg> newBindInputArgs = null;
|
||||
if (configInputArgs != null) {
|
||||
//configInputArgs不为空,bindConfigArgs为空,直接返回configInputArgs
|
||||
//转换后返回
|
||||
newBindInputArgs = configInputArgs.stream().map(arg -> {
|
||||
ArgBindConfigDto arg1 = new ArgBindConfigDto();
|
||||
BeanUtils.copyProperties(arg, arg1);
|
||||
return arg1;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
if (bindConfigArgs == null && newBindInputArgs != null) {
|
||||
//configInputArgs不为空,bindConfigArgs为空,直接返回configInputArgs
|
||||
//转换后返回
|
||||
return newBindInputArgs;
|
||||
}
|
||||
if (newBindInputArgs == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
Map<String, Arg> argMap = new HashMap<>();
|
||||
generateKey(startKey, bindConfigArgs, argMap);
|
||||
updateInputArgs(startKey, newBindInputArgs, argMap);
|
||||
return newBindInputArgs;
|
||||
}
|
||||
|
||||
private static <T> void updateInputArgs(String pKey, List<T> args, Map<String, Arg> argMap) {
|
||||
if (args != null) {
|
||||
args.forEach(arg -> {
|
||||
if (arg instanceof Arg) {
|
||||
Arg arg1 = (Arg) arg;
|
||||
if (pKey == null) {
|
||||
arg1.setKey(arg1.getName());
|
||||
} else {
|
||||
arg1.setKey(pKey + "." + (StringUtils.isNotBlank(arg1.getName()) ? arg1.getName() : UUID.randomUUID().toString()));
|
||||
}
|
||||
List<Arg> subArgs = arg1.getSubArgs();
|
||||
Arg bindConfigArg = argMap.get(arg1.getKey());
|
||||
if (bindConfigArg != null && arg1.getEnable()) {
|
||||
bindConfigArg.setRequire(arg1.isRequire());
|
||||
bindConfigArg.setDescription(arg1.getDescription());
|
||||
bindConfigArg.setDataType(arg1.getDataType());
|
||||
BeanUtils.copyProperties(bindConfigArg, arg1);
|
||||
arg1.setSubArgs(subArgs);
|
||||
}
|
||||
updateInputArgs(arg1.getKey(), subArgs, argMap);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//生成参数key
|
||||
public static <T> void generateKey(String pKey, List<T> args, Map<String, Arg> argMap) {
|
||||
if (args != null) {
|
||||
args.forEach(arg -> {
|
||||
if (arg instanceof Arg) {
|
||||
Arg arg1 = (Arg) arg;
|
||||
if (pKey == null) {
|
||||
arg1.setKey(arg1.getName());
|
||||
} else {
|
||||
arg1.setKey(pKey + "." + arg1.getName());
|
||||
}
|
||||
if (argMap != null) {
|
||||
argMap.put(arg1.getKey(), arg1);
|
||||
}
|
||||
generateKey(arg1.getKey(), arg1.getSubArgs(), argMap);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除不可见的参数
|
||||
*
|
||||
* @param inputArgs
|
||||
*/
|
||||
public static void removeDisabledArgs(List<?> inputArgs) {
|
||||
if (inputArgs == null) {
|
||||
return;
|
||||
}
|
||||
//遍历 inputArgs,if (!((Arg) arg).isEnable())时移除该arg
|
||||
Iterator<?> iterator = inputArgs.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Object arg = iterator.next();
|
||||
if (arg instanceof Arg) {
|
||||
if (((Arg) arg).getEnable() != null && !((Arg) arg).getEnable()) {
|
||||
iterator.remove();
|
||||
}
|
||||
if (((Arg) arg).getSubArgs() != null) {
|
||||
removeDisabledArgs(((Arg) arg).getSubArgs());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Boolean getEnable() {
|
||||
return enable == null || enable;
|
||||
}
|
||||
|
||||
public static List<Arg> getSystemVariableArgs() {
|
||||
List<Arg> systemVariableArgs = new ArrayList<>();
|
||||
systemVariableArgs.add(Arg.builder().systemVariable(true).name(GlobalVariableEnum.SYS_USER_ID.name()).description("Platform user ID").require(true).enable(true).build());
|
||||
systemVariableArgs.add(Arg.builder().systemVariable(true).name(GlobalVariableEnum.USER_UID.name()).description("User unique identifier").require(true).enable(true).build());
|
||||
systemVariableArgs.add(Arg.builder().systemVariable(true).name(GlobalVariableEnum.USER_LANG.name()).description("User language preference").require(true).enable(true).build());
|
||||
systemVariableArgs.add(Arg.builder().systemVariable(true).name(GlobalVariableEnum.USER_NAME.name()).description("User name").require(true).enable(true).build());
|
||||
systemVariableArgs.add(Arg.builder().systemVariable(true).name(GlobalVariableEnum.AGENT_ID.name()).description("Agent unique identifier").require(true).enable(true).build());
|
||||
systemVariableArgs.add(Arg.builder().systemVariable(true).name(GlobalVariableEnum.CONVERSATION_ID.name()).description("Conversation unique identifier").require(true).enable(true).build());
|
||||
systemVariableArgs.add(Arg.builder().systemVariable(true).name(GlobalVariableEnum.REQUEST_ID.name()).description("Request unique identifier").require(true).enable(true).build());
|
||||
systemVariableArgs.add(Arg.builder().systemVariable(true).name(GlobalVariableEnum.AGENT_USER_MSG.name()).description("User message").require(true).enable(true).build());
|
||||
systemVariableArgs.add(Arg.builder().systemVariable(true).name(GlobalVariableEnum.CHAT_CONTEXT.name()).description("Conversation context message list").require(true).enable(true).build());
|
||||
I18nUtil.replaceSystemMessage("SystemVariable", systemVariableArgs);
|
||||
return systemVariableArgs;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.xspaceagi.agent.core.adapter.dto.config;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ArgBindConfigDto extends Arg {
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user