From 6c1f1a9f534a2327f4a7544393525c6c285f2d2f Mon Sep 17 00:00:00 2001 From: Kevin Hu Date: Wed, 28 Aug 2024 16:29:23 +0800 Subject: [PATCH] remove alter log (#2140) ### What problem does this PR solve? ### Type of change - [x] Refactoring --- api/apps/api_app.py | 1 + api/apps/conversation_app.py | 1 + rag/utils/redis_conn.py | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/api/apps/api_app.py b/api/apps/api_app.py index af5b4bfda..483243e4d 100644 --- a/api/apps/api_app.py +++ b/api/apps/api_app.py @@ -210,6 +210,7 @@ def completion(): else: conv.reference[-1] = ans["reference"] conv.message[-1] = {"role": "assistant", "content": ans["answer"], "id": message_id} + ans["id"] = message_id def rename_field(ans): reference = ans['reference'] diff --git a/api/apps/conversation_app.py b/api/apps/conversation_app.py index fbff76850..617a9f4cb 100644 --- a/api/apps/conversation_app.py +++ b/api/apps/conversation_app.py @@ -144,6 +144,7 @@ def completion(): else: conv.reference[-1] = ans["reference"] conv.message[-1] = {"role": "assistant", "content": ans["answer"], "id": message_id, "prompt": ans.get("prompt", "")} + ans["id"] = message_id def stream(): nonlocal dia, msg, req, conv diff --git a/rag/utils/redis_conn.py b/rag/utils/redis_conn.py index f08ce3538..4a405eaa1 100644 --- a/rag/utils/redis_conn.py +++ b/rag/utils/redis_conn.py @@ -158,7 +158,9 @@ class RedisDB: _, payload = msg[0] return Payload(self.REDIS, queue_name, group_name, msg_id, payload) except Exception as e: - logging.warning("[EXCEPTION]xpending_range" + consumer_name + "||" + str(e)) + if 'key' in str(e): + return + logging.warning("[EXCEPTION]xpending_range: " + consumer_name + "||" + str(e)) self.__open__() REDIS_CONN = RedisDB()