Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -38,10 +38,18 @@ def extract_content_value(data):
|
|
| 38 |
content_values.append(content.text.value)
|
| 39 |
return content_values
|
| 40 |
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
def chat(message, history):
|
| 43 |
-
client
|
|
|
|
|
|
|
| 44 |
|
|
|
|
|
|
|
|
|
|
| 45 |
history_openai_format = []
|
| 46 |
|
| 47 |
for human, assistant in history:
|
|
|
|
| 38 |
content_values.append(content.text.value)
|
| 39 |
return content_values
|
| 40 |
|
| 41 |
+
client = None
|
| 42 |
+
assistant = None
|
| 43 |
+
thread = None
|
| 44 |
|
| 45 |
def chat(message, history):
|
| 46 |
+
global client
|
| 47 |
+
global assistant
|
| 48 |
+
global thread
|
| 49 |
|
| 50 |
+
if len(history_openai_format) > 1:
|
| 51 |
+
client, assistant, thread = init_assistant()
|
| 52 |
+
|
| 53 |
history_openai_format = []
|
| 54 |
|
| 55 |
for human, assistant in history:
|