Browse Source

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

tags/0.10.1
-LAN- 1 year ago
parent
commit
36f66d40e5
No account linked to committer's email address

+ 5
- 6
api/controllers/console/datasets/file.py View File

@account_initialization_required @account_initialization_required
@marshal_with(upload_config_fields) @marshal_with(upload_config_fields)
def get(self): 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 { 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 }, 200


@setup_required @setup_required

+ 2
- 2
api/core/app/task_pipeline/based_generate_task_pipeline.py View File

self._output_moderation_handler = self._init_output_moderation() self._output_moderation_handler = self._init_output_moderation()
self._stream = stream 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. Handle error event.
:param event: event :param event: event


return message return message


def _error_to_stream_response(self, e: Exception) -> ErrorStreamResponse:
def _error_to_stream_response(self, e: Exception):
""" """
Error to stream response. Error to stream response.
:param e: exception :param e: exception

Loading…
Cancel
Save