scooter7 commited on
Commit
5124f8c
·
verified ·
1 Parent(s): b0fc348

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -192,7 +192,7 @@ class RAGVoiceHandler(AsyncStreamHandler):
192
  # 4. Voice Streaming Setup & FastAPI Endpoints
193
  # ====================================================
194
 
195
- # Supply a dummy (but valid) RTC configuration to satisfy fastrtc.
196
  rtc_config = {
197
  "iceServers": [
198
  {"urls": "stun:stun.l.google.com:19302"},
@@ -228,6 +228,15 @@ async def input_hook(body: InputData):
228
  async def webrtc_offer(offer: dict):
229
  return await stream.handle_offer(offer)
230
 
 
 
 
 
 
 
 
 
 
231
  @app.get("/")
232
  async def index():
233
  index_path = current_dir / "index.html"
 
192
  # 4. Voice Streaming Setup & FastAPI Endpoints
193
  # ====================================================
194
 
195
+ # Supply a dummy (but valid) RTC configuration with a TURN server entry
196
  rtc_config = {
197
  "iceServers": [
198
  {"urls": "stun:stun.l.google.com:19302"},
 
228
  async def webrtc_offer(offer: dict):
229
  return await stream.handle_offer(offer)
230
 
231
+ # Added /chat endpoint for text-based queries (fallback)
232
+ @app.post("/chat")
233
+ async def chat_endpoint(payload: dict):
234
+ question = payload.get("question", "")
235
+ if not question:
236
+ return {"error": "No question provided"}
237
+ answer = generate_answer(question)
238
+ return {"answer": answer}
239
+
240
  @app.get("/")
241
  async def index():
242
  index_path = current_dir / "index.html"