Skip to content

Commit 5bebe8f

Browse files
mirodrr2mirodrr
andauthored
Additional fix to chat history (#103)
* fix to chat history. more logs * remove unneeded logs * spacing * spacing --------- Co-authored-by: michael rodriguez <[email protected]>
1 parent 82b0b8a commit 5bebe8f

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

middleware/app.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -916,13 +916,10 @@ async def proxy_request(request: Request):
916916
# History not enabled: start with empty
917917
chat_history = []
918918

919-
# Merge incoming system/user messages into chat_history in original order
920-
# (We generally skip adding "assistant" messages from the request side,
921-
# because those come from the model, not from the user.)
919+
# Merge incoming messages into chat_history in original order
922920
new_messages = data.get("messages", [])
923921
for msg in new_messages:
924-
if msg["role"] in ["system", "user"]:
925-
chat_history.append(msg)
922+
chat_history.append(msg)
926923

927924
# Now data["messages"] should be the entire conversation the model sees
928925
data["messages"] = chat_history

0 commit comments

Comments
 (0)