From 78f2ae2a03d8786050892e1c17bcf24b029a27db Mon Sep 17 00:00:00 2001 From: Wenjie Zhang Date: Fri, 20 Mar 2026 12:42:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=A7=BB=E9=99=A4=5Fparser=5F=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E4=B8=AD=E7=9A=84source=5Ftype=E5=8F=82=E6=95=B0?= =?UTF-8?q?=EF=BC=8C=E5=B9=B6=E6=9B=B4=E6=96=B0=E7=9B=B8=E5=85=B3=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/package/yuxi/services/conversation_service.py | 4 ++-- backend/test/test_conversation_service_attachment_state.py | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) 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)