Class SpringAICozeService

java.lang.Object
com.bytedesk.ai.springai.service.BaseSpringAIService
com.bytedesk.ai.springai.providers.coze.SpringAICozeService
All Implemented Interfaces:
SpringAIService

@Service public class SpringAICozeService extends BaseSpringAIService
Coze AI服务类 使用 Coze OpenAPI SDK 实现聊天功能,继承自BaseSpringAIService https://www.coze.cn/open/docs/developer_guides
  • Field Details

  • Constructor Details

    • SpringAICozeService

      public SpringAICozeService()
  • Method Details

    • createDynamicCozeApi

      private com.coze.openapi.service.service.CozeAPI createDynamicCozeApi(RobotLlm llm)
      根据机器人配置创建动态的CozeAPI实例
      Parameters:
      llm - 机器人LLM配置
      Returns:
      配置了特定参数的CozeAPI
    • createChatRequest

      private com.coze.openapi.client.chat.CreateChatReq createChatRequest(RobotLlm llm, String message, String userID)
      根据机器人配置创建聊天请求
    • extractTextFromPrompt

      private String extractTextFromPrompt(org.springframework.ai.chat.prompt.Prompt prompt)
      从Prompt中提取文本内容
    • 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