Soumik555 commited on
Commit
e7b09de
·
1 Parent(s): d25d5e9
Files changed (1) hide show
  1. main.py +3 -3
main.py CHANGED
@@ -293,12 +293,12 @@ async def chat_endpoint(request: ChatRequest):
293
  detail="Model not loaded yet. Please wait for initialization."
294
  )
295
 
296
- # Validate input
297
  if not request.message.strip():
298
  raise HTTPException(status_code=400, detail="Message cannot be empty")
299
 
300
- if len(request.message) > 1000:
301
- raise HTTPException(status_code=400, detail="Message too long (max 1000 characters)")
302
 
303
  # Generate response
304
  response_text, response_time = generate_response(
 
293
  detail="Model not loaded yet. Please wait for initialization."
294
  )
295
 
296
+ # Validate input - stricter limits for free tier
297
  if not request.message.strip():
298
  raise HTTPException(status_code=400, detail="Message cannot be empty")
299
 
300
+ if len(request.message) > 500: # Reduced limit for HF Spaces
301
+ raise HTTPException(status_code=400, detail="Message too long (max 500 characters)")
302
 
303
  # Generate response
304
  response_text, response_time = generate_response(