Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -29,6 +29,20 @@ worksheet = spreadsheet.worksheet(worksheet_name)
|
|
| 29 |
|
| 30 |
# Rest of your code...
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
def get_response(msg, bot, doc_text_list, doc_embeddings):
|
| 33 |
# Process the user input here
|
| 34 |
res = result.json()['content']
|
|
|
|
| 29 |
|
| 30 |
# Rest of your code...
|
| 31 |
|
| 32 |
+
def get_response(msg, bot, doc_text_list, doc_embeddings):
|
| 33 |
+
# Process the user input here
|
| 34 |
+
res = result.json()['content']
|
| 35 |
+
bot.append([msg, res])
|
| 36 |
+
log_interaction(msg, res) # Log the user input and bot response
|
| 37 |
+
return bot[max(0, len(bot) - 3):]
|
| 38 |
+
|
| 39 |
+
def log_interaction(user_input, bot_response):
|
| 40 |
+
timestamp = time.strftime('%Y-%m-%d %H:%M:%S')
|
| 41 |
+
row_values = [timestamp, user_input, bot_response]
|
| 42 |
+
worksheet.append_row(row_values)
|
| 43 |
+
|
| 44 |
+
# Rest of your code...
|
| 45 |
+
|
| 46 |
def get_response(msg, bot, doc_text_list, doc_embeddings):
|
| 47 |
# Process the user input here
|
| 48 |
res = result.json()['content']
|