Spaces:
Sleeping
Sleeping
make myChatMessage serializing
Browse files
app.py
CHANGED
@@ -8,6 +8,12 @@ import gradio as gr
|
|
8 |
class myChatMessage(chatglm_cpp.ChatMessage):
|
9 |
def __deepcopy__(self, memo):
|
10 |
return chatglm_cpp.ChatMessage(self.role, self.content)
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
init_history = [
|
13 |
myChatMessage(role="user", content='你讀過《故事課》嗎?'),
|
|
|
8 |
class myChatMessage(chatglm_cpp.ChatMessage):
|
9 |
def __deepcopy__(self, memo):
|
10 |
return chatglm_cpp.ChatMessage(self.role, self.content)
|
11 |
+
def __getstate__(self):
|
12 |
+
"""Used for serializing instances"""
|
13 |
+
return (self.role, self.content)
|
14 |
+
def __setstate__(self, state):
|
15 |
+
"""Used for deserializing"""
|
16 |
+
self.role, self.content = state
|
17 |
|
18 |
init_history = [
|
19 |
myChatMessage(role="user", content='你讀過《故事課》嗎?'),
|