Update app.py
Browse files140 unmodified lines14114214314414514614712 unmodified lines160161162163164165140 unmodified lines{"role": "user", "content": user_message}],"temperature": 0.0,"max_tokens": 256}try:12 unmodified linesreply = result.get("choices", [{}])[0].get("message", {}).get("content", "").strip()if not reply:logger.error(f"OpenRouter returned empty response in /classify. Full result: {result}")raise HTTPException(status_code=500, detail="No response from OpenRouter")140 unmodified lines14114214314414514614712 unmodified lines160161162163164165166167168169170140 unmodified lines{"role": "user", "content": user_message}],"temperature": 0.0,"max_tokens": 2000 # Increased for models with extended reasoning/thinking}try:12 unmodified linesreply = result.get("choices", [{}])[0].get("message", {}).get("content", "").strip()if not reply:logger.warning(f"Empty content in response. Finish reason: {result.get('choices', [{}])[0].get('finish_reason')}")# If content is empty, try to extract from reasoning or log for debuggingreasoning = result.get("choices", [{}])[0].get("message", {}).get("reasoning", "")if reasoning:logger.warning(f"Model has reasoning but no content. This may indicate truncation.")logger.error(f"OpenRouter returned empty response in /classify. Full result: {result}")raise HTTPException(status_code=500, detail="No response from OpenRouter")
app.py+6-1