Kevin Hu
commited on
Commit
·
dd2c2ea
1
Parent(s):
503e1a6
remove alter log (#2140)
Browse files### What problem does this PR solve?
### Type of change
- [x] Refactoring
- api/apps/api_app.py +1 -0
- api/apps/conversation_app.py +1 -0
- rag/utils/redis_conn.py +3 -1
api/apps/api_app.py
CHANGED
|
@@ -210,6 +210,7 @@ def completion():
|
|
| 210 |
else:
|
| 211 |
conv.reference[-1] = ans["reference"]
|
| 212 |
conv.message[-1] = {"role": "assistant", "content": ans["answer"], "id": message_id}
|
|
|
|
| 213 |
|
| 214 |
def rename_field(ans):
|
| 215 |
reference = ans['reference']
|
|
|
|
| 210 |
else:
|
| 211 |
conv.reference[-1] = ans["reference"]
|
| 212 |
conv.message[-1] = {"role": "assistant", "content": ans["answer"], "id": message_id}
|
| 213 |
+
ans["id"] = message_id
|
| 214 |
|
| 215 |
def rename_field(ans):
|
| 216 |
reference = ans['reference']
|
api/apps/conversation_app.py
CHANGED
|
@@ -144,6 +144,7 @@ def completion():
|
|
| 144 |
else: conv.reference[-1] = ans["reference"]
|
| 145 |
conv.message[-1] = {"role": "assistant", "content": ans["answer"],
|
| 146 |
"id": message_id, "prompt": ans.get("prompt", "")}
|
|
|
|
| 147 |
|
| 148 |
def stream():
|
| 149 |
nonlocal dia, msg, req, conv
|
|
|
|
| 144 |
else: conv.reference[-1] = ans["reference"]
|
| 145 |
conv.message[-1] = {"role": "assistant", "content": ans["answer"],
|
| 146 |
"id": message_id, "prompt": ans.get("prompt", "")}
|
| 147 |
+
ans["id"] = message_id
|
| 148 |
|
| 149 |
def stream():
|
| 150 |
nonlocal dia, msg, req, conv
|
rag/utils/redis_conn.py
CHANGED
|
@@ -158,7 +158,9 @@ class RedisDB:
|
|
| 158 |
_, payload = msg[0]
|
| 159 |
return Payload(self.REDIS, queue_name, group_name, msg_id, payload)
|
| 160 |
except Exception as e:
|
| 161 |
-
|
|
|
|
|
|
|
| 162 |
self.__open__()
|
| 163 |
|
| 164 |
REDIS_CONN = RedisDB()
|
|
|
|
| 158 |
_, payload = msg[0]
|
| 159 |
return Payload(self.REDIS, queue_name, group_name, msg_id, payload)
|
| 160 |
except Exception as e:
|
| 161 |
+
if 'key' in str(e):
|
| 162 |
+
return
|
| 163 |
+
logging.warning("[EXCEPTION]xpending_range: " + consumer_name + "||" + str(e))
|
| 164 |
self.__open__()
|
| 165 |
|
| 166 |
REDIS_CONN = RedisDB()
|