Class SpringAIMinimaxChatService

java.lang.Object
com.bytedesk.ai.springai.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 Details

    • minimaxChatModel

      @Autowired(required=false) @Qualifier("minimaxChatModel") private org.springframework.ai.chat.model.ChatModel minimaxChatModel
  • Constructor Details

    • SpringAIMinimaxChatService

      public SpringAIMinimaxChatService()
  • Method Details

    • createDynamicOptions

      private org.springframework.ai.minimax.MiniMaxChatOptions createDynamicOptions(RobotLlm llm)
      根据机器人配置创建动态的MiniMaxChatOptions
      Parameters:
      llm - 机器人LLM配置
      Returns:
      根据机器人配置创建的选项
    • processPromptWebsocket

      protected void processPromptWebsocket(org.springframework.ai.chat.prompt.Prompt prompt, RobotProtobuf robot, MessageProtobuf messageProtobufQuery, MessageProtobuf messageProtobufReply, String fullPromptContent)
      Description copied from class: BaseSpringAIService
      Token usage data class
      Specified by:
      processPromptWebsocket in class BaseSpringAIService
    • processPromptSync

      protected String processPromptSync(String message, RobotProtobuf robot, String fullPromptContent)
      Specified by:
      processPromptSync in class BaseSpringAIService
    • 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:
      processPromptSse in class BaseSpringAIService
    • extractDeepSeekTokenUsage

      private ChatTokenUsage extractDeepSeekTokenUsage(org.springframework.ai.chat.model.ChatResponse response)
      专门为Minimax API提取token使用情况 由于Minimax API返回的usage字段是EmptyUsage对象,需要特殊处理
      Parameters:
      response - ChatResponse对象
      Returns:
      TokenUsage对象
    • isServiceHealthy

      public Boolean isServiceHealthy()