From 0aa8144e2c09b39caf29f77b5447bea67d146526 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期五, 22 十一月 2024 11:26:32 +0800 Subject: [PATCH] 文档上传接口支持前端传多个文件 --- app/service/basic.py | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/service/basic.py b/app/service/basic.py index 9c22206..32b7fe5 100644 --- a/app/service/basic.py +++ b/app/service/basic.py @@ -44,12 +44,11 @@ url = f"{self.base_url}/exceltalk/download/excel" return await self.download_from_url(url, params={'excel_name': file_id}) - async def excel_talk_upload(self, chat_id: str, filename: str, file_content: bytes): + async def excel_talk_upload(self, chat_id: str, files): url = f"{self.base_url}/exceltalk/upload/files" params = {'chat_id': chat_id, 'is_col': '0'} - # 鍒涘缓 FormData 瀵硅薄 - files = [('files', (filename, file_content, 'application/octet-stream'))] + async with httpx.AsyncClient() as client: response = await client.post( -- Gitblit v1.8.0