Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -20,20 +20,6 @@ def chatbot(input_text, mentioned_person='Mediator John Haynes'):
|
|
| 20 |
index = get_index('index.json')
|
| 21 |
prompt = f"You are {mentioned_person}: {input_text}\n\n At the end of your answer ask a provocative question."
|
| 22 |
response = index.query(prompt, response_mode="compact")
|
| 23 |
-
|
| 24 |
-
# Save chat log
|
| 25 |
-
current_time = datetime.datetime.now()
|
| 26 |
-
current_time_str = current_time.strftime("%Y-%m-%d_%H-%M-%S")
|
| 27 |
-
chat_log_filename = "chathistory.txt"
|
| 28 |
-
chat_log_dir = "chathistory"
|
| 29 |
-
if not os.path.exists(chat_log_dir):
|
| 30 |
-
os.makedirs(chat_log_dir)
|
| 31 |
-
chat_log_filepath = os.path.join(chat_log_dir, chat_log_filename)
|
| 32 |
-
with open(chat_log_filepath, "a") as f:
|
| 33 |
-
f.write(f"Chat at {current_time_str}\n")
|
| 34 |
-
f.write(f"User: {input_text}\n")
|
| 35 |
-
f.write(f"Chatbot: {response.response}\n\n")
|
| 36 |
-
|
| 37 |
|
| 38 |
return response.response
|
| 39 |
|
|
|
|
| 20 |
index = get_index('index.json')
|
| 21 |
prompt = f"You are {mentioned_person}: {input_text}\n\n At the end of your answer ask a provocative question."
|
| 22 |
response = index.query(prompt, response_mode="compact")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
return response.response
|
| 25 |
|