Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -40,11 +40,14 @@ def generate_text() -> str:
|
|
| 40 |
def store_message(chatinput: str, chatresponse: str):
|
| 41 |
if chatinput and chatresponse:
|
| 42 |
with open(DATA_FILE, "a") as file:
|
| 43 |
-
now = datetime.now()
|
| 44 |
timestamp = now.strftime("%Y-%m-%d %H:%M:%S")
|
| 45 |
file.write(f"{timestamp},{chatinput},{chatresponse}\n")
|
| 46 |
print(f"Stored message: {timestamp},{chatinput},{chatresponse}")
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
| 48 |
return generate_text()
|
| 49 |
|
| 50 |
|
|
|
|
| 40 |
def store_message(chatinput: str, chatresponse: str):
|
| 41 |
if chatinput and chatresponse:
|
| 42 |
with open(DATA_FILE, "a") as file:
|
| 43 |
+
now = datetime.now(tz=AEST)
|
| 44 |
timestamp = now.strftime("%Y-%m-%d %H:%M:%S")
|
| 45 |
file.write(f"{timestamp},{chatinput},{chatresponse}\n")
|
| 46 |
print(f"Stored message: {timestamp},{chatinput},{chatresponse}")
|
| 47 |
+
try:
|
| 48 |
+
repo.upload(DATA_FILENAME, commit_message="Update data.txt")
|
| 49 |
+
except Exception as e:
|
| 50 |
+
print(f"Error uploading to repository: {str(e)}")
|
| 51 |
return generate_text()
|
| 52 |
|
| 53 |
|