Interface DifyChatClient


public interface DifyChatClient
Dify Chat Client Interface Provides methods to interact with Dify's chat API for sending messages, managing conversations, and handling message-related operations.
Since:
2025/4/7 13:20
Version:
0.8.0
Author:
yanghq
  • Method Details

    • chat

      Sends a chat message and returns the response
      Parameters:
      chatRequest - The chat message request containing message content and parameters
      Returns:
      The response from the chat service
    • streamingChat

      reactor.core.publisher.Flux<ChatMessageSendCompletionResponse> streamingChat(ChatMessageSendRequest chatRequest)
      Sends a chat message and returns the response as a reactive stream Used for streaming responses from the chat service
      Parameters:
      chatRequest - The chat message request containing message content and parameters
      Returns:
      A Flux stream of chat message completion responses
    • stopMessagesStream

      void stopMessagesStream(String apiKey, String taskId, String userId)
      Stops an ongoing message stream
      Parameters:
      apiKey - The API key for authentication
      taskId - The ID of the streaming task to stop
      userId - The ID of the user who initiated the stream
    • messageFeedback

      Provides feedback for a specific message
      Parameters:
      request - The message feedback request containing rating and other feedback details
      Returns:
      The response from the feedback submission
    • conversations

      io.github.guoshiqiufeng.dify.core.pojo.DifyPageResult<MessageConversationsResponse> conversations(MessageConversationsRequest request)
      Retrieves a paginated list of conversations
      Parameters:
      request - The request parameters for fetching conversations
      Returns:
      Paginated result containing conversation data
    • messages

      io.github.guoshiqiufeng.dify.core.pojo.DifyPageResult<io.github.guoshiqiufeng.dify.core.pojo.response.MessagesResponseVO> messages(MessagesRequest request)
      Retrieves a paginated list of messages
      Parameters:
      request - The request parameters for fetching messages
      Returns:
      Paginated result containing message data
    • messagesSuggested

      List<String> messagesSuggested(String messageId, String apiKey, String userId)
      Retrieves suggested follow-up messages for a given message
      Parameters:
      messageId - The ID of the message to get suggestions for
      apiKey - The API key for authentication
      userId - The ID of the user requesting suggestions
      Returns:
      A list of suggested message texts
    • deleteConversation

      void deleteConversation(String conversationId, String apiKey, String userId)
      Deletes a specific conversation
      Parameters:
      conversationId - The ID of the conversation to delete
      apiKey - The API key for authentication
      userId - The ID of the user who owns the conversation
    • textToAudio

      org.springframework.http.ResponseEntity<byte[]> textToAudio(TextToAudioRequest request)
      Converts text to audio format
      Parameters:
      request - The text to audio conversion request
      Returns:
      Response entity containing the audio data as byte array
    • audioToText

      DifyTextVO audioToText(AudioToTextRequest request)
      Converts audio to text format
      Parameters:
      request - The audio to text conversion request
      Returns:
      Text data extracted from the audio
    • renameConversation

      MessageConversationsResponse renameConversation(RenameConversationRequest renameConversationRequest)
      Renames an existing conversation
      Parameters:
      renameConversationRequest - The request containing the new name and conversation details
      Returns:
      Updated conversation data
    • parameters

      AppParametersResponseVO parameters(String apiKey)
      Retrieves application parameters using the provided API key
      Parameters:
      apiKey - The API key for authentication and retrieving app parameters
      Returns:
      Application parameters data
    • site

      AppSiteResponse site(String apikey)
      app site
      Parameters:
      apikey - The API key for authentication and retrieving app parameters
      Returns:
      Application site
      Since:
      1.1.0, Dify version 1.4.0 or higher
    • fileUpload

      file upload
      Parameters:
      request - file upload param
      Returns:
      file upload response
      Since:
      0.10.0
    • info

      AppInfoResponse info(String apiKey)
      app info
      Parameters:
      apiKey - The API key for authentication and retrieving app parameters
      Returns:
      Application info
      Since:
      0.10.0
    • meta

      AppMetaResponse meta(String apiKey)
      app meta
      Parameters:
      apiKey - The API key for authentication and retrieving app parameters
      Returns:
      Application meta
      Since:
      0.10.0
    • pageAppAnnotation

      io.github.guoshiqiufeng.dify.core.pojo.DifyPageResult<AppAnnotationResponse> pageAppAnnotation(AppAnnotationPageRequest request)
      Paginate application annotations
      Parameters:
      request - Annotation pagination request containing page parameters and filters
      Returns:
      DifyPageResult Paginated result with annotation list
      Since:
      0.10.0, Dify version 1.2.0 or higher
    • createAppAnnotation

      AppAnnotationResponse createAppAnnotation(AppAnnotationCreateRequest request)
      Create application annotation
      Parameters:
      request - Annotation creation request containing annotation content and metadata
      Returns:
      AppAnnotationResponse The created annotation information
      Since:
      0.10.0, Dify version 1.2.0 or higher
    • updateAppAnnotation

      AppAnnotationResponse updateAppAnnotation(AppAnnotationUpdateRequest request)
      Update application annotation
      Parameters:
      request - Annotation update request containing modified annotation content and metadata
      Returns:
      AppAnnotationResponse The updated annotation information
      Since:
      0.10.0, Dify version 1.3.1 or higher
    • deleteAppAnnotation

      void deleteAppAnnotation(String annotationId, String apiKey)
      Delete application annotation
      Parameters:
      annotationId - Annotation ID to identify the annotation to delete
      apiKey - API key for authentication
      Since:
      0.10.0, Dify version 1.2.0 or higher
    • annotationReply

      Reply to an annotation
      Parameters:
      request - Annotation reply request containing the reply content and metadata
      Returns:
      AppAnnotationReplyResponse Response containing the created reply information
      Since:
      0.10.0, Dify version 1.2.0 or higher
    • queryAnnotationReply

      Query annotation reply information
      Parameters:
      request - Query parameters for retrieving annotation reply data
      Returns:
      AppAnnotationReplyResponse Response containing the requested reply information
      Since:
      0.10.0, Dify version 1.2.0 or higher