dify-oapi2 0.4.0__py3-none-any.whl → 0.5.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.
Files changed (191) hide show
  1. dify_oapi/api/chat/v1/model/__init__.py +37 -0
  2. dify_oapi/api/chat/v1/model/agent_thought.py +69 -0
  3. dify_oapi/api/chat/v1/model/annotation_info.py +43 -0
  4. dify_oapi/api/chat/v1/model/app_info.py +35 -0
  5. dify_oapi/api/chat/v1/model/app_parameters.py +494 -0
  6. dify_oapi/api/chat/v1/model/audio_to_text_request_body.py +2 -2
  7. dify_oapi/api/chat/v1/model/chat_file.py +53 -0
  8. dify_oapi/api/chat/v1/model/chat_request_body.py +26 -13
  9. dify_oapi/api/chat/v1/model/chat_response.py +12 -2
  10. dify_oapi/api/chat/v1/model/chat_types.py +65 -0
  11. dify_oapi/api/chat/v1/model/configure_annotation_reply_request.py +36 -0
  12. dify_oapi/api/chat/v1/model/configure_annotation_reply_request_body.py +39 -0
  13. dify_oapi/api/chat/v1/model/configure_annotation_reply_response.py +10 -0
  14. dify_oapi/api/chat/v1/model/conversation_info.py +57 -0
  15. dify_oapi/api/chat/v1/model/conversation_variable.py +55 -0
  16. dify_oapi/api/chat/v1/model/create_annotation_request.py +29 -0
  17. dify_oapi/api/chat/v1/model/create_annotation_request_body.py +32 -0
  18. dify_oapi/api/chat/v1/model/create_annotation_response.py +9 -0
  19. dify_oapi/api/chat/v1/model/delete_annotation_request.py +26 -0
  20. dify_oapi/api/chat/v1/model/delete_annotation_response.py +7 -0
  21. dify_oapi/api/chat/v1/model/feedback_info.py +75 -0
  22. dify_oapi/api/chat/v1/model/file_info.py +59 -0
  23. dify_oapi/api/chat/v1/model/get_annotation_reply_status_request.py +32 -0
  24. dify_oapi/api/chat/v1/model/get_annotation_reply_status_response.py +11 -0
  25. dify_oapi/api/chat/v1/model/get_app_info_request.py +24 -0
  26. dify_oapi/api/chat/v1/model/get_app_info_response.py +9 -0
  27. dify_oapi/api/chat/v1/model/get_app_meta_request.py +24 -0
  28. dify_oapi/api/chat/v1/model/get_app_meta_response.py +9 -0
  29. dify_oapi/api/chat/v1/model/get_app_parameters_request.py +28 -0
  30. dify_oapi/api/chat/v1/model/get_app_parameters_response.py +9 -0
  31. dify_oapi/api/chat/v1/model/get_conversation_list_request.py +25 -24
  32. dify_oapi/api/chat/v1/model/get_conversation_list_response.py +4 -15
  33. dify_oapi/api/chat/v1/model/get_conversation_variables_request.py +54 -0
  34. dify_oapi/api/chat/v1/model/get_conversation_variables_response.py +10 -0
  35. dify_oapi/api/chat/v1/model/get_feedbacks_request.py +32 -0
  36. dify_oapi/api/chat/v1/model/get_feedbacks_response.py +7 -0
  37. dify_oapi/api/chat/v1/model/get_site_settings_request.py +24 -0
  38. dify_oapi/api/chat/v1/model/get_site_settings_response.py +9 -0
  39. dify_oapi/api/chat/v1/model/get_suggested_questions_request.py +36 -0
  40. dify_oapi/api/chat/v1/model/{message_suggested_response.py → get_suggested_questions_response.py} +1 -1
  41. dify_oapi/api/chat/v1/model/list_annotations_request.py +32 -0
  42. dify_oapi/api/chat/v1/model/list_annotations_response.py +11 -0
  43. dify_oapi/api/chat/v1/model/message_file.py +46 -0
  44. dify_oapi/api/chat/v1/model/message_history_request.py +24 -24
  45. dify_oapi/api/chat/v1/model/message_history_response.py +4 -43
  46. dify_oapi/api/chat/v1/model/message_info.py +73 -0
  47. dify_oapi/api/chat/v1/model/pagination_info.py +44 -0
  48. dify_oapi/api/chat/v1/model/rename_conversation_request_body.py +1 -1
  49. dify_oapi/api/chat/v1/model/retriever_resource.py +64 -0
  50. dify_oapi/api/chat/v1/model/site_settings.py +92 -0
  51. dify_oapi/api/chat/v1/model/submit_feedback_request.py +34 -0
  52. dify_oapi/api/chat/v1/model/submit_feedback_request_body.py +33 -0
  53. dify_oapi/api/chat/v1/model/submit_feedback_response.py +5 -0
  54. dify_oapi/api/chat/v1/model/text_to_audio_request.py +32 -0
  55. dify_oapi/api/chat/v1/model/text_to_audio_request_body.py +33 -0
  56. dify_oapi/api/chat/v1/model/text_to_audio_response.py +7 -0
  57. dify_oapi/api/chat/v1/model/tool_icon.py +52 -0
  58. dify_oapi/api/chat/v1/model/update_annotation_request.py +33 -0
  59. dify_oapi/api/chat/v1/model/update_annotation_request_body.py +32 -0
  60. dify_oapi/api/chat/v1/model/update_annotation_response.py +9 -0
  61. dify_oapi/api/chat/v1/model/upload_file_request.py +54 -0
  62. dify_oapi/api/chat/v1/model/upload_file_request_body.py +29 -0
  63. dify_oapi/api/chat/v1/model/upload_file_response.py +10 -0
  64. dify_oapi/api/chat/v1/model/usage_info.py +84 -0
  65. dify_oapi/api/chat/v1/resource/__init__.py +7 -3
  66. dify_oapi/api/chat/v1/resource/annotation.py +77 -0
  67. dify_oapi/api/chat/v1/resource/app.py +47 -0
  68. dify_oapi/api/chat/v1/resource/audio.py +13 -0
  69. dify_oapi/api/chat/v1/resource/chat.py +14 -0
  70. dify_oapi/api/chat/v1/resource/conversation.py +55 -9
  71. dify_oapi/api/chat/v1/resource/feedback.py +31 -0
  72. dify_oapi/api/chat/v1/resource/file.py +25 -0
  73. dify_oapi/api/chat/v1/resource/message.py +19 -15
  74. dify_oapi/api/chat/v1/version.py +8 -2
  75. dify_oapi/api/chatflow/__init__.py +0 -0
  76. dify_oapi/api/chatflow/service.py +25 -0
  77. dify_oapi/api/chatflow/v1/__init__.py +0 -0
  78. dify_oapi/api/chatflow/v1/model/__init__.py +0 -0
  79. dify_oapi/api/chatflow/v1/model/annotation_info.py +43 -0
  80. dify_oapi/api/chatflow/v1/model/annotation_reply_settings_request.py +37 -0
  81. dify_oapi/api/chatflow/v1/model/annotation_reply_settings_request_body.py +33 -0
  82. dify_oapi/api/chatflow/v1/model/annotation_reply_settings_response.py +10 -0
  83. dify_oapi/api/chatflow/v1/model/annotation_reply_status_request.py +36 -0
  84. dify_oapi/api/chatflow/v1/model/annotation_reply_status_response.py +11 -0
  85. dify_oapi/api/chatflow/v1/model/app_info.py +33 -0
  86. dify_oapi/api/chatflow/v1/model/app_parameters.py +276 -0
  87. dify_oapi/api/chatflow/v1/model/audio_to_text_request.py +37 -0
  88. dify_oapi/api/chatflow/v1/model/audio_to_text_response.py +21 -0
  89. dify_oapi/api/chatflow/v1/model/chat_file.py +40 -0
  90. dify_oapi/api/chatflow/v1/model/chat_message.py +88 -0
  91. dify_oapi/api/chatflow/v1/model/chatflow_types.py +210 -0
  92. dify_oapi/api/chatflow/v1/model/conversation_info.py +53 -0
  93. dify_oapi/api/chatflow/v1/model/conversation_variable.py +55 -0
  94. dify_oapi/api/chatflow/v1/model/create_annotation_request.py +30 -0
  95. dify_oapi/api/chatflow/v1/model/create_annotation_request_body.py +28 -0
  96. dify_oapi/api/chatflow/v1/model/create_annotation_response.py +9 -0
  97. dify_oapi/api/chatflow/v1/model/delete_annotation_request.py +28 -0
  98. dify_oapi/api/chatflow/v1/model/delete_annotation_response.py +7 -0
  99. dify_oapi/api/chatflow/v1/model/delete_conversation_request.py +36 -0
  100. dify_oapi/api/chatflow/v1/model/delete_conversation_request_body.py +21 -0
  101. dify_oapi/api/chatflow/v1/model/delete_conversation_response.py +17 -0
  102. dify_oapi/api/chatflow/v1/model/feedback_info.py +75 -0
  103. dify_oapi/api/chatflow/v1/model/file_info.py +53 -0
  104. dify_oapi/api/chatflow/v1/model/get_annotations_request.py +30 -0
  105. dify_oapi/api/chatflow/v1/model/get_annotations_response.py +13 -0
  106. dify_oapi/api/chatflow/v1/model/get_app_feedbacks_request.py +30 -0
  107. dify_oapi/api/chatflow/v1/model/get_app_feedbacks_response.py +23 -0
  108. dify_oapi/api/chatflow/v1/model/get_conversation_messages_request.py +38 -0
  109. dify_oapi/api/chatflow/v1/model/get_conversation_messages_response.py +33 -0
  110. dify_oapi/api/chatflow/v1/model/get_conversation_variables_request.py +44 -0
  111. dify_oapi/api/chatflow/v1/model/get_conversation_variables_response.py +33 -0
  112. dify_oapi/api/chatflow/v1/model/get_conversations_request.py +40 -0
  113. dify_oapi/api/chatflow/v1/model/get_conversations_response.py +33 -0
  114. dify_oapi/api/chatflow/v1/model/get_info_request.py +22 -0
  115. dify_oapi/api/chatflow/v1/model/get_info_response.py +7 -0
  116. dify_oapi/api/chatflow/v1/model/get_meta_request.py +22 -0
  117. dify_oapi/api/chatflow/v1/model/get_meta_response.py +7 -0
  118. dify_oapi/api/chatflow/v1/model/get_parameters_request.py +22 -0
  119. dify_oapi/api/chatflow/v1/model/get_parameters_response.py +7 -0
  120. dify_oapi/api/chatflow/v1/model/get_site_request.py +22 -0
  121. dify_oapi/api/chatflow/v1/model/get_site_response.py +7 -0
  122. dify_oapi/api/chatflow/v1/model/get_suggested_questions_request.py +32 -0
  123. dify_oapi/api/chatflow/v1/model/get_suggested_questions_response.py +6 -0
  124. dify_oapi/api/chatflow/v1/model/message_feedback_request.py +36 -0
  125. dify_oapi/api/chatflow/v1/model/message_feedback_request_body.py +33 -0
  126. dify_oapi/api/chatflow/v1/model/message_feedback_response.py +21 -0
  127. dify_oapi/api/chatflow/v1/model/rename_conversation_request.py +36 -0
  128. dify_oapi/api/chatflow/v1/model/rename_conversation_request_body.py +31 -0
  129. dify_oapi/api/chatflow/v1/model/rename_conversation_response.py +53 -0
  130. dify_oapi/api/chatflow/v1/model/retriever_resource.py +58 -0
  131. dify_oapi/api/chatflow/v1/model/send_chat_message_request.py +30 -0
  132. dify_oapi/api/chatflow/v1/model/send_chat_message_request_body.py +54 -0
  133. dify_oapi/api/chatflow/v1/model/send_chat_message_response.py +7 -0
  134. dify_oapi/api/chatflow/v1/model/stop_chat_message_request.py +36 -0
  135. dify_oapi/api/chatflow/v1/model/stop_chat_message_request_body.py +21 -0
  136. dify_oapi/api/chatflow/v1/model/stop_chat_message_response.py +5 -0
  137. dify_oapi/api/chatflow/v1/model/text_to_audio_request.py +30 -0
  138. dify_oapi/api/chatflow/v1/model/text_to_audio_request_body.py +36 -0
  139. dify_oapi/api/chatflow/v1/model/text_to_audio_response.py +19 -0
  140. dify_oapi/api/chatflow/v1/model/tool_icon.py +48 -0
  141. dify_oapi/api/chatflow/v1/model/update_annotation_request.py +36 -0
  142. dify_oapi/api/chatflow/v1/model/update_annotation_request_body.py +28 -0
  143. dify_oapi/api/chatflow/v1/model/update_annotation_response.py +9 -0
  144. dify_oapi/api/chatflow/v1/model/upload_file_request.py +41 -0
  145. dify_oapi/api/chatflow/v1/model/upload_file_response.py +11 -0
  146. dify_oapi/api/chatflow/v1/model/usage_info.py +78 -0
  147. dify_oapi/api/chatflow/v1/model/user_input_form.py +141 -0
  148. dify_oapi/api/chatflow/v1/model/webapp_settings.py +88 -0
  149. dify_oapi/api/chatflow/v1/resource/__init__.py +0 -0
  150. dify_oapi/api/chatflow/v1/resource/annotation.py +122 -0
  151. dify_oapi/api/chatflow/v1/resource/application.py +76 -0
  152. dify_oapi/api/chatflow/v1/resource/chatflow.py +91 -0
  153. dify_oapi/api/chatflow/v1/resource/conversation.py +104 -0
  154. dify_oapi/api/chatflow/v1/resource/feedback.py +69 -0
  155. dify_oapi/api/chatflow/v1/resource/file.py +39 -0
  156. dify_oapi/api/chatflow/v1/resource/tts.py +29 -0
  157. dify_oapi/api/chatflow/v1/version.py +29 -0
  158. dify_oapi/api/knowledge/v1/model/data_source_detail.py +23 -0
  159. dify_oapi/api/knowledge/v1/model/dataset_info.py +10 -9
  160. dify_oapi/api/knowledge/v1/model/dataset_metadata.py +14 -0
  161. dify_oapi/api/knowledge/v1/model/document_info.py +18 -6
  162. dify_oapi/api/knowledge/v1/model/external_knowledge_info.py +11 -1
  163. dify_oapi/api/knowledge/v1/model/external_retrieval_model.py +13 -0
  164. dify_oapi/api/knowledge/v1/model/knowledge_types.py +2 -2
  165. dify_oapi/api/knowledge/v1/model/retrieval_model.py +10 -4
  166. dify_oapi/api/knowledge/v1/model/weights.py +27 -0
  167. dify_oapi/api/workflow/v1/model/chunk_workflow_event.py +74 -0
  168. dify_oapi/api/workflow/v1/model/input_file_object_workflow.py +76 -0
  169. dify_oapi/api/workflow/v1/model/node_finished_data.py +118 -0
  170. dify_oapi/api/workflow/v1/model/node_started_data.py +81 -0
  171. dify_oapi/api/workflow/v1/model/ping_data.py +28 -0
  172. dify_oapi/api/workflow/v1/model/run_workflow_request_body.py +1 -1
  173. dify_oapi/api/workflow/v1/model/text_chunk_data.py +39 -0
  174. dify_oapi/api/workflow/v1/model/tts_message_data.py +45 -0
  175. dify_oapi/api/workflow/v1/model/tts_message_end_data.py +45 -0
  176. dify_oapi/api/workflow/v1/model/workflow_completion_response.py +50 -0
  177. dify_oapi/api/workflow/v1/model/workflow_finished_data.py +93 -0
  178. dify_oapi/api/workflow/v1/model/workflow_started_data.py +51 -0
  179. dify_oapi/api/workflow/v1/model/workflow_types.py +27 -12
  180. dify_oapi/client.py +45 -0
  181. dify_oapi/core/http/transport/__init__.py +2 -1
  182. dify_oapi/core/http/transport/async_transport.py +73 -50
  183. dify_oapi/core/http/transport/connection_pool.py +131 -0
  184. dify_oapi/core/http/transport/sync_transport.py +73 -50
  185. dify_oapi/core/model/config.py +10 -0
  186. {dify_oapi2-0.4.0.dist-info → dify_oapi2-0.5.0.dist-info}/METADATA +44 -12
  187. {dify_oapi2-0.4.0.dist-info → dify_oapi2-0.5.0.dist-info}/RECORD +189 -34
  188. dify_oapi/api/chat/v1/model/chat_request_file.py +0 -46
  189. dify_oapi/api/chat/v1/model/message_suggested_request.py +0 -36
  190. {dify_oapi2-0.4.0.dist-info → dify_oapi2-0.5.0.dist-info}/LICENSE +0 -0
  191. {dify_oapi2-0.4.0.dist-info → dify_oapi2-0.5.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,210 @@
1
+ """Strict type definitions for all Chatflow API enums and constants.
2
+
3
+ This module defines all Literal types used throughout the Chatflow API
4
+ to ensure type safety and prevent invalid values.
5
+ """
6
+
7
+ from typing import Literal
8
+
9
+ # Response mode types for chat messages
10
+ ResponseMode = Literal["streaming", "blocking"]
11
+ """Response mode for chat messages.
12
+ - streaming: Real-time streaming response
13
+ - blocking: Complete response after processing (Cloudflare timeout is 100s)
14
+ """
15
+
16
+ # File types for file attachments
17
+ FileType = Literal["document", "image", "audio", "video", "custom"]
18
+ """File type for attachments.
19
+ - document: TXT, MD, PDF, HTML, XLSX, DOCX, CSV, EML, MSG, PPTX, XML, EPUB
20
+ - image: JPG, PNG, GIF, WEBP, SVG
21
+ - audio: MP3, M4A, WAV, WEBM, AMR
22
+ - video: MP4, MOV, MPEG, MPGA
23
+ - custom: Custom file type
24
+ """
25
+
26
+ # Transfer method types for file handling
27
+ TransferMethod = Literal["remote_url", "local_file"]
28
+ """Transfer method for file handling.
29
+ - remote_url: File URL for remote files
30
+ - local_file: File upload for local files
31
+ """
32
+
33
+ # Stream event types for real-time responses
34
+ StreamEvent = Literal[
35
+ "message",
36
+ "message_file",
37
+ "message_end",
38
+ "tts_message",
39
+ "tts_message_end",
40
+ "message_replace",
41
+ "workflow_started",
42
+ "node_started",
43
+ "node_finished",
44
+ "workflow_finished",
45
+ "error",
46
+ "ping",
47
+ ]
48
+ """Stream event types for real-time chat responses.
49
+ - message: Chat message content chunk
50
+ - message_file: File attachment information
51
+ - message_end: End of message with metadata
52
+ - tts_message: Text-to-speech audio chunk (Base64 encoded)
53
+ - tts_message_end: End of TTS conversion
54
+ - message_replace: Replace previous message content
55
+ - workflow_started: Workflow execution started
56
+ - node_started: Workflow node execution started
57
+ - node_finished: Workflow node execution finished
58
+ - workflow_finished: Workflow execution completed
59
+ - error: Error occurred during processing
60
+ - ping: Keep-alive ping
61
+ """
62
+
63
+ # Message file belongs to types
64
+ MessageFileBelongsTo = Literal["user", "assistant"]
65
+ """Message file ownership.
66
+ - user: File belongs to user
67
+ - assistant: File belongs to assistant
68
+ """
69
+
70
+ # Feedback rating types
71
+ FeedbackRating = Literal["like", "dislike"]
72
+ """Feedback rating types.
73
+ - like: Positive feedback
74
+ - dislike: Negative feedback
75
+ """
76
+
77
+ # Sort by types for conversation listing
78
+ SortBy = Literal["created_at", "-created_at", "updated_at", "-updated_at"]
79
+ """Sort by options for conversation listing.
80
+ - created_at: Sort by creation time (ascending)
81
+ - -created_at: Sort by creation time (descending)
82
+ - updated_at: Sort by update time (ascending)
83
+ - -updated_at: Sort by update time (descending)
84
+ """
85
+
86
+ # Conversation status types
87
+ ConversationStatus = Literal["normal", "archived"]
88
+ """Conversation status types.
89
+ - normal: Active conversation
90
+ - archived: Archived conversation
91
+ """
92
+
93
+ # Variable value types
94
+ VariableValueType = Literal["string", "number", "select"]
95
+ """Variable value types for conversation variables.
96
+ - string: String value
97
+ - number: Numeric value
98
+ - select: Selection value
99
+ """
100
+
101
+ # Form input types for user input forms
102
+ FormInputType = Literal["text-input", "paragraph", "select"]
103
+ """Form input types for user input forms.
104
+ - text-input: Single line text input
105
+ - paragraph: Multi-line text input
106
+ - select: Selection dropdown
107
+ """
108
+
109
+ # Job status types for annotation operations
110
+ JobStatus = Literal["waiting", "running", "completed", "failed"]
111
+ """Job status types for annotation operations.
112
+ - waiting: Job is waiting to start
113
+ - running: Job is currently running
114
+ - completed: Job completed successfully
115
+ - failed: Job failed with error
116
+ """
117
+
118
+ # Audio format types for TTS operations
119
+ AudioFormat = Literal["mp3", "mp4", "mpeg", "mpga", "m4a", "wav", "webm"]
120
+ """Audio format types for TTS operations.
121
+ - mp3: MP3 audio format
122
+ - mp4: MP4 audio format
123
+ - mpeg: MPEG audio format
124
+ - mpga: MPGA audio format
125
+ - m4a: M4A audio format
126
+ - wav: WAV audio format
127
+ - webm: WebM audio format
128
+ """
129
+
130
+ # Language codes for internationalization
131
+ LanguageCode = Literal["en", "zh", "ja", "ko", "es", "fr", "de", "it", "pt", "ru"]
132
+ """Language codes for internationalization.
133
+ - en: English
134
+ - zh: Chinese
135
+ - ja: Japanese
136
+ - ko: Korean
137
+ - es: Spanish
138
+ - fr: French
139
+ - de: German
140
+ - it: Italian
141
+ - pt: Portuguese
142
+ - ru: Russian
143
+ """
144
+
145
+ # Chat color theme types
146
+ ChatColorTheme = Literal["blue", "green", "purple", "orange", "red"]
147
+ """Chat color theme types for UI customization.
148
+ - blue: Blue theme
149
+ - green: Green theme
150
+ - purple: Purple theme
151
+ - orange: Orange theme
152
+ - red: Red theme
153
+ """
154
+
155
+ # Default language types for application settings
156
+ DefaultLanguage = Literal[
157
+ "en-US", "zh-Hans", "zh-Hant", "ja-JP", "ko-KR", "es-ES", "fr-FR", "de-DE", "it-IT", "pt-BR", "ru-RU"
158
+ ]
159
+ """Default language types for application settings.
160
+ - en-US: English (United States)
161
+ - zh-Hans: Chinese (Simplified)
162
+ - zh-Hant: Chinese (Traditional)
163
+ - ja-JP: Japanese (Japan)
164
+ - ko-KR: Korean (Korea)
165
+ - es-ES: Spanish (Spain)
166
+ - fr-FR: French (France)
167
+ - de-DE: German (Germany)
168
+ - it-IT: Italian (Italy)
169
+ - pt-BR: Portuguese (Brazil)
170
+ - ru-RU: Russian (Russia)
171
+ """
172
+
173
+ # Icon types for application settings
174
+ IconType = Literal["emoji", "image"]
175
+ """Icon types for application settings.
176
+ - emoji: Emoji icon
177
+ - image: Image icon
178
+ """
179
+
180
+ # AutoPlay types for TTS settings
181
+ AutoPlay = Literal["enabled", "disabled"]
182
+ """AutoPlay types for TTS settings.
183
+ - enabled: Auto-play enabled
184
+ - disabled: Auto-play disabled
185
+ """
186
+
187
+ # Annotation action types
188
+ AnnotationAction = Literal["enable", "disable"]
189
+ """Annotation action types for reply settings.
190
+ - enable: Enable annotation reply
191
+ - disable: Disable annotation reply
192
+ """
193
+
194
+ # Node status types for workflow operations
195
+ NodeStatus = Literal["running", "succeeded", "failed", "stopped"]
196
+ """Node status types for workflow operations.
197
+ - running: Node is currently running
198
+ - succeeded: Node completed successfully
199
+ - failed: Node failed with error
200
+ - stopped: Node was stopped
201
+ """
202
+
203
+ # Workflow status types
204
+ WorkflowStatus = Literal["running", "succeeded", "failed", "stopped"]
205
+ """Workflow status types.
206
+ - running: Workflow is currently running
207
+ - succeeded: Workflow completed successfully
208
+ - failed: Workflow failed with error
209
+ - stopped: Workflow was stopped
210
+ """
@@ -0,0 +1,53 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class ConversationInfo(BaseModel):
5
+ """Conversation information model."""
6
+
7
+ id: str | None = None
8
+ name: str | None = None
9
+ inputs: dict[str, str] | None = None
10
+ status: str | None = None
11
+ introduction: str | None = None
12
+ created_at: int | None = None
13
+ updated_at: int | None = None
14
+
15
+ @staticmethod
16
+ def builder() -> "ConversationInfoBuilder":
17
+ return ConversationInfoBuilder()
18
+
19
+
20
+ class ConversationInfoBuilder:
21
+ def __init__(self):
22
+ self._conversation_info = ConversationInfo()
23
+
24
+ def build(self) -> ConversationInfo:
25
+ return self._conversation_info
26
+
27
+ def id(self, id: str) -> "ConversationInfoBuilder":
28
+ self._conversation_info.id = id
29
+ return self
30
+
31
+ def name(self, name: str) -> "ConversationInfoBuilder":
32
+ self._conversation_info.name = name
33
+ return self
34
+
35
+ def inputs(self, inputs: dict[str, str]) -> "ConversationInfoBuilder":
36
+ self._conversation_info.inputs = inputs
37
+ return self
38
+
39
+ def status(self, status: str) -> "ConversationInfoBuilder":
40
+ self._conversation_info.status = status
41
+ return self
42
+
43
+ def introduction(self, introduction: str) -> "ConversationInfoBuilder":
44
+ self._conversation_info.introduction = introduction
45
+ return self
46
+
47
+ def created_at(self, created_at: int) -> "ConversationInfoBuilder":
48
+ self._conversation_info.created_at = created_at
49
+ return self
50
+
51
+ def updated_at(self, updated_at: int) -> "ConversationInfoBuilder":
52
+ self._conversation_info.updated_at = updated_at
53
+ return self
@@ -0,0 +1,55 @@
1
+ from pydantic import BaseModel
2
+
3
+ from .chatflow_types import VariableValueType
4
+
5
+
6
+ class ConversationVariable(BaseModel):
7
+ """Conversation variable model."""
8
+
9
+ id: str | None = None
10
+ name: str | None = None
11
+ value_type: VariableValueType | None = None
12
+ value: str | None = None
13
+ description: str | None = None
14
+ created_at: int | None = None
15
+ updated_at: int | None = None
16
+
17
+ @staticmethod
18
+ def builder() -> "ConversationVariableBuilder":
19
+ return ConversationVariableBuilder()
20
+
21
+
22
+ class ConversationVariableBuilder:
23
+ def __init__(self):
24
+ self._conversation_variable = ConversationVariable()
25
+
26
+ def build(self) -> ConversationVariable:
27
+ return self._conversation_variable
28
+
29
+ def id(self, id: str) -> "ConversationVariableBuilder":
30
+ self._conversation_variable.id = id
31
+ return self
32
+
33
+ def name(self, name: str) -> "ConversationVariableBuilder":
34
+ self._conversation_variable.name = name
35
+ return self
36
+
37
+ def value_type(self, value_type: VariableValueType) -> "ConversationVariableBuilder":
38
+ self._conversation_variable.value_type = value_type
39
+ return self
40
+
41
+ def value(self, value: str) -> "ConversationVariableBuilder":
42
+ self._conversation_variable.value = value
43
+ return self
44
+
45
+ def description(self, description: str) -> "ConversationVariableBuilder":
46
+ self._conversation_variable.description = description
47
+ return self
48
+
49
+ def created_at(self, created_at: int) -> "ConversationVariableBuilder":
50
+ self._conversation_variable.created_at = created_at
51
+ return self
52
+
53
+ def updated_at(self, updated_at: int) -> "ConversationVariableBuilder":
54
+ self._conversation_variable.updated_at = updated_at
55
+ return self
@@ -0,0 +1,30 @@
1
+ from dify_oapi.core.enum import HttpMethod
2
+ from dify_oapi.core.model.base_request import BaseRequest
3
+
4
+ from .create_annotation_request_body import CreateAnnotationRequestBody
5
+
6
+
7
+ class CreateAnnotationRequest(BaseRequest):
8
+ def __init__(self):
9
+ super().__init__()
10
+ self.request_body: CreateAnnotationRequestBody | None = None
11
+
12
+ @staticmethod
13
+ def builder() -> "CreateAnnotationRequestBuilder":
14
+ return CreateAnnotationRequestBuilder()
15
+
16
+
17
+ class CreateAnnotationRequestBuilder:
18
+ def __init__(self):
19
+ create_annotation_request = CreateAnnotationRequest()
20
+ create_annotation_request.http_method = HttpMethod.POST
21
+ create_annotation_request.uri = "/v1/apps/annotations"
22
+ self._create_annotation_request = create_annotation_request
23
+
24
+ def build(self) -> CreateAnnotationRequest:
25
+ return self._create_annotation_request
26
+
27
+ def request_body(self, request_body: CreateAnnotationRequestBody) -> "CreateAnnotationRequestBuilder":
28
+ self._create_annotation_request.request_body = request_body
29
+ self._create_annotation_request.body = request_body.model_dump(exclude_none=True, mode="json")
30
+ return self
@@ -0,0 +1,28 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class CreateAnnotationRequestBody(BaseModel):
5
+ """Request body for creating annotation."""
6
+
7
+ question: str | None = None
8
+ answer: str | None = None
9
+
10
+ @staticmethod
11
+ def builder() -> "CreateAnnotationRequestBodyBuilder":
12
+ return CreateAnnotationRequestBodyBuilder()
13
+
14
+
15
+ class CreateAnnotationRequestBodyBuilder:
16
+ def __init__(self):
17
+ self._create_annotation_request_body = CreateAnnotationRequestBody()
18
+
19
+ def build(self) -> CreateAnnotationRequestBody:
20
+ return self._create_annotation_request_body
21
+
22
+ def question(self, question: str) -> "CreateAnnotationRequestBodyBuilder":
23
+ self._create_annotation_request_body.question = question
24
+ return self
25
+
26
+ def answer(self, answer: str) -> "CreateAnnotationRequestBodyBuilder":
27
+ self._create_annotation_request_body.answer = answer
28
+ return self
@@ -0,0 +1,9 @@
1
+ from dify_oapi.core.model.base_response import BaseResponse
2
+
3
+ from .annotation_info import AnnotationInfo
4
+
5
+
6
+ class CreateAnnotationResponse(AnnotationInfo, BaseResponse):
7
+ """Response for creating annotation."""
8
+
9
+ pass
@@ -0,0 +1,28 @@
1
+ from dify_oapi.core.enum import HttpMethod
2
+ from dify_oapi.core.model.base_request import BaseRequest
3
+
4
+
5
+ class DeleteAnnotationRequest(BaseRequest):
6
+ def __init__(self):
7
+ super().__init__()
8
+ self.annotation_id: str | None = None
9
+
10
+ @staticmethod
11
+ def builder() -> "DeleteAnnotationRequestBuilder":
12
+ return DeleteAnnotationRequestBuilder()
13
+
14
+
15
+ class DeleteAnnotationRequestBuilder:
16
+ def __init__(self):
17
+ delete_annotation_request = DeleteAnnotationRequest()
18
+ delete_annotation_request.http_method = HttpMethod.DELETE
19
+ delete_annotation_request.uri = "/v1/apps/annotations/:annotation_id"
20
+ self._delete_annotation_request = delete_annotation_request
21
+
22
+ def build(self) -> DeleteAnnotationRequest:
23
+ return self._delete_annotation_request
24
+
25
+ def annotation_id(self, annotation_id: str) -> "DeleteAnnotationRequestBuilder":
26
+ self._delete_annotation_request.annotation_id = annotation_id
27
+ self._delete_annotation_request.paths["annotation_id"] = annotation_id
28
+ return self
@@ -0,0 +1,7 @@
1
+ from dify_oapi.core.model.base_response import BaseResponse
2
+
3
+
4
+ class DeleteAnnotationResponse(BaseResponse):
5
+ """Response for deleting annotation (No Content - 204)."""
6
+
7
+ pass
@@ -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 .delete_conversation_request_body import DeleteConversationRequestBody
5
+
6
+
7
+ class DeleteConversationRequest(BaseRequest):
8
+ def __init__(self):
9
+ super().__init__()
10
+ self.request_body: DeleteConversationRequestBody | None = None
11
+ self.conversation_id: str | None = None
12
+
13
+ @staticmethod
14
+ def builder() -> "DeleteConversationRequestBuilder":
15
+ return DeleteConversationRequestBuilder()
16
+
17
+
18
+ class DeleteConversationRequestBuilder:
19
+ def __init__(self):
20
+ delete_conversation_request = DeleteConversationRequest()
21
+ delete_conversation_request.http_method = HttpMethod.DELETE
22
+ delete_conversation_request.uri = "/v1/conversations/:conversation_id"
23
+ self._delete_conversation_request = delete_conversation_request
24
+
25
+ def build(self) -> DeleteConversationRequest:
26
+ return self._delete_conversation_request
27
+
28
+ def conversation_id(self, conversation_id: str) -> "DeleteConversationRequestBuilder":
29
+ self._delete_conversation_request.conversation_id = conversation_id
30
+ self._delete_conversation_request.paths["conversation_id"] = conversation_id
31
+ return self
32
+
33
+ def request_body(self, request_body: DeleteConversationRequestBody) -> "DeleteConversationRequestBuilder":
34
+ self._delete_conversation_request.request_body = request_body
35
+ self._delete_conversation_request.body = request_body.model_dump(exclude_none=True, mode="json")
36
+ return self
@@ -0,0 +1,21 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class DeleteConversationRequestBody(BaseModel):
5
+ user: str | None = None
6
+
7
+ @staticmethod
8
+ def builder() -> "DeleteConversationRequestBodyBuilder":
9
+ return DeleteConversationRequestBodyBuilder()
10
+
11
+
12
+ class DeleteConversationRequestBodyBuilder:
13
+ def __init__(self):
14
+ self._delete_conversation_request_body = DeleteConversationRequestBody()
15
+
16
+ def build(self) -> DeleteConversationRequestBody:
17
+ return self._delete_conversation_request_body
18
+
19
+ def user(self, user: str) -> "DeleteConversationRequestBodyBuilder":
20
+ self._delete_conversation_request_body.user = user
21
+ return self
@@ -0,0 +1,17 @@
1
+ from dify_oapi.core.model.base_response import BaseResponse
2
+
3
+
4
+ class DeleteConversationResponse(BaseResponse):
5
+ """Response for delete conversation operation (No Content - 204)."""
6
+
7
+ @staticmethod
8
+ def builder() -> "DeleteConversationResponseBuilder":
9
+ return DeleteConversationResponseBuilder()
10
+
11
+
12
+ class DeleteConversationResponseBuilder:
13
+ def __init__(self):
14
+ self._delete_conversation_response = DeleteConversationResponse()
15
+
16
+ def build(self) -> DeleteConversationResponse:
17
+ return self._delete_conversation_response
@@ -0,0 +1,75 @@
1
+ from pydantic import BaseModel
2
+
3
+ from .chatflow_types import FeedbackRating
4
+
5
+
6
+ class FeedbackInfo(BaseModel):
7
+ """Feedback information model."""
8
+
9
+ id: str | None = None
10
+ app_id: str | None = None
11
+ conversation_id: str | None = None
12
+ message_id: str | None = None
13
+ rating: FeedbackRating | None = None
14
+ content: str | None = None
15
+ from_source: str | None = None
16
+ from_end_user_id: str | None = None
17
+ from_account_id: str | None = None
18
+ created_at: str | None = None
19
+ updated_at: str | None = None
20
+
21
+ @staticmethod
22
+ def builder() -> "FeedbackInfoBuilder":
23
+ return FeedbackInfoBuilder()
24
+
25
+
26
+ class FeedbackInfoBuilder:
27
+ def __init__(self):
28
+ self._feedback_info = FeedbackInfo()
29
+
30
+ def build(self) -> FeedbackInfo:
31
+ return self._feedback_info
32
+
33
+ def id(self, id: str) -> "FeedbackInfoBuilder":
34
+ self._feedback_info.id = id
35
+ return self
36
+
37
+ def app_id(self, app_id: str) -> "FeedbackInfoBuilder":
38
+ self._feedback_info.app_id = app_id
39
+ return self
40
+
41
+ def conversation_id(self, conversation_id: str) -> "FeedbackInfoBuilder":
42
+ self._feedback_info.conversation_id = conversation_id
43
+ return self
44
+
45
+ def message_id(self, message_id: str) -> "FeedbackInfoBuilder":
46
+ self._feedback_info.message_id = message_id
47
+ return self
48
+
49
+ def rating(self, rating: FeedbackRating) -> "FeedbackInfoBuilder":
50
+ self._feedback_info.rating = rating
51
+ return self
52
+
53
+ def content(self, content: str) -> "FeedbackInfoBuilder":
54
+ self._feedback_info.content = content
55
+ return self
56
+
57
+ def from_source(self, from_source: str) -> "FeedbackInfoBuilder":
58
+ self._feedback_info.from_source = from_source
59
+ return self
60
+
61
+ def from_end_user_id(self, from_end_user_id: str) -> "FeedbackInfoBuilder":
62
+ self._feedback_info.from_end_user_id = from_end_user_id
63
+ return self
64
+
65
+ def from_account_id(self, from_account_id: str) -> "FeedbackInfoBuilder":
66
+ self._feedback_info.from_account_id = from_account_id
67
+ return self
68
+
69
+ def created_at(self, created_at: str) -> "FeedbackInfoBuilder":
70
+ self._feedback_info.created_at = created_at
71
+ return self
72
+
73
+ def updated_at(self, updated_at: str) -> "FeedbackInfoBuilder":
74
+ self._feedback_info.updated_at = updated_at
75
+ return self
@@ -0,0 +1,53 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class FileInfo(BaseModel):
5
+ """File information model."""
6
+
7
+ id: str | None = None
8
+ name: str | None = None
9
+ size: int | None = None
10
+ extension: str | None = None
11
+ mime_type: str | None = None
12
+ created_by: str | None = None
13
+ created_at: int | None = None
14
+
15
+ @staticmethod
16
+ def builder() -> "FileInfoBuilder":
17
+ return FileInfoBuilder()
18
+
19
+
20
+ class FileInfoBuilder:
21
+ def __init__(self):
22
+ self._file_info = FileInfo()
23
+
24
+ def build(self) -> FileInfo:
25
+ return self._file_info
26
+
27
+ def id(self, id: str) -> "FileInfoBuilder":
28
+ self._file_info.id = id
29
+ return self
30
+
31
+ def name(self, name: str) -> "FileInfoBuilder":
32
+ self._file_info.name = name
33
+ return self
34
+
35
+ def size(self, size: int) -> "FileInfoBuilder":
36
+ self._file_info.size = size
37
+ return self
38
+
39
+ def extension(self, extension: str) -> "FileInfoBuilder":
40
+ self._file_info.extension = extension
41
+ return self
42
+
43
+ def mime_type(self, mime_type: str) -> "FileInfoBuilder":
44
+ self._file_info.mime_type = mime_type
45
+ return self
46
+
47
+ def created_by(self, created_by: str) -> "FileInfoBuilder":
48
+ self._file_info.created_by = created_by
49
+ return self
50
+
51
+ def created_at(self, created_at: int) -> "FileInfoBuilder":
52
+ self._file_info.created_at = created_at
53
+ return self
@@ -0,0 +1,30 @@
1
+ from dify_oapi.core.enum import HttpMethod
2
+ from dify_oapi.core.model.base_request import BaseRequest
3
+
4
+
5
+ class GetAnnotationsRequest(BaseRequest):
6
+ def __init__(self):
7
+ super().__init__()
8
+
9
+ @staticmethod
10
+ def builder() -> "GetAnnotationsRequestBuilder":
11
+ return GetAnnotationsRequestBuilder()
12
+
13
+
14
+ class GetAnnotationsRequestBuilder:
15
+ def __init__(self):
16
+ get_annotations_request = GetAnnotationsRequest()
17
+ get_annotations_request.http_method = HttpMethod.GET
18
+ get_annotations_request.uri = "/v1/apps/annotations"
19
+ self._get_annotations_request = get_annotations_request
20
+
21
+ def build(self) -> GetAnnotationsRequest:
22
+ return self._get_annotations_request
23
+
24
+ def page(self, page: int) -> "GetAnnotationsRequestBuilder":
25
+ self._get_annotations_request.add_query("page", page)
26
+ return self
27
+
28
+ def limit(self, limit: int) -> "GetAnnotationsRequestBuilder":
29
+ self._get_annotations_request.add_query("limit", limit)
30
+ return self
@@ -0,0 +1,13 @@
1
+ from dify_oapi.core.model.base_response import BaseResponse
2
+
3
+ from .annotation_info import AnnotationInfo
4
+
5
+
6
+ class GetAnnotationsResponse(BaseResponse):
7
+ """Response for getting annotation list."""
8
+
9
+ data: list[AnnotationInfo] | None = None
10
+ has_more: bool | None = None
11
+ limit: int | None = None
12
+ total: int | None = None
13
+ page: int | None = None