diff --git a/apps/application/flow/step_node/document_extract_node/impl/base_document_extract_node.py b/apps/application/flow/step_node/document_extract_node/impl/base_document_extract_node.py index 6ddcb6e2f..0c4d09bce 100644 --- a/apps/application/flow/step_node/document_extract_node/impl/base_document_extract_node.py +++ b/apps/application/flow/step_node/document_extract_node/impl/base_document_extract_node.py @@ -66,7 +66,7 @@ class BaseDocumentExtractNode(IDocumentExtractNode): for doc in document: file = QuerySet(File).filter(id=doc['file_id']).first() - buffer = io.BytesIO(file.get_byte().tobytes()) + buffer = io.BytesIO(file.get_byte()) buffer.name = doc['name'] # this is the important line for split_handle in (parse_table_handle_list + split_handles): diff --git a/apps/application/flow/step_node/image_understand_step_node/impl/base_image_understand_node.py b/apps/application/flow/step_node/image_understand_step_node/impl/base_image_understand_node.py index 44765bc4f..0b405619d 100644 --- a/apps/application/flow/step_node/image_understand_step_node/impl/base_image_understand_node.py +++ b/apps/application/flow/step_node/image_understand_step_node/impl/base_image_understand_node.py @@ -62,7 +62,7 @@ def file_id_to_base64(file_id: str): file = QuerySet(File).filter(id=file_id).first() file_bytes = file.get_byte() base64_image = base64.b64encode(file_bytes).decode("utf-8") - return [base64_image, what(None, file_bytes.tobytes())] + return [base64_image, what(None, file_bytes)] class BaseImageUnderstandNode(IImageUnderstandNode): @@ -172,7 +172,7 @@ class BaseImageUnderstandNode(IImageUnderstandNode): file = QuerySet(File).filter(id=file_id).first() image_bytes = file.get_byte() base64_image = base64.b64encode(image_bytes).decode("utf-8") - image_format = what(None, image_bytes.tobytes()) + image_format = what(None, image_bytes) images.append({'type': 'image_url', 'image_url': {'url': f'data:image/{image_format};base64,{base64_image}'}}) messages = [HumanMessage( content=[ diff --git a/apps/application/flow/step_node/speech_to_text_step_node/impl/base_speech_to_text_node.py b/apps/application/flow/step_node/speech_to_text_step_node/impl/base_speech_to_text_node.py index d6bdbcce7..8f48823f0 100644 --- a/apps/application/flow/step_node/speech_to_text_step_node/impl/base_speech_to_text_node.py +++ b/apps/application/flow/step_node/speech_to_text_step_node/impl/base_speech_to_text_node.py @@ -32,7 +32,7 @@ class BaseSpeechToTextNode(ISpeechToTextNode): # 根据file_name 吧文件转成mp3格式 file_format = file.file_name.split('.')[-1] with tempfile.NamedTemporaryFile(delete=False, suffix=f'.{file_format}') as temp_file: - temp_file.write(file.get_byte().tobytes()) + temp_file.write(file.get_byte()) temp_file_path = temp_file.name with tempfile.NamedTemporaryFile(delete=False, suffix='.mp3') as temp_amr_file: temp_mp3_path = temp_amr_file.name