🔧 fix(schemas.py): add optional chatKey field to ChatMessage schema to support additional metadata for chat messages

🔧 fix(manager.py): add support for chatKey field in ChatService to store additional metadata for chat messages
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-09-29 10:24:40 -03:00 committed by anovazzi1
commit 89880b14a0
2 changed files with 3 additions and 1 deletions

View file

@ -78,6 +78,7 @@ class ChatMessage(BaseModel):
is_bot: bool = False
message: Union[str, None, dict] = None
chatKey: Optional[str] = None
type: str = "human"

View file

@ -126,7 +126,8 @@ class ChatService(Service):
):
# Process the graph data and chat message
chat_inputs = payload.pop("inputs", {})
chat_inputs = ChatMessage(message=chat_inputs)
chatkey = payload.pop("chatKey", None)
chat_inputs = ChatMessage(message=chat_inputs, chatKey=chatkey)
self.chat_history.add_message(client_id, chat_inputs)
# graph_data = payload