mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-11-20 03:54:43 +00:00
- Add robust serialize_for_json() function to handle non-serializable objects - Update server_error_response() to safely serialize exception data - Update get_json_result() with fallback error handling - Handles ModelMetaclass, functions, and other problematic objects - Maintains proper JSON response format instead of server crashes Fixes #9797 ### What problem does this PR solve? Currently, error responses and certain result objects may include types that are not JSON serializable (e.g., ModelMetaclass, functions). This causes server crashes instead of returning valid JSON responses. This PR introduces a robust serializer that converts unsupported types into string representations, ensuring the server always returns a valid JSON response. ### Type of change - [] Bug Fix (non-breaking change which fixes an issue)