Class SseMessageHelper

java.lang.Object
com.bytedesk.ai.service.SseMessageHelper

@Component public class SseMessageHelper extends Object
  • Field Details

  • Constructor Details

    • SseMessageHelper

      public SseMessageHelper()
  • Method Details

    • sendStreamStartMessage

      public void sendStreamStartMessage(MessageProtobuf messageProtobufQuery, MessageProtobuf messageProtobufReply, org.springframework.web.servlet.mvc.method.annotation.SseEmitter emitter, String initialContent)
    • sendStreamMessage

      public void sendStreamMessage(MessageProtobuf messageProtobufQuery, MessageProtobuf messageProtobufReply, org.springframework.web.servlet.mvc.method.annotation.SseEmitter emitter, String content, String reasonContent, List<RobotContent.SourceReference> sourceReferences)
    • sendStreamMessage

      public void sendStreamMessage(MessageProtobuf messageProtobufQuery, MessageProtobuf messageProtobufReply, org.springframework.web.servlet.mvc.method.annotation.SseEmitter emitter, String content, String reasonContent, List<RobotContent.SourceReference> sourceReferences, Boolean isUnanswered, boolean completeAfterSend, boolean contentIsStreamContentJson)
    • looksLikeRobotContentJson

      private boolean looksLikeRobotContentJson(String content)
    • sendStreamEndMessage

      public void sendStreamEndMessage(MessageProtobuf messageProtobufQuery, MessageProtobuf messageProtobufReply, org.springframework.web.servlet.mvc.method.annotation.SseEmitter emitter, long promptTokens, long completionTokens, long totalTokens, org.springframework.ai.chat.prompt.Prompt prompt, String aiProvider, String aiModel)
    • sendStreamEndMessage

      public void sendStreamEndMessage(MessageProtobuf messageProtobufQuery, MessageProtobuf messageProtobufReply, org.springframework.web.servlet.mvc.method.annotation.SseEmitter emitter, long promptTokens, long completionTokens, long totalTokens, org.springframework.ai.chat.prompt.Prompt prompt, String aiProvider, String aiModel, boolean persistMessage)
    • sendDefaultReplySse

      public void sendDefaultReplySse(String query, RobotProtobuf robot, MessageProtobuf messageProtobufQuery, MessageProtobuf messageProtobufReply, org.springframework.web.servlet.mvc.method.annotation.SseEmitter emitter)
    • sendMessageWebsocket

      public void sendMessageWebsocket(MessageTypeEnum type, String content, MessageProtobuf messageProtobufReply)
    • processPromptSseWithContext

      public void processPromptSseWithContext(BaseSpringAIService service, String query, String context, RobotProtobuf robot, MessageProtobuf messageProtobufQuery, MessageProtobuf messageProtobufReply, List<RobotContent.SourceReference> sourceReferences, org.springframework.web.servlet.mvc.method.annotation.SseEmitter emitter, String errorLogTag)
    • handleSseError

      public void handleSseError(Throwable error, MessageProtobuf messageProtobufQuery, MessageProtobuf messageProtobufReply, org.springframework.web.servlet.mvc.method.annotation.SseEmitter emitter)
    • isEmitterCompleted

      public boolean isEmitterCompleted(org.springframework.web.servlet.mvc.method.annotation.SseEmitter emitter)