diff --git a/backend/package/yuxi/services/conversation_service.py b/backend/package/yuxi/services/conversation_service.py index cc5ddaff..f5dca488 100644 --- a/backend/package/yuxi/services/conversation_service.py +++ b/backend/package/yuxi/services/conversation_service.py @@ -83,7 +83,7 @@ async def _convert_upload_to_markdown(upload: UploadFile) -> ConversionResult: try: file_size = await _write_upload_to_disk(upload, temp_path) - markdown = await Parser.aparse(str(temp_path), source_type="file") + markdown = await Parser.aparse(str(temp_path)) markdown, truncated = _truncate_markdown(markdown) return ConversionResult( file_id=uuid.uuid4().hex, @@ -94,7 +94,7 @@ async def _convert_upload_to_markdown(upload: UploadFile) -> ConversionResult: truncated=truncated, ) except Exception as exc: # noqa: BLE001 - logger.error("Attachment conversion failed: %s", exc) + logger.error(f"Attachment conversion failed: {exc}") raise diff --git a/backend/test/test_conversation_service_attachment_state.py b/backend/test/test_conversation_service_attachment_state.py index 7d85d5b3..c133329e 100644 --- a/backend/test/test_conversation_service_attachment_state.py +++ b/backend/test/test_conversation_service_attachment_state.py @@ -123,8 +123,7 @@ async def test_convert_upload_to_markdown_returns_conversion_result( tmp_path, monkeypatch: pytest.MonkeyPatch, ): - async def _fake_aparse(source: str, params=None, source_type: str = "file") -> str: - assert source_type == "file" + async def _fake_aparse(source: str, params=None) -> str: return "converted markdown" monkeypatch.setattr(svc, "_ensure_workdir", lambda: tmp_path) @@ -147,8 +146,7 @@ async def test_convert_upload_to_markdown_truncates_content( tmp_path, monkeypatch: pytest.MonkeyPatch, ): - async def _fake_aparse(source: str, params=None, source_type: str = "file") -> str: - assert source_type == "file" + async def _fake_aparse(source: str, params=None) -> str: return "x" * (svc.MAX_ATTACHMENT_MARKDOWN_CHARS + 200) monkeypatch.setattr(svc, "_ensure_workdir", lambda: tmp_path)