mirror of
https://github.com/Yanyutin753/RefreshToV1Api.git
synced 2025-10-14 23:22:42 +00:00
[fix] 尝试解决未知错误引起的会话中断导致对话记录删除失败的问题
This commit is contained in:
13
main.py
13
main.py
@@ -187,9 +187,9 @@ CORS(app, resources={r"/images/*": {"origins": "*"}})
|
||||
PANDORA_UPLOAD_URL = 'files.pandoranext.com'
|
||||
|
||||
|
||||
VERSION = '0.4.8'
|
||||
VERSION = '0.4.9'
|
||||
# VERSION = 'test'
|
||||
UPDATE_INFO = '基于Redis减少重复文件的上传,优化响应速度'
|
||||
UPDATE_INFO = '尝试解决未知错误引起的会话中断导致对话记录删除失败的问题'
|
||||
# UPDATE_INFO = '【仅供临时测试使用】 '
|
||||
|
||||
with app.app_context():
|
||||
@@ -952,6 +952,7 @@ def data_fetcher(upstream_response, data_queue, stop_event, last_data_time, api_
|
||||
file_output_accumulating = False
|
||||
execution_output_image_url_buffer = ""
|
||||
execution_output_image_id_buffer = ""
|
||||
try:
|
||||
for chunk in upstream_response.iter_content(chunk_size=1024):
|
||||
if chunk:
|
||||
buffer += chunk.decode('utf-8')
|
||||
@@ -1439,6 +1440,14 @@ def data_fetcher(upstream_response, data_queue, stop_event, last_data_time, api_
|
||||
data_queue.put(('all_new_text', all_new_text))
|
||||
data_queue.put(q_data)
|
||||
last_data_time[0] = time.time()
|
||||
except Exception as e:
|
||||
logger.error(f"Exception: {e}")
|
||||
complete_data = 'data: [DONE]\n\n'
|
||||
logger.info(f"会话结束")
|
||||
q_data = complete_data
|
||||
data_queue.put(('all_new_text', all_new_text))
|
||||
data_queue.put(q_data)
|
||||
last_data_time[0] = time.time()
|
||||
|
||||
def keep_alive(last_data_time, stop_event, queue, model, chat_message_id):
|
||||
while not stop_event.is_set():
|
||||
|
Reference in New Issue
Block a user