Fix a subtle bug: modelDefault doesn’t apply when provider === "auto" (#2576)

* Fix a subtle bug: `modelDefault` doesn’t apply when provider === "auto"

1.Fix bugs when provider === "auto" which can lead model end up get ""

2. Fix to only include remote if you actually have any remote fields. (Is this intentional?)

* Refactor memory-search.ts to simplify remote checks

Remove redundant hasRemote variable and simplify includeRemote condition.

* oxfmt-friendly version

oxfmt-friendly version

* fix: local updates for PR #2576

Co-authored-by: papago2355 <papago2355@users.noreply.github.com>

* fix: memory search auto defaults (#2576) (thanks @papago2355)

---------

Co-authored-by: Gustavo Madeira Santana <gumadeiras@gmail.com>
Co-authored-by: papago2355 <papago2355@users.noreply.github.com>
This commit is contained in:
TideFinder
2026-01-27 14:28:04 +09:00
committed by GitHub
parent 3b0c80ce24
commit 6c451f47f4
3 changed files with 57 additions and 2 deletions

View File

@@ -119,9 +119,16 @@ function mergeConfig(
const provider = overrides?.provider ?? defaults?.provider ?? "auto";
const defaultRemote = defaults?.remote;
const overrideRemote = overrides?.remote;
const hasRemote = Boolean(defaultRemote || overrideRemote);
const hasRemoteConfig = Boolean(
overrideRemote?.baseUrl ||
overrideRemote?.apiKey ||
overrideRemote?.headers ||
defaultRemote?.baseUrl ||
defaultRemote?.apiKey ||
defaultRemote?.headers,
);
const includeRemote =
hasRemote || provider === "openai" || provider === "gemini" || provider === "auto";
hasRemoteConfig || provider === "openai" || provider === "gemini" || provider === "auto";
const batch = {
enabled: overrideRemote?.batch?.enabled ?? defaultRemote?.batch?.enabled ?? true,
wait: overrideRemote?.batch?.wait ?? defaultRemote?.batch?.wait ?? true,