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 Summary
Modifier and TypeMethodDescriptionannotationReply(AppAnnotationReplyRequest request) Reply to an annotationaudioToText(AudioToTextRequest request) Converts audio to text formatchat(ChatMessageSendRequest chatRequest) Sends a chat message and returns the responseio.github.guoshiqiufeng.dify.core.pojo.DifyPageResult<MessageConversationsResponse> conversations(MessageConversationsRequest request) Retrieves a paginated list of conversationsCreate application annotationvoiddeleteAppAnnotation(String annotationId, String apiKey) Delete application annotationvoiddeleteConversation(String conversationId, String apiKey, String userId) Deletes a specific conversationfileUpload(FileUploadRequest request) file uploadapp infomessageFeedback(MessageFeedbackRequest request) Provides feedback for a specific messageio.github.guoshiqiufeng.dify.core.pojo.DifyPageResult<io.github.guoshiqiufeng.dify.core.pojo.response.MessagesResponseVO> messages(MessagesRequest request) Retrieves a paginated list of messagesmessagesSuggested(String messageId, String apiKey, String userId) Retrieves suggested follow-up messages for a given messageapp metaio.github.guoshiqiufeng.dify.core.pojo.DifyPageResult<AppAnnotationResponse> Paginate application annotationsparameters(String apiKey) Retrieves application parameters using the provided API keyQuery annotation reply informationrenameConversation(RenameConversationRequest renameConversationRequest) Renames an existing conversationapp sitevoidstopMessagesStream(String apiKey, String taskId, String userId) Stops an ongoing message streamreactor.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 serviceorg.springframework.http.ResponseEntity<byte[]> textToAudio(TextToAudioRequest request) Converts text to audio formatUpdate application annotation
-
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
Stops an ongoing message stream- Parameters:
apiKey- The API key for authenticationtaskId- The ID of the streaming task to stopuserId- 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
Retrieves suggested follow-up messages for a given message- Parameters:
messageId- The ID of the message to get suggestions forapiKey- The API key for authenticationuserId- The ID of the user requesting suggestions- Returns:
- A list of suggested message texts
-
deleteConversation
Deletes a specific conversation- Parameters:
conversationId- The ID of the conversation to deleteapiKey- The API key for authenticationuserId- The ID of the user who owns the conversation
-
textToAudio
Converts text to audio format- Parameters:
request- The text to audio conversion request- Returns:
- Response entity containing the audio data as byte array
-
audioToText
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
Retrieves application parameters using the provided API key- Parameters:
apiKey- The API key for authentication and retrieving app parameters- Returns:
- Application parameters data
-
site
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
app info- Parameters:
apiKey- The API key for authentication and retrieving app parameters- Returns:
- Application info
- Since:
- 0.10.0
-
meta
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
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
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
Delete application annotation- Parameters:
annotationId- Annotation ID to identify the annotation to deleteapiKey- 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
-