- Introduced a `debug_log` function to standardize logging to a debug.log file.
- Replaced print statements with `debug_log` calls throughout the OpenAI API interaction functions for better logging control.
- Enhanced the `_truncate_base64_in_dict` function to provide more informative truncation for both base64 and long strings.
- Improved the handling of streaming responses by collecting additional fields and logging their extraction.
- Updated debug messages to provide clearer context and information about API requests and responses.
- Add automatic URL image download support for APIs that return image URLs instead of base64
- Implement dual response format handling (base64 + URL) for maximum API compatibility
- Add comprehensive JSON debug logging for all API requests and responses
- Enhance error handling with detailed validation and diagnostic information
- Support streaming and non-streaming debug modes for text generation
- Add robust network error handling with timeout and retry mechanisms
- Maintain 100% backward compatibility with existing configurations
Fixes:
- 'argument should be a bytes-like object or ASCII string, not NoneType' error
- 'images.edit returns URL instead of base64' compatibility issue
Features:
- Auto-download images from URLs when API doesn't support base64 responses
- Enhanced debug mode with complete JSON request/response logging
- Smart field detection for different API providers (b64_json, b64, base64, url)
- Network timeout handling and user-friendly error messages
- Modern ComfyUI FlexAI plugin with OpenAI SDK 1.x support
- Dual-mode image processing: generation (images.generate) + editing (images.edit)
- Support for 1-4 simultaneous image inputs in edit mode
- Multimodal text generation with vision-language understanding
- Multi-provider configuration system
- Comprehensive error handling with visual feedback
- Clean architecture with unified flexai: namespace
- Complete documentation in English and Chinese