Skip to content

Commit 81bb802

Browse files
authored
🐛 Bugfix: Fixed the issue where uploaded text files could not be parsed during a session. (#3219)
* 🐛 Bugfix: Fixed the issue where uploaded text files could not be parsed during a session. [Specification Details] 1. The return parameter of the file_process method has changed and needs to be unpacked. * 🐛 Bugfix: Fixed the issue where uploaded text files could not be parsed during a session. [Specification Details] 1. Modify test case.
1 parent 109a915 commit 81bb802

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

backend/services/data_process_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ async def process_uploaded_text_file(self, file_content: bytes, filename: str, c
600600
f"Processing uploaded file: {filename} using SDK DataProcessCore")
601601

602602
data_processor = DataProcessCore()
603-
chunks = data_processor.file_process(
603+
chunks, _ = data_processor.file_process(
604604
file_data=file_content,
605605
filename=filename,
606606
chunking_strategy=chunking_strategy

test/backend/services/test_data_process_service.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1918,11 +1918,14 @@ async def async_test_process_uploaded_text_file(self, mock_data_process_core):
19181918
"""
19191919
# Arrange: mock DataProcessCore.file_process to return mixed chunks
19201920
mock_instance = MagicMock()
1921-
mock_instance.file_process.return_value = [
1922-
{"content": "First chunk"},
1923-
{"no_content": True},
1924-
{"content": "Second chunk"},
1925-
]
1921+
mock_instance.file_process.return_value = (
1922+
[
1923+
{"content": "First chunk"},
1924+
{"no_content": True},
1925+
{"content": "Second chunk"},
1926+
],
1927+
[] # images_info
1928+
)
19261929
mock_data_process_core.return_value = mock_instance
19271930

19281931
filename = "test.txt"

0 commit comments

Comments
 (0)