Spaces:
Runtime error
Runtime error
Commit
·
920ef21
1
Parent(s):
277f66b
testing rag
Browse files
app.py
CHANGED
@@ -168,8 +168,9 @@ async def index():
|
|
168 |
|
169 |
# Define the route for processing messages
|
170 |
@app.post("/process-message")
|
171 |
-
async def process_message_route(
|
172 |
try:
|
|
|
173 |
if not user_message:
|
174 |
raise HTTPException(status_code=400, detail="User message is required.")
|
175 |
|
@@ -178,7 +179,7 @@ async def process_message_route(user_message: str):
|
|
178 |
# Return the bot's response as JSON
|
179 |
return JSONResponse(content={"botResponse": bot_response})
|
180 |
except Exception as e:
|
181 |
-
|
182 |
raise HTTPException(status_code=500, detail="An error occurred while processing the message.")
|
183 |
|
184 |
# Define the route for processing documents
|
|
|
168 |
|
169 |
# Define the route for processing messages
|
170 |
@app.post("/process-message")
|
171 |
+
async def process_message_route(message: MessageRequest):
|
172 |
try:
|
173 |
+
user_message = message.userMessage # Extract the user's message from the request
|
174 |
if not user_message:
|
175 |
raise HTTPException(status_code=400, detail="User message is required.")
|
176 |
|
|
|
179 |
# Return the bot's response as JSON
|
180 |
return JSONResponse(content={"botResponse": bot_response})
|
181 |
except Exception as e:
|
182 |
+
logger.error(f"Error processing message: {e}")
|
183 |
raise HTTPException(status_code=500, detail="An error occurred while processing the message.")
|
184 |
|
185 |
# Define the route for processing documents
|