Merge pull request #3091 from chengzhichao-xydt/codex/provider-native-search-type-assert
fix(openai_compat): add ok check for native_search type assertion
This commit is contained in:
commit
ec9c6cde8e
1 changed files with 12 additions and 1 deletions
|
|
@ -154,7 +154,18 @@ func (p *Provider) buildRequestBody(
|
||||||
}
|
}
|
||||||
|
|
||||||
// When fallback uses a different provider (e.g. DeepSeek), that provider must not inject web_search_preview.
|
// When fallback uses a different provider (e.g. DeepSeek), that provider must not inject web_search_preview.
|
||||||
nativeSearch, _ := options["native_search"].(bool)
|
nativeSearch, ok := options["native_search"].(bool)
|
||||||
|
if !ok {
|
||||||
|
// If the option is present but not a bool, log a warning and
|
||||||
|
// treat it as false — web_search_preview must not be injected
|
||||||
|
// when the caller cannot express a well-typed intent.
|
||||||
|
if _, present := options["native_search"]; present {
|
||||||
|
log.Printf(
|
||||||
|
"[openai_compat] native_search option has unexpected type %T, ignoring",
|
||||||
|
options["native_search"],
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
nativeSearch = nativeSearch && isNativeSearchHost(p.apiBase)
|
nativeSearch = nativeSearch && isNativeSearchHost(p.apiBase)
|
||||||
if len(tools) > 0 || nativeSearch {
|
if len(tools) > 0 || nativeSearch {
|
||||||
requestBody["tools"] = buildToolsList(tools, nativeSearch)
|
requestBody["tools"] = buildToolsList(tools, nativeSearch)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue