BELLA / app.py
rajsecrets0's picture
Update app.py
add5039 verified
raw
history blame
959 Bytes
import os
from dotenv import load_dotenv
import chainlit as cl
# Load environment variables from .env file
load_dotenv()
# Debug: Print environment variables
print("Environment variables:")
for key, value in os.environ.items():
print(f"{key}: {value}")
# Check if API keys are loaded
GEMINI_API_KEY = os.getenv("GEMINI_API_KEY")
SERP_API_KEY = os.getenv("SERP_API_KEY")
if not GEMINI_API_KEY:
raise ValueError("GEMINI_API_KEY environment variable is not set")
if not SERP_API_KEY:
raise ValueError("SERP_API_KEY environment variable is not set")
print(f"GEMINI_API_KEY: {GEMINI_API_KEY}")
print(f"SERP_API_KEY: {SERP_API_KEY}")
# Chainlit app
@cl.on_chat_start
async def start():
await cl.Message(content="Hello! How can I assist you today?").send()
@cl.on_message
async def main(message: cl.Message):
await cl.Message(content=f"You said: {message.content}").send()
if __name__ == "__main__":
cl.run(app, port=7860, debug=True)