Package com.bytedesk.ai.service
Class BaseSpringAIService
java.lang.Object
com.bytedesk.ai.service.BaseSpringAIService
- All Implemented Interfaces:
SpringAIService
- Direct Known Subclasses:
SpringAIBaiduChatService,SpringAIBaiduService,SpringAICozeService,SpringAICustomChatService,SpringAICustomService,SpringAIDashscopeChatService,SpringAIDashscopeService,SpringAIDeepseekChatService,SpringAIDeepseekService,SpringAIDifyService,SpringAIFastGptService,SpringAIGeminiChatService,SpringAIGeminiService,SpringAIGiteeChatService,SpringAIGiteeService,SpringAIMaxkbService,SpringAIMinimaxChatService,SpringAIMinimaxService,SpringAIN8nService,SpringAIOllamaChatService,SpringAIOllamaService,SpringAIOpenaiChatService,SpringAIOpenaiService,SpringAIOpenrouterChatService,SpringAIOpenrouterService,SpringAIRagflowService,SpringAISiliconFlowChatService,SpringAISiliconFlowService,SpringAITencentChatService,SpringAITencentService,SpringAIVolcengineChatService,SpringAIVolcengineService,SpringAIWeknoraService,SpringAIZhipuaiChatService,ZhipuaiMultiModelService
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationEventPublisherprotected ChunkElasticServiceprotected ChunkVectorServiceprotected FaqElasticServiceprotected FaqVectorServiceprotected KnowledgeBaseSearchHelperprotected MessagePersistCacheprotected MessagePersistenceHelperprotected MessageRestServiceprotected IMessageSendServiceprotected PromptHelperprotected RobotMessageCacheprotected RobotRestServiceprotected SseMessageHelperprotected TextElasticServiceprotected TextVectorServiceprotected ThreadRestServiceprotected UidUtilsprotected WebpageElasticServiceprotected WebpageVectorService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidprocessPromptSse(org.springframework.ai.chat.prompt.Prompt prompt, RobotProtobuf robot, MessageProtobuf messageProtobufQuery, MessageProtobuf messageProtobufReply, List<RobotContent.SourceReference> sourceReferences, org.springframework.web.servlet.mvc.method.annotation.SseEmitter emitter) protected abstract StringprocessPromptSync(String message, RobotProtobuf robot) protected abstract voidprocessPromptWebsocket(org.springframework.ai.chat.prompt.Prompt prompt, RobotProtobuf robot, MessageProtobuf messageProtobufQuery, MessageProtobuf messageProtobufReply) processSyncRequest(String query, RobotProtobuf robot, boolean searchKnowledgeBase) 直接处理LLM请求并同步返回结果,支持控制是否查询知识库 主要用于RobotAgentService中的processLlmRequest方法voidsendSseMessage(String query, RobotProtobuf robot, MessageProtobuf messageProtobufQuery, MessageProtobuf messageProtobufReply, org.springframework.web.servlet.mvc.method.annotation.SseEmitter emitter) 发送Sse消息sendSyncMessage(String query, RobotProtobuf robot, MessageProtobuf messageProtobufQuery, MessageProtobuf messageProtobufReply) 发送同步消息并返回回复内容voidsendWebsocketMessage(String query, RobotProtobuf robot, MessageProtobuf messageProtobufQuery, MessageProtobuf messageProtobufReply) 发送websocket消息
-
Field Details
-
faqElasticService
-
faqVectorService
-
textElasticService
-
textVectorService
-
chunkElasticService
-
chunkVectorService
-
webpageElasticService
-
webpageVectorService
-
messageSendService
-
uidUtils
-
robotRestService
-
threadRestService
-
messagePersistCache
-
robotMessageCache
-
messageRestService
-
applicationEventPublisher
@Autowired protected org.springframework.context.ApplicationEventPublisher applicationEventPublisher -
knowledgeBaseSearchHelper
-
promptHelper
-
messagePersistenceHelper
-
sseMessageHelper
-
-
Constructor Details
-
BaseSpringAIService
protected BaseSpringAIService()
-
-
Method Details
-
sendWebsocketMessage
public void sendWebsocketMessage(String query, RobotProtobuf robot, MessageProtobuf messageProtobufQuery, MessageProtobuf messageProtobufReply) Description copied from interface:SpringAIService发送websocket消息- Specified by:
sendWebsocketMessagein interfaceSpringAIService- Parameters:
query- 用户查询robot- 机器人实体
-
sendSseMessage
public void sendSseMessage(String query, RobotProtobuf robot, MessageProtobuf messageProtobufQuery, MessageProtobuf messageProtobufReply, org.springframework.web.servlet.mvc.method.annotation.SseEmitter emitter) Description copied from interface:SpringAIService发送Sse消息- Specified by:
sendSseMessagein interfaceSpringAIServiceemitter- SseEmitter
-
sendSyncMessage
public String sendSyncMessage(String query, RobotProtobuf robot, MessageProtobuf messageProtobufQuery, MessageProtobuf messageProtobufReply) Description copied from interface:SpringAIService发送同步消息并返回回复内容- Specified by:
sendSyncMessagein interfaceSpringAIService- Parameters:
query- 用户查询robot- 机器人实体messageProtobufQuery- 查询消息messageProtobufReply- 回复消息- Returns:
- 回复内容
-
processSyncRequest
Description copied from interface:SpringAIService直接处理LLM请求并同步返回结果,支持控制是否查询知识库 主要用于RobotAgentService中的processLlmRequest方法- Specified by:
processSyncRequestin interfaceSpringAIService- Parameters:
query- 用户查询robot- 机器人配置searchKnowledgeBase- 是否需要查询知识库- Returns:
- 大模型生成的回复内容
-
processPromptWebsocket
protected abstract void processPromptWebsocket(org.springframework.ai.chat.prompt.Prompt prompt, RobotProtobuf robot, MessageProtobuf messageProtobufQuery, MessageProtobuf messageProtobufReply) -
processPromptSse
protected abstract void processPromptSse(org.springframework.ai.chat.prompt.Prompt prompt, RobotProtobuf robot, MessageProtobuf messageProtobufQuery, MessageProtobuf messageProtobufReply, List<RobotContent.SourceReference> sourceReferences, org.springframework.web.servlet.mvc.method.annotation.SseEmitter emitter) -
processPromptSync
-