-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathserver.py
More file actions
27 lines (22 loc) · 768 Bytes
/
server.py
File metadata and controls
27 lines (22 loc) · 768 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from flask import Flask, render_template, request, redirect, url_for, session, jsonify
from dotenv import load_dotenv
import os
import chainlit as cl
import asyncio
import threading
# Load environment variables
load_dotenv()
app = Flask(__name__)
app.secret_key = os.getenv('SECRET_KEY', 'your-secret-key-here')
@app.route('/')
def landing_page():
"""Serve the custom landing page"""
return app.send_static_file('index.html')
@app.route('/chat')
def chat_page():
"""Serve the Chainlit chat interface"""
# Redirect to Chainlit running on a different port
# The user should start Chainlit separately with: chainlit run app.py --port 8001
return redirect('http://localhost:8001')
if __name__ == '__main__':
app.run(debug=True, port=8000)