Kevin Hu
commited on
Commit
·
c393ddc
1
Parent(s):
47f7da5
add thumb up api (#2092)
Browse files### What problem does this PR solve?
#2088
### Type of change
- [x] New Feature (non-breaking change which adds functionality)
api/apps/conversation_app.py
CHANGED
|
@@ -211,10 +211,12 @@ def thumbup():
|
|
| 211 |
conv = conv.to_dict()
|
| 212 |
for i, msg in enumerate(conv["message"]):
|
| 213 |
if req["message_id"] == msg.get("id", "") and msg.get("role", "") == "assistant":
|
| 214 |
-
if up_down:
|
|
|
|
|
|
|
| 215 |
else:
|
| 216 |
msg["thumbup"] = False
|
| 217 |
-
msg["feedback"] = feedback
|
| 218 |
break
|
| 219 |
|
| 220 |
ConversationService.update_by_id(conv["id"], conv)
|
|
|
|
| 211 |
conv = conv.to_dict()
|
| 212 |
for i, msg in enumerate(conv["message"]):
|
| 213 |
if req["message_id"] == msg.get("id", "") and msg.get("role", "") == "assistant":
|
| 214 |
+
if up_down:
|
| 215 |
+
msg["thumbup"] = True
|
| 216 |
+
if "feedback" in msg: del msg["feedback"]
|
| 217 |
else:
|
| 218 |
msg["thumbup"] = False
|
| 219 |
+
if feedback: msg["feedback"] = feedback
|
| 220 |
break
|
| 221 |
|
| 222 |
ConversationService.update_by_id(conv["id"], conv)
|