Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -32,18 +32,27 @@ def get_user_data(prompt: str):
|
|
| 32 |
|
| 33 |
def get_history(history):
|
| 34 |
mod_history = []
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
def chat(prompt, history):
|
| 49 |
|
|
|
|
| 32 |
|
| 33 |
def get_history(history):
|
| 34 |
mod_history = []
|
| 35 |
+
for user_message, bot_message in history:
|
| 36 |
+
user_dict = {
|
| 37 |
+
"role": "user",
|
| 38 |
+
"content": [
|
| 39 |
+
{
|
| 40 |
+
"type": "text",
|
| 41 |
+
"text": user_message
|
| 42 |
+
}
|
| 43 |
+
]
|
| 44 |
+
}
|
| 45 |
+
bot_dict = {
|
| 46 |
+
"role": "assistant",
|
| 47 |
+
"content": [
|
| 48 |
+
{
|
| 49 |
+
"type": "text",
|
| 50 |
+
"text": bot_message
|
| 51 |
+
}
|
| 52 |
+
]
|
| 53 |
+
}
|
| 54 |
+
mod_history.append(user_dict)
|
| 55 |
+
mod_history.append(bot_dict)
|
| 56 |
|
| 57 |
def chat(prompt, history):
|
| 58 |
|