Class SpringAIMinimaxService
java.lang.Object
com.bytedesk.ai.springai.service.BaseSpringAIService
com.bytedesk.ai.springai.providers.minimax.SpringAIMinimaxService
- All Implemented Interfaces:
SpringAIService
-
Nested Class Summary
Nested classes/interfaces inherited from class com.bytedesk.ai.springai.service.BaseSpringAIService
BaseSpringAIService.PromptResult -
Field Summary
FieldsFields inherited from class com.bytedesk.ai.springai.service.BaseSpringAIService
applicationEventPublisher, chunkElasticService, chunkVectorService, faqElasticService, faqVectorService, messagePersistCache, messageRestService, messageSendService, robotMessageCache, robotRestService, textElasticService, textVectorService, threadRestService, uidUtils -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate org.springframework.ai.minimax.MiniMaxChatOptions根据机器人配置创建动态的MiniMaxChatOptionsprivate org.springframework.ai.minimax.MiniMaxChatModel根据机器人配置创建动态的MiniMaxChatModelprivate ChatTokenUsageextractMinimaxTokenUsage(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, org.springframework.web.servlet.mvc.method.annotation.SseEmitter emitter, String fullPromptContent) protected StringprocessPromptSync(String message, RobotProtobuf robot, String fullPromptContent) protected voidprocessPromptWebsocket(org.springframework.ai.chat.prompt.Prompt prompt, RobotProtobuf robot, MessageProtobuf messageProtobufQuery, MessageProtobuf messageProtobufReply, String fullPromptContent) Token usage data classMethods inherited from class com.bytedesk.ai.springai.service.BaseSpringAIService
createDynamicOptions, extractFullPromptContent, extractTextFromResponse, extractTokenUsage, getTokenUnitPrice, handleSseError, isEmitterCompleted, persistMessage, persistMessage, persistMessage, persistMessage, processDirectLlmRequest, processLlmResponseWebsocket, publishAiTokenUsageEvent, recordAiTokenUsage, searchKnowledgeBase, sendMessageWebsocket, sendSseMessage, sendStreamEndMessage, sendStreamMessage, sendStreamStartMessage, sendSyncMessage, sendWebsocketMessage
-
Field Details
-
llmProviderRestService
-
-
Constructor Details
-
SpringAIMinimaxService
public SpringAIMinimaxService()
-
-
Method Details
-
createDynamicOptions
根据机器人配置创建动态的MiniMaxChatOptions- Parameters:
llm- 机器人LLM配置- Returns:
- 根据机器人配置创建的选项
-
createMinimaxChatModel
根据机器人配置创建动态的MiniMaxChatModel- Parameters:
llm- 机器人LLM配置- Returns:
- 配置了特定模型的MiniMaxChatModel
-
processPromptWebsocket
protected void processPromptWebsocket(org.springframework.ai.chat.prompt.Prompt prompt, RobotProtobuf robot, MessageProtobuf messageProtobufQuery, MessageProtobuf messageProtobufReply, String fullPromptContent) Description copied from class:BaseSpringAIServiceToken usage data class- 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, org.springframework.web.servlet.mvc.method.annotation.SseEmitter emitter, String fullPromptContent) - Specified by:
processPromptSsein classBaseSpringAIService
-
extractMinimaxTokenUsage
private ChatTokenUsage extractMinimaxTokenUsage(org.springframework.ai.chat.model.ChatResponse response) 专门为Minimax API提取token使用情况 由于Minimax API返回的usage字段是EmptyUsage对象,需要特殊处理- Parameters:
response- ChatResponse对象- Returns:
- TokenUsage对象
-