File size: 455 Bytes
6c48c9b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class ChatContext:
    def __init__(self):
        self.messages = []
        self.user_info = {}

    def add_message(self, role, content):
        self.messages.append({"role": role, "content": content})

    def get_context(self):
        return self.messages

    def set_user_info(self, user_info):
        self.user_info = user_info

    def get_user_info(self):
        return self.user_info

    def clear_context(self):
        self.messages = []