Class SpringAIMinimaxChatService
java.lang.Object
com.bytedesk.ai.service.BaseSpringAIService
com.bytedesk.ai.springai.providers.minimax.SpringAIMinimaxChatService
- All Implemented Interfaces:
SpringAIService
@Service
@ConditionalOnProperty(prefix="spring.ai.minimax.chat",
name="enabled",
havingValue="true",
matchIfMissing=false)
public class SpringAIMinimaxChatService
extends BaseSpringAIService
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.springframework.ai.chat.model.ChatModelprivate TokenUsageHelperFields inherited from class com.bytedesk.ai.service.BaseSpringAIService
applicationEventPublisher, chunkElasticService, chunkVectorService, faqElasticService, faqVectorService, knowledgeBaseSearchHelper, messagePersistCache, messagePersistenceHelper, messageRestService, messageSendService, promptHelper, robotMessageCache, robotRestService, sseMessageHelper, textElasticService, textVectorService, threadRestService, uidUtils, webpageElasticService, webpageVectorService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate org.springframework.ai.minimax.MiniMaxChatOptions根据机器人配置创建动态的MiniMaxChatOptionsprivate ChatTokenUsageextractDeepSeekTokenUsage(org.springframework.ai.chat.model.ChatResponse response) 专门为Minimax API提取token使用情况 由于Minimax API返回的usage字段是EmptyUsage对象,需要特殊处理protected 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 StringprocessPromptSync(String message, RobotProtobuf robot) protected voidprocessPromptWebsocket(org.springframework.ai.chat.prompt.Prompt prompt, RobotProtobuf robot, MessageProtobuf messageProtobufQuery, MessageProtobuf messageProtobufReply) Methods inherited from class com.bytedesk.ai.service.BaseSpringAIService
processSyncRequest, sendSseMessage, sendSyncMessage, sendWebsocketMessage
-
Field Details
-
minimaxChatModel
@Autowired(required=false) @Qualifier("minimaxChatModel") private org.springframework.ai.chat.model.ChatModel minimaxChatModel -
tokenUsageHelper
-
-
Constructor Details
-
SpringAIMinimaxChatService
public SpringAIMinimaxChatService()
-
-
Method Details
-
createDynamicOptions
根据机器人配置创建动态的MiniMaxChatOptions- Parameters:
llm- 机器人LLM配置- Returns:
- 根据机器人配置创建的选项
-
processPromptWebsocket
protected void processPromptWebsocket(org.springframework.ai.chat.prompt.Prompt prompt, RobotProtobuf robot, MessageProtobuf messageProtobufQuery, MessageProtobuf messageProtobufReply) - Specified by:
processPromptWebsocketin classBaseSpringAIService
-
processPromptSync
- Specified by:
processPromptSyncin classBaseSpringAIService
-
processPromptSse
protected 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) - Specified by:
processPromptSsein classBaseSpringAIService
-
extractDeepSeekTokenUsage
private ChatTokenUsage extractDeepSeekTokenUsage(org.springframework.ai.chat.model.ChatResponse response) 专门为Minimax API提取token使用情况 由于Minimax API返回的usage字段是EmptyUsage对象,需要特殊处理- Parameters:
response- ChatResponse对象- Returns:
- TokenUsage对象
-
isServiceHealthy
-