├── .devcontainer ├── Dockerfile ├── devcontainer.json └── scripts │ └── onCreateCommand.sh ├── .github ├── .codecov.yml ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ └── feature_request.yml ├── pull_request_template.md └── workflows │ ├── docs-build.yml │ ├── docs.yml │ ├── gradle-build.yml │ ├── gradle-dify-test.yml │ └── gradle-publish.yml ├── .gitignore ├── LICENSE ├── README-zh.md ├── README.md ├── bom ├── build.gradle └── dify-bom │ └── build.gradle ├── build.gradle ├── dify ├── build.gradle ├── dify-client │ ├── build.gradle │ ├── dify-client-spring5 │ │ ├── build.gradle │ │ └── src │ │ │ ├── main │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── github │ │ │ │ └── guoshiqiufeng │ │ │ │ └── dify │ │ │ │ └── client │ │ │ │ └── spring5 │ │ │ │ ├── base │ │ │ │ └── BaseDifyDefaultClient.java │ │ │ │ ├── builder │ │ │ │ ├── BaseDifyBuilder.java │ │ │ │ ├── DifyChatBuilder.java │ │ │ │ ├── DifyDatasetBuilder.java │ │ │ │ ├── DifyServerBuilder.java │ │ │ │ └── DifyWorkflowBuilder.java │ │ │ │ ├── chat │ │ │ │ └── DifyChatDefaultClient.java │ │ │ │ ├── dataset │ │ │ │ └── DifyDatasetDefaultClient.java │ │ │ │ ├── logging │ │ │ │ ├── DifyLoggingControl.java │ │ │ │ └── DifyLoggingFilter.java │ │ │ │ ├── server │ │ │ │ └── DifyServerDefaultClient.java │ │ │ │ ├── utils │ │ │ │ ├── DatasetHeaderUtils.java │ │ │ │ ├── DifyExchangeStrategies.java │ │ │ │ ├── MultipartInputStreamFileResource.java │ │ │ │ └── WebClientUtil.java │ │ │ │ └── workflow │ │ │ │ └── DifyWorkflowDefaultClient.java │ │ │ └── test │ │ │ └── java │ │ │ └── io │ │ │ └── github │ │ │ └── guoshiqiufeng │ │ │ └── dify │ │ │ └── client │ │ │ └── spring5 │ │ │ ├── BaseClientTest.java │ │ │ ├── base │ │ │ ├── BaseDifyDefaultClientLoggingTest.java │ │ │ └── BaseDifyDefaultClientTest.java │ │ │ ├── builder │ │ │ ├── BaseDifyBuilderTest.java │ │ │ ├── DifyChatBuilderTest.java │ │ │ ├── DifyDatasetBuilderTest.java │ │ │ ├── DifyServerBuilderTest.java │ │ │ └── DifyWorkflowBuilderTest.java │ │ │ ├── chat │ │ │ └── DifyChatDefaultClientTest.java │ │ │ ├── dataset │ │ │ └── DifyDatasetDefaultClientTest.java │ │ │ ├── logging │ │ │ ├── DifyLoggingControlTest.java │ │ │ └── DifyLoggingFilterTest.java │ │ │ ├── server │ │ │ └── DifyServerDefaultClientTest.java │ │ │ ├── utils │ │ │ ├── DatasetHeaderUtilsTest.java │ │ │ ├── DifyExchangeStrategiesTest.java │ │ │ ├── MultipartInputStreamFileResourceTest.java │ │ │ └── WebClientUtilTest.java │ │ │ └── workflow │ │ │ └── DifyWorkflowDefaultClientTest.java │ └── dify-client-spring6 │ │ ├── build.gradle │ │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── github │ │ │ └── guoshiqiufeng │ │ │ └── dify │ │ │ └── client │ │ │ └── spring6 │ │ │ ├── base │ │ │ └── BaseDifyDefaultClient.java │ │ │ ├── builder │ │ │ ├── BaseDifyBuilder.java │ │ │ ├── DifyChatBuilder.java │ │ │ ├── DifyDatasetBuilder.java │ │ │ ├── DifyServerBuilder.java │ │ │ └── DifyWorkflowBuilder.java │ │ │ ├── chat │ │ │ └── DifyChatDefaultClient.java │ │ │ ├── dataset │ │ │ └── DifyDatasetDefaultClient.java │ │ │ ├── logging │ │ │ ├── DifyLoggingControl.java │ │ │ ├── DifyLoggingFilter.java │ │ │ └── DifyRestLoggingInterceptor.java │ │ │ ├── server │ │ │ └── DifyServerDefaultClient.java │ │ │ ├── utils │ │ │ ├── DatasetHeaderUtils.java │ │ │ ├── DifyExchangeStrategies.java │ │ │ ├── DifyMessageConverters.java │ │ │ ├── MultipartInputStreamFileResource.java │ │ │ └── WebClientUtil.java │ │ │ └── workflow │ │ │ └── DifyWorkflowDefaultClient.java │ │ └── test │ │ └── java │ │ └── io │ │ └── github │ │ └── guoshiqiufeng │ │ └── dify │ │ └── client │ │ └── spring6 │ │ ├── BaseClientTest.java │ │ ├── base │ │ ├── BaseDifyDefaultClientLoggingTest.java │ │ └── BaseDifyDefaultClientTest.java │ │ ├── builder │ │ ├── BaseDifyBuilderTest.java │ │ ├── DifyChatBuilderTest.java │ │ ├── DifyDatasetBuilderTest.java │ │ ├── DifyServerBuilderTest.java │ │ └── DifyWorkflowBuilderTest.java │ │ ├── chat │ │ └── DifyChatDefaultClientTest.java │ │ ├── dataset │ │ └── DifyDatasetDefaultClientTest.java │ │ ├── logging │ │ ├── DifyLoggingControlTest.java │ │ ├── DifyLoggingFilterTest.java │ │ └── DifyRestLoggingInterceptorTest.java │ │ ├── server │ │ └── DifyServerDefaultClientTest.java │ │ ├── utils │ │ ├── DatasetHeaderUtilsTest.java │ │ ├── DifyExchangeStrategiesTest.java │ │ ├── DifyMessageConvertersTest.java │ │ ├── MultipartInputStreamFileResourceTest.java │ │ └── WebClientUtilTest.java │ │ └── workflow │ │ └── DifyWorkflowDefaultClientTest.java ├── dify-core │ ├── build.gradle │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── github │ │ │ └── guoshiqiufeng │ │ │ └── dify │ │ │ └── core │ │ │ ├── client │ │ │ └── BaseDifyClient.java │ │ │ ├── config │ │ │ └── DifyProperties.java │ │ │ ├── enums │ │ │ ├── ResponseModeEnum.java │ │ │ └── message │ │ │ │ ├── MessageFileTransferMethodEnum.java │ │ │ │ └── MessageFileTypeEnum.java │ │ │ ├── exception │ │ │ ├── BaseException.java │ │ │ ├── BaseExceptionEnum.java │ │ │ ├── DiftClientExceptionEnum.java │ │ │ └── DifyClientException.java │ │ │ └── pojo │ │ │ ├── DifyPageResult.java │ │ │ ├── DifyResult.java │ │ │ ├── request │ │ │ └── ChatMessageVO.java │ │ │ └── response │ │ │ └── MessagesResponseVO.java │ │ └── test │ │ └── java │ │ └── io │ │ └── github │ │ └── guoshiqiufeng │ │ └── dify │ │ └── core │ │ ├── client │ │ └── BaseDifyClientTest.java │ │ ├── config │ │ └── DifyPropertiesTest.java │ │ ├── enums │ │ ├── ResponseModeEnumTest.java │ │ └── message │ │ │ ├── MessageFileTransferMethodEnumTest.java │ │ │ └── MessageFileTypeEnumTest.java │ │ ├── exception │ │ ├── BaseExceptionEnumTest.java │ │ ├── BaseExceptionTest.java │ │ └── DifyClientExceptionTest.java │ │ └── pojo │ │ ├── DifyPageResultTest.java │ │ ├── DifyResultTest.java │ │ ├── request │ │ ├── ChatMessageVOJsonTest.java │ │ └── ChatMessageVOTest.java │ │ └── response │ │ └── MessagesResponseVOTest.java ├── dify-support │ ├── build.gradle │ ├── dify-support-chat │ │ ├── build.gradle │ │ └── src │ │ │ ├── main │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── github │ │ │ │ └── guoshiqiufeng │ │ │ │ └── dify │ │ │ │ └── chat │ │ │ │ ├── DifyChat.java │ │ │ │ ├── client │ │ │ │ └── DifyChatClient.java │ │ │ │ ├── constant │ │ │ │ └── ChatUriConstant.java │ │ │ │ ├── dto │ │ │ │ ├── request │ │ │ │ │ ├── AppAnnotationCreateRequest.java │ │ │ │ │ ├── AppAnnotationPageRequest.java │ │ │ │ │ ├── AppAnnotationReplyQueryRequest.java │ │ │ │ │ ├── AppAnnotationReplyRequest.java │ │ │ │ │ ├── AppAnnotationUpdateRequest.java │ │ │ │ │ ├── AudioToTextRequest.java │ │ │ │ │ ├── BaseChatRequest.java │ │ │ │ │ ├── ChatMessageSendRequest.java │ │ │ │ │ ├── FileUploadRequest.java │ │ │ │ │ ├── MessageConversationsRequest.java │ │ │ │ │ ├── MessageFeedbackRequest.java │ │ │ │ │ ├── MessagesCurrentRequest.java │ │ │ │ │ ├── MessagesRequest.java │ │ │ │ │ ├── RenameConversationRequest.java │ │ │ │ │ └── TextToAudioRequest.java │ │ │ │ └── response │ │ │ │ │ ├── AppAnnotationReplyResponse.java │ │ │ │ │ ├── AppAnnotationResponse.java │ │ │ │ │ ├── AppInfoResponse.java │ │ │ │ │ ├── AppMetaResponse.java │ │ │ │ │ ├── AppParametersResponseVO.java │ │ │ │ │ ├── AppSiteResponse.java │ │ │ │ │ ├── ChatMessageSendCompletionResponse.java │ │ │ │ │ ├── ChatMessageSendResponse.java │ │ │ │ │ ├── DifyTextVO.java │ │ │ │ │ ├── FileUploadResponse.java │ │ │ │ │ ├── MessageConversationsResponse.java │ │ │ │ │ ├── MessageFeedbackResponse.java │ │ │ │ │ ├── MetaData.java │ │ │ │ │ ├── jackson │ │ │ │ │ ├── ChatMessageSendCompletionResponseDeserializer.java │ │ │ │ │ └── CompletionDataDeserializer.java │ │ │ │ │ ├── message │ │ │ │ │ ├── AgentLogData.java │ │ │ │ │ ├── CompletionData.java │ │ │ │ │ ├── EmptyData.java │ │ │ │ │ ├── NodeFinishedData.java │ │ │ │ │ ├── NodeStartedData.java │ │ │ │ │ ├── ParallelBranchFinishedData.java │ │ │ │ │ ├── ParallelBranchStartedData.java │ │ │ │ │ ├── WorkflowFinishedData.java │ │ │ │ │ └── WorkflowStartedData.java │ │ │ │ │ └── parameter │ │ │ │ │ ├── Enabled.java │ │ │ │ │ ├── FileUpload.java │ │ │ │ │ ├── FileUploadConfig.java │ │ │ │ │ ├── FileUploadImage.java │ │ │ │ │ ├── Paragraph.java │ │ │ │ │ ├── Select.java │ │ │ │ │ ├── TextInput.java │ │ │ │ │ ├── TextToSpeech.java │ │ │ │ │ └── UserInputForm.java │ │ │ │ ├── enums │ │ │ │ ├── AnnotationReplyActionEnum.java │ │ │ │ ├── IconTypeEnum.java │ │ │ │ └── StreamEventEnum.java │ │ │ │ ├── exception │ │ │ │ ├── DiftChatException.java │ │ │ │ └── DiftChatExceptionEnum.java │ │ │ │ └── impl │ │ │ │ └── DifyChatClientImpl.java │ │ │ └── test │ │ │ └── java │ │ │ └── io │ │ │ └── github │ │ │ └── guoshiqiufeng │ │ │ └── dify │ │ │ └── chat │ │ │ ├── client │ │ │ └── DifyChatClientTest.java │ │ │ ├── dto │ │ │ ├── request │ │ │ │ ├── AppAnnotationCreateRequestTest.java │ │ │ │ ├── AppAnnotationPageRequestTest.java │ │ │ │ ├── AppAnnotationReplyQueryRequestTest.java │ │ │ │ ├── AppAnnotationReplyRequestTest.java │ │ │ │ ├── AppAnnotationUpdateRequestTest.java │ │ │ │ ├── AudioToTextRequestTest.java │ │ │ │ ├── BaseChatRequestTest.java │ │ │ │ ├── ChatMessageFileTest.java │ │ │ │ ├── ChatMessageSendRequestTest.java │ │ │ │ ├── FileUploadRequestTest.java │ │ │ │ ├── MessageConversationsRequestTest.java │ │ │ │ ├── MessageFeedbackRequestTest.java │ │ │ │ ├── MessagesCurrentRequestTest.java │ │ │ │ ├── MessagesRequestTest.java │ │ │ │ ├── RenameConversationRequestTest.java │ │ │ │ └── TextToAudioRequestTest.java │ │ │ └── response │ │ │ │ ├── AppAnnotationReplyResponseTest.java │ │ │ │ ├── AppInfoResponseTest.java │ │ │ │ ├── AppMetaResponseTest.java │ │ │ │ ├── AppParametersResponseVOJsonTest.java │ │ │ │ ├── AppParametersResponseVOTest.java │ │ │ │ ├── AppSiteResponseJsonTest.java │ │ │ │ ├── AppSiteResponseTest.java │ │ │ │ ├── ChatMessageSendResponseJsonTest.java │ │ │ │ ├── ChatMessageSendResponseTest.java │ │ │ │ ├── FileUploadResponseTest.java │ │ │ │ ├── MessageConversationsResponseTest.java │ │ │ │ ├── jackson │ │ │ │ ├── ChatMessageSendCompletionResponseDeserializerTest.java │ │ │ │ └── CompletionDataDeserializerTest.java │ │ │ │ ├── message │ │ │ │ ├── CompletionDataTest.java │ │ │ │ ├── NodeFinishedDataTest.java │ │ │ │ ├── NodeStartedDataTest.java │ │ │ │ ├── WorkflowFinishedDataTest.java │ │ │ │ └── WorkflowStartedDataTest.java │ │ │ │ └── parameter │ │ │ │ ├── EnabledTest.java │ │ │ │ ├── FileUploadConfigTest.java │ │ │ │ ├── FileUploadImageTest.java │ │ │ │ ├── FileUploadTest.java │ │ │ │ ├── ParagraphTest.java │ │ │ │ ├── SelectTest.java │ │ │ │ ├── TextInputTest.java │ │ │ │ ├── TextToSpeechTest.java │ │ │ │ └── UserInputFormTest.java │ │ │ ├── enums │ │ │ ├── IconTypeEnumTest.java │ │ │ └── StreamEventEnumTest.java │ │ │ ├── exception │ │ │ ├── DiftChatExceptionEnumTest.java │ │ │ └── DiftChatExceptionTest.java │ │ │ └── impl │ │ │ └── DifyChatClientImplTest.java │ ├── dify-support-dataset │ │ ├── build.gradle │ │ └── src │ │ │ ├── main │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── github │ │ │ │ └── guoshiqiufeng │ │ │ │ └── dify │ │ │ │ └── dataset │ │ │ │ ├── DifyDataset.java │ │ │ │ ├── client │ │ │ │ └── DifyDatasetClient.java │ │ │ │ ├── constant │ │ │ │ └── DatasetUriConstant.java │ │ │ │ ├── dto │ │ │ │ ├── RetrievalModel.java │ │ │ │ ├── request │ │ │ │ │ ├── BaseDatasetRequest.java │ │ │ │ │ ├── DatasetCreateRequest.java │ │ │ │ │ ├── DatasetInfoRequest.java │ │ │ │ │ ├── DatasetPageDocumentRequest.java │ │ │ │ │ ├── DatasetPageRequest.java │ │ │ │ │ ├── DatasetUpdateRequest.java │ │ │ │ │ ├── DocumentCreateByFileRequest.java │ │ │ │ │ ├── DocumentCreateByTextRequest.java │ │ │ │ │ ├── DocumentIndexingStatusRequest.java │ │ │ │ │ ├── DocumentMetaDataUpdateRequest.java │ │ │ │ │ ├── DocumentUpdateByFileRequest.java │ │ │ │ │ ├── DocumentUpdateByTextRequest.java │ │ │ │ │ ├── MetaData.java │ │ │ │ │ ├── MetaDataActionRequest.java │ │ │ │ │ ├── MetaDataCreateRequest.java │ │ │ │ │ ├── MetaDataUpdateRequest.java │ │ │ │ │ ├── RetrieveRequest.java │ │ │ │ │ ├── SegmentChildChunkCreateRequest.java │ │ │ │ │ ├── SegmentChildChunkDeleteRequest.java │ │ │ │ │ ├── SegmentChildChunkPageRequest.java │ │ │ │ │ ├── SegmentChildChunkUpdateRequest.java │ │ │ │ │ ├── SegmentCreateRequest.java │ │ │ │ │ ├── SegmentPageRequest.java │ │ │ │ │ ├── SegmentParam.java │ │ │ │ │ ├── SegmentUpdateParam.java │ │ │ │ │ ├── SegmentUpdateRequest.java │ │ │ │ │ ├── document │ │ │ │ │ │ ├── CustomRule.java │ │ │ │ │ │ ├── PreProcessingRule.java │ │ │ │ │ │ ├── ProcessRule.java │ │ │ │ │ │ ├── Segmentation.java │ │ │ │ │ │ └── SubChunkSegmentation.java │ │ │ │ │ └── file │ │ │ │ │ │ └── FileOperation.java │ │ │ │ └── response │ │ │ │ │ ├── DatasetInfoResponse.java │ │ │ │ │ ├── DatasetResponse.java │ │ │ │ │ ├── DocumentCreateResponse.java │ │ │ │ │ ├── DocumentIndexingStatusResponse.java │ │ │ │ │ ├── DocumentInfo.java │ │ │ │ │ ├── ExternalKnowledgeInfo.java │ │ │ │ │ ├── MetaDataListResponse.java │ │ │ │ │ ├── MetaDataResponse.java │ │ │ │ │ ├── RetrieveResponse.java │ │ │ │ │ ├── SegmentChildChunkCreateResponse.java │ │ │ │ │ ├── SegmentChildChunkResponse.java │ │ │ │ │ ├── SegmentChildChunkUpdateResponse.java │ │ │ │ │ ├── SegmentData.java │ │ │ │ │ ├── SegmentResponse.java │ │ │ │ │ ├── SegmentUpdateResponse.java │ │ │ │ │ ├── TextEmbeddingListResponse.java │ │ │ │ │ ├── UploadFileInfoResponse.java │ │ │ │ │ └── textembedding │ │ │ │ │ ├── TextEmbedding.java │ │ │ │ │ ├── TextEmbeddingIcon.java │ │ │ │ │ ├── TextEmbeddingLabel.java │ │ │ │ │ ├── TextEmbeddingModel.java │ │ │ │ │ └── TextEmbeddingModelProperties.java │ │ │ │ ├── enums │ │ │ │ ├── IndexingTechniqueEnum.java │ │ │ │ ├── MetaDataActionEnum.java │ │ │ │ ├── ModelFeatureEnum.java │ │ │ │ ├── ModelStatusEnum.java │ │ │ │ ├── PermissionEnum.java │ │ │ │ ├── ProviderEnum.java │ │ │ │ ├── RerankingModeEnum.java │ │ │ │ ├── SearchMethodEnum.java │ │ │ │ └── document │ │ │ │ │ ├── DocFormEnum.java │ │ │ │ │ ├── DocTypeEnum.java │ │ │ │ │ ├── ModeEnum.java │ │ │ │ │ ├── ParentModeEnum.java │ │ │ │ │ └── PreProcessingRuleTypeEnum.java │ │ │ │ ├── exception │ │ │ │ ├── DiftDatasetException.java │ │ │ │ └── DiftDatasetExceptionEnum.java │ │ │ │ ├── impl │ │ │ │ └── DifyDatasetClientImpl.java │ │ │ │ └── utils │ │ │ │ └── MultipartBodyUtil.java │ │ │ └── test │ │ │ └── java │ │ │ └── io │ │ │ └── github │ │ │ └── guoshiqiufeng │ │ │ └── dify │ │ │ └── dataset │ │ │ ├── client │ │ │ └── DifyDatasetClientTest.java │ │ │ ├── dto │ │ │ ├── RetrievalModelTest.java │ │ │ ├── request │ │ │ │ ├── BaseDatasetRequestTest.java │ │ │ │ ├── DatasetCreateRequestTest.java │ │ │ │ ├── DatasetPageDocumentRequestTest.java │ │ │ │ ├── DatasetPageRequestTest.java │ │ │ │ ├── DocumentCreateByFileRequestTest.java │ │ │ │ ├── DocumentCreateByTextRequestTest.java │ │ │ │ ├── DocumentIndexingStatusRequestTest.java │ │ │ │ ├── DocumentMetaDataUpdateRequestTest.java │ │ │ │ ├── DocumentUpdateByFileRequestTest.java │ │ │ │ ├── DocumentUpdateByTextRequestTest.java │ │ │ │ ├── MetaDataActionRequestTest.java │ │ │ │ ├── MetaDataCreateRequestTest.java │ │ │ │ ├── MetaDataUpdateRequestTest.java │ │ │ │ ├── RetrieveRequestTest.java │ │ │ │ ├── SegmentChildChunkCreateRequestTest.java │ │ │ │ ├── SegmentChildChunkDeleteRequestTest.java │ │ │ │ ├── SegmentChildChunkPageRequestTest.java │ │ │ │ ├── SegmentChildChunkUpdateRequestTest.java │ │ │ │ ├── SegmentCreateRequestTest.java │ │ │ │ ├── SegmentPageRequestTest.java │ │ │ │ ├── SegmentParamTest.java │ │ │ │ ├── SegmentUpdateParamTest.java │ │ │ │ ├── SegmentUpdateRequestTest.java │ │ │ │ └── document │ │ │ │ │ ├── CustomRuleTest.java │ │ │ │ │ ├── PreProcessingRuleTest.java │ │ │ │ │ ├── ProcessRuleTest.java │ │ │ │ │ ├── SegmentationTest.java │ │ │ │ │ └── SubChunkSegmentationTest.java │ │ │ └── response │ │ │ │ ├── DatasetResponseTest.java │ │ │ │ ├── DocumentCreateResponseTest.java │ │ │ │ ├── DocumentIndexingStatusResponseTest.java │ │ │ │ ├── DocumentInfoTest.java │ │ │ │ ├── MetaDataListResponseTest.java │ │ │ │ ├── MetaDataResponseTest.java │ │ │ │ ├── RetrieveResponseTest.java │ │ │ │ ├── SegmentChildChunkCreateResponseTest.java │ │ │ │ ├── SegmentChildChunkResponseTest.java │ │ │ │ ├── SegmentChildChunkUpdateResponseTest.java │ │ │ │ ├── SegmentDataTest.java │ │ │ │ ├── SegmentResponseTest.java │ │ │ │ ├── SegmentUpdateResponseTest.java │ │ │ │ └── textembedding │ │ │ │ ├── TextEmbeddingIconTest.java │ │ │ │ ├── TextEmbeddingLabelTest.java │ │ │ │ ├── TextEmbeddingModelPropertiesTest.java │ │ │ │ ├── TextEmbeddingModelTest.java │ │ │ │ └── TextEmbeddingTest.java │ │ │ ├── enums │ │ │ ├── IndexingTechniqueEnumTest.java │ │ │ ├── MetaDataActionEnumTest.java │ │ │ ├── ModelFeatureEnumTest.java │ │ │ ├── ModelStatusEnumTest.java │ │ │ ├── PermissionEnumTest.java │ │ │ ├── ProviderEnumTest.java │ │ │ ├── RerankingModeEnumTest.java │ │ │ ├── SearchMethodEnumTest.java │ │ │ └── document │ │ │ │ ├── DocFormEnumTest.java │ │ │ │ ├── DocTypeEnumTest.java │ │ │ │ ├── ModeEnumTest.java │ │ │ │ ├── ParentModeEnumTest.java │ │ │ │ └── PreProcessingRuleTypeEnumTest.java │ │ │ ├── impl │ │ │ └── DifyDatasetClientImplTest.java │ │ │ └── utils │ │ │ └── MultipartBodyUtilTest.java │ ├── dify-support-server │ │ ├── build.gradle │ │ └── src │ │ │ ├── main │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── github │ │ │ │ └── guoshiqiufeng │ │ │ │ └── dify │ │ │ │ └── server │ │ │ │ ├── DifyServer.java │ │ │ │ ├── cache │ │ │ │ └── DifyRedisKey.java │ │ │ │ ├── client │ │ │ │ ├── BaseDifyServerToken.java │ │ │ │ ├── DifyServerClient.java │ │ │ │ ├── DifyServerTokenDefault.java │ │ │ │ ├── DifyServerTokenRedis.java │ │ │ │ └── RequestSupplier.java │ │ │ │ ├── constant │ │ │ │ └── ServerUriConstant.java │ │ │ │ ├── dto │ │ │ │ ├── request │ │ │ │ │ └── DifyLoginRequest.java │ │ │ │ └── response │ │ │ │ │ ├── ApiKeyResponse.java │ │ │ │ │ ├── ApiKeyResultResponse.java │ │ │ │ │ ├── AppsResponse.java │ │ │ │ │ ├── AppsResponseResult.java │ │ │ │ │ ├── DatasetApiKeyResponse.java │ │ │ │ │ ├── DatasetApiKeyResult.java │ │ │ │ │ ├── LoginResponse.java │ │ │ │ │ └── LoginResultResponse.java │ │ │ │ ├── exception │ │ │ │ ├── DifyServerException.java │ │ │ │ └── DifyServerExceptionEnum.java │ │ │ │ └── impl │ │ │ │ └── DifyServerClientImpl.java │ │ │ └── test │ │ │ └── java │ │ │ └── io │ │ │ └── github │ │ │ └── guoshiqiufeng │ │ │ └── dify │ │ │ └── server │ │ │ ├── client │ │ │ ├── BaseDifyServerTokenTest.java │ │ │ ├── DifyServerClientTest.java │ │ │ ├── DifyServerTokenDefaultTest.java │ │ │ └── DifyServerTokenRedisTest.java │ │ │ ├── dto │ │ │ ├── request │ │ │ │ ├── DifyLoginRequestJsonTest.java │ │ │ │ ├── DifyLoginRequestTest.java │ │ │ │ └── MockServerServiceTest.java │ │ │ └── response │ │ │ │ ├── ApiKeyResponseTest.java │ │ │ │ ├── ApiKeyResultResponseTest.java │ │ │ │ ├── AppsResponseJsonTest.java │ │ │ │ ├── AppsResponseResultTest.java │ │ │ │ ├── AppsResponseTest.java │ │ │ │ ├── DatasetApiKeyResponseTest.java │ │ │ │ ├── DatasetApiKeyResultTest.java │ │ │ │ ├── LoginResponseTest.java │ │ │ │ └── LoginResultResponseTest.java │ │ │ ├── exception │ │ │ ├── DifyServerExceptionEnumTest.java │ │ │ ├── DifyServerExceptionTest.java │ │ │ └── ExceptionTestUtil.java │ │ │ └── impl │ │ │ └── DifyServerClientImplTest.java │ └── dify-support-workflow │ │ ├── build.gradle │ │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── github │ │ │ └── guoshiqiufeng │ │ │ └── dify │ │ │ └── workflow │ │ │ ├── DifyWorkflow.java │ │ │ ├── client │ │ │ └── DifyWorkflowClient.java │ │ │ ├── constant │ │ │ └── WorkflowConstant.java │ │ │ ├── dto │ │ │ ├── request │ │ │ │ ├── BaseWorkflowRequest.java │ │ │ │ ├── WorkflowLogsRequest.java │ │ │ │ └── WorkflowRunRequest.java │ │ │ └── response │ │ │ │ ├── MetaData.java │ │ │ │ ├── WorkflowInfoResponse.java │ │ │ │ ├── WorkflowLogs.java │ │ │ │ ├── WorkflowRunResponse.java │ │ │ │ ├── WorkflowRunStreamResponse.java │ │ │ │ ├── WorkflowStopResponse.java │ │ │ │ ├── jackson │ │ │ │ └── WorkflowRunStreamResponseDeserializer.java │ │ │ │ └── stream │ │ │ │ ├── AgentLogData.java │ │ │ │ ├── BaseWorkflowRunData.java │ │ │ │ ├── NodeFinishedData.java │ │ │ │ ├── NodeStartedData.java │ │ │ │ ├── ParallelBranchFinishedData.java │ │ │ │ ├── ParallelBranchStartedData.java │ │ │ │ ├── WorkflowFinishedData.java │ │ │ │ └── WorkflowStartedData.java │ │ │ ├── enums │ │ │ └── StreamEventEnum.java │ │ │ ├── exception │ │ │ ├── DifyWorkflowException.java │ │ │ └── DifyWorkflowExceptionEnum.java │ │ │ └── impl │ │ │ └── DifyWorkflowClientImpl.java │ │ └── test │ │ └── java │ │ └── io │ │ └── github │ │ └── guoshiqiufeng │ │ └── dify │ │ └── workflow │ │ ├── client │ │ └── DifyWorkflowClientTest.java │ │ ├── dto │ │ ├── request │ │ │ ├── BaseWorkflowRequestTest.java │ │ │ ├── WorkflowFileTest.java │ │ │ ├── WorkflowLogsRequestTest.java │ │ │ └── WorkflowRunRequestTest.java │ │ └── response │ │ │ ├── WorkflowInfoResponseJsonTest.java │ │ │ ├── WorkflowInfoResponseTest.java │ │ │ ├── WorkflowRunResponseTest.java │ │ │ ├── WorkflowRunStreamResponseTest.java │ │ │ ├── WorkflowStopResponseTest.java │ │ │ ├── jackson │ │ │ └── WorkflowRunStreamResponseDeserializerTest.java │ │ │ └── stream │ │ │ ├── BaseWorkflowRunDataTest.java │ │ │ ├── NodeFinishedDataTest.java │ │ │ ├── NodeStartedDataTest.java │ │ │ ├── WorkflowFinishedDataTest.java │ │ │ └── WorkflowStartedDataTest.java │ │ ├── exception │ │ ├── DifyWorkflowExceptionEnumTest.java │ │ ├── DifyWorkflowExceptionTest.java │ │ ├── ExceptionTestUtil.java │ │ ├── MockWorkflowService.java │ │ └── MockWorkflowServiceTest.java │ │ └── impl │ │ └── DifyWorkflowClientImplTest.java ├── spring-boot-starter │ ├── build.gradle │ ├── dify-spring-boot-starter-autoconfigure │ │ ├── build.gradle │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── io │ │ │ │ │ └── github │ │ │ │ │ └── guoshiqiufeng │ │ │ │ │ └── dify │ │ │ │ │ └── springboot │ │ │ │ │ └── autoconfigure │ │ │ │ │ ├── DifyChatAutoConfiguration.java │ │ │ │ │ ├── DifyConnectionDetails.java │ │ │ │ │ ├── DifyDatasetAutoConfiguration.java │ │ │ │ │ ├── DifyPropertiesAutoConfiguration.java │ │ │ │ │ ├── DifyServerAutoConfiguration.java │ │ │ │ │ ├── DifyServerRedisTokenAutoConfiguration.java │ │ │ │ │ └── DifyWorkflowAutoConfiguration.java │ │ │ └── resources │ │ │ │ └── META-INF │ │ │ │ └── spring │ │ │ │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports │ │ │ └── test │ │ │ └── java │ │ │ └── io │ │ │ └── github │ │ │ └── guoshiqiufeng │ │ │ └── dify │ │ │ └── springboot │ │ │ └── autoconfigure │ │ │ ├── DifyChatAutoConfigurationTest.java │ │ │ ├── DifyDatasetAutoConfigurationTest.java │ │ │ ├── DifyPropertiesAutoConfigurationTest.java │ │ │ ├── DifyServerAutoConfigurationTest.java │ │ │ ├── DifyServerRedisTokenAutoConfigurationTest.java │ │ │ └── DifyWorkflowAutoConfigurationTest.java │ ├── dify-spring-boot-starter-chat │ │ └── build.gradle │ ├── dify-spring-boot-starter-dataset │ │ └── build.gradle │ ├── dify-spring-boot-starter-server │ │ └── build.gradle │ ├── dify-spring-boot-starter-workflow │ │ └── build.gradle │ └── dify-spring-boot-starter │ │ ├── build.gradle │ │ └── src │ │ └── test │ │ ├── java │ │ └── io │ │ │ └── github │ │ │ └── guoshiqiufeng │ │ │ └── dify │ │ │ └── boot │ │ │ ├── ChatTest.java │ │ │ ├── DatasetTest.java │ │ │ ├── ServerTest.java │ │ │ ├── application │ │ │ ├── DifyTestSpringBootApplication.java │ │ │ └── LoggingInterceptor.java │ │ │ └── base │ │ │ ├── BaseChatContainerTest.java │ │ │ ├── BaseDatasetContainerTest.java │ │ │ ├── BaseServerContainerTest.java │ │ │ ├── BaseWorkflowContainerTest.java │ │ │ └── RedisContainerTest.java │ │ └── resources │ │ └── application.yml └── spring-boot2-starter │ ├── build.gradle │ ├── dify-spring-boot2-starter-autoconfigure │ ├── build.gradle │ └── src │ │ ├── main │ │ ├── java │ │ │ └── io │ │ │ │ └── github │ │ │ │ └── guoshiqiufeng │ │ │ │ └── dify │ │ │ │ └── springboot2 │ │ │ │ └── autoconfigure │ │ │ │ ├── DifyChatAutoConfiguration.java │ │ │ │ ├── DifyConnectionDetails.java │ │ │ │ ├── DifyDatasetAutoConfiguration.java │ │ │ │ ├── DifyPropertiesAutoConfiguration.java │ │ │ │ ├── DifyServerAutoConfiguration.java │ │ │ │ ├── DifyServerRedisTokenAutoConfiguration.java │ │ │ │ └── DifyWorkflowAutoConfiguration.java │ │ └── resources │ │ │ └── META-INF │ │ │ ├── spring.factories │ │ │ └── spring │ │ │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports │ │ └── test │ │ └── java │ │ └── io │ │ └── github │ │ └── guoshiqiufeng │ │ └── dify │ │ └── springboot2 │ │ └── autoconfigure │ │ ├── DifyChatAutoConfigurationTest.java │ │ ├── DifyDatasetAutoConfigurationTest.java │ │ ├── DifyPropertiesAutoConfigurationTest.java │ │ ├── DifyServerAutoConfigurationTest.java │ │ ├── DifyServerRedisTokenAutoConfigurationTest.java │ │ └── DifyWorkflowAutoConfigurationTest.java │ ├── dify-spring-boot2-starter-chat │ └── build.gradle │ ├── dify-spring-boot2-starter-dataset │ └── build.gradle │ ├── dify-spring-boot2-starter-server │ └── build.gradle │ ├── dify-spring-boot2-starter-workflow │ └── build.gradle │ └── dify-spring-boot2-starter │ ├── build.gradle │ └── src │ └── test │ ├── java │ └── io │ │ └── github │ │ └── guoshiqiufeng │ │ └── dify │ │ └── boot │ │ ├── ChatTest.java │ │ ├── DatasetTest.java │ │ ├── ServerTest.java │ │ ├── application │ │ ├── DifyTestSpringBootApplication.java │ │ └── LoggingInterceptor.java │ │ └── base │ │ ├── BaseChatContainerTest.java │ │ ├── BaseDatasetContainerTest.java │ │ ├── BaseServerContainerTest.java │ │ ├── BaseWorkflowContainerTest.java │ │ └── RedisContainerTest.java │ └── resources │ └── application.yml ├── docs ├── .vuepress │ ├── client.js │ ├── config.js │ └── public │ │ └── images │ │ └── f.ico ├── README.md ├── config │ ├── custom.md │ └── introduction.md ├── en │ ├── README.md │ ├── config │ │ ├── custom.md │ │ └── introduction.md │ └── guide │ │ ├── builder.md │ │ ├── config.md │ │ ├── feature │ │ ├── chat.md │ │ ├── dataset.md │ │ ├── server.md │ │ └── workflow.md │ │ ├── getting-started.md │ │ ├── install.md │ │ └── introduction.md └── guide │ ├── builder.md │ ├── config.md │ ├── feature │ ├── chat.md │ ├── dataset.md │ ├── server.md │ └── workflow.md │ ├── getting-started.md │ ├── install.md │ └── introduction.md ├── ext.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── header.txt ├── lombok.config └── settings.gradle /.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | # See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/ubuntu/.devcontainer/base.Dockerfile 2 | 3 | # [Choice] Ubuntu version (use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon): ubuntu-22.04, ubuntu-20.04, ubuntu-18.04 4 | ARG VARIANT="jammy" 5 | FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT} 6 | 7 | RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ 8 | && apt-get -y install --no-install-recommends direnv 9 | 10 | -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | // For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: 2 | // https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/ubuntu 3 | { 4 | "name": "acme-fitness-store", 5 | "build": { 6 | "dockerfile": "Dockerfile", 7 | // Update 'VARIANT' to pick an Ubuntu version: jammy / ubuntu-22.04, focal / ubuntu-20.04, bionic /ubuntu-18.04 8 | // Use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon. 9 | "args": { 10 | "VARIANT": "ubuntu-22.04" 11 | } 12 | }, 13 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 14 | // "forwardPorts": [], 15 | // "onCreateCommand": "./.devcontainer/scripts/onCreateCommand.sh", 16 | // Use 'postCreateCommand' to run commands after the container is created. 17 | // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. 18 | "remoteUser": "vscode", 19 | "hostRequirements": { 20 | "cpus": 2 21 | }, 22 | "containerEnv": { 23 | "GRADLE_USER_HOME": "/home/vscode", 24 | // required because the java feature is not setting this correctly 25 | "M2": "/home/vscode" 26 | // required because the java feature is not setting this correctly 27 | }, 28 | "features": { 29 | "azure-cli": "latest", 30 | "docker-from-docker": "latest", 31 | "node": "lts", 32 | "ghcr.io/devcontainers/features/java:1": { 33 | "version": "21", 34 | "installGradle": true, 35 | "installMaven": true 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /.devcontainer/scripts/onCreateCommand.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -x 4 | 5 | az extension add --name dify 6 | -------------------------------------------------------------------------------- /.github/.codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | status: 3 | project: 4 | default: 5 | threshold: 20% 6 | component_management: 7 | individual_components: 8 | - component_id: "springboot2" 9 | paths: 10 | - "dify/dify-client/dify-client-spring5/" 11 | - "dify/spring-boot2-starter/" 12 | - component_id: "springboot3" 13 | paths: 14 | - "dify/dify-client/dify-client-spring6/" 15 | - "dify/spring-boot-starter/" 16 | 17 | comment: 18 | layout: "header, diff, flags, components" # show component info in the PR comment 19 | 20 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.yml: -------------------------------------------------------------------------------- 1 | name: "⭐ Feature or enhancement request" 2 | description: Propose something new. 3 | labels: 4 | - enhancement 5 | body: 6 | - type: textarea 7 | attributes: 8 | label: 1. Is this request related to a challenge you're experiencing? Tell me about your story. 9 | placeholder: Please describe the specific scenario or problem you're facing as clearly as possible. For instance "I was trying to use [feature] for [specific task], and [what happened]... It was frustrating because...." 10 | validations: 11 | required: true 12 | - type: textarea 13 | attributes: 14 | label: 2. Additional context or comments 15 | placeholder: (Any other information, comments, documentations, links, or screenshots that would provide more clarity. This is the place to add anything else not covered above.) 16 | validations: 17 | required: false 18 | - type: checkboxes 19 | attributes: 20 | label: 3. Can you help us with this feature? 21 | description: Let us know! This is not a commitment, but a starting point for collaboration. 22 | options: 23 | - label: I am interested in contributing to this feature. 24 | required: false 25 | - type: markdown 26 | attributes: 27 | value: Please limit one request per issue. 28 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | # Summary 2 | 3 | Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. 4 | List any dependencies that are required for this change. 5 | 6 | > [!Tip] 7 | > Close issue syntax: `Fixes #` or `Resolves #`, 8 | > 9 | see [documentation](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword) 10 | > for more details. 11 | 12 | # Screenshots 13 | 14 | | Before | After | 15 | |--------|-------| 16 | | ... | ... | 17 | 18 | # Checklist 19 | 20 | > [!IMPORTANT] 21 | > Please review the checklist below before submitting your pull request. 22 | 23 | - [ ] This change requires a documentation update 24 | - [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic 25 | change. 26 | - [x] I've updated the documentation accordingly. 27 | -------------------------------------------------------------------------------- /.github/workflows/gradle-build.yml: -------------------------------------------------------------------------------- 1 | name: Gradle Build 2 | permissions: 3 | contents: read 4 | pull-requests: write 5 | 6 | on: 7 | pull_request: 8 | paths: 9 | - 'dify/**' 10 | - '.github/workflows/gradle-build.yml' 11 | 12 | jobs: 13 | build: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - name: Checkout Repository 17 | uses: actions/checkout@v4 18 | with: 19 | fetch-depth: 0 20 | # 运行 JDK 配置 21 | - name: Set up JDK 21 22 | uses: actions/setup-java@v4 23 | with: 24 | java-version: '21' 25 | distribution: 'temurin' 26 | cache: gradle 27 | 28 | # Gradle 缓存配置 29 | - name: Cache Gradle packages 30 | uses: actions/cache@v3 31 | with: 32 | path: ~/.gradle/caches 33 | key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} 34 | restore-keys: ${{ runner.os }}-gradle 35 | 36 | - name: Setup Gradle 37 | uses: gradle/actions/setup-gradle@v4 38 | with: 39 | gradle-version: "8.10.2" 40 | build-root-directory: . 41 | 42 | - name: Build with Gradle 43 | run: | 44 | gradle build -x test 45 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | build/ 3 | !gradle/wrapper/gradle-wrapper.jar 4 | !**/src/main/**/build/ 5 | !**/src/test/**/build/ 6 | 7 | ### IntelliJ IDEA ### 8 | .idea 9 | .idea/modules.xml 10 | .idea/jarRepositories.xml 11 | .idea/compiler.xml 12 | .idea/libraries/ 13 | *.iws 14 | *.iml 15 | *.ipr 16 | out/ 17 | !**/src/main/**/out/ 18 | !**/src/test/**/out/ 19 | 20 | ### Eclipse ### 21 | .apt_generated 22 | .classpath 23 | .factorypath 24 | .project 25 | .settings 26 | .springBeans 27 | .sts4-cache 28 | bin/ 29 | !**/src/main/**/bin/ 30 | !**/src/test/**/bin/ 31 | 32 | ### NetBeans ### 33 | /nbproject/private/ 34 | /nbbuild/ 35 | /dist/ 36 | /nbdist/ 37 | /.nb-gradle/ 38 | 39 | ### VS Code ### 40 | .vscode/ 41 | 42 | ### Mac OS ### 43 | .DS_Store 44 | 45 | node_modules/** 46 | /docs/.vuepress/.cache/ 47 | /docs/.vuepress/.temp/ 48 | /docs/.vuepress/dist/ 49 | /dify/spring-boot-starter/dify-spring-boot-starter/src/test/resources/application-test.yml 50 | /dify/spring-boot2-starter/dify-spring-boot2-starter/src/test/resources/application-test.yml 51 | -------------------------------------------------------------------------------- /bom/build.gradle: -------------------------------------------------------------------------------- 1 | tasks.matching { 2 | it.name == 'publishToMavenCentralPortal' 3 | || it.name == 'publishMavenJavaPublicationToLocalRepository' 4 | || it.group == 'publishing' 5 | }.each { it.enabled = false } 6 | -------------------------------------------------------------------------------- /dify/build.gradle: -------------------------------------------------------------------------------- 1 | tasks.matching { 2 | it.name == 'publishToMavenCentralPortal' 3 | || it.name == 'publishMavenJavaPublicationToLocalRepository' 4 | || it.group == 'publishing' 5 | }.each { it.enabled = false } 6 | -------------------------------------------------------------------------------- /dify/dify-client/build.gradle: -------------------------------------------------------------------------------- 1 | subprojects { 2 | dependencies { 3 | testImplementation "org.mockito:mockito-core:${mockitoVersion}" 4 | testImplementation "org.mockito:mockito-junit-jupiter:${mockitoVersion}" 5 | testImplementation "net.bytebuddy:byte-buddy:${bytebuddyVersion}" 6 | testImplementation "net.bytebuddy:byte-buddy-agent:${bytebuddyVersion}" 7 | testImplementation "io.projectreactor:reactor-test" 8 | } 9 | } 10 | tasks.matching { 11 | it.name == 'publishToMavenCentralPortal' 12 | || it.name == 'publishMavenJavaPublicationToLocalRepository' 13 | || it.group == 'publishing' 14 | }.each { it.enabled = false } 15 | -------------------------------------------------------------------------------- /dify/dify-client/dify-client-spring5/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | api project(":dify:dify-core") 3 | api "${lib["hutool-core"]}" 4 | implementation project(":dify:dify-support:dify-support-chat") 5 | implementation project(":dify:dify-support:dify-support-dataset") 6 | implementation project(":dify:dify-support:dify-support-server") 7 | implementation project(":dify:dify-support:dify-support-workflow") 8 | 9 | api "org.springframework:spring-webflux" 10 | 11 | implementation "com.fasterxml.jackson.core:jackson-databind" 12 | 13 | testImplementation 'org.junit.jupiter:junit-jupiter' 14 | testImplementation 'org.springframework.boot:spring-boot-starter-reactor-netty' 15 | testImplementation 'ch.qos.logback:logback-classic' 16 | } 17 | -------------------------------------------------------------------------------- /dify/dify-client/dify-client-spring5/src/main/java/io/github/guoshiqiufeng/dify/client/spring5/utils/MultipartInputStreamFileResource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.client.spring5.utils; 17 | 18 | import org.springframework.core.io.InputStreamResource; 19 | 20 | import java.io.InputStream; 21 | 22 | /** 23 | * 处理 MultipartFile 24 | * 25 | * @author yanghq 26 | * @version 0.8.0 27 | * @since 2025/4/7 16:20 28 | */ 29 | public class MultipartInputStreamFileResource extends InputStreamResource { 30 | private final String filename; 31 | 32 | public MultipartInputStreamFileResource(InputStream inputStream, String filename) { 33 | super(inputStream); 34 | this.filename = filename; 35 | } 36 | 37 | @Override 38 | public String getFilename() { 39 | return this.filename; 40 | } 41 | 42 | @Override 43 | public long contentLength() { 44 | return -1; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /dify/dify-client/dify-client-spring6/build.gradle: -------------------------------------------------------------------------------- 1 | compileJava { 2 | options.release = 17 3 | } 4 | 5 | dependencies { 6 | api project(":dify:dify-core") 7 | api "${lib["hutool-core"]}" 8 | implementation project(":dify:dify-support:dify-support-chat") 9 | implementation project(":dify:dify-support:dify-support-dataset") 10 | implementation project(":dify:dify-support:dify-support-server") 11 | implementation project(":dify:dify-support:dify-support-workflow") 12 | 13 | api "org.springframework:spring-webflux" 14 | 15 | implementation "com.fasterxml.jackson.core:jackson-databind" 16 | 17 | testImplementation 'org.junit.jupiter:junit-jupiter' 18 | testImplementation 'org.springframework.boot:spring-boot-starter-reactor-netty' 19 | testImplementation 'ch.qos.logback:logback-classic' 20 | } 21 | -------------------------------------------------------------------------------- /dify/dify-client/dify-client-spring6/src/main/java/io/github/guoshiqiufeng/dify/client/spring6/utils/MultipartInputStreamFileResource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.client.spring6.utils; 17 | 18 | import org.springframework.core.io.InputStreamResource; 19 | 20 | import java.io.InputStream; 21 | 22 | /** 23 | * 处理 MultipartFile 24 | * 25 | * @author yanghq 26 | * @version 0.8.0 27 | * @since 2025/4/7 16:20 28 | */ 29 | public class MultipartInputStreamFileResource extends InputStreamResource { 30 | private final String filename; 31 | 32 | public MultipartInputStreamFileResource(InputStream inputStream, String filename) { 33 | super(inputStream); 34 | this.filename = filename; 35 | } 36 | 37 | @Override 38 | public String getFilename() { 39 | return this.filename; 40 | } 41 | 42 | @Override 43 | public long contentLength() { 44 | return -1; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /dify/dify-core/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | api "org.slf4j:slf4j-api" 3 | api "com.fasterxml.jackson.core:jackson-annotations" 4 | implementation "com.fasterxml.jackson.core:jackson-databind" 5 | 6 | 7 | testImplementation 'org.junit.jupiter:junit-jupiter' 8 | } 9 | -------------------------------------------------------------------------------- /dify/dify-core/src/main/java/io/github/guoshiqiufeng/dify/core/client/BaseDifyClient.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.core.client; 17 | 18 | /** 19 | * @author yanghq 20 | * @version 1.0 21 | * @since 2025/4/16 09:42 22 | */ 23 | public interface BaseDifyClient { 24 | 25 | String REQUEST_BODY_NULL_ERROR = "The request body can not be null."; 26 | 27 | String DEFAULT_BASE_URL = "http://localhost"; 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /dify/dify-core/src/main/java/io/github/guoshiqiufeng/dify/core/enums/ResponseModeEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.core.enums; 17 | 18 | import lombok.AllArgsConstructor; 19 | import lombok.Getter; 20 | 21 | /** 22 | * @author yanghq 23 | * @version 1.0 24 | * @since 2025/1/8 09:29 25 | */ 26 | @AllArgsConstructor 27 | @Getter 28 | public enum ResponseModeEnum { 29 | 30 | /** 31 | * 流式请求 32 | */ 33 | streaming, 34 | /** 35 | * 阻塞式请求 36 | */ 37 | blocking 38 | } 39 | -------------------------------------------------------------------------------- /dify/dify-core/src/main/java/io/github/guoshiqiufeng/dify/core/enums/message/MessageFileTransferMethodEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.core.enums.message; 17 | 18 | /** 19 | * @author yanghq 20 | * @version 1.1.0 21 | * @since 2025/5/30 13:17 22 | */ 23 | public enum MessageFileTransferMethodEnum { 24 | 25 | /** 26 | * remote_url 27 | */ 28 | remote_url, 29 | 30 | /** 31 | * local_file 32 | */ 33 | local_file 34 | 35 | } 36 | -------------------------------------------------------------------------------- /dify/dify-core/src/main/java/io/github/guoshiqiufeng/dify/core/enums/message/MessageFileTypeEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.core.enums.message; 17 | 18 | /** 19 | * @author yanghq 20 | * @version 1.1.0 21 | * @since 2025/5/30 13:13 22 | */ 23 | public enum MessageFileTypeEnum { 24 | 25 | /** 26 | * 'TXT', 'MD', 'MARKDOWN', 'PDF', 'HTML', 'XLSX', 'XLS', 'DOCX', 'CSV', 'EML', 'MSG', 'PPTX', 'PPT', 'XML', 'EPUB' 27 | */ 28 | document, 29 | 30 | /** 31 | * 'JPG', 'JPEG', 'PNG', 'GIF', 'WEBP', 'SVG' 32 | */ 33 | image, 34 | 35 | /** 36 | * 'MP3', 'M4A', 'WAV', 'WEBM', 'AMR' 37 | */ 38 | audio, 39 | 40 | /** 41 | * 'MP4', 'MOV', 'MPEG', 'MPGA' 42 | */ 43 | video, 44 | 45 | /** 46 | * other 47 | */ 48 | custom 49 | } 50 | -------------------------------------------------------------------------------- /dify/dify-core/src/main/java/io/github/guoshiqiufeng/dify/core/exception/BaseException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.core.exception; 17 | 18 | /** 19 | * @author yanghq 20 | * @version 1.0 21 | * @since 2025/2/27 15:31 22 | */ 23 | public class BaseException extends RuntimeException { 24 | 25 | /** 26 | * 错误码 27 | */ 28 | private Integer code; 29 | 30 | /** 31 | * 错误消息 32 | */ 33 | private String msg; 34 | 35 | public BaseException(Integer code, String msg) { 36 | super(msg); 37 | this.code = code; 38 | this.msg = msg; 39 | } 40 | 41 | public BaseException(BaseExceptionEnum abstractExceptionEnum) { 42 | super(abstractExceptionEnum.getMsg()); 43 | this.code = abstractExceptionEnum.getCode(); 44 | this.msg = abstractExceptionEnum.getMsg(); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /dify/dify-core/src/main/java/io/github/guoshiqiufeng/dify/core/exception/BaseExceptionEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.core.exception; 17 | 18 | /** 19 | * @author yanghq 20 | * @version 1.0 21 | * @since 2021-07-21 14:19 22 | */ 23 | public interface BaseExceptionEnum { 24 | 25 | /** 26 | * 获取异常的状态码 27 | * 28 | * @return 状态码 29 | */ 30 | Integer getCode(); 31 | 32 | /** 33 | * 获取异常的消息 34 | * 35 | * @return 异常消息 36 | */ 37 | String getMsg(); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /dify/dify-core/src/main/java/io/github/guoshiqiufeng/dify/core/exception/DiftClientExceptionEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.core.exception; 17 | 18 | import lombok.AllArgsConstructor; 19 | import lombok.Getter; 20 | 21 | /** 22 | * @author yanghq 23 | * @version 1.0 24 | * @since 2025/5/19 13:42 25 | */ 26 | @Getter 27 | @AllArgsConstructor 28 | public enum DiftClientExceptionEnum implements BaseExceptionEnum { 29 | 30 | /** 31 | * unauthorized 32 | */ 33 | UNAUTHORIZED(401, "Access token is invalid"), 34 | /** 35 | * notFound 36 | */ 37 | NOT_FOUND(404, "Not Found"), 38 | 39 | 40 | ; 41 | 42 | private final Integer code; 43 | 44 | private final String msg; 45 | } 46 | -------------------------------------------------------------------------------- /dify/dify-core/src/main/java/io/github/guoshiqiufeng/dify/core/exception/DifyClientException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.core.exception; 17 | 18 | /** 19 | * @author yanghq 20 | * @version 1.0 21 | * @since 2025/5/19 13:41 22 | */ 23 | public class DifyClientException extends BaseException { 24 | 25 | public DifyClientException(DiftClientExceptionEnum exceptionEnum) { 26 | super(exceptionEnum.getCode(), exceptionEnum.getMsg()); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /dify/dify-core/src/main/java/io/github/guoshiqiufeng/dify/core/pojo/DifyPageResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.core.pojo; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import lombok.Data; 20 | 21 | import java.io.Serializable; 22 | import java.util.List; 23 | 24 | /** 25 | * 分页返回结果类,用于封装分页查询接口的返回数据。
26 | * 泛型 T 表示返回数据的具体类型。 27 | * 28 | * @author yanghq 29 | * @version 1.0 30 | * @since 2024/12/31 15:49 31 | */ 32 | @Data 33 | public class DifyPageResult implements Serializable { 34 | private static final long serialVersionUID = 9185003870754105941L; 35 | 36 | /** 37 | * 当前页的数据列表,类型由泛型 T 决定 38 | */ 39 | private List data; 40 | 41 | /** 42 | * 是否还有更多数据(即是否存在下一页) 43 | */ 44 | @JsonAlias("has_more") 45 | private Boolean hasMore; 46 | 47 | /** 48 | * 每页的最大数据条数 49 | */ 50 | private Integer limit; 51 | 52 | /** 53 | * 当前页码 54 | */ 55 | private Integer page; 56 | 57 | /** 58 | * 总数据条数 59 | */ 60 | private Integer total; 61 | } 62 | -------------------------------------------------------------------------------- /dify/dify-core/src/main/java/io/github/guoshiqiufeng/dify/core/pojo/DifyResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.core.pojo; 17 | 18 | import lombok.Data; 19 | 20 | import java.io.Serializable; 21 | 22 | /** 23 | * 通用返回结果类,用于封装接口返回的数据。
24 | * 泛型 T 表示返回数据的具体类型。 25 | * 26 | * @author yanghq 27 | * @version 1.0 28 | * @since 2024/12/31 14:27 29 | */ 30 | @Data 31 | public class DifyResult implements Serializable { 32 | 33 | private static final long serialVersionUID = 4454314914521369005L; 34 | 35 | public static final String SUCCESS = "success"; 36 | 37 | /** 38 | * 返回的具体数据,类型由泛型 T 决定 39 | */ 40 | private T data; 41 | 42 | /** 43 | * 返回的结果状态,通常用于描述操作的成功或失败信息 44 | */ 45 | private String result; 46 | } 47 | -------------------------------------------------------------------------------- /dify/dify-support/build.gradle: -------------------------------------------------------------------------------- 1 | subprojects { 2 | dependencies { 3 | testImplementation "org.mockito:mockito-core:${mockitoVersion}" 4 | testImplementation "org.mockito:mockito-junit-jupiter:${mockitoVersion}" 5 | testImplementation "net.bytebuddy:byte-buddy:${bytebuddyVersion}" 6 | testImplementation "net.bytebuddy:byte-buddy-agent:${bytebuddyVersion}" 7 | testImplementation "io.projectreactor:reactor-test" 8 | } 9 | } 10 | tasks.matching { 11 | it.name == 'publishToMavenCentralPortal' 12 | || it.name == 'publishMavenJavaPublicationToLocalRepository' 13 | || it.group == 'publishing' 14 | }.each { it.enabled = false } 15 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | api project(":dify:dify-core") 3 | api "${lib["hutool-core"]}" 4 | 5 | implementation "io.projectreactor:reactor-core" 6 | implementation "org.springframework:spring-webflux" 7 | 8 | implementation "com.fasterxml.jackson.core:jackson-databind" 9 | 10 | testImplementation 'org.junit.jupiter:junit-jupiter' 11 | testImplementation 'org.springframework:spring-test' 12 | } 13 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/constant/ChatUriConstant.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.constant; 17 | 18 | /** 19 | * 常量 20 | * 21 | * @author yanghq 22 | * @version 1.0 23 | * @since 2025/3/4 14:33 24 | */ 25 | public interface ChatUriConstant { 26 | 27 | String V1_URL = "/v1"; 28 | 29 | String V1_CHAT_MESSAGES_URI = V1_URL + "/chat-messages"; 30 | 31 | String V1_CONVERSATIONS_URI = V1_URL + "/conversations"; 32 | 33 | String V1_MESSAGES_URI = V1_URL + "/messages"; 34 | 35 | String V1_PARAMETERS_URI = V1_URL + "/parameters"; 36 | 37 | String V1_SITE_URI = V1_URL + "/site"; 38 | 39 | String V1_TEXT_TO_AUDIO_URI = V1_URL + "/text-to-audio"; 40 | 41 | String V1_AUDIO_TO_TEXT_URI = V1_URL + "/audio-to-text"; 42 | 43 | } 44 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/dto/request/AppAnnotationCreateRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.dto.request; 17 | 18 | import lombok.Data; 19 | import lombok.EqualsAndHashCode; 20 | 21 | import java.io.Serializable; 22 | 23 | /** 24 | * @author yanghq 25 | * @version 1.0 26 | * @since 2025/4/27 09:32 27 | */ 28 | @Data 29 | @EqualsAndHashCode(callSuper = true) 30 | public class AppAnnotationCreateRequest extends BaseChatRequest implements Serializable { 31 | private static final long serialVersionUID = 2331158428449970536L; 32 | 33 | private String question; 34 | 35 | private String answer; 36 | } 37 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/dto/request/AppAnnotationPageRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.dto.request; 17 | 18 | import lombok.Data; 19 | import lombok.EqualsAndHashCode; 20 | 21 | import java.io.Serializable; 22 | 23 | /** 24 | * @author yanghq 25 | * @version 0.10.0 26 | * @since 2025/4/27 09:24 27 | */ 28 | @Data 29 | @EqualsAndHashCode(callSuper = true) 30 | public class AppAnnotationPageRequest extends BaseChatRequest implements Serializable { 31 | 32 | private static final long serialVersionUID = 6852829739740557565L; 33 | 34 | /** 35 | * 页码 36 | */ 37 | private Integer page = 1; 38 | 39 | /** 40 | * 返回条数,默认 20,范围 1-100 41 | */ 42 | private Integer limit = 20; 43 | } 44 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/dto/request/AppAnnotationReplyQueryRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.dto.request; 17 | 18 | import io.github.guoshiqiufeng.dify.chat.enums.AnnotationReplyActionEnum; 19 | import lombok.Data; 20 | import lombok.EqualsAndHashCode; 21 | 22 | import java.io.Serializable; 23 | 24 | /** 25 | * @author yanghq 26 | * @version 1.0 27 | * @since 2025/4/27 11:02 28 | */ 29 | @Data 30 | @EqualsAndHashCode(callSuper = true) 31 | public class AppAnnotationReplyQueryRequest extends BaseChatRequest implements Serializable { 32 | 33 | private static final long serialVersionUID = 3705079948625308524L; 34 | 35 | private AnnotationReplyActionEnum action; 36 | 37 | private String jobId; 38 | } 39 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/dto/request/AppAnnotationUpdateRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.dto.request; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import com.fasterxml.jackson.annotation.JsonProperty; 20 | import lombok.Data; 21 | import lombok.EqualsAndHashCode; 22 | 23 | import java.io.Serializable; 24 | 25 | /** 26 | * @author yanghq 27 | * @version 1.0 28 | * @since 2025/4/27 09:33 29 | */ 30 | @Data 31 | @EqualsAndHashCode(callSuper = true) 32 | public class AppAnnotationUpdateRequest extends BaseChatRequest implements Serializable { 33 | private static final long serialVersionUID = 8840321586554282993L; 34 | 35 | @JsonProperty("annotation_id") 36 | @JsonAlias("annotationId") 37 | private String annotationId; 38 | 39 | private String question; 40 | 41 | private String answer; 42 | } 43 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/dto/request/AudioToTextRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.dto.request; 17 | 18 | import lombok.Data; 19 | import lombok.EqualsAndHashCode; 20 | import org.springframework.web.multipart.MultipartFile; 21 | 22 | import java.io.Serializable; 23 | 24 | /** 25 | * @author yanghq 26 | * @version 1.0 27 | * @since 2025/1/14 16:57 28 | */ 29 | @Data 30 | @EqualsAndHashCode(callSuper = true) 31 | public class AudioToTextRequest extends BaseChatRequest implements Serializable { 32 | private static final long serialVersionUID = -7700945517933651361L; 33 | 34 | private MultipartFile file; 35 | } 36 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/dto/request/BaseChatRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.dto.request; 17 | 18 | import lombok.Data; 19 | 20 | import java.io.Serializable; 21 | 22 | /** 23 | * @author yanghq 24 | * @version 1.0 25 | * @since 2025/3/5 17:52 26 | */ 27 | @Data 28 | public class BaseChatRequest implements Serializable { 29 | private static final long serialVersionUID = 5086111414608906670L; 30 | 31 | /** 32 | * apikey 33 | */ 34 | private String apiKey; 35 | 36 | /** 37 | * 用户 id 38 | */ 39 | private String userId; 40 | } 41 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/dto/request/FileUploadRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.dto.request; 17 | 18 | import lombok.AllArgsConstructor; 19 | import lombok.Data; 20 | import lombok.EqualsAndHashCode; 21 | import lombok.NoArgsConstructor; 22 | import lombok.experimental.Accessors; 23 | import org.springframework.web.multipart.MultipartFile; 24 | 25 | import java.io.Serializable; 26 | 27 | /** 28 | * @author yanghq 29 | * @version 0.10.0 30 | * @since 2025/4/24 13:25 31 | */ 32 | @Data 33 | @Accessors(chain = true) 34 | @EqualsAndHashCode(callSuper = true) 35 | @AllArgsConstructor 36 | @NoArgsConstructor 37 | public class FileUploadRequest extends BaseChatRequest implements Serializable { 38 | 39 | private MultipartFile file; 40 | } 41 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/dto/request/MessageConversationsRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.dto.request; 17 | 18 | import lombok.Data; 19 | import lombok.EqualsAndHashCode; 20 | 21 | import java.io.Serializable; 22 | 23 | /** 24 | * @author yanghq 25 | * @version 1.0 26 | * @since 2025/1/8 14:32 27 | */ 28 | @Data 29 | @EqualsAndHashCode(callSuper = true) 30 | public class MessageConversationsRequest extends BaseChatRequest implements Serializable { 31 | private static final long serialVersionUID = 4267154262382364533L; 32 | 33 | /** 34 | * 当前页最后面一条记录的 ID,默认 null 35 | */ 36 | private String lastId; 37 | 38 | /** 39 | * 一次请求返回多少条记录,默认 20 条,最大 100 条,最小 1 条。 40 | */ 41 | private Integer limit = 20; 42 | 43 | /** 44 | * 排序字段,默认 -updated_at(按更新时间倒序排列) 45 | *

46 | * 可选值:created_at, -created_at, updated_at, -updated_at 47 | * 字段前面的符号代表顺序或倒序,-代表倒序 48 | */ 49 | private String sortBy; 50 | 51 | } 52 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/dto/request/MessagesCurrentRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.dto.request; 17 | 18 | import lombok.Data; 19 | 20 | import java.io.Serializable; 21 | 22 | /** 23 | * @author yanghq 24 | * @version 1.0 25 | * @since 2025/1/8 15:39 26 | */ 27 | @Data 28 | public class MessagesCurrentRequest implements Serializable { 29 | private static final long serialVersionUID = 5790356634269119842L; 30 | 31 | private String appId; 32 | 33 | private String conversationId; 34 | 35 | 36 | /** 37 | * 当前页第一条聊天记录的 ID,默认 null 38 | */ 39 | private String firstId; 40 | 41 | /** 42 | * 一次请求返回多少条记录,默认 20 条,最大 100 条,最小 1 条。 43 | */ 44 | private Integer limit = 20; 45 | 46 | 47 | } 48 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/dto/request/MessagesRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.dto.request; 17 | 18 | import lombok.Data; 19 | import lombok.EqualsAndHashCode; 20 | 21 | import java.io.Serializable; 22 | 23 | /** 24 | * @author yanghq 25 | * @version 1.0 26 | * @since 2025/1/8 15:39 27 | */ 28 | @Data 29 | @EqualsAndHashCode(callSuper = true) 30 | public class MessagesRequest extends BaseChatRequest implements Serializable { 31 | private static final long serialVersionUID = 5790356634269119842L; 32 | 33 | 34 | private String conversationId; 35 | 36 | 37 | /** 38 | * 当前页第一条聊天记录的 ID,默认 null 39 | */ 40 | private String firstId; 41 | 42 | /** 43 | * 一次请求返回多少条记录,默认 20 条,最大 100 条,最小 1 条。 44 | */ 45 | private Integer limit = 20; 46 | 47 | 48 | } 49 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/dto/request/RenameConversationRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.dto.request; 17 | 18 | import lombok.Data; 19 | import lombok.EqualsAndHashCode; 20 | 21 | import java.io.Serializable; 22 | 23 | /** 24 | * @author yanghq 25 | * @version 1.0 26 | * @since 2025/3/10 13:46 27 | */ 28 | @Data 29 | @EqualsAndHashCode(callSuper = true) 30 | public class RenameConversationRequest extends BaseChatRequest implements Serializable { 31 | 32 | private static final long serialVersionUID = 3291175701376858324L; 33 | 34 | /** 35 | * 会话ID,标识需要重命名的会话 36 | */ 37 | private String conversationId; 38 | 39 | /** 40 | * 会话名称 41 | */ 42 | private String name; 43 | 44 | /** 45 | * 自动生成标题,默认 false 46 | */ 47 | private Boolean autoGenerate = false; 48 | } 49 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/dto/request/TextToAudioRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.dto.request; 17 | 18 | import lombok.Data; 19 | import lombok.EqualsAndHashCode; 20 | 21 | import java.io.Serializable; 22 | 23 | /** 24 | * @author yanghq 25 | * @version 1.0 26 | * @since 2025/1/14 15:06 27 | */ 28 | @Data 29 | @EqualsAndHashCode(callSuper = true) 30 | public class TextToAudioRequest extends BaseChatRequest implements Serializable { 31 | private static final long serialVersionUID = -6512681121991565229L; 32 | 33 | private String text; 34 | 35 | private String messageId; 36 | } 37 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/dto/response/AppAnnotationReplyResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.dto.response; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import lombok.Data; 20 | 21 | import java.io.Serializable; 22 | 23 | /** 24 | * @author yanghq 25 | * @version 0.10.0 26 | * @since 2025/4/27 11:01 27 | */ 28 | @Data 29 | public class AppAnnotationReplyResponse implements Serializable { 30 | private static final long serialVersionUID = 6264478725338981923L; 31 | @JsonAlias("job_id") 32 | private String jobId; 33 | @JsonAlias("job_status") 34 | private String jobStatus; 35 | @JsonAlias("error_msg") 36 | private String errorMsg; 37 | } 38 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/dto/response/AppAnnotationResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.dto.response; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import lombok.Data; 20 | 21 | import java.io.Serializable; 22 | 23 | /** 24 | * @author yanghq 25 | * @version 0.10.0 26 | * @since 2025/4/27 09:25 27 | */ 28 | @Data 29 | public class AppAnnotationResponse implements Serializable { 30 | private static final long serialVersionUID = 7358615091264023969L; 31 | 32 | private String id; 33 | 34 | private String question; 35 | 36 | private String answer; 37 | 38 | @JsonAlias("hit_count") 39 | private Integer hitCount; 40 | 41 | @JsonAlias("created_at") 42 | private Long createdAt; 43 | } 44 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/dto/response/AppInfoResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.dto.response; 17 | 18 | import lombok.Data; 19 | 20 | import java.io.Serializable; 21 | import java.util.List; 22 | 23 | /** 24 | * @author yanghq 25 | * @version 0.10.0 26 | * @since 2025/4/24 15:42 27 | */ 28 | @Data 29 | public class AppInfoResponse implements Serializable { 30 | 31 | private static final long serialVersionUID = 4056692447435687674L; 32 | 33 | private String name; 34 | 35 | private String description; 36 | 37 | private List tags; 38 | } 39 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/dto/response/AppMetaResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.dto.response; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import lombok.Data; 20 | 21 | import java.io.Serializable; 22 | import java.util.Map; 23 | 24 | /** 25 | * @author yanghq 26 | * @version 0.10.0 27 | * @since 2025/4/24 15:45 28 | */ 29 | @Data 30 | public class AppMetaResponse implements Serializable { 31 | private static final long serialVersionUID = -7338059912707915292L; 32 | 33 | @JsonAlias("tool_icons") 34 | private Map toolIcons; 35 | 36 | } 37 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/dto/response/DifyTextVO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.dto.response; 17 | 18 | import lombok.Data; 19 | 20 | import java.io.Serializable; 21 | 22 | /** 23 | * @author yanghq 24 | * @version 1.0 25 | * @since 2025/1/14 16:56 26 | */ 27 | @Data 28 | public class DifyTextVO implements Serializable { 29 | private static final long serialVersionUID = 3865342118298393192L; 30 | 31 | 32 | private String text; 33 | } 34 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/dto/response/FileUploadResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.dto.response; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import lombok.Data; 20 | 21 | import java.io.Serializable; 22 | 23 | /** 24 | * @author yanghq 25 | * @version 0.10.0 26 | * @since 2025/4/24 13:38 27 | */ 28 | @Data 29 | public class FileUploadResponse implements Serializable { 30 | private static final long serialVersionUID = 135249636075831292L; 31 | 32 | private String id; 33 | 34 | private String name; 35 | 36 | private Integer size; 37 | 38 | /** 39 | * 文件后缀 40 | */ 41 | private String extension; 42 | 43 | /** 44 | * 文件 mime-type 45 | */ 46 | @JsonAlias("mime_type") 47 | private String mimeType; 48 | 49 | /** 50 | * 创建人 51 | */ 52 | @JsonAlias("created_by") 53 | private String createdBy; 54 | 55 | /** 56 | * 创建时间 57 | */ 58 | @JsonAlias("created_at") 59 | private Long createdAt; 60 | } 61 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/dto/response/MessageFeedbackResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.dto.response; 17 | 18 | import lombok.Data; 19 | 20 | import java.io.Serializable; 21 | 22 | /** 23 | * @author yanghq 24 | * @version 1.0 25 | * @since 2025/3/10 13:55 26 | */ 27 | @Data 28 | public class MessageFeedbackResponse implements Serializable { 29 | 30 | private String result; 31 | } 32 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/dto/response/MetaData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.dto.response; 17 | 18 | import lombok.Data; 19 | 20 | /** 21 | * @author yanghq 22 | * @version 1.0.3 23 | * @since 2025/5/29 10:38 24 | */ 25 | @Data 26 | public class MetaData { 27 | 28 | private String provider; 29 | 30 | private String icon; 31 | } 32 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/dto/response/message/AgentLogData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.dto.response.message; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import io.github.guoshiqiufeng.dify.chat.dto.response.MetaData; 20 | import lombok.Data; 21 | import lombok.EqualsAndHashCode; 22 | 23 | import java.util.Map; 24 | 25 | /** 26 | * @author yanghq 27 | * @version 1.0.3 28 | * @since 2025/5/29 10:50 29 | */ 30 | @Data 31 | @EqualsAndHashCode(callSuper = true) 32 | public class AgentLogData extends CompletionData { 33 | @JsonAlias("node_execution_id") 34 | private String nodeExecutionId; 35 | 36 | private String id; 37 | 38 | private String label; 39 | 40 | @JsonAlias("parent_id") 41 | private String parentId; 42 | 43 | private String error; 44 | 45 | private String status; 46 | 47 | private Map data; 48 | 49 | private MetaData metadata; 50 | 51 | @JsonAlias("node_id") 52 | private String nodeId; 53 | } 54 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/dto/response/message/CompletionData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.dto.response.message; 17 | 18 | import java.io.Serializable; 19 | 20 | /** 21 | * @author yanghq 22 | * @version 1.0 23 | * @since 2025/4/15 17:44 24 | */ 25 | public class CompletionData implements Serializable { 26 | private static final long serialVersionUID = -9035787788964834544L; 27 | } 28 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/dto/response/message/EmptyData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.dto.response.message; 17 | 18 | import lombok.Data; 19 | import lombok.EqualsAndHashCode; 20 | 21 | /** 22 | * @author yanghq 23 | * @version 1.0.3 24 | * @since 2025/5/29 11:12 25 | */ 26 | @Data 27 | @EqualsAndHashCode(callSuper = true) 28 | public class EmptyData extends CompletionData { 29 | } 30 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/dto/response/message/ParallelBranchFinishedData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.dto.response.message; 17 | 18 | import lombok.Data; 19 | import lombok.EqualsAndHashCode; 20 | 21 | /** 22 | * @author yanghq 23 | * @version 1.0.3 24 | * @since 2025/5/29 10:39 25 | */ 26 | @Data 27 | @EqualsAndHashCode(callSuper = true) 28 | public class ParallelBranchFinishedData extends ParallelBranchStartedData { 29 | 30 | private String status; 31 | 32 | private String error; 33 | } 34 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/dto/response/message/WorkflowStartedData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.dto.response.message; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import com.fasterxml.jackson.annotation.JsonProperty; 20 | import lombok.Data; 21 | import lombok.EqualsAndHashCode; 22 | 23 | import java.util.Map; 24 | 25 | /** 26 | * @author yanghq 27 | * @version 1.0 28 | * @since 2025/4/15 17:44 29 | */ 30 | @Data 31 | @EqualsAndHashCode(callSuper = true) 32 | public class WorkflowStartedData extends CompletionData { 33 | 34 | private String id; 35 | 36 | @JsonProperty("workflowId") 37 | @JsonAlias("workflow_id") 38 | private String workflowId; 39 | 40 | @JsonProperty("sequenceNumber") 41 | @JsonAlias("sequence_number") 42 | private Integer sequenceNumber; 43 | 44 | @JsonProperty("createdAt") 45 | @JsonAlias("created_at") 46 | private Long createdAt; 47 | 48 | private Map inputs; 49 | } 50 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/dto/response/parameter/Enabled.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.dto.response.parameter; 17 | 18 | import lombok.AllArgsConstructor; 19 | import lombok.Data; 20 | import lombok.NoArgsConstructor; 21 | 22 | import java.io.Serializable; 23 | 24 | /** 25 | * @author yanghq 26 | * @version 1.0 27 | * @since 2025/3/24 14:30 28 | */ 29 | @AllArgsConstructor 30 | @NoArgsConstructor 31 | @Data 32 | public class Enabled implements Serializable { 33 | /** 34 | * 是否开启 35 | */ 36 | private Boolean enabled; 37 | } 38 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/dto/response/parameter/FileUploadConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.dto.response.parameter; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import lombok.Data; 20 | 21 | import java.io.Serializable; 22 | 23 | /** 24 | * @author yanghq 25 | * @version 1.0 26 | * @since 2025/3/24 14:44 27 | */ 28 | @Data 29 | public class FileUploadConfig implements Serializable { 30 | 31 | @JsonAlias("file_size_limit") 32 | private Integer fileSizeLimit; 33 | @JsonAlias("batch_count_limit") 34 | private Integer batchCountLimit; 35 | @JsonAlias("image_file_size_limit") 36 | private Integer imageFileSizeLimit; 37 | @JsonAlias("video_file_size_limit") 38 | private Integer videoFileSizeLimit; 39 | @JsonAlias("audio_file_size_limit") 40 | private Integer audioFileSizeLimit; 41 | @JsonAlias("workflow_file_upload_limit") 42 | private Integer workflowFileUploadLimit; 43 | } 44 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/dto/response/parameter/FileUploadImage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.dto.response.parameter; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import lombok.Data; 20 | 21 | import java.io.Serializable; 22 | import java.util.List; 23 | 24 | /** 25 | * @author yanghq 26 | * @version 1.0 27 | * @since 2025/3/24 14:32 28 | */ 29 | @Data 30 | public class FileUploadImage implements Serializable { 31 | 32 | private static final long serialVersionUID = 2405030232637136714L; 33 | 34 | /** 35 | * enabled(bool) 是否开启 36 | */ 37 | @JsonAlias("enabled") 38 | private Boolean enabled; 39 | /** 40 | * number_limits(int) 图片数量限制,默认 3 41 | */ 42 | @JsonAlias("number_limits") 43 | private Integer numberLimits; 44 | 45 | /** 46 | * transfer_methods(array[string]) 传递方式列表,remote_url ,local_file, 必选一个 47 | */ 48 | @JsonAlias("transfer_methods") 49 | private List transferMethods; 50 | 51 | 52 | } 53 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/dto/response/parameter/Paragraph.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.dto.response.parameter; 17 | 18 | import lombok.Data; 19 | import lombok.EqualsAndHashCode; 20 | import lombok.ToString; 21 | 22 | import java.io.Serializable; 23 | 24 | /** 25 | * @author yanghq 26 | * @version 1.0 27 | * @since 2025/3/24 14:32 28 | */ 29 | @Data 30 | @ToString(callSuper = true) 31 | @EqualsAndHashCode(callSuper = true) 32 | public class Paragraph extends TextInput implements Serializable { 33 | 34 | } 35 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/dto/response/parameter/Select.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.dto.response.parameter; 17 | 18 | import lombok.Data; 19 | import lombok.EqualsAndHashCode; 20 | import lombok.ToString; 21 | 22 | import java.io.Serializable; 23 | import java.util.List; 24 | 25 | /** 26 | * @author yanghq 27 | * @version 1.0 28 | * @since 2025/3/24 14:33 29 | */ 30 | @Data 31 | @ToString(callSuper = true) 32 | @EqualsAndHashCode(callSuper = true) 33 | public class Select extends TextInput implements Serializable { 34 | 35 | private String type; 36 | 37 | private List options; 38 | } 39 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/dto/response/parameter/TextInput.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.dto.response.parameter; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import lombok.Data; 20 | 21 | import java.io.Serializable; 22 | 23 | /** 24 | * @author yanghq 25 | * @version 1.0 26 | * @since 2025/3/24 14:36 27 | */ 28 | @Data 29 | public class TextInput implements Serializable { 30 | 31 | /** 32 | * label (string) 控件展示标签名 33 | */ 34 | @JsonAlias("label") 35 | private String label; 36 | /** 37 | * variable (string) 控件 ID 38 | */ 39 | @JsonAlias("variable") 40 | private String variable; 41 | /** 42 | * required (bool) 是否必填 43 | */ 44 | @JsonAlias("required") 45 | private Boolean required; 46 | 47 | @JsonAlias("max_length") 48 | private Integer maxLength; 49 | /** 50 | * default (string) 默认值 51 | */ 52 | @JsonAlias("default") 53 | private String defaultValue; 54 | } 55 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/dto/response/parameter/TextToSpeech.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.dto.response.parameter; 17 | 18 | import lombok.Data; 19 | 20 | import java.io.Serializable; 21 | 22 | /** 23 | * @author yanghq 24 | * @version 1.0 25 | * @since 2025/3/24 14:38 26 | */ 27 | @Data 28 | public class TextToSpeech implements Serializable { 29 | 30 | private Boolean enabled; 31 | 32 | private String voice; 33 | 34 | private String language; 35 | } 36 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/dto/response/parameter/UserInputForm.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.dto.response.parameter; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import lombok.Data; 20 | 21 | import java.io.Serializable; 22 | 23 | /** 24 | * @author yanghq 25 | * @version 1.0 26 | * @since 2025/3/24 14:35 27 | */ 28 | @Data 29 | public class UserInputForm implements Serializable { 30 | /** 31 | * text-input (object) 文本输入控件 32 | */ 33 | @JsonAlias("text-input") 34 | private TextInput textInput; 35 | 36 | /** 37 | * paragraph(object) 段落文本输入控件 38 | */ 39 | @JsonAlias("paragraph") 40 | private Paragraph paragraph; 41 | 42 | /** 43 | * select(object) 下拉控件 44 | */ 45 | @JsonAlias("select") 46 | private Select select; 47 | } 48 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/enums/AnnotationReplyActionEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.enums; 17 | 18 | /** 19 | * @author yanghq 20 | * @version 0.10.0 21 | * @since 2025/4/27 11:04 22 | */ 23 | public enum AnnotationReplyActionEnum { 24 | 25 | /** 26 | * enable Action 27 | */ 28 | enable, 29 | 30 | disable 31 | } 32 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/enums/IconTypeEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.enums; 17 | 18 | /** 19 | /** 20 | * @author yanghq 21 | * @version 1.1.0 22 | * @since 2024/5/30 14:09 23 | */ 24 | public enum IconTypeEnum { 25 | 26 | /** 27 | * emoji 28 | */ 29 | emoji, 30 | 31 | /** 32 | * image 33 | */ 34 | image 35 | } 36 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/main/java/io/github/guoshiqiufeng/dify/chat/exception/DiftChatException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.exception; 17 | 18 | import io.github.guoshiqiufeng.dify.core.exception.BaseException; 19 | import io.github.guoshiqiufeng.dify.core.exception.BaseExceptionEnum; 20 | 21 | /** 22 | * @author yanghq 23 | * @version 1.0 24 | * @since 2025/3/4 10:59 25 | */ 26 | public class DiftChatException extends BaseException { 27 | 28 | public DiftChatException(BaseExceptionEnum abstractExceptionEnum) { 29 | super(abstractExceptionEnum); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/test/java/io/github/guoshiqiufeng/dify/chat/enums/IconTypeEnumTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.enums; 17 | 18 | import org.junit.jupiter.api.Test; 19 | 20 | import static org.junit.jupiter.api.Assertions.assertEquals; 21 | 22 | /** 23 | * Unit tests for {@link IconTypeEnum} 24 | * 25 | * @author yanghq 26 | * @version 1.1.0 27 | * @since 2024/5/30 14:09 28 | */ 29 | public class IconTypeEnumTest { 30 | 31 | @Test 32 | public void testIconTypeEnum() { 33 | // Verify the enum values 34 | assertEquals("emoji", IconTypeEnum.emoji.name()); 35 | assertEquals("image", IconTypeEnum.image.name()); 36 | } 37 | } -------------------------------------------------------------------------------- /dify/dify-support/dify-support-chat/src/test/java/io/github/guoshiqiufeng/dify/chat/exception/DiftChatExceptionTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.chat.exception; 17 | 18 | import org.junit.jupiter.api.Test; 19 | 20 | import static org.junit.jupiter.api.Assertions.assertEquals; 21 | 22 | /** 23 | * Tests for {@link DiftChatException}. 24 | * 25 | * @author yanghq 26 | * @version 0.10.0 27 | * @since 2025/4/24 08:16 28 | */ 29 | class DiftChatExceptionTest { 30 | 31 | @Test 32 | void testExceptionMessage() { 33 | DiftChatException exception = new DiftChatException(DiftChatExceptionEnum.DIFY_TTS_IS_NOT_ENABLED); 34 | 35 | assertEquals(DiftChatExceptionEnum.DIFY_TTS_IS_NOT_ENABLED.getMsg(), exception.getMessage()); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | api project(":dify:dify-core") 3 | 4 | api "${lib["hutool-core"]}" 5 | 6 | implementation "io.projectreactor:reactor-core" 7 | implementation "org.springframework:spring-webflux" 8 | 9 | implementation "com.fasterxml.jackson.core:jackson-databind" 10 | 11 | testImplementation 'org.junit.jupiter:junit-jupiter' 12 | testImplementation 'org.springframework:spring-test' 13 | } 14 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/request/BaseDatasetRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.request; 17 | 18 | import lombok.Data; 19 | 20 | import java.io.Serializable; 21 | 22 | /** 23 | * @author yanghq 24 | * @version 1.0 25 | * @since 2025/3/13 13:13 26 | */ 27 | @Data 28 | public class BaseDatasetRequest implements Serializable { 29 | 30 | private String apiKey; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/request/DatasetInfoRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.request; 17 | 18 | import lombok.Data; 19 | import lombok.EqualsAndHashCode; 20 | 21 | import java.io.Serializable; 22 | 23 | /** 24 | * @author yanghq 25 | * @version 1.0 26 | * @since 2025/5/15 14:19 27 | */ 28 | @Data 29 | @EqualsAndHashCode(callSuper = true) 30 | public class DatasetInfoRequest extends BaseDatasetRequest implements Serializable { 31 | 32 | private String datasetId; 33 | } 34 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/request/DatasetPageDocumentRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.request; 17 | 18 | import lombok.Data; 19 | import lombok.EqualsAndHashCode; 20 | 21 | import java.io.Serializable; 22 | 23 | /** 24 | * @author yanghq 25 | * @version 1.0 26 | * @since 2025/3/13 16:05 27 | */ 28 | @Data 29 | @EqualsAndHashCode(callSuper = true) 30 | public class DatasetPageDocumentRequest extends BaseDatasetRequest implements Serializable { 31 | private static final long serialVersionUID = 8484601270947692397L; 32 | 33 | private String datasetId; 34 | 35 | private String keyword; 36 | 37 | private Integer page = 1; 38 | 39 | private Integer limit = 20; 40 | } 41 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/request/DatasetPageRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.request; 17 | 18 | import lombok.Data; 19 | import lombok.EqualsAndHashCode; 20 | 21 | import java.io.Serializable; 22 | import java.util.List; 23 | 24 | /** 25 | * @author yanghq 26 | * @version 1.0 27 | * @since 2025/3/13 13:12 28 | */ 29 | @Data 30 | @EqualsAndHashCode(callSuper = true) 31 | public class DatasetPageRequest extends BaseDatasetRequest implements Serializable { 32 | 33 | /** 34 | * 页码 35 | */ 36 | private Integer page = 1; 37 | 38 | /** 39 | * 返回条数,默认 20,范围 1-100 40 | */ 41 | private Integer limit = 20; 42 | 43 | private String keyword; 44 | 45 | private List tagIds; 46 | 47 | private Boolean includeAll; 48 | } 49 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/request/DocumentIndexingStatusRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.request; 17 | 18 | import lombok.Data; 19 | import lombok.EqualsAndHashCode; 20 | 21 | import java.io.Serializable; 22 | 23 | /** 24 | * @author yanghq 25 | * @version 1.0 26 | * @since 2025/3/14 14:00 27 | */ 28 | @Data 29 | @EqualsAndHashCode(callSuper = true) 30 | public class DocumentIndexingStatusRequest extends BaseDatasetRequest implements Serializable { 31 | 32 | private String datasetId; 33 | 34 | private String batch; 35 | } 36 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/request/MetaData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.request; 17 | 18 | import lombok.AllArgsConstructor; 19 | import lombok.Builder; 20 | import lombok.Data; 21 | import lombok.NoArgsConstructor; 22 | 23 | import java.io.Serializable; 24 | 25 | /** 26 | * @author yanghq 27 | * @version 1.0 28 | * @since 2025/4/09 17:17 29 | */ 30 | @Data 31 | @AllArgsConstructor 32 | @NoArgsConstructor 33 | @Builder 34 | public class MetaData implements Serializable { 35 | 36 | private static final long serialVersionUID = 1083376788375284035L; 37 | 38 | private String id; 39 | 40 | private String type; 41 | 42 | private String name; 43 | 44 | private String value; 45 | } 46 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/request/MetaDataActionRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.request; 17 | 18 | import io.github.guoshiqiufeng.dify.dataset.enums.MetaDataActionEnum; 19 | import lombok.Data; 20 | import lombok.EqualsAndHashCode; 21 | 22 | import java.io.Serializable; 23 | 24 | /** 25 | * @author yanghq 26 | * @version 1.0 27 | * @since 2025/3/24 10:48 28 | */ 29 | @Data 30 | @EqualsAndHashCode(callSuper = true) 31 | public class MetaDataActionRequest extends BaseDatasetRequest implements Serializable { 32 | private static final long serialVersionUID = 6701409042040093766L; 33 | 34 | private String datasetId; 35 | 36 | private MetaDataActionEnum action; 37 | } 38 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/request/MetaDataCreateRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.request; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import lombok.Data; 20 | import lombok.EqualsAndHashCode; 21 | import lombok.ToString; 22 | 23 | import java.io.Serializable; 24 | 25 | /** 26 | * @author yanghq 27 | * @version 1.0 28 | * @since 2025/3/24 10:45 29 | */ 30 | @Data 31 | @EqualsAndHashCode(callSuper = true) 32 | @ToString(callSuper = true) 33 | public class MetaDataCreateRequest extends BaseDatasetRequest implements Serializable { 34 | private static final long serialVersionUID = 3246895121202690206L; 35 | 36 | 37 | @JsonAlias("datasetId") 38 | private String datasetId; 39 | 40 | /** 41 | * 元数据类型,必填 42 | */ 43 | private String type; 44 | 45 | /** 46 | * 元数据名称,必填 47 | */ 48 | private String name; 49 | } 50 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/request/MetaDataUpdateRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.request; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import lombok.Data; 20 | import lombok.EqualsAndHashCode; 21 | import lombok.ToString; 22 | 23 | import java.io.Serializable; 24 | 25 | /** 26 | * @author yanghq 27 | * @version 1.0 28 | * @since 2025/3/24 10:46 29 | */ 30 | @Data 31 | @EqualsAndHashCode(callSuper = true) 32 | @ToString(callSuper = true) 33 | public class MetaDataUpdateRequest extends BaseDatasetRequest implements Serializable { 34 | 35 | private static final long serialVersionUID = -7443098127777945554L; 36 | 37 | 38 | @JsonAlias("datasetId") 39 | private String datasetId; 40 | 41 | 42 | @JsonAlias("metaDataId") 43 | private String metaDataId; 44 | 45 | private String name; 46 | } 47 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/request/RetrieveRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.request; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import com.fasterxml.jackson.annotation.JsonProperty; 20 | import io.github.guoshiqiufeng.dify.dataset.dto.RetrievalModel; 21 | import lombok.Data; 22 | import lombok.EqualsAndHashCode; 23 | 24 | import java.io.Serializable; 25 | 26 | /** 27 | * @author yanghq 28 | * @version 1.0 29 | * @since 2025/3/13 17:40 30 | */ 31 | @Data 32 | @EqualsAndHashCode(callSuper = true) 33 | public class RetrieveRequest extends BaseDatasetRequest implements Serializable { 34 | private static final long serialVersionUID = -4555074954659951949L; 35 | 36 | 37 | @JsonAlias("datasetId") 38 | private String datasetId; 39 | 40 | private String query; 41 | 42 | @JsonProperty("retrieval_model") 43 | @JsonAlias("retrievalModel") 44 | private RetrievalModel retrievalModel; 45 | 46 | } 47 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/request/SegmentChildChunkCreateRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.request; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import lombok.*; 20 | 21 | import java.io.Serializable; 22 | 23 | /** 24 | * @author yanghq 25 | * @version 0.8.0 26 | * @since 2025/4/11 09:33 27 | */ 28 | @Data 29 | @EqualsAndHashCode(callSuper = true) 30 | @AllArgsConstructor 31 | @NoArgsConstructor 32 | @ToString(callSuper = true) 33 | public class SegmentChildChunkCreateRequest extends BaseDatasetRequest implements Serializable { 34 | 35 | 36 | private static final long serialVersionUID = -7471081767075321760L; 37 | 38 | 39 | @JsonAlias("datasetId") 40 | private String datasetId; 41 | 42 | 43 | @JsonAlias("documentId") 44 | private String documentId; 45 | 46 | 47 | @JsonAlias("segmentId") 48 | private String segmentId; 49 | 50 | private String content; 51 | 52 | } 53 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/request/SegmentChildChunkDeleteRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.request; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import lombok.*; 20 | 21 | import java.io.Serializable; 22 | 23 | /** 24 | * @author yanghq 25 | * @version 0.8.0 26 | * @since 2025/4/11 09:53 27 | */ 28 | @Data 29 | @EqualsAndHashCode(callSuper = true) 30 | @AllArgsConstructor 31 | @NoArgsConstructor 32 | @ToString(callSuper = true) 33 | public class SegmentChildChunkDeleteRequest extends BaseDatasetRequest implements Serializable { 34 | 35 | private static final long serialVersionUID = 927938288064559455L; 36 | 37 | 38 | @JsonAlias("datasetId") 39 | private String datasetId; 40 | 41 | 42 | @JsonAlias("documentId") 43 | private String documentId; 44 | 45 | 46 | @JsonAlias("segmentId") 47 | private String segmentId; 48 | 49 | 50 | @JsonAlias("childChunkId") 51 | private String childChunkId; 52 | } 53 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/request/SegmentChildChunkPageRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.request; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import lombok.*; 20 | 21 | import java.io.Serializable; 22 | 23 | /** 24 | * @author yanghq 25 | * @version 0.8.0 26 | * @since 2025/4/11 09:42 27 | */ 28 | @Data 29 | @EqualsAndHashCode(callSuper = true) 30 | @AllArgsConstructor 31 | @NoArgsConstructor 32 | @ToString(callSuper = true) 33 | public class SegmentChildChunkPageRequest extends BaseDatasetRequest implements Serializable { 34 | 35 | private static final long serialVersionUID = -533785715119718298L; 36 | 37 | 38 | @JsonAlias("datasetId") 39 | private String datasetId; 40 | 41 | 42 | @JsonAlias("documentId") 43 | private String documentId; 44 | 45 | 46 | @JsonAlias("segmentId") 47 | private String segmentId; 48 | 49 | private String keyword; 50 | 51 | private Integer page = 1; 52 | 53 | private Integer limit = 20; 54 | } 55 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/request/SegmentCreateRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.request; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import lombok.Data; 20 | import lombok.EqualsAndHashCode; 21 | 22 | import java.io.Serializable; 23 | import java.util.List; 24 | 25 | /** 26 | * @author yanghq 27 | * @version 1.0 28 | * @since 2025/3/13 17:16 29 | */ 30 | 31 | @Data 32 | @EqualsAndHashCode(callSuper = true) 33 | public class SegmentCreateRequest extends BaseDatasetRequest implements Serializable { 34 | 35 | 36 | @JsonAlias("datasetId") 37 | private String datasetId; 38 | 39 | 40 | @JsonAlias("documentId") 41 | private String documentId; 42 | 43 | private List segments; 44 | } 45 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/request/SegmentPageRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.request; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import lombok.Data; 20 | import lombok.EqualsAndHashCode; 21 | import lombok.ToString; 22 | 23 | import java.io.Serializable; 24 | 25 | /** 26 | * @author yanghq 27 | * @version 1.0 28 | * @since 2025/3/13 17:24 29 | */ 30 | @Data 31 | @EqualsAndHashCode(callSuper = true) 32 | @ToString(callSuper = true) 33 | public class SegmentPageRequest extends BaseDatasetRequest implements Serializable { 34 | private static final long serialVersionUID = 7786447642979142908L; 35 | 36 | 37 | @JsonAlias("datasetId") 38 | private String datasetId; 39 | 40 | 41 | @JsonAlias("documentId") 42 | private String documentId; 43 | 44 | private String keyword; 45 | 46 | private String status; 47 | 48 | private Integer page = 1; 49 | 50 | private Integer limit = 20; 51 | } 52 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/request/SegmentParam.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.request; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import com.fasterxml.jackson.annotation.JsonProperty; 20 | import lombok.Data; 21 | import lombok.experimental.Accessors; 22 | 23 | import java.io.Serializable; 24 | import java.util.List; 25 | 26 | /** 27 | * @author yanghq 28 | * @version 1.0 29 | * @since 2025/3/13 17:29 30 | */ 31 | @Accessors(chain = true) 32 | @Data 33 | public class SegmentParam implements Serializable { 34 | private static final long serialVersionUID = 8632921484666324246L; 35 | 36 | private String content; 37 | 38 | private String answer; 39 | 40 | private List keywords; 41 | 42 | private Boolean enabled; 43 | 44 | @JsonProperty("regenerate_child_chunks") 45 | @JsonAlias("regenerateChildChunks") 46 | private Boolean regenerateChildChunks; 47 | } 48 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/request/SegmentUpdateParam.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.request; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import com.fasterxml.jackson.annotation.JsonProperty; 20 | import lombok.Data; 21 | import lombok.EqualsAndHashCode; 22 | import lombok.experimental.Accessors; 23 | 24 | import java.io.Serializable; 25 | 26 | /** 27 | * @author yanghq 28 | * @version 1.0 29 | * @since 2025/3/13 17:29 30 | */ 31 | @Accessors(chain = true) 32 | @Data 33 | @EqualsAndHashCode(callSuper = true) 34 | public class SegmentUpdateParam extends SegmentParam implements Serializable { 35 | private static final long serialVersionUID = 8632921484666324246L; 36 | 37 | private Boolean enabled; 38 | 39 | @JsonProperty("regenerate_child_chunks") 40 | @JsonAlias("regenerateChildChunks") 41 | private Boolean regenerateChildChunks; 42 | } 43 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/request/SegmentUpdateRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.request; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import lombok.Data; 20 | import lombok.EqualsAndHashCode; 21 | 22 | import java.io.Serializable; 23 | 24 | /** 25 | * @author yanghq 26 | * @version 1.0 27 | * @since 2025/3/13 17:27 28 | */ 29 | @Data 30 | @EqualsAndHashCode(callSuper = true) 31 | public class SegmentUpdateRequest extends BaseDatasetRequest implements Serializable { 32 | 33 | 34 | @JsonAlias("datasetId") 35 | private String datasetId; 36 | 37 | 38 | @JsonAlias("documentId") 39 | private String documentId; 40 | 41 | 42 | @JsonAlias("segmentId") 43 | private String segmentId; 44 | 45 | private SegmentParam segment; 46 | } 47 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/request/document/PreProcessingRule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.request.document; 17 | 18 | import io.github.guoshiqiufeng.dify.dataset.enums.document.PreProcessingRuleTypeEnum; 19 | import lombok.AllArgsConstructor; 20 | import lombok.Data; 21 | 22 | import java.io.Serializable; 23 | 24 | /** 25 | * @author yanghq 26 | * @version 1.0 27 | * @since 2025/3/13 15:24 28 | */ 29 | @Data 30 | @AllArgsConstructor 31 | public class PreProcessingRule implements Serializable { 32 | private static final long serialVersionUID = 2662516999304017667L; 33 | 34 | /** 35 | * 预处理规则的唯一标识符 remove_extra_spaces,remove_urls_emails 36 | */ 37 | private PreProcessingRuleTypeEnum id; 38 | /** 39 | * 是否选中该规则,不传入文档 ID 时代表默认值 40 | */ 41 | private Boolean enabled; 42 | } 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/request/document/ProcessRule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.request.document; 17 | 18 | import io.github.guoshiqiufeng.dify.dataset.enums.document.ModeEnum; 19 | import lombok.Data; 20 | 21 | import java.io.Serializable; 22 | 23 | /** 24 | * @author yanghq 25 | * @version 1.0 26 | * @since 2025/3/13 15:22 27 | */ 28 | @Data 29 | public class ProcessRule implements Serializable { 30 | 31 | private static final long serialVersionUID = 2662516999304017667L; 32 | 33 | /** 34 | * 清洗、分段模式 ,automatic 自动 / custom 自定义 35 | */ 36 | private ModeEnum mode; 37 | 38 | /** 39 | * 自定义规则(自动模式下,该字段为空 40 | */ 41 | private CustomRule rules; 42 | } 43 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/request/document/Segmentation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.request.document; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import com.fasterxml.jackson.annotation.JsonProperty; 20 | import lombok.AllArgsConstructor; 21 | import lombok.Data; 22 | import lombok.NoArgsConstructor; 23 | 24 | import java.io.Serializable; 25 | 26 | /** 27 | * @author yanghq 28 | * @version 1.0 29 | * @since 2025/3/13 15:25 30 | */ 31 | @Data 32 | @AllArgsConstructor 33 | @NoArgsConstructor 34 | public class Segmentation implements Serializable { 35 | 36 | /** 37 | * 自定义分段标识符,目前仅允许设置一个分隔符。默认为 \n 38 | */ 39 | private String separator = "\\n"; 40 | 41 | /** 42 | * 最大长度(token)默认为 1000 43 | */ 44 | @JsonAlias("maxTokens") 45 | @JsonProperty("max_tokens") 46 | private Integer maxTokens = 1000; 47 | } 48 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/request/document/SubChunkSegmentation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.request.document; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import com.fasterxml.jackson.annotation.JsonProperty; 20 | import lombok.AllArgsConstructor; 21 | import lombok.Data; 22 | import lombok.NoArgsConstructor; 23 | 24 | import java.io.Serializable; 25 | 26 | /** 27 | * @author yanghq 28 | * @version 1.0 29 | * @since 2025/3/13 15:24 30 | */ 31 | @Data 32 | @AllArgsConstructor 33 | @NoArgsConstructor 34 | public class SubChunkSegmentation implements Serializable { 35 | 36 | private String separator = "/n"; 37 | 38 | @JsonAlias("maxTokens") 39 | @JsonProperty("max_tokens") 40 | private Integer maxTokens = 200; 41 | 42 | @JsonAlias("chunkOverlap") 43 | @JsonProperty("chunk_overlap") 44 | private Integer chunkOverlap; 45 | 46 | } 47 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/request/file/FileOperation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.request.file; 17 | 18 | import org.springframework.web.multipart.MultipartFile; 19 | 20 | /** 21 | * File Operation Interface 22 | * Defines operations for handling file uploads in Dify dataset requests. 23 | * This interface is implemented by request classes that need to accept 24 | * and process file uploads as part of their functionality. 25 | * 26 | * @author yanghq 27 | * @version 1.0 28 | * @since 2025/4/17 17:28 29 | */ 30 | public interface FileOperation { 31 | 32 | /** 33 | * Sets a file to be used in a dataset operation 34 | * 35 | * @param file The MultipartFile to be processed as part of a dataset request 36 | */ 37 | public void setFile(MultipartFile file); 38 | } 39 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/response/DocumentCreateResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.response; 17 | 18 | import lombok.Data; 19 | 20 | import java.io.Serializable; 21 | 22 | /** 23 | * @author yanghq 24 | * @version 1.0 25 | * @since 2025/3/13 15:27 26 | */ 27 | @Data 28 | public class DocumentCreateResponse implements Serializable { 29 | private static final long serialVersionUID = -1760772788128759542L; 30 | 31 | private DocumentInfo document; 32 | 33 | private String batch; 34 | } 35 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/response/MetaDataResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.response; 17 | 18 | import lombok.Data; 19 | 20 | import java.io.Serializable; 21 | 22 | /** 23 | * @author yanghq 24 | * @version 1.0 25 | * @since 2025/3/24 10:43 26 | */ 27 | @Data 28 | public class MetaDataResponse implements Serializable { 29 | 30 | private String id; 31 | 32 | /** 33 | * 元数据类型,必填 34 | */ 35 | private String type; 36 | 37 | /** 38 | * 元数据名称,必填 39 | */ 40 | private String name; 41 | } 42 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/response/SegmentChildChunkCreateResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.response; 17 | 18 | import lombok.Data; 19 | 20 | import java.io.Serializable; 21 | 22 | /** 23 | * @author yanghq 24 | * @version 0.8.0 25 | * @since 2025/4/11 09:34 26 | */ 27 | @Data 28 | public class SegmentChildChunkCreateResponse implements Serializable { 29 | private static final long serialVersionUID = 2972643083546017485L; 30 | 31 | private SegmentChildChunkResponse data; 32 | } 33 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/response/SegmentChildChunkUpdateResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.response; 17 | 18 | import lombok.Data; 19 | 20 | import java.io.Serializable; 21 | 22 | /** 23 | * @author yanghq 24 | * @version 0.8.0 25 | * @since 2025/4/11 09:59 26 | */ 27 | @Data 28 | public class SegmentChildChunkUpdateResponse implements Serializable { 29 | 30 | 31 | private static final long serialVersionUID = 2625814895156143331L; 32 | 33 | 34 | private SegmentChildChunkResponse data; 35 | } 36 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/response/SegmentResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.response; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import lombok.Data; 20 | 21 | import java.io.Serializable; 22 | import java.util.List; 23 | 24 | /** 25 | * @author yanghq 26 | * @version 1.0 27 | * @since 2025/3/13 17:18 28 | */ 29 | @Data 30 | public class SegmentResponse implements Serializable { 31 | private static final long serialVersionUID = -1174425396475689757L; 32 | 33 | private List data; 34 | 35 | @JsonAlias("doc_form") 36 | private String docForm; 37 | 38 | @JsonAlias("has_more") 39 | private Boolean hasMore; 40 | 41 | /** 42 | * 每页的最大数据条数 43 | */ 44 | private Integer limit; 45 | 46 | /** 47 | * 当前页码 48 | */ 49 | private Integer page; 50 | 51 | /** 52 | * 总数据条数 53 | */ 54 | private Integer total; 55 | } 56 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/response/SegmentUpdateResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.response; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import lombok.Data; 20 | 21 | import java.io.Serializable; 22 | 23 | /** 24 | * @author yanghq 25 | * @version 1.0 26 | * @since 2025/3/13 17:18 27 | */ 28 | @Data 29 | public class SegmentUpdateResponse implements Serializable { 30 | private static final long serialVersionUID = -1174425396475689757L; 31 | 32 | private SegmentData data; 33 | 34 | @JsonAlias("doc_form") 35 | private String docForm; 36 | } 37 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/response/TextEmbeddingListResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.response; 17 | 18 | import io.github.guoshiqiufeng.dify.dataset.dto.response.textembedding.TextEmbedding; 19 | import lombok.Data; 20 | 21 | import java.io.Serializable; 22 | import java.util.List; 23 | 24 | /** 25 | * @author yanghq 26 | * @version 0.8.0 27 | * @since 2025/4/10 13:54 28 | */ 29 | @Data 30 | public class TextEmbeddingListResponse implements Serializable { 31 | 32 | private List data; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/response/UploadFileInfoResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.response; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import lombok.Data; 20 | 21 | import java.io.Serializable; 22 | 23 | /** 24 | * @author yanghq 25 | * @version 1.0 26 | * @since 2025/3/13 17:38 27 | */ 28 | @Data 29 | public class UploadFileInfoResponse implements Serializable { 30 | private static final long serialVersionUID = 487590129337348606L; 31 | 32 | private String id; 33 | private String name; 34 | private Integer size; 35 | private String extension; 36 | private String url; 37 | @JsonAlias("download_url") 38 | private String downloadUrl; 39 | @JsonAlias("mine_type") 40 | private String mimeType; 41 | @JsonAlias("created_by") 42 | private String createdBy; 43 | @JsonAlias("created_at") 44 | private Long createdAt; 45 | 46 | } 47 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/response/textembedding/TextEmbedding.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.response.textembedding; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import lombok.AllArgsConstructor; 20 | import lombok.Data; 21 | import lombok.NoArgsConstructor; 22 | 23 | import java.io.Serializable; 24 | import java.util.List; 25 | 26 | /** 27 | * @author yanghq 28 | * @version 0.8.0 29 | * @since 2025/4/10 14:01 30 | */ 31 | @Data 32 | @AllArgsConstructor 33 | @NoArgsConstructor 34 | public class TextEmbedding implements Serializable { 35 | 36 | private static final long serialVersionUID = -7050862386720963430L; 37 | private String provider; 38 | 39 | private TextEmbeddingLabel label; 40 | 41 | @JsonAlias("icon_small") 42 | private TextEmbeddingIcon iconSmall; 43 | 44 | @JsonAlias("icon_large") 45 | private TextEmbeddingIcon iconLarge; 46 | 47 | private String status; 48 | 49 | private List models; 50 | 51 | } 52 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/response/textembedding/TextEmbeddingIcon.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.response.textembedding; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import lombok.AllArgsConstructor; 20 | import lombok.Data; 21 | import lombok.NoArgsConstructor; 22 | 23 | import java.io.Serializable; 24 | 25 | /** 26 | * @author yanghq 27 | * @version 0.8.0 28 | * @since 2025/4/10 13:58 29 | */ 30 | @Data 31 | @AllArgsConstructor 32 | @NoArgsConstructor 33 | public class TextEmbeddingIcon implements Serializable { 34 | 35 | private static final long serialVersionUID = -5570238242943685386L; 36 | @JsonAlias("zh_Hans") 37 | private String zhHans; 38 | 39 | @JsonAlias("en_US") 40 | private String enUs; 41 | } 42 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/response/textembedding/TextEmbeddingLabel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.response.textembedding; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import lombok.AllArgsConstructor; 20 | import lombok.Data; 21 | import lombok.NoArgsConstructor; 22 | 23 | import java.io.Serializable; 24 | 25 | /** 26 | * @author yanghq 27 | * @version 0.8.0 28 | * @since 2025/4/10 13:57 29 | */ 30 | @Data 31 | @AllArgsConstructor 32 | @NoArgsConstructor 33 | public class TextEmbeddingLabel implements Serializable { 34 | 35 | private static final long serialVersionUID = -1766049392784610707L; 36 | @JsonAlias("zh_Hans") 37 | private String zhHans; 38 | 39 | @JsonAlias("en_US") 40 | private String enUs; 41 | } 42 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/dto/response/textembedding/TextEmbeddingModelProperties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.dto.response.textembedding; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import lombok.AllArgsConstructor; 20 | import lombok.Data; 21 | import lombok.NoArgsConstructor; 22 | 23 | import java.io.Serializable; 24 | 25 | /** 26 | * @author yanghq 27 | * @version 1.0 28 | * @since 2025/4/10 14:23 29 | */ 30 | @Data 31 | @AllArgsConstructor 32 | @NoArgsConstructor 33 | public class TextEmbeddingModelProperties implements Serializable { 34 | 35 | @JsonAlias("context_size") 36 | private Integer contextSize; 37 | 38 | @JsonAlias("max_chunks") 39 | private Integer maxChunks; 40 | } 41 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/enums/MetaDataActionEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.enums; 17 | 18 | /** 19 | * @author yanghq 20 | * @version 1.0 21 | * @since 2025/3/24 10:49 22 | */ 23 | public enum MetaDataActionEnum { 24 | /** 25 | * 禁用 26 | */ 27 | disable, 28 | /** 29 | * 启用 30 | */ 31 | enable 32 | } 33 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/enums/ProviderEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.enums; 17 | 18 | /** 19 | * @author yanghq 20 | * @version 1.0 21 | * @since 2025/3/13 13:36 22 | */ 23 | public enum ProviderEnum { 24 | /** 25 | * 上传文件 26 | */ 27 | vendor, 28 | 29 | /** 30 | * 外部知识库 31 | */ 32 | external 33 | 34 | } 35 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/enums/RerankingModeEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.enums; 17 | 18 | /** 19 | * @author yanghq 20 | * @version 1.0 21 | * @since 2025/3/25 17:16 22 | */ 23 | public enum RerankingModeEnum { 24 | 25 | /** 26 | * 权重 27 | */ 28 | weighted_score, 29 | 30 | /** 31 | * reranking模型 32 | */ 33 | reranking_model 34 | } 35 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/enums/SearchMethodEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.enums; 17 | 18 | /** 19 | * @author yanghq 20 | * @version 1.0 21 | * @since 2025/3/13 14:58 22 | */ 23 | public enum SearchMethodEnum { 24 | 25 | /** 26 | * 关键字检索 27 | */ 28 | keyword_search, 29 | /** 30 | * 混合检索 31 | */ 32 | hybrid_search, 33 | 34 | /** 35 | * 语义检索 36 | */ 37 | semantic_search, 38 | 39 | /** 40 | * 全文检索 41 | */ 42 | full_text_search 43 | } 44 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/enums/document/DocFormEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.enums.document; 17 | 18 | /** 19 | * @author yanghq 20 | * @version 1.0 21 | * @since 2025/3/13 14:27 22 | */ 23 | public enum DocFormEnum { 24 | 25 | /** 26 | * text 文档直接 embedding,经济模式默认为该模式 27 | */ 28 | text_model, 29 | 30 | /** 31 | * parent-child 模式 32 | */ 33 | hierarchical_model, 34 | 35 | /** 36 | * Q&A 模式:为分片文档生成 Q&A 对,然后对问题进行 embedding 37 | */ 38 | qa_model 39 | } 40 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/enums/document/ModeEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.enums.document; 17 | 18 | /** 19 | * 清洗、分段模式 20 | * 21 | * @author yanghq 22 | * @version 1.0 23 | * @since 2025/3/13 15:21 24 | */ 25 | public enum ModeEnum { 26 | /** 27 | * 自动 28 | */ 29 | automatic, 30 | /** 31 | * 自定义 32 | */ 33 | custom, 34 | 35 | /** 36 | * parent-child 模式 37 | */ 38 | hierarchical 39 | } 40 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/enums/document/ParentModeEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.enums.document; 17 | 18 | import com.fasterxml.jackson.annotation.JsonCreator; 19 | import com.fasterxml.jackson.annotation.JsonValue; 20 | import lombok.AllArgsConstructor; 21 | import lombok.Getter; 22 | 23 | import java.util.Arrays; 24 | 25 | /** 26 | * @author yanghq 27 | * @version 1.0 28 | * @since 2025/3/13 15:19 29 | */ 30 | @Getter 31 | @AllArgsConstructor 32 | public enum ParentModeEnum { 33 | 34 | /** 35 | * 全文召回 36 | */ 37 | FULL_DOC("full-doc"), 38 | 39 | /** 40 | * 段落召回 41 | */ 42 | PARAGRAPH("paragraph"); 43 | 44 | @JsonValue 45 | private final String code; 46 | 47 | @JsonCreator 48 | public static ParentModeEnum fromCode(String code) { 49 | return Arrays.stream(values()) 50 | .filter(e -> e.code.equals(code)) 51 | .findFirst() 52 | .orElse(null); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/enums/document/PreProcessingRuleTypeEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.enums.document; 17 | 18 | /** 19 | * @author yanghq 20 | * @version 1.0 21 | * @since 2025/3/13 15:20 22 | */ 23 | public enum PreProcessingRuleTypeEnum { 24 | /** 25 | * 替换连续空格、换行符、制表符 26 | */ 27 | remove_extra_spaces, 28 | /** 29 | * 删除 URL、电子邮件地址 30 | */ 31 | remove_urls_emails 32 | } 33 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-dataset/src/main/java/io/github/guoshiqiufeng/dify/dataset/exception/DiftDatasetException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.dataset.exception; 17 | 18 | import io.github.guoshiqiufeng.dify.core.exception.BaseException; 19 | import io.github.guoshiqiufeng.dify.core.exception.BaseExceptionEnum; 20 | 21 | /** 22 | * @author yanghq 23 | * @version 1.0 24 | * @since 2025/3/13 11:38 25 | */ 26 | public class DiftDatasetException extends BaseException { 27 | 28 | public DiftDatasetException(BaseExceptionEnum abstractExceptionEnum) { 29 | super(abstractExceptionEnum); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-server/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | api project(":dify:dify-core") 3 | api "${lib["hutool-core"]}" 4 | 5 | implementation "io.projectreactor:reactor-core" 6 | implementation "org.springframework:spring-webflux" 7 | implementation "com.fasterxml.jackson.core:jackson-databind" 8 | implementation "org.springframework.boot:spring-boot-starter-data-redis" 9 | 10 | testImplementation 'org.junit.jupiter:junit-jupiter' 11 | testImplementation 'org.springframework:spring-test' 12 | } 13 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-server/src/main/java/io/github/guoshiqiufeng/dify/server/cache/DifyRedisKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.server.cache; 17 | 18 | /** 19 | * @author yanghq 20 | * @version 1.0 21 | * @since 2025/3/4 13:52 22 | */ 23 | public interface DifyRedisKey { 24 | 25 | String ACCESS_TOKEN = "dify:access_token"; 26 | 27 | String REFRESH_TOKEN = "dify:refresh_token"; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-server/src/main/java/io/github/guoshiqiufeng/dify/server/client/RequestSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.server.client; 17 | 18 | /** 19 | * Request Supplier Interface 20 | * A functional interface that represents a supplier of requests to the Dify API. 21 | * This interface is used to defer or lazily execute API requests and handle 22 | * generic request execution in a functional programming style. 23 | * 24 | * @param The type of result produced by this supplier 25 | * @author yanghq 26 | * @version 0.8.0 27 | * @since 2025/4/09 15:44 28 | */ 29 | @FunctionalInterface 30 | public interface RequestSupplier { 31 | 32 | /** 33 | * Gets a result from this supplier 34 | * 35 | * @return A result of type T 36 | */ 37 | T get(); 38 | } 39 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-server/src/main/java/io/github/guoshiqiufeng/dify/server/constant/ServerUriConstant.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.server.constant; 17 | 18 | /** 19 | * @author yanghq 20 | * @version 1.0 21 | * @since 2025/3/4 15:11 22 | */ 23 | public interface ServerUriConstant { 24 | 25 | String API = "/console/api"; 26 | 27 | String LOGIN = API + "/login"; 28 | 29 | String REFRESH_TOKEN = API + "/refresh-token"; 30 | 31 | String APPS = API + "/apps"; 32 | 33 | String DATASETS = API + "/datasets"; 34 | } 35 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-server/src/main/java/io/github/guoshiqiufeng/dify/server/dto/request/DifyLoginRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.server.dto.request; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import lombok.Data; 20 | 21 | import java.io.Serializable; 22 | 23 | /** 24 | * @author yanghq 25 | * @version 1.0 26 | * @since 2024/12/31 14:17 27 | */ 28 | @Data 29 | public class DifyLoginRequest implements Serializable { 30 | private static final long serialVersionUID = 7556073605254679649L; 31 | 32 | private String email; 33 | 34 | private String password; 35 | 36 | private String language; 37 | @JsonAlias("remember-me") 38 | private Boolean rememberMe; 39 | 40 | public static DifyLoginRequest build(String email, String password) { 41 | DifyLoginRequest vo = new DifyLoginRequest(); 42 | vo.setEmail(email); 43 | vo.setPassword(password); 44 | vo.setLanguage("zh-Hans"); 45 | vo.setRememberMe(true); 46 | return vo; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-server/src/main/java/io/github/guoshiqiufeng/dify/server/dto/response/ApiKeyResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.server.dto.response; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import lombok.Data; 20 | 21 | import java.io.Serializable; 22 | 23 | /** 24 | * @author yanghq 25 | * @version 1.0 26 | * @since 2025/1/7 17:03 27 | */ 28 | @Data 29 | public class ApiKeyResponse implements Serializable { 30 | 31 | private String id; 32 | 33 | private String type; 34 | 35 | private String token; 36 | 37 | @JsonAlias("last_used_at") 38 | private Long lastUsedAt; 39 | 40 | @JsonAlias("created_at") 41 | private Long createdAt; 42 | } 43 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-server/src/main/java/io/github/guoshiqiufeng/dify/server/dto/response/ApiKeyResultResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.server.dto.response; 17 | 18 | import io.github.guoshiqiufeng.dify.core.pojo.DifyPageResult; 19 | import lombok.Data; 20 | import lombok.EqualsAndHashCode; 21 | 22 | /** 23 | * @author yanghq 24 | * @version 1.0 25 | * @since 2025/1/7 17:11 26 | */ 27 | @Data 28 | @EqualsAndHashCode(callSuper = true) 29 | public class ApiKeyResultResponse extends DifyPageResult { 30 | } 31 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-server/src/main/java/io/github/guoshiqiufeng/dify/server/dto/response/AppsResponseResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.server.dto.response; 17 | 18 | import io.github.guoshiqiufeng.dify.core.pojo.DifyPageResult; 19 | import lombok.Data; 20 | import lombok.EqualsAndHashCode; 21 | 22 | import java.io.Serializable; 23 | 24 | /** 25 | * @author yanghq 26 | * @version 1.0 27 | * @since 2024/12/31 15:46 28 | */ 29 | @Data 30 | @EqualsAndHashCode(callSuper = true) 31 | public class AppsResponseResult extends DifyPageResult implements Serializable { 32 | 33 | 34 | private static final long serialVersionUID = -8135296664181854970L; 35 | 36 | } 37 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-server/src/main/java/io/github/guoshiqiufeng/dify/server/dto/response/DatasetApiKeyResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.server.dto.response; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import lombok.Data; 20 | 21 | import java.io.Serializable; 22 | 23 | /** 24 | * @author yanghq 25 | * @version 1.0 26 | * @since 2025/4/1 13:41 27 | */ 28 | @Data 29 | public class DatasetApiKeyResponse implements Serializable { 30 | private static final long serialVersionUID = 5622933209445579199L; 31 | 32 | private String id; 33 | 34 | private String type; 35 | 36 | private String token; 37 | 38 | @JsonAlias("last_used_at") 39 | private Long lastUsedAt; 40 | 41 | @JsonAlias("created_at") 42 | private Long createdAt; 43 | 44 | } 45 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-server/src/main/java/io/github/guoshiqiufeng/dify/server/dto/response/DatasetApiKeyResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.server.dto.response; 17 | 18 | import lombok.Data; 19 | 20 | import java.io.Serializable; 21 | import java.util.List; 22 | 23 | /** 24 | * @author yanghq 25 | * @version 1.0 26 | * @since 2025/4/1 13:41 27 | */ 28 | @Data 29 | public class DatasetApiKeyResult implements Serializable { 30 | private static final long serialVersionUID = 5622933209445579199L; 31 | 32 | private List data; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-server/src/main/java/io/github/guoshiqiufeng/dify/server/dto/response/LoginResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.server.dto.response; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import lombok.Data; 20 | 21 | import java.io.Serializable; 22 | 23 | /** 24 | * @author yanghq 25 | * @version 1.0 26 | * @since 2024/12/31 14:25 27 | */ 28 | @Data 29 | public class LoginResponse implements Serializable { 30 | 31 | 32 | private static final long serialVersionUID = -2546124702668700191L; 33 | 34 | @JsonAlias("access_token") 35 | private String accessToken; 36 | 37 | @JsonAlias("refresh_token") 38 | private String refreshToken; 39 | 40 | } 41 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-server/src/main/java/io/github/guoshiqiufeng/dify/server/dto/response/LoginResultResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.server.dto.response; 17 | 18 | 19 | import io.github.guoshiqiufeng.dify.core.pojo.DifyResult; 20 | import lombok.Data; 21 | import lombok.EqualsAndHashCode; 22 | 23 | import java.io.Serializable; 24 | 25 | /** 26 | * @author yanghq 27 | * @version 1.0 28 | * @since 2024/12/31 14:50 29 | */ 30 | @Data 31 | @EqualsAndHashCode(callSuper = true) 32 | public class LoginResultResponse extends DifyResult implements Serializable { 33 | } 34 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-server/src/main/java/io/github/guoshiqiufeng/dify/server/exception/DifyServerException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.server.exception; 17 | 18 | import io.github.guoshiqiufeng.dify.core.exception.BaseException; 19 | import io.github.guoshiqiufeng.dify.core.exception.BaseExceptionEnum; 20 | 21 | /** 22 | * @author yanghq 23 | * @version 1.0 24 | * @since 2025/3/11 14:23 25 | */ 26 | public class DifyServerException extends BaseException { 27 | 28 | public DifyServerException(BaseExceptionEnum abstractExceptionEnum) { 29 | super(abstractExceptionEnum); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-server/src/main/java/io/github/guoshiqiufeng/dify/server/exception/DifyServerExceptionEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.server.exception; 17 | 18 | import io.github.guoshiqiufeng.dify.core.exception.BaseExceptionEnum; 19 | import lombok.AllArgsConstructor; 20 | import lombok.Getter; 21 | 22 | /** 23 | * @author yanghq 24 | * @version 1.0 25 | * @since 2025/3/11 14:24 26 | */ 27 | @Getter 28 | @AllArgsConstructor 29 | public enum DifyServerExceptionEnum implements BaseExceptionEnum { 30 | 31 | /** 32 | * 数据解析失败 33 | */ 34 | DIFY_DATA_PARSING_FAILURE(39910, "数据解析失败"), 35 | 36 | /** 37 | * 远程调用失败 38 | */ 39 | DIFY_API_ERROR(29990, "远程调用失败"), 40 | ; 41 | 42 | private final Integer code; 43 | 44 | private final String msg; 45 | } 46 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-workflow/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | api project(":dify:dify-core") 3 | 4 | api "${lib["hutool-core"]}" 5 | 6 | implementation "io.projectreactor:reactor-core" 7 | implementation "org.springframework:spring-webflux" 8 | 9 | implementation "com.fasterxml.jackson.core:jackson-databind" 10 | 11 | testImplementation 'org.junit.jupiter:junit-jupiter' 12 | } 13 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-workflow/src/main/java/io/github/guoshiqiufeng/dify/workflow/constant/WorkflowConstant.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.workflow.constant; 17 | 18 | /** 19 | * 常量 20 | * 21 | * @author yanghq 22 | * @version 1.0 23 | * @since 2025/3/11 14:18 24 | */ 25 | public interface WorkflowConstant { 26 | 27 | String V1_URL = "/v1"; 28 | 29 | String WORKFLOWS_URL = V1_URL + "/workflows"; 30 | 31 | String WORKFLOW_RUN_URL = WORKFLOWS_URL + "/run"; 32 | 33 | String WORKFLOW_TASKS_URL = WORKFLOWS_URL + "/tasks"; 34 | 35 | String WORKFLOW_LOGS_URL = WORKFLOWS_URL + "/logs"; 36 | 37 | 38 | } 39 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-workflow/src/main/java/io/github/guoshiqiufeng/dify/workflow/dto/request/BaseWorkflowRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.workflow.dto.request; 17 | 18 | import lombok.Data; 19 | 20 | import java.io.Serializable; 21 | 22 | /** 23 | * @author yanghq 24 | * @version 1.0 25 | * @since 2025/3/11 14:52 26 | */ 27 | @Data 28 | public class BaseWorkflowRequest implements Serializable { 29 | private static final long serialVersionUID = 5086111414608906670L; 30 | 31 | /** 32 | * apikey 33 | */ 34 | private String apiKey; 35 | 36 | /** 37 | * 用户 id 38 | */ 39 | private String userId; 40 | } 41 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-workflow/src/main/java/io/github/guoshiqiufeng/dify/workflow/dto/request/WorkflowLogsRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.workflow.dto.request; 17 | 18 | import lombok.Data; 19 | import lombok.EqualsAndHashCode; 20 | 21 | import java.io.Serializable; 22 | 23 | /** 24 | * @author yanghq 25 | * @version 1.0 26 | * @since 2025/3/11 15:23 27 | */ 28 | @Data 29 | @EqualsAndHashCode(callSuper = true) 30 | public class WorkflowLogsRequest extends BaseWorkflowRequest implements Serializable { 31 | private static final long serialVersionUID = 3376685474776239732L; 32 | 33 | 34 | /** 35 | * 关键字 36 | */ 37 | private String keyword; 38 | 39 | /** 40 | * 执行状态 succeeded/failed/stopped 41 | */ 42 | private String status; 43 | 44 | private Integer page = 1; 45 | 46 | private Integer limit = 20; 47 | } 48 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-workflow/src/main/java/io/github/guoshiqiufeng/dify/workflow/dto/response/MetaData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.workflow.dto.response; 17 | 18 | import lombok.Data; 19 | 20 | /** 21 | * @author yanghq 22 | * @version 1.0 23 | * @since 2025/5/16 17:54 24 | */ 25 | @Data 26 | public class MetaData { 27 | 28 | private String provider; 29 | 30 | private String icon; 31 | } 32 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-workflow/src/main/java/io/github/guoshiqiufeng/dify/workflow/dto/response/WorkflowStopResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.workflow.dto.response; 17 | 18 | import lombok.Data; 19 | 20 | import java.io.Serializable; 21 | 22 | /** 23 | * @author yanghq 24 | * @version 1.0 25 | * @since 2025/3/11 15:20 26 | */ 27 | @Data 28 | public class WorkflowStopResponse implements Serializable { 29 | 30 | private static final long serialVersionUID = -819996155513448775L; 31 | private String result; 32 | } 33 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-workflow/src/main/java/io/github/guoshiqiufeng/dify/workflow/dto/response/stream/AgentLogData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.workflow.dto.response.stream; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import io.github.guoshiqiufeng.dify.workflow.dto.response.MetaData; 20 | import lombok.Data; 21 | 22 | import java.util.Map; 23 | 24 | /** 25 | * @author yanghq 26 | * @version 0.12.1 27 | * @since 2025/5/16 17:50 28 | */ 29 | @Data 30 | public class AgentLogData { 31 | @JsonAlias("node_execution_id") 32 | private String nodeExecutionId; 33 | 34 | private String id; 35 | 36 | private String label; 37 | 38 | @JsonAlias("parent_id") 39 | private String parentId; 40 | 41 | private String error; 42 | 43 | private String status; 44 | 45 | private Map data; 46 | 47 | private MetaData metadata; 48 | 49 | @JsonAlias("node_id") 50 | private String nodeId; 51 | } 52 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-workflow/src/main/java/io/github/guoshiqiufeng/dify/workflow/dto/response/stream/BaseWorkflowRunData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.workflow.dto.response.stream; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import lombok.Data; 20 | 21 | /** 22 | * @author yanghq 23 | * @version 1.0 24 | * @since 2025/3/13 10:36 25 | */ 26 | @Data 27 | public abstract class BaseWorkflowRunData { 28 | /** 29 | * Unique ID of workflow execution 30 | */ 31 | private String id; 32 | 33 | /** 34 | * Creation timestamp, e.g., 1705395332 35 | */ 36 | @JsonAlias("created_at") 37 | private Long createdAt; 38 | } 39 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-workflow/src/main/java/io/github/guoshiqiufeng/dify/workflow/dto/response/stream/ParallelBranchFinishedData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.workflow.dto.response.stream; 17 | 18 | import lombok.Data; 19 | import lombok.EqualsAndHashCode; 20 | 21 | /** 22 | * @author yanghq 23 | * @version 0.12.1 24 | * @since 2025/5/16 17:44 25 | */ 26 | @Data 27 | @EqualsAndHashCode(callSuper = true) 28 | public class ParallelBranchFinishedData extends ParallelBranchStartedData { 29 | 30 | private String status; 31 | 32 | private String error; 33 | } 34 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-workflow/src/main/java/io/github/guoshiqiufeng/dify/workflow/dto/response/stream/WorkflowStartedData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.workflow.dto.response.stream; 17 | 18 | import com.fasterxml.jackson.annotation.JsonAlias; 19 | import lombok.Data; 20 | import lombok.EqualsAndHashCode; 21 | import lombok.ToString; 22 | 23 | import java.util.Map; 24 | 25 | /** 26 | * @author yanghq 27 | * @version 1.0 28 | * @since 2025/3/13 10:40 29 | */ 30 | @Data 31 | @EqualsAndHashCode(callSuper = true) 32 | @ToString(callSuper = true) 33 | public class WorkflowStartedData extends BaseWorkflowRunData { 34 | 35 | /** 36 | * ID of related workflow 37 | */ 38 | @JsonAlias("workflow_id") 39 | private String workflowId; 40 | 41 | /** 42 | * Self-increasing serial number, self-increasing in the App, starting from 1 43 | */ 44 | @JsonAlias("sequence_number") 45 | private Integer sequenceNumber; 46 | 47 | private Map inputs; 48 | 49 | } 50 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-workflow/src/main/java/io/github/guoshiqiufeng/dify/workflow/exception/DifyWorkflowException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.workflow.exception; 17 | 18 | import io.github.guoshiqiufeng.dify.core.exception.BaseException; 19 | import io.github.guoshiqiufeng.dify.core.exception.BaseExceptionEnum; 20 | 21 | /** 22 | * @author yanghq 23 | * @version 1.0 24 | * @since 2025/3/11 14:23 25 | */ 26 | public class DifyWorkflowException extends BaseException { 27 | 28 | public DifyWorkflowException(BaseExceptionEnum abstractExceptionEnum) { 29 | super(abstractExceptionEnum); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /dify/dify-support/dify-support-workflow/src/main/java/io/github/guoshiqiufeng/dify/workflow/exception/DifyWorkflowExceptionEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.workflow.exception; 17 | 18 | import io.github.guoshiqiufeng.dify.core.exception.BaseExceptionEnum; 19 | import lombok.AllArgsConstructor; 20 | import lombok.Getter; 21 | 22 | /** 23 | * @author yanghq 24 | * @version 1.0 25 | * @since 2025/3/11 14:24 26 | */ 27 | @Getter 28 | @AllArgsConstructor 29 | public enum DifyWorkflowExceptionEnum implements BaseExceptionEnum { 30 | 31 | /** 32 | * 数据解析失败 33 | */ 34 | DIFY_DATA_PARSING_FAILURE(39910, "数据解析失败"), 35 | 36 | /** 37 | * 远程调用失败 38 | */ 39 | DIFY_API_ERROR(29990, "远程调用失败"), 40 | ; 41 | 42 | private final Integer code; 43 | 44 | private final String msg; 45 | } 46 | -------------------------------------------------------------------------------- /dify/spring-boot-starter/build.gradle: -------------------------------------------------------------------------------- 1 | subprojects { 2 | compileJava { 3 | options.release = 17 4 | } 5 | } 6 | tasks.matching { 7 | it.name == 'publishToMavenCentralPortal' 8 | || it.name == 'publishMavenJavaPublicationToLocalRepository' 9 | || it.group == 'publishing' 10 | }.each { it.enabled = false } 11 | -------------------------------------------------------------------------------- /dify/spring-boot-starter/dify-spring-boot-starter-autoconfigure/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | implementation project(":dify:dify-support:dify-support-chat") 3 | implementation project(":dify:dify-support:dify-support-dataset") 4 | implementation project(":dify:dify-support:dify-support-server") 5 | implementation project(":dify:dify-support:dify-support-workflow") 6 | 7 | api project(":dify:dify-client:dify-client-spring6") 8 | 9 | api 'org.springframework.boot:spring-boot-starter-reactor-netty' 10 | 11 | implementation "org.springframework.boot:spring-boot-starter-data-redis" 12 | 13 | implementation "org.springframework.boot:spring-boot-autoconfigure" 14 | annotationProcessor "org.springframework.boot:spring-boot-starter-actuator" 15 | annotationProcessor "org.springframework.boot:spring-boot-configuration-processor" 16 | 17 | testImplementation "org.springframework.boot:spring-boot-starter-test" 18 | 19 | testImplementation "org.mockito:mockito-core:${mockitoVersion}" 20 | testImplementation "org.mockito:mockito-junit-jupiter:${mockitoVersion}" 21 | testImplementation "net.bytebuddy:byte-buddy:${bytebuddyVersion}" 22 | testImplementation "net.bytebuddy:byte-buddy-agent:${bytebuddyVersion}" 23 | testImplementation "io.projectreactor:reactor-test" 24 | } 25 | -------------------------------------------------------------------------------- /dify/spring-boot-starter/dify-spring-boot-starter-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports: -------------------------------------------------------------------------------- 1 | io.github.guoshiqiufeng.dify.springboot.autoconfigure.DifyPropertiesAutoConfiguration 2 | io.github.guoshiqiufeng.dify.springboot.autoconfigure.DifyChatAutoConfiguration 3 | io.github.guoshiqiufeng.dify.springboot.autoconfigure.DifyDatasetAutoConfiguration 4 | io.github.guoshiqiufeng.dify.springboot.autoconfigure.DifyServerRedisTokenAutoConfiguration 5 | io.github.guoshiqiufeng.dify.springboot.autoconfigure.DifyServerAutoConfiguration 6 | io.github.guoshiqiufeng.dify.springboot.autoconfigure.DifyWorkflowAutoConfiguration 7 | -------------------------------------------------------------------------------- /dify/spring-boot-starter/dify-spring-boot-starter-chat/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | api project(":dify:spring-boot-starter:dify-spring-boot-starter-autoconfigure") 3 | 4 | api project(":dify:dify-support:dify-support-chat") 5 | 6 | annotationProcessor "org.springframework.boot:spring-boot-starter-actuator" 7 | annotationProcessor "org.springframework.boot:spring-boot-configuration-processor" 8 | 9 | testImplementation "org.springframework.boot:spring-boot-starter-test" 10 | } 11 | -------------------------------------------------------------------------------- /dify/spring-boot-starter/dify-spring-boot-starter-dataset/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | api project(":dify:spring-boot-starter:dify-spring-boot-starter-autoconfigure") 3 | 4 | 5 | api project(":dify:dify-support:dify-support-dataset") 6 | 7 | 8 | annotationProcessor "org.springframework.boot:spring-boot-starter-actuator" 9 | annotationProcessor "org.springframework.boot:spring-boot-configuration-processor" 10 | 11 | testImplementation "org.springframework.boot:spring-boot-starter-test" 12 | } 13 | -------------------------------------------------------------------------------- /dify/spring-boot-starter/dify-spring-boot-starter-server/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | api project(":dify:spring-boot-starter:dify-spring-boot-starter-autoconfigure") 3 | 4 | api project(":dify:dify-support:dify-support-server") 5 | 6 | implementation "org.springframework.boot:spring-boot-starter-data-redis" 7 | 8 | annotationProcessor "org.springframework.boot:spring-boot-starter-actuator" 9 | annotationProcessor "org.springframework.boot:spring-boot-configuration-processor" 10 | 11 | testImplementation "org.springframework.boot:spring-boot-starter-test" 12 | } 13 | -------------------------------------------------------------------------------- /dify/spring-boot-starter/dify-spring-boot-starter-workflow/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | api project(":dify:spring-boot-starter:dify-spring-boot-starter-autoconfigure") 3 | 4 | api project(":dify:dify-support:dify-support-workflow") 5 | 6 | annotationProcessor "org.springframework.boot:spring-boot-starter-actuator" 7 | annotationProcessor "org.springframework.boot:spring-boot-configuration-processor" 8 | 9 | testImplementation "org.springframework.boot:spring-boot-starter-test" 10 | } 11 | -------------------------------------------------------------------------------- /dify/spring-boot-starter/dify-spring-boot-starter/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | api project(":dify:spring-boot-starter:dify-spring-boot-starter-autoconfigure") 3 | 4 | api project(":dify:dify-support:dify-support-chat") 5 | api project(":dify:dify-support:dify-support-dataset") 6 | api project(":dify:dify-support:dify-support-server") 7 | api project(":dify:dify-support:dify-support-workflow") 8 | 9 | implementation "org.springframework.boot:spring-boot-starter-data-redis" 10 | 11 | annotationProcessor "org.springframework.boot:spring-boot-starter-actuator" 12 | annotationProcessor "org.springframework.boot:spring-boot-configuration-processor" 13 | 14 | testImplementation "org.springframework.boot:spring-boot-starter-test" 15 | testImplementation 'org.junit.jupiter:junit-jupiter' 16 | testImplementation 'org.testcontainers:junit-jupiter' 17 | testImplementation "io.projectreactor:reactor-test" 18 | testImplementation "org.apache.httpcomponents.client5:httpclient5" 19 | testImplementation "${lib["hutool-json"]}" 20 | } 21 | -------------------------------------------------------------------------------- /dify/spring-boot-starter/dify-spring-boot-starter/src/test/java/io/github/guoshiqiufeng/dify/boot/base/BaseServerContainerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.boot.base; 17 | 18 | import lombok.extern.slf4j.Slf4j; 19 | 20 | /** 21 | * @author yanghq 22 | * @version 1.0 23 | * @since 2025/4/1 13:27 24 | */ 25 | @Slf4j 26 | public abstract class BaseServerContainerTest implements RedisContainerTest { 27 | 28 | } 29 | -------------------------------------------------------------------------------- /dify/spring-boot-starter/dify-spring-boot-starter/src/test/java/io/github/guoshiqiufeng/dify/boot/base/BaseWorkflowContainerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.boot.base; 17 | 18 | import io.github.guoshiqiufeng.dify.server.DifyServer; 19 | import jakarta.annotation.Resource; 20 | import lombok.extern.slf4j.Slf4j; 21 | 22 | /** 23 | * @author yanghq 24 | * @version 1.0 25 | * @since 2025/4/1 13:27 26 | */ 27 | @Slf4j 28 | public abstract class BaseWorkflowContainerTest implements RedisContainerTest { 29 | 30 | @Resource 31 | DifyServer difyServer; 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /dify/spring-boot-starter/dify-spring-boot-starter/src/test/resources/application.yml: -------------------------------------------------------------------------------- 1 | dify: 2 | url: http://localhost 3 | server: 4 | email: admin@admin.com 5 | password: admin123456 6 | dataset: 7 | api-key: dataset-aaabbbcccdddeeefffggghhh 8 | logging: 9 | level: 10 | root: ERROR 11 | io.github.guoshiqiufeng.dify: DEBUG 12 | -------------------------------------------------------------------------------- /dify/spring-boot2-starter/build.gradle: -------------------------------------------------------------------------------- 1 | tasks.matching { 2 | it.name == 'publishToMavenCentralPortal' 3 | || it.name == 'publishMavenJavaPublicationToLocalRepository' 4 | || it.group == 'publishing' 5 | }.each { it.enabled = false } 6 | -------------------------------------------------------------------------------- /dify/spring-boot2-starter/dify-spring-boot2-starter-autoconfigure/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | implementation project(":dify:dify-support:dify-support-chat") 3 | implementation project(":dify:dify-support:dify-support-dataset") 4 | implementation project(":dify:dify-support:dify-support-server") 5 | implementation project(":dify:dify-support:dify-support-workflow") 6 | 7 | api project(":dify:dify-client:dify-client-spring5") 8 | 9 | api 'org.springframework.boot:spring-boot-starter-reactor-netty' 10 | 11 | implementation "org.springframework.boot:spring-boot-starter-data-redis" 12 | 13 | implementation "org.springframework.boot:spring-boot-autoconfigure" 14 | annotationProcessor "org.springframework.boot:spring-boot-starter-actuator" 15 | annotationProcessor "org.springframework.boot:spring-boot-configuration-processor" 16 | 17 | testImplementation "org.springframework.boot:spring-boot-starter-test" 18 | 19 | testImplementation "org.mockito:mockito-core:${mockitoVersion}" 20 | testImplementation "org.mockito:mockito-junit-jupiter:${mockitoVersion}" 21 | testImplementation "net.bytebuddy:byte-buddy:${bytebuddyVersion}" 22 | testImplementation "net.bytebuddy:byte-buddy-agent:${bytebuddyVersion}" 23 | testImplementation "io.projectreactor:reactor-test" 24 | } 25 | -------------------------------------------------------------------------------- /dify/spring-boot2-starter/dify-spring-boot2-starter-autoconfigure/src/main/java/io/github/guoshiqiufeng/dify/springboot2/autoconfigure/DifyConnectionDetails.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.springboot2.autoconfigure; 17 | 18 | /** 19 | * Dify Connection Details Interface 20 | * Provides connection information required to establish a connection to the Dify API. 21 | * This interface is used by the Spring Boot auto-configuration to set up Dify clients 22 | * with the appropriate connection settings. 23 | * 24 | * @author yanghq 25 | * @version 0.9.0 26 | * @since 2025/4/7 16:53 27 | */ 28 | public interface DifyConnectionDetails { 29 | 30 | /** 31 | * Retrieves the URL of the Dify API server 32 | * 33 | * @return The base URL string for the Dify API endpoint 34 | */ 35 | String getUrl(); 36 | } 37 | -------------------------------------------------------------------------------- /dify/spring-boot2-starter/dify-spring-boot2-starter-autoconfigure/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | io.github.guoshiqiufeng.dify.springboot2.autoconfigure.DifyPropertiesAutoConfiguration,\ 3 | io.github.guoshiqiufeng.dify.springboot2.autoconfigure.DifyChatAutoConfiguration,\ 4 | io.github.guoshiqiufeng.dify.springboot2.autoconfigure.DifyDatasetAutoConfiguration,\ 5 | io.github.guoshiqiufeng.dify.springboot2.autoconfigure.DifyServerAutoConfiguration,\ 6 | io.github.guoshiqiufeng.dify.springboot2.autoconfigure.DifyWorkflowAutoConfiguration 7 | -------------------------------------------------------------------------------- /dify/spring-boot2-starter/dify-spring-boot2-starter-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports: -------------------------------------------------------------------------------- 1 | io.github.guoshiqiufeng.dify.springboot2.autoconfigure.DifyPropertiesAutoConfiguration 2 | io.github.guoshiqiufeng.dify.springboot2.autoconfigure.DifyChatAutoConfiguration 3 | io.github.guoshiqiufeng.dify.springboot2.autoconfigure.DifyDatasetAutoConfiguration 4 | io.github.guoshiqiufeng.dify.springboot2.autoconfigure.DifyServerAutoConfiguration 5 | io.github.guoshiqiufeng.dify.springboot2.autoconfigure.DifyWorkflowAutoConfiguration 6 | -------------------------------------------------------------------------------- /dify/spring-boot2-starter/dify-spring-boot2-starter-chat/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | api project(":dify:spring-boot2-starter:dify-spring-boot2-starter-autoconfigure") 3 | 4 | api project(":dify:dify-support:dify-support-chat") 5 | 6 | annotationProcessor "org.springframework.boot:spring-boot-starter-actuator" 7 | annotationProcessor "org.springframework.boot:spring-boot-configuration-processor" 8 | 9 | testImplementation "org.springframework.boot:spring-boot-starter-test" 10 | } 11 | -------------------------------------------------------------------------------- /dify/spring-boot2-starter/dify-spring-boot2-starter-dataset/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | api project(":dify:spring-boot2-starter:dify-spring-boot2-starter-autoconfigure") 3 | 4 | 5 | api project(":dify:dify-support:dify-support-dataset") 6 | 7 | 8 | annotationProcessor "org.springframework.boot:spring-boot-starter-actuator" 9 | annotationProcessor "org.springframework.boot:spring-boot-configuration-processor" 10 | 11 | testImplementation "org.springframework.boot:spring-boot-starter-test" 12 | } 13 | -------------------------------------------------------------------------------- /dify/spring-boot2-starter/dify-spring-boot2-starter-server/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | api project(":dify:spring-boot2-starter:dify-spring-boot2-starter-autoconfigure") 3 | 4 | api project(":dify:dify-support:dify-support-server") 5 | 6 | implementation "org.springframework.boot:spring-boot-starter-data-redis" 7 | 8 | annotationProcessor "org.springframework.boot:spring-boot-starter-actuator" 9 | annotationProcessor "org.springframework.boot:spring-boot-configuration-processor" 10 | 11 | testImplementation "org.springframework.boot:spring-boot-starter-test" 12 | } 13 | -------------------------------------------------------------------------------- /dify/spring-boot2-starter/dify-spring-boot2-starter-workflow/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | api project(":dify:spring-boot2-starter:dify-spring-boot2-starter-autoconfigure") 3 | 4 | api project(":dify:dify-support:dify-support-workflow") 5 | 6 | annotationProcessor "org.springframework.boot:spring-boot-starter-actuator" 7 | annotationProcessor "org.springframework.boot:spring-boot-configuration-processor" 8 | 9 | testImplementation "org.springframework.boot:spring-boot-starter-test" 10 | } 11 | -------------------------------------------------------------------------------- /dify/spring-boot2-starter/dify-spring-boot2-starter/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | api project(":dify:spring-boot2-starter:dify-spring-boot2-starter-autoconfigure") 3 | 4 | api project(":dify:dify-support:dify-support-chat") 5 | api project(":dify:dify-support:dify-support-dataset") 6 | api project(":dify:dify-support:dify-support-server") 7 | api project(":dify:dify-support:dify-support-workflow") 8 | 9 | implementation "org.springframework.boot:spring-boot-starter-data-redis" 10 | 11 | annotationProcessor "org.springframework.boot:spring-boot-starter-actuator" 12 | annotationProcessor "org.springframework.boot:spring-boot-configuration-processor" 13 | 14 | testImplementation "org.springframework.boot:spring-boot-starter-test" 15 | testImplementation 'org.junit.jupiter:junit-jupiter' 16 | testImplementation 'org.testcontainers:junit-jupiter' 17 | testImplementation "io.projectreactor:reactor-test" 18 | testImplementation "org.apache.httpcomponents.client5:httpclient5" 19 | testImplementation "${lib["hutool-json"]}" 20 | } 21 | -------------------------------------------------------------------------------- /dify/spring-boot2-starter/dify-spring-boot2-starter/src/test/java/io/github/guoshiqiufeng/dify/boot/application/DifyTestSpringBootApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.boot.application; 17 | 18 | import org.springframework.boot.SpringApplication; 19 | import org.springframework.boot.autoconfigure.SpringBootApplication; 20 | 21 | /** 22 | * @author yanghq 23 | * @version 1.0 24 | * @since 2025/3/31 09:42 25 | */ 26 | @SpringBootApplication(excludeName = "io.github.guoshiqiufeng.dify.boot") 27 | public class DifyTestSpringBootApplication { 28 | 29 | public static void main(String[] args) { 30 | SpringApplication.run(DifyTestSpringBootApplication.class, args); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /dify/spring-boot2-starter/dify-spring-boot2-starter/src/test/java/io/github/guoshiqiufeng/dify/boot/base/BaseServerContainerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.boot.base; 17 | 18 | import lombok.extern.slf4j.Slf4j; 19 | 20 | /** 21 | * @author yanghq 22 | * @version 1.0 23 | * @since 2025/4/1 13:27 24 | */ 25 | @Slf4j 26 | public abstract class BaseServerContainerTest implements RedisContainerTest { 27 | 28 | } 29 | -------------------------------------------------------------------------------- /dify/spring-boot2-starter/dify-spring-boot2-starter/src/test/java/io/github/guoshiqiufeng/dify/boot/base/BaseWorkflowContainerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2025-2025, fubluesky (fubluesky@foxmail.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.github.guoshiqiufeng.dify.boot.base; 17 | 18 | import io.github.guoshiqiufeng.dify.server.DifyServer; 19 | import lombok.extern.slf4j.Slf4j; 20 | 21 | import javax.annotation.Resource; 22 | 23 | /** 24 | * @author yanghq 25 | * @version 1.0 26 | * @since 2025/4/1 13:27 27 | */ 28 | @Slf4j 29 | public abstract class BaseWorkflowContainerTest implements RedisContainerTest { 30 | 31 | @Resource 32 | DifyServer difyServer; 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /dify/spring-boot2-starter/dify-spring-boot2-starter/src/test/resources/application.yml: -------------------------------------------------------------------------------- 1 | dify: 2 | url: http://localhost 3 | server: 4 | email: admin@admin.com 5 | password: admin123456 6 | dataset: 7 | api-key: dataset-aaabbbcccdddeeefffggghhh 8 | logging: 9 | level: 10 | root: ERROR 11 | io.github.guoshiqiufeng.dify: DEBUG 12 | -------------------------------------------------------------------------------- /docs/.vuepress/client.js: -------------------------------------------------------------------------------- 1 | import {provide} from "vue" 2 | import {defineClientConfig} from "vuepress/client"; 3 | import {version} from '../../package.json' 4 | 5 | export default defineClientConfig({ 6 | setup() { 7 | console.log("version:" + version) 8 | provide('version', version) 9 | }, 10 | }) 11 | -------------------------------------------------------------------------------- /docs/.vuepress/public/images/f.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guoshiqiufeng/dify-spring-boot-starter/30798f6f065a9eb63e107f22412051b9399de6c5/docs/.vuepress/public/images/f.ico -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | --- 2 | lang: zh-CN 3 | home: true 4 | title: 首页 5 | #heroImage: /images/logo.png 6 | actions: 7 | - text: 快速开始 8 | link: /guide/getting-started.html 9 | type: primary 10 | - text: 项目简介 11 | link: /guide/introduction.html 12 | type: secondary 13 | features: 14 | - title: 统一规范 15 | details: 基于Dify 接口 规范开发 16 | - title: 快速集成 17 | details: 基于Spring Boot 快速集成。 18 | footer: Apache License 2.0 | Copyright © 2024-present fubluesky 19 | --- 20 | 21 | ### 最新版本 22 | 23 |

24 | 25 | [![Maven central](https://img.shields.io/maven-central/v/io.github.guoshiqiufeng.dify/dify-spring-boot-starter.svg?style=flat-square)](https://search.maven.org/search?q=g:io.github.guoshiqiufeng.dify%20AND%20a:dify-spring-boot-starter) 26 | [![GitHub release](https://img.shields.io/github/release/guoshiqiufeng/dify-spring-boot-starter.svg)](https://github.com/guoshiqiufeng/dify-spring-boot-starter) 27 | 28 |
29 | -------------------------------------------------------------------------------- /docs/config/custom.md: -------------------------------------------------------------------------------- 1 | --- 2 | lang: zh-CN 3 | title: 自定义配置 4 | description: 5 | --- 6 | 7 | # 自定义配置 8 | 9 | ## Client 10 | 11 | > springboot3 使用 WebClient + RestClient,springboot2 使用 WebClient 12 | 13 | ### WebClient 14 | 15 | > 支持自定义 webClientBuilder,覆盖默认实例 16 | 17 | ```java 18 | 19 | @Bean 20 | public WebClient.Builder webClientBuilder() { 21 | HttpClient httpClient = HttpClient.create() 22 | .protocol(HttpProtocol.HTTP11); 23 | return WebClient.builder() 24 | .defaultHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) 25 | .clientConnector(new ReactorClientHttpConnector(httpClient)) 26 | ; 27 | } 28 | ``` 29 | 30 | ### RestClient 31 | 32 | > 支持自定义 restClientBuilder,覆盖默认实例 33 | 34 | ```java 35 | 36 | @Bean 37 | public RestClient.Builder restClientBuilder() { 38 | return RestClient.builder() 39 | .defaultHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) 40 | ; 41 | } 42 | ``` 43 | -------------------------------------------------------------------------------- /docs/config/introduction.md: -------------------------------------------------------------------------------- 1 | --- 2 | lang: zh-CN 3 | title: 使用配置 4 | description: 5 | --- 6 | 7 | ## Spring Boot 2/3 8 | 9 | ```yaml 10 | dify: 11 | url: http://192.168.1.10 # 请替换为实际的 Dify 服务地址 12 | server: 13 | email: admin@admin.com # 请替换为实际的 Dify 服务邮箱,若不需要调用 server相关接口可不填 14 | password: admin123456 # 请替换为实际的 Dify 服务密码,若不需要调用 server相关接口可不填 15 | dataset: 16 | api-key: dataset-aaabbbcccdddeeefffggghhh # 请替换为实际的知识库api-key, 若不需要调用知识库可不填 17 | ``` 18 | 19 | ### dify 20 | 21 | #### url 22 | 23 | - 类型:`String` 24 | - 默认值:`` 25 | - 必填 26 | - 描述:Dify 服务地址 27 | 28 | #### server 29 | 30 | ##### email 31 | 32 | - 类型:`String` 33 | - 默认值:`` 34 | - 非必填 35 | - 描述:Dify 服务邮箱,若不需要调用 server相关接口可不填 36 | 37 | ##### password 38 | 39 | - 类型:`String` 40 | - 默认值:`` 41 | - 非必填 42 | - 描述:Dify 服务密码,若不需要调用 server相关接口可不填 43 | 44 | #### dataset 45 | 46 | ##### api-key 47 | 48 | - 类型:`String` 49 | - 默认值:`` 50 | - 非必填 51 | - 描述:知识库api-key,若不需要调用知识库可不填 52 | 53 | #### clientConfig 54 | 55 | > 发起请求相关配置 56 | 57 | ##### skipNull 58 | 59 | - 类型:`Boolean` 60 | - 默认值:`true` 61 | - 非必填 62 | - 描述:是否跳过null字段,默认提交数据时,会过滤掉null字段 63 | 64 | ##### logging 65 | 66 | - 类型:`Boolean` 67 | - 默认值:`true` 68 | - 非必填 69 | - 描述:是否打印请求日志,开启此参数并配置`io.github.guoshiqiufeng.dify.client`日志级别为 debug则打印请求、响应日志 70 | 71 | -------------------------------------------------------------------------------- /docs/en/README.md: -------------------------------------------------------------------------------- 1 | --- 2 | lang: en-US 3 | home: true 4 | title: Home 5 | #heroImage: /images/f.png 6 | actions: 7 | - text: Get Started 8 | link: /en/guide/getting-started.html 9 | type: primary 10 | - text: Project Introduction 11 | link: /en/guide/introduction.html 12 | type: secondary 13 | features: 14 | - title: Standardize 15 | details: Developed based on the Dify interface specification 16 | - title: Rapid Integration 17 | details: Fast integration based on Spring Boot. 18 | footer: Apache License 2.0 | Copyright © 2024-present fubluesky 19 | --- 20 | 21 | ### Latest version 22 | 23 |
24 | 25 | [![Maven central](https://img.shields.io/maven-central/v/io.github.guoshiqiufeng.dify/dify-spring-boot-starter.svg?style=flat-square)](https://search.maven.org/search?q=g:io.github.guoshiqiufeng.dify%20AND%20a:dify-spring-boot-starter) 26 | [![GitHub release](https://img.shields.io/github/release/guoshiqiufeng/dify-spring-boot-starter.svg)](https://github.com/guoshiqiufeng/dify-spring-boot-starter) 27 | 28 |
29 | -------------------------------------------------------------------------------- /docs/en/config/custom.md: -------------------------------------------------------------------------------- 1 | --- 2 | lang: en-US 3 | title: Customized Configuration 4 | description: 5 | --- 6 | 7 | # Customized Configuration 8 | 9 | ## Client 10 | 11 | > springboot3 uses WebClient + RestClient, springboot2 uses WebClient. 12 | 13 | ### WebClient 14 | 15 | > Support for custom webClientBuilder, overriding the default instance 16 | 17 | ```java 18 | 19 | @Bean 20 | public WebClient.Builder webClientBuilder() { 21 | HttpClient httpClient = HttpClient.create() 22 | .protocol(HttpProtocol.HTTP11); 23 | return WebClient.builder() 24 | .defaultHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) 25 | .clientConnector(new ReactorClientHttpConnector(httpClient)) 26 | ; 27 | } 28 | ``` 29 | 30 | ### RestClient 31 | 32 | > Support for custom restClientBuilder, overriding the default instance 33 | 34 | ```java 35 | 36 | @Bean 37 | public RestClient.Builder restClientBuilder() { 38 | return RestClient.builder() 39 | .defaultHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) 40 | ; 41 | } 42 | ``` 43 | -------------------------------------------------------------------------------- /docs/en/guide/config.md: -------------------------------------------------------------------------------- 1 | --- 2 | lang: en-US 3 | title: Configure 4 | description: Configure 5 | --- 6 | 7 | # Configure 8 | 9 | [dify-spring-boot-starter](https://github.com/guoshiqiufeng/dify-spring-boot-starter) is very easy to configure, we 10 | just need some simple configuration! 11 | 12 | > ake sure you have dify-spring-boot-starter,installed,if you haven't, check out the [Install](install.md)。 13 | 14 | ## Configuration parameters 15 | 16 | ### `application.yml` Configure connection parameters 17 | 18 | ```yaml 19 | dify: 20 | url: http://192.168.1.10 # Please replace with the actual Dify service address 21 | server: 22 | email: admin@admin.com # Please replace the actual Dify service mailbox, if you do not need to call the server-related interfaces can not be filled in! 23 | password: admin123456 # Please replace the password with the actual Dify service password, if you don't need to call the server-related interfaces can not be filled in! 24 | dataset: 25 | api-key: dataset-aaabbbcccdddeeefffggghhh # Please replace with the actual Dify dataset API key, if you don't need to call the dataset-related interfaces can not be filled in! 26 | ``` 27 | 28 | -------------------------------------------------------------------------------- /docs/guide/config.md: -------------------------------------------------------------------------------- 1 | --- 2 | lang: zh-cn 3 | title: 配置 4 | description: 5 | --- 6 | 7 | # 配置 8 | 9 | [dify-spring-boot-starter](https://github.com/guoshiqiufeng/dify-spring-boot-starter) 的配置异常的简单,我们仅需要一些简单的配置即可! 10 | 11 | > 请确保您已经安装了 dify-spring-boot-starter,如果您尚未安装,请查看 [安装](install.md)。 12 | 13 | ## 配置参数 14 | 15 | ### `application.yml` 配置 连接参数 16 | 17 | ```yaml 18 | dify: 19 | url: http://192.168.1.10 # 请替换为实际的 Dify 服务地址 20 | server: 21 | email: admin@admin.com # 请替换为实际的 Dify 服务邮箱,若不需要调用 server相关接口可不填 22 | password: admin123456 # 请替换为实际的 Dify 服务密码,若不需要调用 server相关接口可不填 23 | dataset: 24 | api-key: dataset-aaabbbcccdddeeefffggghhh # 请替换为实际的知识库api-key, 若不需要调用知识库可不填 25 | ``` 26 | 27 | -------------------------------------------------------------------------------- /ext.gradle: -------------------------------------------------------------------------------- 1 | ext { 2 | configuration = [ 3 | javaVersion = JavaVersion.VERSION_21 4 | ] 5 | 6 | libraries = [ 7 | springBoot3Version = '3.4.5', 8 | springBoot2Version = '2.7.18', 9 | hutoolVersion = '5.8.38', 10 | testcontainersVersion = '1.20.6', 11 | mockitoVersion = '5.17.0', 12 | bytebuddyVersion = '1.15.11' 13 | ] 14 | 15 | lib = [ 16 | "hutool-core": "cn.hutool:hutool-core:${hutoolVersion}", 17 | "hutool-json": "cn.hutool:hutool-json:${hutoolVersion}" 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # {x-release-please-start-version} 2 | APP_VERSION=1.1.0-SNAPSHOT 3 | # {x-release-please-end-version} 4 | APP_GROUP=io.github.guoshiqiufeng.dify 5 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/guoshiqiufeng/dify-spring-boot-starter/30798f6f065a9eb63e107f22412051b9399de6c5/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /header.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2025-${year}, fubluesky (fubluesky@foxmail.com) 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /lombok.config: -------------------------------------------------------------------------------- 1 | config.stopBubbling = true 2 | lombok.addLombokGeneratedAnnotation = true 3 | --------------------------------------------------------------------------------