Excluding history for better performance
Browse files
app.py
CHANGED
|
@@ -320,14 +320,8 @@ def respond(message, chat_history):
|
|
| 320 |
yield ""
|
| 321 |
return
|
| 322 |
|
| 323 |
-
# Build prompt from
|
| 324 |
ids = [BOS]
|
| 325 |
-
for entry in chat_history:
|
| 326 |
-
role, content = entry["role"], entry["content"]
|
| 327 |
-
if role == "user":
|
| 328 |
-
ids += [USER_START] + enc.encode_ordinary(content) + [USER_END]
|
| 329 |
-
elif role == "assistant":
|
| 330 |
-
ids += [ASST_START] + enc.encode_ordinary(content) + [ASST_END]
|
| 331 |
ids += [USER_START] + enc.encode_ordinary(message) + [USER_END]
|
| 332 |
ids.append(ASST_START)
|
| 333 |
|
|
|
|
| 320 |
yield ""
|
| 321 |
return
|
| 322 |
|
| 323 |
+
# Build prompt from current message only (no history)
|
| 324 |
ids = [BOS]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 325 |
ids += [USER_START] + enc.encode_ordinary(message) + [USER_END]
|
| 326 |
ids.append(ASST_START)
|
| 327 |
|