Commit Graph

6 Commits

  • Add reverse mappings for original tool names and improve error logging
    - Introduced reverse mapping logic for tool names in translators to restore original names when shortened.
    - Enhanced error handling by logging API response errors consistently across handlers.
    - Refactored request and response loggers to include API error details, improving debugging capabilities.
    - Integrated robust tool name shortening and uniqueness mechanisms for OpenAI, Gemini, and Claude requests.
    - Improved handler retry logic to properly capture and respond to errors.
  • Refactor API handlers to implement retry mechanism with configurable limits and improved error handling
    - Introduced retry counter with a configurable ` RequestRetry ` limit in all handlers.
    - Enhanced error handling with specific HTTP status codes for switching clients.
    - Standardized response forwarding for non-retriable errors.
    - Improved logging for quota and client switch scenarios.
  • Refactor error handling and variable declarations in browser and logging modules
    - Simplified variable initialization in `browser.go` for readability.
    - Updated error handling in `request_logger.go` with better resource cleanup using deferred anonymous functions.
    
    Refactor API handlers to use `GetContextWithCancel` for streamlined context creation and response handling
    
    - Replaced redundant `context.WithCancel` and `context.WithValue` logic with the new `GetContextWithCancel` utility in all handlers.
    - Centralized API response storage in the given context during cancellation.
    - Updated associated cancellation calls for consistency and improved resource management.
    
    - Replaced `apiResponseData` with `AddAPIResponseData` for centralized response recording.
    - Simplified cancellation logic by switching to a boolean-based `cliCancel` method.
    - Removed unused `apiResponseData` slices across handlers to reduce memory usage.
    - Updated `handlers.go` to support unified response data storage per request context.
  • Add request logging capabilities to API handlers and update .gitignore
    Enhance API response handling by storing responses in context and updating request logger to include API responses