parent
079507a713
commit
fc9a985d67
@ -1,21 +0,0 @@
|
|||||||
from typing import List
|
|
||||||
|
|
||||||
from pydantic import BaseModel
|
|
||||||
|
|
||||||
from swarms.agents.memory.base_memory import BaseChatMessageHistory, BaseMessage
|
|
||||||
|
|
||||||
|
|
||||||
class ChatMessageHistory(BaseChatMessageHistory, BaseModel):
|
|
||||||
"""In memory implementation of chat message history.
|
|
||||||
|
|
||||||
Stores messages in an in memory list.
|
|
||||||
"""
|
|
||||||
|
|
||||||
messages: List[BaseMessage] = []
|
|
||||||
|
|
||||||
def add_message(self, message: BaseMessage) -> None:
|
|
||||||
"""Add a self-created message to the store"""
|
|
||||||
self.messages.append(message)
|
|
||||||
|
|
||||||
def clear(self) -> None:
|
|
||||||
self.messages = []
|
|
Loading…
Reference in new issue