From 519930bc1112cdf7881fecce907381ce6374e74c Mon Sep 17 00:00:00 2001
From: zhaoqingang <zhaoqg0118@163.com>
Date: 星期二, 14 一月 2025 13:37:56 +0800
Subject: [PATCH] 文档出卷-未上传文件提示
---
app/service/basic.py | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/app/service/basic.py b/app/service/basic.py
index b3ad295..29bb02a 100644
--- a/app/service/basic.py
+++ b/app/service/basic.py
@@ -51,7 +51,7 @@
url = f"{self.base_url}/exceltalk/upload/files"
params = {'chat_id': chat_id, 'is_col': '0'}
- async with httpx.AsyncClient() as client:
+ async with httpx.AsyncClient(timeout=300) as client:
response = await client.post(
url,
files=files,
@@ -73,18 +73,23 @@
if decoded_line.startswith("data:"):
decoded_line = decoded_line[5:]
answer = json.loads(decoded_line)
+ answer["type"] = "message"
yield answer
except GeneratorExit as e:
logger.error("------------except GeneratorExit as e:---------------------")
logger.error(e)
print(e)
yield {"message": "鍐呴儴閿欒", "type": "close"}
- finally:
- # 鍦ㄦ墍鏈夋暟鎹帴鏀跺畬姣曞悗杩斿洖close
- yield {"message": "", "type": "close"}
+ # finally:
+ # # 鍦ㄦ墍鏈夋暟鎹帴鏀跺畬姣曞悗杩斿洖close
+ # yield {"message": "", "type": "close"}
else:
- yield f"Error: {response.status_code}"
+ continue
+ # yield f"Error: {response.status_code}"
+ else:
+ # 鍦ㄦ墍鏈夋暟鎹帴鏀跺畬姣曞悗杩斿洖close
+ yield {"message": "", "type": "close"}
async def questions_talk(self, question, chat_id: str):
logger.error("---------------questions_talk--------------------------")
--
Gitblit v1.8.0