Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion python/ai-server/src/ai_server/py_client/gaas/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ def get_chat_history(
history = self.model_engine.get_conversation_history()
messages = []
for msg in sorted(history, key=lambda x: x["DATE_CREATED"]):
if "MESSAGE_DATA" not in msg:
continue
if msg["MESSAGE_TYPE"] == "INPUT":
messages.append(HumanMessage(content=msg["MESSAGE_DATA"]))
elif msg["MESSAGE_TYPE"] == "RESPONSE":
Expand Down Expand Up @@ -333,7 +335,8 @@ def _create_chat_result(self, response: Dict[str, Any]) -> ChatResult:
# if this is a tool
# need to do a different return

if response["messageType"] == "TOOL":
# if response["messageType"] == "TOOL":
if response.get("messageType") == "TOOL": # Returns None in case "messageType" is not present
tool_response = []
for m in message:
tool_response.append(
Expand Down