Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -31,17 +31,17 @@ def generate_text() -> str:
|
|
| 31 |
with open(DATA_FILE) as file:
|
| 32 |
text = ""
|
| 33 |
for line in file:
|
| 34 |
-
row_parts = line.strip().split("
|
| 35 |
if len(row_parts) != 3:
|
| 36 |
continue
|
| 37 |
user, chatbot, time = row_parts
|
| 38 |
-
text += f"
|
| 39 |
return text if text else "No messages yet"
|
| 40 |
|
| 41 |
def store_message(chatinput: str, chatresponse: str):
|
| 42 |
if chatinput and chatresponse:
|
| 43 |
with open(DATA_FILE, "a") as file:
|
| 44 |
-
file.write(f"{
|
| 45 |
|
| 46 |
return generate_text()
|
| 47 |
|
|
|
|
| 31 |
with open(DATA_FILE) as file:
|
| 32 |
text = ""
|
| 33 |
for line in file:
|
| 34 |
+
row_parts = line.strip().split(";")
|
| 35 |
if len(row_parts) != 3:
|
| 36 |
continue
|
| 37 |
user, chatbot, time = row_parts
|
| 38 |
+
text += f"Time: {time}\nUser: {user}\nChatbot: {chatbot}\n\n"
|
| 39 |
return text if text else "No messages yet"
|
| 40 |
|
| 41 |
def store_message(chatinput: str, chatresponse: str):
|
| 42 |
if chatinput and chatresponse:
|
| 43 |
with open(DATA_FILE, "a") as file:
|
| 44 |
+
file.write(f"{datetime.now()},{chatinput},{chatresponse}\n")
|
| 45 |
|
| 46 |
return generate_text()
|
| 47 |
|