From a27d23e9d7dde3a220795828971f480850c22b8f Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期四, 14 十一月 2024 23:32:09 +0800 Subject: [PATCH] 文档智能改成毕昇的,去除毕昇文档回答的重复消息 --- app/task/fetch_agent.py | 2 +- app/api/report.py | 12 ++++++++---- app/config/config.yaml | 4 ++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/api/report.py b/app/api/report.py index 232c4b0..b2bac8a 100644 --- a/app/api/report.py +++ b/app/api/report.py @@ -65,16 +65,19 @@ files = data.get("files", []) steps = data.get("intermediate_steps", "") msg = data.get("message", "") + category = data.get("category", "") - if len(files) != 0 or (steps and last_message == "step") or msg or data["type"] == "close": + if len(files) != 0 or (msg and category != "answer") or data["type"] == "close": if data["type"] == "close": t = "close" else: t = "stream" process_files(files, agent_id) - result = {"step_message": steps, "message": msg, "type": t, "files": files} + result = {"message": msg, "type": t, "files": files} await websocket.send_json(result) - print(f"Forwarded to client, {chat_id}: {result}") + elif steps and last_message == "step": + result = {"step_message": steps, "type": "stream", "files": files} + await websocket.send_json(result) last_message = "message" if msg else "step" @@ -90,7 +93,8 @@ task.cancel() try: await task - except asyncio.CancelledError: + except asyncio.CancelledError as e: + print(f"asyncio CancelledError: {e}") pass except WebSocketDisconnect as e: diff --git a/app/config/config.yaml b/app/config/config.yaml index 9477b79..48050ba 100644 --- a/app/config/config.yaml +++ b/app/config/config.yaml @@ -10,5 +10,5 @@ MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArq9XTUSeYr2+N1h3Afl/z8Dse/2yD0ZGrKwx+EEEcdsBLca9Ynmx3nIB5obmLlSfmskLpBo0UACBmB5rEjBp2Q2f3AG3Hjd4B+gNCG6BDaawuDlgANIhGnaTLrIqWrrcm4EMzJOnAOI1fgzJRsOOUEfaS318Eq9OVO3apEyCCt0lOQK6PuksduOjVxtltDav+guVAA068NrPYmRNabVKRNLJpL8w4D44sfth5RvZ3q9t+6RTArpEtc5sh5ChzvqPOzKGMXW83C95TxmXqpbK6olN4RevSfVjEAgCydH6HN6OhtOQEcnrU97r9H0iZOWwbw3pVrZiUkuRD1R56Wzs2wIDAQAB -----END PUBLIC KEY----- PRIVATE_KEY: str -fetch_sgb_agent: 鎶ュ憡鐢熸垚 -fetch_fwr_agent: 鐭ヨ瘑闂瓟,鏂囨。鏅鸿兘,鏅鸿兘闂瓟 \ No newline at end of file +fetch_sgb_agent: 鎶ュ憡鐢熸垚,鏂囨。鏅鸿兘 +fetch_fwr_agent: 鐭ヨ瘑闂瓟,鏅鸿兘闂瓟 \ No newline at end of file diff --git a/app/task/fetch_agent.py b/app/task/fetch_agent.py index b6852c0..706ac6f 100644 --- a/app/task/fetch_agent.py +++ b/app/task/fetch_agent.py @@ -112,7 +112,7 @@ initial_agents = [ ('80ee430a-e396-48c4-a12c-7c7cdf5eda51', 1, '鎶ュ憡鐢熸垚', 'BISHENG', 'report'), ('basic_excel_merge', 2, '鎶ヨ〃鍚堝苟', 'BASIC', 'excelMerge'), - ('bfd090d589d811efb3630242ac190006', 4, '鏂囨。鏅鸿兘', 'RAGFLOW', 'documentChat'), + ('bfd090d589d811efb3630242ac190006', 4, '鏂囨。鏅鸿兘', 'BISHENG', 'documentChat'), ('da3451da89d911efb9490242ac190006', 3, '鐭ヨ瘑闂瓟', 'RAGFLOW', 'knowledgeQA'), ('e96eb7a589db11ef87d20242ac190006', 5, '鏅鸿兘闂瓟', 'RAGFLOW', 'chat') ] -- Gitblit v1.8.0