updated app
Browse files
app.py
CHANGED
|
@@ -15,22 +15,15 @@ logger = logging.getLogger(__name__)
|
|
| 15 |
|
| 16 |
async def chat_interface(message, history):
|
| 17 |
try:
|
| 18 |
-
history
|
| 19 |
-
updated_history
|
| 20 |
-
|
| 21 |
-
# Extract the last message from the updated history
|
| 22 |
-
last_message = updated_history[-1] if updated_history else ("", "")
|
| 23 |
-
|
| 24 |
-
# Return the message and the full updated history
|
| 25 |
-
return last_message[1], updated_history
|
| 26 |
except Exception as e:
|
| 27 |
logger.error(f"Error in chat_interface: {str(e)}")
|
| 28 |
burner_error_message = (
|
| 29 |
"Whoa there, playa pal! It seems the dust has clogged my circuits. "
|
| 30 |
"Let's take a deep breath and try that again. Radical self-reliance, remember?"
|
| 31 |
)
|
| 32 |
-
history
|
| 33 |
-
return burner_error_message, history
|
| 34 |
|
| 35 |
gr.ChatInterface(
|
| 36 |
chat_interface,
|
|
|
|
| 15 |
|
| 16 |
async def chat_interface(message, history):
|
| 17 |
try:
|
| 18 |
+
updated_history = await bot(history + [(message, None)])
|
| 19 |
+
return updated_history[-1][1], updated_history
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
except Exception as e:
|
| 21 |
logger.error(f"Error in chat_interface: {str(e)}")
|
| 22 |
burner_error_message = (
|
| 23 |
"Whoa there, playa pal! It seems the dust has clogged my circuits. "
|
| 24 |
"Let's take a deep breath and try that again. Radical self-reliance, remember?"
|
| 25 |
)
|
| 26 |
+
return burner_error_message, history + [(message, burner_error_message)]
|
|
|
|
| 27 |
|
| 28 |
gr.ChatInterface(
|
| 29 |
chat_interface,
|