dify-oapi2 0.4.0__py3-none-any.whl → 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dify_oapi/api/chat/v1/model/__init__.py +37 -0
- dify_oapi/api/chat/v1/model/agent_thought.py +69 -0
- dify_oapi/api/chat/v1/model/annotation_info.py +43 -0
- dify_oapi/api/{completion/v1/model/info → chat/v1/model}/app_info.py +6 -14
- dify_oapi/api/chat/v1/model/app_parameters.py +494 -0
- dify_oapi/api/chat/v1/model/chat_file.py +53 -0
- dify_oapi/api/chat/v1/model/chat_request_body.py +26 -13
- dify_oapi/api/chat/v1/model/chat_response.py +13 -2
- dify_oapi/api/chat/v1/model/chat_types.py +65 -0
- dify_oapi/api/chat/v1/model/configure_annotation_reply_request.py +37 -0
- dify_oapi/api/chat/v1/model/configure_annotation_reply_request_body.py +39 -0
- dify_oapi/api/chat/v1/model/configure_annotation_reply_response.py +10 -0
- dify_oapi/api/chat/v1/model/conversation_info.py +57 -0
- dify_oapi/api/chat/v1/model/conversation_variable.py +55 -0
- dify_oapi/api/chat/v1/model/create_annotation_request.py +30 -0
- dify_oapi/api/chat/v1/model/create_annotation_request_body.py +32 -0
- dify_oapi/api/chat/v1/model/create_annotation_response.py +9 -0
- dify_oapi/api/chat/v1/model/delete_annotation_request.py +26 -0
- dify_oapi/api/chat/v1/model/delete_annotation_response.py +7 -0
- dify_oapi/api/{completion/v1/model/feedback → chat/v1/model}/feedback_info.py +29 -7
- dify_oapi/api/{completion/v1/model/file → chat/v1/model}/file_info.py +6 -0
- dify_oapi/api/chat/v1/model/get_annotation_reply_status_request.py +32 -0
- dify_oapi/api/chat/v1/model/get_annotation_reply_status_response.py +11 -0
- dify_oapi/api/chat/v1/model/get_conversation_list_request.py +25 -24
- dify_oapi/api/chat/v1/model/get_conversation_list_response.py +4 -15
- dify_oapi/api/chat/v1/model/get_conversation_variables_request.py +54 -0
- dify_oapi/api/chat/v1/model/get_conversation_variables_response.py +10 -0
- dify_oapi/api/chat/v1/model/get_conversations_request.py +49 -0
- dify_oapi/api/chat/v1/model/get_suggested_questions_request.py +36 -0
- dify_oapi/api/chat/v1/model/{message_suggested_response.py → get_suggested_questions_response.py} +1 -1
- dify_oapi/api/chat/v1/model/list_annotations_request.py +32 -0
- dify_oapi/api/chat/v1/model/list_annotations_response.py +11 -0
- dify_oapi/api/chat/v1/model/message_file.py +46 -0
- dify_oapi/api/chat/v1/model/message_history_request.py +24 -24
- dify_oapi/api/chat/v1/model/message_history_response.py +4 -43
- dify_oapi/api/chat/v1/model/message_info.py +73 -0
- dify_oapi/api/chat/v1/model/pagination_info.py +44 -0
- dify_oapi/api/chat/v1/model/rename_conversation_request_body.py +1 -1
- dify_oapi/api/chat/v1/model/retriever_resource.py +64 -0
- dify_oapi/api/chat/v1/model/site_settings.py +92 -0
- dify_oapi/api/chat/v1/model/text_to_audio_response.py +7 -0
- dify_oapi/api/chat/v1/model/tool_icon.py +52 -0
- dify_oapi/api/chat/v1/model/update_annotation_request.py +34 -0
- dify_oapi/api/chat/v1/model/update_annotation_request_body.py +32 -0
- dify_oapi/api/chat/v1/model/update_annotation_response.py +9 -0
- dify_oapi/api/{completion/v1/model/file → chat/v1/model}/upload_file_request_body.py +9 -3
- dify_oapi/api/chat/v1/model/usage_info.py +84 -0
- dify_oapi/api/chat/v1/resource/__init__.py +1 -4
- dify_oapi/api/chat/v1/resource/annotation.py +87 -0
- dify_oapi/api/chat/v1/resource/chat.py +47 -25
- dify_oapi/api/chat/v1/resource/conversation.py +45 -33
- dify_oapi/api/chat/v1/resource/message.py +22 -20
- dify_oapi/api/chat/v1/version.py +18 -5
- dify_oapi/api/chatflow/__init__.py +0 -0
- dify_oapi/api/chatflow/service.py +8 -0
- dify_oapi/api/chatflow/v1/__init__.py +0 -0
- dify_oapi/api/chatflow/v1/model/__init__.py +0 -0
- dify_oapi/api/chatflow/v1/model/annotation_info.py +43 -0
- dify_oapi/api/chatflow/v1/model/annotation_reply_settings_request.py +37 -0
- dify_oapi/api/chatflow/v1/model/annotation_reply_settings_request_body.py +33 -0
- dify_oapi/api/chatflow/v1/model/annotation_reply_settings_response.py +10 -0
- dify_oapi/api/chatflow/v1/model/annotation_reply_status_request.py +36 -0
- dify_oapi/api/chatflow/v1/model/annotation_reply_status_response.py +11 -0
- dify_oapi/api/chatflow/v1/model/app_info.py +33 -0
- dify_oapi/api/chatflow/v1/model/app_parameters.py +276 -0
- dify_oapi/api/chatflow/v1/model/chat_file.py +40 -0
- dify_oapi/api/chatflow/v1/model/chat_message.py +88 -0
- dify_oapi/api/chatflow/v1/model/chatflow_types.py +210 -0
- dify_oapi/api/chatflow/v1/model/conversation_info.py +53 -0
- dify_oapi/api/chatflow/v1/model/conversation_variable.py +55 -0
- dify_oapi/api/chatflow/v1/model/create_annotation_request.py +30 -0
- dify_oapi/api/chatflow/v1/model/create_annotation_request_body.py +28 -0
- dify_oapi/api/chatflow/v1/model/create_annotation_response.py +9 -0
- dify_oapi/api/chatflow/v1/model/delete_annotation_request.py +28 -0
- dify_oapi/api/chatflow/v1/model/delete_annotation_response.py +7 -0
- dify_oapi/api/chatflow/v1/model/delete_conversation_request.py +36 -0
- dify_oapi/api/chatflow/v1/model/delete_conversation_request_body.py +21 -0
- dify_oapi/api/chatflow/v1/model/delete_conversation_response.py +17 -0
- dify_oapi/api/chatflow/v1/model/feedback_info.py +75 -0
- dify_oapi/api/chatflow/v1/model/file_info.py +53 -0
- dify_oapi/api/chatflow/v1/model/get_annotations_request.py +30 -0
- dify_oapi/api/chatflow/v1/model/get_annotations_response.py +13 -0
- dify_oapi/api/chatflow/v1/model/get_conversation_messages_request.py +38 -0
- dify_oapi/api/chatflow/v1/model/get_conversation_messages_response.py +33 -0
- dify_oapi/api/chatflow/v1/model/get_conversation_variables_request.py +44 -0
- dify_oapi/api/chatflow/v1/model/get_conversation_variables_response.py +33 -0
- dify_oapi/api/chatflow/v1/model/get_conversations_request.py +40 -0
- dify_oapi/api/chatflow/v1/model/get_conversations_response.py +33 -0
- dify_oapi/api/chatflow/v1/model/get_suggested_questions_request.py +32 -0
- dify_oapi/api/{completion/v1/model/feedback/message_feedback_response.py → chatflow/v1/model/get_suggested_questions_response.py} +2 -3
- dify_oapi/api/chatflow/v1/model/rename_conversation_request.py +36 -0
- dify_oapi/api/chatflow/v1/model/rename_conversation_request_body.py +31 -0
- dify_oapi/api/chatflow/v1/model/rename_conversation_response.py +53 -0
- dify_oapi/api/chatflow/v1/model/retriever_resource.py +58 -0
- dify_oapi/api/chatflow/v1/model/send_chat_message_request.py +30 -0
- dify_oapi/api/chatflow/v1/model/send_chat_message_request_body.py +54 -0
- dify_oapi/api/chatflow/v1/model/send_chat_message_response.py +7 -0
- dify_oapi/api/chatflow/v1/model/stop_chat_message_request.py +36 -0
- dify_oapi/api/chatflow/v1/model/stop_chat_message_request_body.py +21 -0
- dify_oapi/api/{dify/v1/model/message_feedback_response.py → chatflow/v1/model/stop_chat_message_response.py} +1 -1
- dify_oapi/api/chatflow/v1/model/tool_icon.py +48 -0
- dify_oapi/api/chatflow/v1/model/update_annotation_request.py +36 -0
- dify_oapi/api/chatflow/v1/model/update_annotation_request_body.py +28 -0
- dify_oapi/api/chatflow/v1/model/update_annotation_response.py +9 -0
- dify_oapi/api/chatflow/v1/model/usage_info.py +78 -0
- dify_oapi/api/chatflow/v1/model/user_input_form.py +141 -0
- dify_oapi/api/chatflow/v1/model/webapp_settings.py +88 -0
- dify_oapi/api/chatflow/v1/resource/__init__.py +0 -0
- dify_oapi/api/chatflow/v1/resource/annotation.py +87 -0
- dify_oapi/api/chatflow/v1/resource/chatflow.py +78 -0
- dify_oapi/api/chatflow/v1/resource/conversation.py +75 -0
- dify_oapi/api/chatflow/v1/version.py +22 -0
- dify_oapi/api/completion/v1/resource/__init__.py +0 -6
- dify_oapi/api/completion/v1/version.py +8 -6
- dify_oapi/api/{chat → dify}/v1/model/audio_to_text_request_body.py +2 -2
- dify_oapi/api/{completion/v1/model/feedback → dify/v1/model}/get_feedbacks_request.py +12 -12
- dify_oapi/api/dify/v1/model/get_feedbacks_response.py +26 -0
- dify_oapi/api/{workflow → dify}/v1/model/get_parameters_request.py +4 -0
- dify_oapi/api/dify/v1/model/{get_parameter_response.py → get_parameters_response.py} +6 -2
- dify_oapi/api/dify/v1/model/get_site_response.py +17 -0
- dify_oapi/api/dify/v1/model/submit_feedback_request.py +34 -0
- dify_oapi/api/dify/v1/model/submit_feedback_request_body.py +35 -0
- dify_oapi/api/dify/v1/model/submit_feedback_response.py +7 -0
- dify_oapi/api/dify/v1/resource/__init__.py +0 -6
- dify_oapi/api/dify/v1/resource/audio.py +12 -0
- dify_oapi/api/dify/v1/resource/feedback.py +31 -0
- dify_oapi/api/dify/v1/resource/info.py +34 -2
- dify_oapi/api/dify/v1/version.py +5 -4
- dify_oapi/api/knowledge/service.py +3 -3
- dify_oapi/api/knowledge/v1/model/create_document_by_file_request.py +1 -3
- dify_oapi/api/knowledge/v1/model/create_document_by_file_request_body.py +4 -46
- dify_oapi/api/knowledge/v1/model/create_document_by_file_request_body_data.py +73 -0
- dify_oapi/api/knowledge/v1/model/data_source_detail.py +23 -0
- dify_oapi/api/knowledge/v1/model/dataset_info.py +10 -9
- dify_oapi/api/knowledge/v1/model/dataset_metadata.py +14 -0
- dify_oapi/api/knowledge/v1/model/document_info.py +18 -6
- dify_oapi/api/knowledge/v1/model/external_knowledge_info.py +11 -1
- dify_oapi/api/knowledge/v1/model/external_retrieval_model.py +13 -0
- dify_oapi/api/knowledge/v1/model/knowledge_types.py +2 -2
- dify_oapi/api/knowledge/v1/model/process_rule.py +0 -6
- dify_oapi/api/knowledge/v1/model/retrieval_model.py +10 -4
- dify_oapi/api/knowledge/v1/model/update_document_by_file_request.py +1 -3
- dify_oapi/api/knowledge/v1/model/update_document_by_file_request_body.py +4 -41
- dify_oapi/api/knowledge/v1/model/update_document_by_file_request_body_data.py +68 -0
- dify_oapi/api/knowledge/v1/model/weights.py +27 -0
- dify_oapi/api/knowledge/v1/resource/__init__.py +0 -8
- dify_oapi/api/workflow/v1/model/chunk_workflow_event.py +74 -0
- dify_oapi/api/workflow/v1/model/input_file_object_workflow.py +76 -0
- dify_oapi/api/workflow/v1/model/node_finished_data.py +118 -0
- dify_oapi/api/workflow/v1/model/node_started_data.py +81 -0
- dify_oapi/api/workflow/v1/model/ping_data.py +28 -0
- dify_oapi/api/workflow/v1/model/run_workflow_request_body.py +1 -1
- dify_oapi/api/workflow/v1/model/text_chunk_data.py +39 -0
- dify_oapi/api/workflow/v1/model/tts_message_data.py +45 -0
- dify_oapi/api/workflow/v1/model/tts_message_end_data.py +45 -0
- dify_oapi/api/workflow/v1/model/workflow_completion_response.py +50 -0
- dify_oapi/api/workflow/v1/model/workflow_finished_data.py +93 -0
- dify_oapi/api/workflow/v1/model/workflow_started_data.py +51 -0
- dify_oapi/api/workflow/v1/model/workflow_types.py +27 -12
- dify_oapi/api/workflow/v1/resource/workflow.py +0 -34
- dify_oapi/api/workflow/v1/version.py +9 -0
- dify_oapi/client.py +49 -4
- dify_oapi/core/http/transport/__init__.py +2 -1
- dify_oapi/core/http/transport/async_transport.py +73 -50
- dify_oapi/core/http/transport/connection_pool.py +131 -0
- dify_oapi/core/http/transport/sync_transport.py +73 -50
- dify_oapi/core/model/config.py +10 -0
- dify_oapi2-1.0.0.dist-info/METADATA +365 -0
- {dify_oapi2-0.4.0.dist-info → dify_oapi2-1.0.0.dist-info}/RECORD +174 -98
- dify_oapi/api/chat/v1/model/chat_request_file.py +0 -46
- dify_oapi/api/chat/v1/model/message_suggested_request.py +0 -36
- dify_oapi/api/chat/v1/resource/audio.py +0 -17
- dify_oapi/api/completion/v1/model/audio/audio_info.py +0 -28
- dify_oapi/api/completion/v1/model/audio/text_to_audio_request.py +0 -32
- dify_oapi/api/completion/v1/model/audio/text_to_audio_request_body.py +0 -33
- dify_oapi/api/completion/v1/model/audio/text_to_audio_response.py +0 -9
- dify_oapi/api/completion/v1/model/feedback/get_feedbacks_response.py +0 -9
- dify_oapi/api/completion/v1/model/feedback/message_feedback_request.py +0 -38
- dify_oapi/api/completion/v1/model/feedback/message_feedback_request_body.py +0 -35
- dify_oapi/api/completion/v1/model/file/upload_file_request.py +0 -42
- dify_oapi/api/completion/v1/model/file/upload_file_response.py +0 -9
- dify_oapi/api/completion/v1/model/info/feature_config.py +0 -91
- dify_oapi/api/completion/v1/model/info/file_upload_config.py +0 -23
- dify_oapi/api/completion/v1/model/info/get_info_request.py +0 -24
- dify_oapi/api/completion/v1/model/info/get_info_response.py +0 -9
- dify_oapi/api/completion/v1/model/info/get_parameters_request.py +0 -24
- dify_oapi/api/completion/v1/model/info/get_parameters_response.py +0 -9
- dify_oapi/api/completion/v1/model/info/get_site_response.py +0 -9
- dify_oapi/api/completion/v1/model/info/parameters_info.py +0 -75
- dify_oapi/api/completion/v1/model/info/site_info.py +0 -90
- dify_oapi/api/completion/v1/model/info/system_parameters.py +0 -38
- dify_oapi/api/completion/v1/model/info/user_input_form.py +0 -158
- dify_oapi/api/completion/v1/resource/audio.py +0 -19
- dify_oapi/api/completion/v1/resource/feedback.py +0 -33
- dify_oapi/api/completion/v1/resource/file.py +0 -19
- dify_oapi/api/completion/v1/resource/info.py +0 -39
- dify_oapi/api/dify/v1/model/get_parameter_request.py +0 -30
- dify_oapi/api/dify/v1/model/message_feedback_request.py +0 -38
- dify_oapi/api/dify/v1/model/message_feedback_request_body.py +0 -30
- dify_oapi/api/dify/v1/resource/message.py +0 -21
- dify_oapi/api/dify/v1/resource/meta.py +0 -17
- dify_oapi/api/dify/v1/resource/parameter.py +0 -19
- dify_oapi/api/workflow/v1/model/get_info_request.py +0 -24
- dify_oapi/api/workflow/v1/model/get_info_response.py +0 -9
- dify_oapi/api/workflow/v1/model/get_parameters_response.py +0 -9
- dify_oapi/api/workflow/v1/model/get_site_request.py +0 -24
- dify_oapi/api/workflow/v1/model/get_site_response.py +0 -9
- dify_oapi/api/workflow/v1/model/upload_file_request.py +0 -42
- dify_oapi/api/workflow/v1/model/upload_file_response.py +0 -9
- dify_oapi2-0.4.0.dist-info/METADATA +0 -303
- /dify_oapi/api/{chat → dify}/v1/model/audio_to_text_request.py +0 -0
- /dify_oapi/api/{chat → dify}/v1/model/audio_to_text_response.py +0 -0
- /dify_oapi/api/{completion/v1/model/info → dify/v1/model}/get_site_request.py +0 -0
- {dify_oapi2-0.4.0.dist-info → dify_oapi2-1.0.0.dist-info}/LICENSE +0 -0
- {dify_oapi2-0.4.0.dist-info → dify_oapi2-1.0.0.dist-info}/WHEEL +0 -0
@@ -4,56 +4,68 @@ from dify_oapi.core.model.request_option import RequestOption
|
|
4
4
|
|
5
5
|
from ..model.delete_conversation_request import DeleteConversationRequest
|
6
6
|
from ..model.delete_conversation_response import DeleteConversationResponse
|
7
|
-
from ..model.get_conversation_list_request import
|
8
|
-
from ..model.get_conversation_list_response import
|
7
|
+
from ..model.get_conversation_list_request import GetConversationsRequest
|
8
|
+
from ..model.get_conversation_list_response import GetConversationsResponse
|
9
|
+
from ..model.get_conversation_variables_request import GetConversationVariablesRequest
|
10
|
+
from ..model.get_conversation_variables_response import GetConversationVariablesResponse
|
11
|
+
from ..model.message_history_request import GetMessageHistoryRequest
|
12
|
+
from ..model.message_history_response import GetMessageHistoryResponse
|
9
13
|
from ..model.rename_conversation_request import RenameConversationRequest
|
10
14
|
from ..model.rename_conversation_response import RenameConversationResponse
|
11
15
|
|
12
16
|
|
13
17
|
class Conversation:
|
14
18
|
def __init__(self, config: Config) -> None:
|
15
|
-
self.config
|
19
|
+
self.config = config
|
16
20
|
|
17
|
-
def list(
|
18
|
-
self, request
|
19
|
-
|
20
|
-
|
21
|
+
def list(self, request: GetConversationsRequest, request_option: RequestOption) -> GetConversationsResponse:
|
22
|
+
return Transport.execute(self.config, request, unmarshal_as=GetConversationsResponse, option=request_option)
|
23
|
+
|
24
|
+
async def alist(self, request: GetConversationsRequest, request_option: RequestOption) -> GetConversationsResponse:
|
25
|
+
return await ATransport.aexecute(
|
26
|
+
self.config, request, unmarshal_as=GetConversationsResponse, option=request_option
|
27
|
+
)
|
28
|
+
|
29
|
+
def history(self, request: GetMessageHistoryRequest, request_option: RequestOption) -> GetMessageHistoryResponse:
|
30
|
+
return Transport.execute(self.config, request, unmarshal_as=GetMessageHistoryResponse, option=request_option)
|
31
|
+
|
32
|
+
async def ahistory(
|
33
|
+
self, request: GetMessageHistoryRequest, request_option: RequestOption
|
34
|
+
) -> GetMessageHistoryResponse:
|
35
|
+
return await ATransport.aexecute(
|
36
|
+
self.config, request, unmarshal_as=GetMessageHistoryResponse, option=request_option
|
37
|
+
)
|
38
|
+
|
39
|
+
def variables(
|
40
|
+
self, request: GetConversationVariablesRequest, request_option: RequestOption
|
41
|
+
) -> GetConversationVariablesResponse:
|
21
42
|
return Transport.execute(
|
22
|
-
self.config,
|
23
|
-
request,
|
24
|
-
unmarshal_as=GetConversationListResponse,
|
25
|
-
option=option,
|
43
|
+
self.config, request, unmarshal_as=GetConversationVariablesResponse, option=request_option
|
26
44
|
)
|
27
45
|
|
28
|
-
async def
|
29
|
-
self, request:
|
30
|
-
) ->
|
31
|
-
# Send request
|
46
|
+
async def avariables(
|
47
|
+
self, request: GetConversationVariablesRequest, request_option: RequestOption
|
48
|
+
) -> GetConversationVariablesResponse:
|
32
49
|
return await ATransport.aexecute(
|
33
|
-
self.config,
|
34
|
-
request,
|
35
|
-
unmarshal_as=GetConversationListResponse,
|
36
|
-
option=option,
|
50
|
+
self.config, request, unmarshal_as=GetConversationVariablesResponse, option=request_option
|
37
51
|
)
|
38
52
|
|
39
|
-
def delete(
|
40
|
-
self, request
|
41
|
-
) -> DeleteConversationResponse:
|
42
|
-
return Transport.execute(self.config, request, unmarshal_as=DeleteConversationResponse, option=option)
|
53
|
+
def delete(self, request: DeleteConversationRequest, request_option: RequestOption) -> DeleteConversationResponse:
|
54
|
+
return Transport.execute(self.config, request, unmarshal_as=DeleteConversationResponse, option=request_option)
|
43
55
|
|
44
56
|
async def adelete(
|
45
|
-
self, request: DeleteConversationRequest,
|
57
|
+
self, request: DeleteConversationRequest, request_option: RequestOption
|
46
58
|
) -> DeleteConversationResponse:
|
47
|
-
|
48
|
-
|
59
|
+
return await ATransport.aexecute(
|
60
|
+
self.config, request, unmarshal_as=DeleteConversationResponse, option=request_option
|
61
|
+
)
|
49
62
|
|
50
|
-
def rename(
|
51
|
-
self, request
|
52
|
-
) -> RenameConversationResponse:
|
53
|
-
return Transport.execute(self.config, request, unmarshal_as=RenameConversationResponse, option=option)
|
63
|
+
def rename(self, request: RenameConversationRequest, request_option: RequestOption) -> RenameConversationResponse:
|
64
|
+
return Transport.execute(self.config, request, unmarshal_as=RenameConversationResponse, option=request_option)
|
54
65
|
|
55
66
|
async def arename(
|
56
|
-
self, request: RenameConversationRequest,
|
67
|
+
self, request: RenameConversationRequest, request_option: RequestOption
|
57
68
|
) -> RenameConversationResponse:
|
58
|
-
|
59
|
-
|
69
|
+
return await ATransport.aexecute(
|
70
|
+
self.config, request, unmarshal_as=RenameConversationResponse, option=request_option
|
71
|
+
)
|
@@ -2,34 +2,36 @@ from dify_oapi.core.http.transport import ATransport, Transport
|
|
2
2
|
from dify_oapi.core.model.config import Config
|
3
3
|
from dify_oapi.core.model.request_option import RequestOption
|
4
4
|
|
5
|
-
from ..model.
|
6
|
-
from ..model.
|
7
|
-
from ..model.
|
8
|
-
from ..model.
|
5
|
+
from ..model.get_suggested_questions_request import GetSuggestedQuestionsRequest
|
6
|
+
from ..model.get_suggested_questions_response import GetSuggestedQuestionsResponse
|
7
|
+
from ..model.message_history_request import GetMessageHistoryRequest
|
8
|
+
from ..model.message_history_response import GetMessageHistoryResponse
|
9
9
|
|
10
10
|
|
11
11
|
class Message:
|
12
12
|
def __init__(self, config: Config) -> None:
|
13
|
-
self.config
|
13
|
+
self.config = config
|
14
14
|
|
15
15
|
def suggested(
|
16
|
-
self, request:
|
17
|
-
) ->
|
18
|
-
|
19
|
-
|
16
|
+
self, request: GetSuggestedQuestionsRequest, request_option: RequestOption
|
17
|
+
) -> GetSuggestedQuestionsResponse:
|
18
|
+
return Transport.execute(
|
19
|
+
self.config, request, unmarshal_as=GetSuggestedQuestionsResponse, option=request_option
|
20
|
+
)
|
20
21
|
|
21
22
|
async def asuggested(
|
22
|
-
self, request:
|
23
|
-
) ->
|
24
|
-
|
25
|
-
|
23
|
+
self, request: GetSuggestedQuestionsRequest, request_option: RequestOption
|
24
|
+
) -> GetSuggestedQuestionsResponse:
|
25
|
+
return await ATransport.aexecute(
|
26
|
+
self.config, request, unmarshal_as=GetSuggestedQuestionsResponse, option=request_option
|
27
|
+
)
|
26
28
|
|
27
|
-
def history(self, request:
|
28
|
-
|
29
|
-
return Transport.execute(self.config, request, unmarshal_as=MessageHistoryResponse, option=option)
|
29
|
+
def history(self, request: GetMessageHistoryRequest, request_option: RequestOption) -> GetMessageHistoryResponse:
|
30
|
+
return Transport.execute(self.config, request, unmarshal_as=GetMessageHistoryResponse, option=request_option)
|
30
31
|
|
31
32
|
async def ahistory(
|
32
|
-
self, request:
|
33
|
-
) ->
|
34
|
-
|
35
|
-
|
33
|
+
self, request: GetMessageHistoryRequest, request_option: RequestOption
|
34
|
+
) -> GetMessageHistoryResponse:
|
35
|
+
return await ATransport.aexecute(
|
36
|
+
self.config, request, unmarshal_as=GetMessageHistoryResponse, option=request_option
|
37
|
+
)
|
dify_oapi/api/chat/v1/version.py
CHANGED
@@ -1,11 +1,24 @@
|
|
1
|
+
from dify_oapi.api.dify.v1.resource.audio import Audio
|
2
|
+
from dify_oapi.api.dify.v1.resource.feedback import Feedback
|
3
|
+
from dify_oapi.api.dify.v1.resource.file import File
|
4
|
+
from dify_oapi.api.dify.v1.resource.info import Info
|
1
5
|
from dify_oapi.core.model.config import Config
|
2
6
|
|
3
|
-
from .resource import
|
7
|
+
from .resource.annotation import Annotation
|
8
|
+
from .resource.chat import Chat
|
9
|
+
from .resource.conversation import Conversation
|
10
|
+
from .resource.message import Message
|
4
11
|
|
5
12
|
|
6
13
|
class V1:
|
7
14
|
def __init__(self, config: Config):
|
8
|
-
|
9
|
-
self.
|
10
|
-
self.
|
11
|
-
self.
|
15
|
+
# Business-specific APIs
|
16
|
+
self.chat = Chat(config)
|
17
|
+
self.conversation = Conversation(config)
|
18
|
+
self.annotation = Annotation(config)
|
19
|
+
self.message = Message(config)
|
20
|
+
# System APIs - direct use of dify module
|
21
|
+
self.file = File(config)
|
22
|
+
self.audio = Audio(config)
|
23
|
+
self.app = Info(config)
|
24
|
+
self.feedback = Feedback(config)
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,43 @@
|
|
1
|
+
from pydantic import BaseModel
|
2
|
+
|
3
|
+
|
4
|
+
class AnnotationInfo(BaseModel):
|
5
|
+
"""Annotation information model."""
|
6
|
+
|
7
|
+
id: str | None = None
|
8
|
+
question: str | None = None
|
9
|
+
answer: str | None = None
|
10
|
+
hit_count: int | None = None
|
11
|
+
created_at: int | None = None
|
12
|
+
|
13
|
+
@staticmethod
|
14
|
+
def builder() -> "AnnotationInfoBuilder":
|
15
|
+
return AnnotationInfoBuilder()
|
16
|
+
|
17
|
+
|
18
|
+
class AnnotationInfoBuilder:
|
19
|
+
def __init__(self):
|
20
|
+
self._annotation_info = AnnotationInfo()
|
21
|
+
|
22
|
+
def build(self) -> AnnotationInfo:
|
23
|
+
return self._annotation_info
|
24
|
+
|
25
|
+
def id(self, id: str) -> "AnnotationInfoBuilder":
|
26
|
+
self._annotation_info.id = id
|
27
|
+
return self
|
28
|
+
|
29
|
+
def question(self, question: str) -> "AnnotationInfoBuilder":
|
30
|
+
self._annotation_info.question = question
|
31
|
+
return self
|
32
|
+
|
33
|
+
def answer(self, answer: str) -> "AnnotationInfoBuilder":
|
34
|
+
self._annotation_info.answer = answer
|
35
|
+
return self
|
36
|
+
|
37
|
+
def hit_count(self, hit_count: int) -> "AnnotationInfoBuilder":
|
38
|
+
self._annotation_info.hit_count = hit_count
|
39
|
+
return self
|
40
|
+
|
41
|
+
def created_at(self, created_at: int) -> "AnnotationInfoBuilder":
|
42
|
+
self._annotation_info.created_at = created_at
|
43
|
+
return self
|
@@ -0,0 +1,37 @@
|
|
1
|
+
from dify_oapi.core.enum import HttpMethod
|
2
|
+
from dify_oapi.core.model.base_request import BaseRequest
|
3
|
+
|
4
|
+
from .annotation_reply_settings_request_body import AnnotationReplySettingsRequestBody
|
5
|
+
from .chatflow_types import AnnotationAction
|
6
|
+
|
7
|
+
|
8
|
+
class AnnotationReplySettingsRequest(BaseRequest):
|
9
|
+
def __init__(self):
|
10
|
+
super().__init__()
|
11
|
+
self.request_body: AnnotationReplySettingsRequestBody | None = None
|
12
|
+
self.action: AnnotationAction | None = None
|
13
|
+
|
14
|
+
@staticmethod
|
15
|
+
def builder() -> "AnnotationReplySettingsRequestBuilder":
|
16
|
+
return AnnotationReplySettingsRequestBuilder()
|
17
|
+
|
18
|
+
|
19
|
+
class AnnotationReplySettingsRequestBuilder:
|
20
|
+
def __init__(self):
|
21
|
+
annotation_reply_settings_request = AnnotationReplySettingsRequest()
|
22
|
+
annotation_reply_settings_request.http_method = HttpMethod.POST
|
23
|
+
annotation_reply_settings_request.uri = "/v1/apps/annotation-reply/:action"
|
24
|
+
self._annotation_reply_settings_request = annotation_reply_settings_request
|
25
|
+
|
26
|
+
def build(self) -> AnnotationReplySettingsRequest:
|
27
|
+
return self._annotation_reply_settings_request
|
28
|
+
|
29
|
+
def action(self, action: AnnotationAction) -> "AnnotationReplySettingsRequestBuilder":
|
30
|
+
self._annotation_reply_settings_request.action = action
|
31
|
+
self._annotation_reply_settings_request.paths["action"] = action
|
32
|
+
return self
|
33
|
+
|
34
|
+
def request_body(self, request_body: AnnotationReplySettingsRequestBody) -> "AnnotationReplySettingsRequestBuilder":
|
35
|
+
self._annotation_reply_settings_request.request_body = request_body
|
36
|
+
self._annotation_reply_settings_request.body = request_body.model_dump(exclude_none=True, mode="json")
|
37
|
+
return self
|
@@ -0,0 +1,33 @@
|
|
1
|
+
from pydantic import BaseModel
|
2
|
+
|
3
|
+
|
4
|
+
class AnnotationReplySettingsRequestBody(BaseModel):
|
5
|
+
"""Request body for annotation reply settings."""
|
6
|
+
|
7
|
+
embedding_provider_name: str | None = None
|
8
|
+
embedding_model_name: str | None = None
|
9
|
+
score_threshold: float | None = None
|
10
|
+
|
11
|
+
@staticmethod
|
12
|
+
def builder() -> "AnnotationReplySettingsRequestBodyBuilder":
|
13
|
+
return AnnotationReplySettingsRequestBodyBuilder()
|
14
|
+
|
15
|
+
|
16
|
+
class AnnotationReplySettingsRequestBodyBuilder:
|
17
|
+
def __init__(self):
|
18
|
+
self._annotation_reply_settings_request_body = AnnotationReplySettingsRequestBody()
|
19
|
+
|
20
|
+
def build(self) -> AnnotationReplySettingsRequestBody:
|
21
|
+
return self._annotation_reply_settings_request_body
|
22
|
+
|
23
|
+
def embedding_provider_name(self, embedding_provider_name: str) -> "AnnotationReplySettingsRequestBodyBuilder":
|
24
|
+
self._annotation_reply_settings_request_body.embedding_provider_name = embedding_provider_name
|
25
|
+
return self
|
26
|
+
|
27
|
+
def embedding_model_name(self, embedding_model_name: str) -> "AnnotationReplySettingsRequestBodyBuilder":
|
28
|
+
self._annotation_reply_settings_request_body.embedding_model_name = embedding_model_name
|
29
|
+
return self
|
30
|
+
|
31
|
+
def score_threshold(self, score_threshold: float) -> "AnnotationReplySettingsRequestBodyBuilder":
|
32
|
+
self._annotation_reply_settings_request_body.score_threshold = score_threshold
|
33
|
+
return self
|
@@ -0,0 +1,10 @@
|
|
1
|
+
from dify_oapi.core.model.base_response import BaseResponse
|
2
|
+
|
3
|
+
from .chatflow_types import JobStatus
|
4
|
+
|
5
|
+
|
6
|
+
class AnnotationReplySettingsResponse(BaseResponse):
|
7
|
+
"""Response for annotation reply settings."""
|
8
|
+
|
9
|
+
job_id: str | None = None
|
10
|
+
job_status: JobStatus | None = None
|
@@ -0,0 +1,36 @@
|
|
1
|
+
from dify_oapi.core.enum import HttpMethod
|
2
|
+
from dify_oapi.core.model.base_request import BaseRequest
|
3
|
+
|
4
|
+
from .chatflow_types import AnnotationAction
|
5
|
+
|
6
|
+
|
7
|
+
class AnnotationReplyStatusRequest(BaseRequest):
|
8
|
+
def __init__(self):
|
9
|
+
super().__init__()
|
10
|
+
self.action: AnnotationAction | None = None
|
11
|
+
self.job_id: str | None = None
|
12
|
+
|
13
|
+
@staticmethod
|
14
|
+
def builder() -> "AnnotationReplyStatusRequestBuilder":
|
15
|
+
return AnnotationReplyStatusRequestBuilder()
|
16
|
+
|
17
|
+
|
18
|
+
class AnnotationReplyStatusRequestBuilder:
|
19
|
+
def __init__(self):
|
20
|
+
annotation_reply_status_request = AnnotationReplyStatusRequest()
|
21
|
+
annotation_reply_status_request.http_method = HttpMethod.GET
|
22
|
+
annotation_reply_status_request.uri = "/v1/apps/annotation-reply/:action/status/:job_id"
|
23
|
+
self._annotation_reply_status_request = annotation_reply_status_request
|
24
|
+
|
25
|
+
def build(self) -> AnnotationReplyStatusRequest:
|
26
|
+
return self._annotation_reply_status_request
|
27
|
+
|
28
|
+
def action(self, action: AnnotationAction) -> "AnnotationReplyStatusRequestBuilder":
|
29
|
+
self._annotation_reply_status_request.action = action
|
30
|
+
self._annotation_reply_status_request.paths["action"] = action
|
31
|
+
return self
|
32
|
+
|
33
|
+
def job_id(self, job_id: str) -> "AnnotationReplyStatusRequestBuilder":
|
34
|
+
self._annotation_reply_status_request.job_id = job_id
|
35
|
+
self._annotation_reply_status_request.paths["job_id"] = job_id
|
36
|
+
return self
|
@@ -0,0 +1,11 @@
|
|
1
|
+
from dify_oapi.core.model.base_response import BaseResponse
|
2
|
+
|
3
|
+
from .chatflow_types import JobStatus
|
4
|
+
|
5
|
+
|
6
|
+
class AnnotationReplyStatusResponse(BaseResponse):
|
7
|
+
"""Response for annotation reply status."""
|
8
|
+
|
9
|
+
job_id: str | None = None
|
10
|
+
job_status: JobStatus | None = None
|
11
|
+
error_msg: str | None = None
|
@@ -0,0 +1,33 @@
|
|
1
|
+
from pydantic import BaseModel
|
2
|
+
|
3
|
+
|
4
|
+
class AppInfo(BaseModel):
|
5
|
+
"""Application information model."""
|
6
|
+
|
7
|
+
name: str | None = None
|
8
|
+
description: str | None = None
|
9
|
+
tags: list[str] | None = None
|
10
|
+
|
11
|
+
@staticmethod
|
12
|
+
def builder() -> "AppInfoBuilder":
|
13
|
+
return AppInfoBuilder()
|
14
|
+
|
15
|
+
|
16
|
+
class AppInfoBuilder:
|
17
|
+
def __init__(self):
|
18
|
+
self._app_info = AppInfo()
|
19
|
+
|
20
|
+
def build(self) -> AppInfo:
|
21
|
+
return self._app_info
|
22
|
+
|
23
|
+
def name(self, name: str) -> "AppInfoBuilder":
|
24
|
+
self._app_info.name = name
|
25
|
+
return self
|
26
|
+
|
27
|
+
def description(self, description: str) -> "AppInfoBuilder":
|
28
|
+
self._app_info.description = description
|
29
|
+
return self
|
30
|
+
|
31
|
+
def tags(self, tags: list[str]) -> "AppInfoBuilder":
|
32
|
+
self._app_info.tags = tags
|
33
|
+
return self
|