Commit Graph

7 Commits

  • Add support for dynamic model providers
    Implements functionality to parse model names with provider information in the format "provider://model" This allows dynamic provider selection rather than relying only on predefined mappings.
    
    The change affects all execution methods to properly handle these dynamic model specifications while maintaining compatibility with the existing approach for standard model names.
  • feat: improve error handling with added status codes and headers
    - Updated Execute methods to include enhanced error handling via `StatusCode` and `Headers` extraction.
    - Introduced structured error responses for cooling down scenarios, providing additional metadata and retry suggestions.
    - Refined quota management, allowing for differentiation between cool-down, disabled, and other block reasons.
    - Improved model filtering logic based on client availability and suspension criteria.
  • Feature: #103
    feat(gemini): add Gemini thinking configuration support and metadata normalization
    
    - Introduced logic to parse and apply `thinkingBudget` and `include_thoughts` configurations from metadata.
    - Enhanced request handling to include normalized Gemini model metadata, preserving the original model identifier.
    - Updated Gemini and Gemini-CLI executors to apply thinking configuration based on metadata overrides.
    - Refactored handlers to support metadata extraction and cloning during request preparation.
  • fix: add Claude→Claude passthrough to prevent SSE event fragmentation
    When from==to (Claude→Claude scenario), directly forward SSE stream
    line-by-line without invoking TranslateStream. This preserves the
    multi-line SSE event structure (event:/data:/blank) and prevents
    JSON parsing errors caused by event fragmentation.
    
    Resolves: JSON parsing error when using Claude Code streaming responses
    
    fix: correct SSE event formatting in Handler layer
    
    Remove duplicate newline additions (\n\n) that were breaking SSE event format.
    The Executor layer already provides properly formatted SSE chunks with correct
    line endings, so the Handler should forward them as-is without modification.
    
    Changes:
    - Remove redundant \n\n addition after each chunk
    - Add len(chunk) > 0 check before writing
    - Format error messages as proper SSE events (event: error\ndata: {...}\n\n)
    - Add chunkIdx counter for future debugging needs
    
    This fixes JSON parsing errors caused by malformed SSE event streams.
    
    fix: update comments for clarity in SSE event forwarding
  • refactor(config): migrate to SDKConfig and streamline proxy handling
    - Replaced `config.Config` with `config.SDKConfig` across components for simpler configuration management.
    - Updated proxy setup functions and handlers to align with `SDKConfig` improvements.
    - Reorganized handler imports to match new SDK structure.