Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

refactor(api): simplify limit retrieval and return types (#9641)

-LAN-36f66d40e5f4
diff --git a/api/controllers/console/datasets/file.py b/api/controllers/console/datasets/file.py
index 51be7e7a7d3..17d2879875b 100644
--- a/api/controllers/console/datasets/file.py
+++ b/api/controllers/console/datasets/file.py
@@ -30,13 +30,12 @@ class FileApi(Resource):
@account_initialization_required
@marshal_with(upload_config_fields)
def get(self):
- file_size_limit = dify_config.UPLOAD_FILE_SIZE_LIMIT
- batch_count_limit = dify_config.UPLOAD_FILE_BATCH_LIMIT
- image_file_size_limit = dify_config.UPLOAD_IMAGE_FILE_SIZE_LIMIT
return {
- "file_size_limit": file_size_limit,
- "batch_count_limit": batch_count_limit,
- "image_file_size_limit": image_file_size_limit,
+ "file_size_limit": dify_config.UPLOAD_FILE_SIZE_LIMIT,
+ "batch_count_limit": dify_config.UPLOAD_FILE_BATCH_LIMIT,
+ "image_file_size_limit": dify_config.UPLOAD_IMAGE_FILE_SIZE_LIMIT,
+ "video_file_size_limit": dify_config.UPLOAD_VIDEO_FILE_SIZE_LIMIT,
+ "audio_file_size_limit": dify_config.UPLOAD_AUDIO_FILE_SIZE_LIMIT,
}, 200
@setup_required
diff --git a/api/core/app/task_pipeline/based_generate_task_pipeline.py b/api/core/app/task_pipeline/based_generate_task_pipeline.py
index a43be5fdf29..51d610e2cbe 100644
--- a/api/core/app/task_pipeline/based_generate_task_pipeline.py
+++ b/api/core/app/task_pipeline/based_generate_task_pipeline.py
@@ -53,7 +53,7 @@ class BasedGenerateTaskPipeline:
self._output_moderation_handler = self._init_output_moderation()
self._stream = stream
- def _handle_error(self, event: QueueErrorEvent, message: Optional[Message] = None) -> Exception:
+ def _handle_error(self, event: QueueErrorEvent, message: Optional[Message] = None):
"""
Handle error event.
:param event: event
@@ -100,7 +100,7 @@ class BasedGenerateTaskPipeline:
return message
- def _error_to_stream_response(self, e: Exception) -> ErrorStreamResponse:
+ def _error_to_stream_response(self, e: Exception):
"""
Error to stream response.
:param e: exception