• Will Chen's avatar
    Fix auto model for engine (#2170) · 759c60f2
    Will Chen 提交于
    <!-- CURSOR_SUMMARY -->
    > [!NOTE]
    > Fixes auto/local-agent model routing and provider-specific behavior.
    > 
    > - Refactors `llm_engine_provider` to require `chatParams { providerId
    }`; wires it into custom fetch and model constructors (`provider`,
    `chatModel`, `responses`)
    > - Updates `get_model_client` to pass `providerId`, tag fallback models
    (`openai`, `anthropic`, `google`), and use `responses()` for OpenAI in
    `local-agent` and auto fallback
    > - Adds Responses API support to fake LLM server (`/v1/responses`) with
    streaming SSE handler and dump generation
    > - Extends test helper to parse Responses API dumps (`body.input`) and
    adds `localAgentUseAutoModel` setup flag
    > - New e2e test `local_agent_auto.spec.ts` with snapshot verifying
    request payload via Responses API
    > 
    > <sup>Written by [Cursor
    Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
    e5b02d253c9842f14da0099bb11e1b05548e9245. This will update automatically
    on new commits. Configure
    [here](https://cursor.com/dashboard?tab=bugbot).</sup>
    <!-- /CURSOR_SUMMARY -->
    
    <!-- This is an auto-generated description by cubic. -->
    ---
    ## Summary by cubic
    Fixes auto model selection in the Dyad engine by passing the correct
    providerId with each request. Ensures provider-specific options are
    applied and avoids incorrect defaults.
    
    - **Bug Fixes**
    - Pass providerId to chat/responses models and into the fetch layer for
    getExtraProviderOptions.
    - Remove originalProviderId from createDyadEngine; add ChatParams and
    update provider API signatures.
    - Tag fallback models with providerId (openai, anthropic, google) and
    forward model.provider in getModelClient.
    
    <sup>Written for commit e5b02d253c9842f14da0099bb11e1b05548e9245.
    Summary will update on new commits.</sup>
    
    <!-- End of auto-generated description by cubic. -->
    759c60f2
responsesHandler.ts 10.3 KB