updated app finally
Browse files
app.py
CHANGED
|
@@ -1,6 +1,10 @@
|
|
| 1 |
import sys
|
| 2 |
import os
|
| 3 |
import logging
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
# Add the current directory to the Python path
|
| 6 |
current_dir = os.path.dirname(os.path.abspath(__file__))
|
|
@@ -28,17 +32,14 @@ async def chat_interface(message, history):
|
|
| 28 |
# Debugging: Print the formatted bot response
|
| 29 |
print(f"Formatted bot response: {bot_response}")
|
| 30 |
|
| 31 |
-
#
|
| 32 |
-
formatted_history = [(str(h), str(a)) for h, a in updated_history]
|
| 33 |
-
|
| 34 |
-
return bot_response, formatted_history
|
| 35 |
except Exception as e:
|
| 36 |
logger.error(f"Error in chat_interface: {str(e)}")
|
| 37 |
burner_error_message = (
|
| 38 |
"Whoa there, playa pal! It seems the dust has clogged my circuits. "
|
| 39 |
"Let's take a deep breath and try that again. Radical self-reliance, remember?"
|
| 40 |
)
|
| 41 |
-
return burner_error_message
|
| 42 |
|
| 43 |
|
| 44 |
gr.ChatInterface(
|
|
|
|
| 1 |
import sys
|
| 2 |
import os
|
| 3 |
import logging
|
| 4 |
+
from dotenv import load_dotenv
|
| 5 |
+
|
| 6 |
+
# Load environment variables from .env file
|
| 7 |
+
load_dotenv()
|
| 8 |
|
| 9 |
# Add the current directory to the Python path
|
| 10 |
current_dir = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
| 32 |
# Debugging: Print the formatted bot response
|
| 33 |
print(f"Formatted bot response: {bot_response}")
|
| 34 |
|
| 35 |
+
return bot_response # Return only the bot_response, not the history
|
|
|
|
|
|
|
|
|
|
| 36 |
except Exception as e:
|
| 37 |
logger.error(f"Error in chat_interface: {str(e)}")
|
| 38 |
burner_error_message = (
|
| 39 |
"Whoa there, playa pal! It seems the dust has clogged my circuits. "
|
| 40 |
"Let's take a deep breath and try that again. Radical self-reliance, remember?"
|
| 41 |
)
|
| 42 |
+
return burner_error_message # Return only the error message, not the history
|
| 43 |
|
| 44 |
|
| 45 |
gr.ChatInterface(
|