chore: fixes for userAgent support and host detection after rebase stabilization

This commit is contained in:
stevef 2026-04-02 08:15:29 +02:00
parent 42dfb5bdae
commit d37d6e6871
2 changed files with 5 additions and 3 deletions

View file

@ -269,6 +269,7 @@ func CreateProviderFromConfig(cfg *config.ModelConfig) (LLMProvider, string, err
cfg.APIKey(),
cfg.APIBase,
cfg.Proxy,
userAgent,
cfg.RequestTimeout,
), modelID, nil

View file

@ -17,9 +17,9 @@ type HTTPProvider struct {
delegate *openai_compat.Provider
}
func NewHTTPProvider(apiKey, apiBase, proxy string) *HTTPProvider {
func NewHTTPProvider(apiKey, apiBase, proxy, userAgent string) *HTTPProvider {
return &HTTPProvider{
delegate: openai_compat.NewProvider(apiKey, apiBase, proxy),
delegate: openai_compat.NewProvider(apiKey, apiBase, proxy, openai_compat.WithUserAgent(userAgent)),
}
}
@ -45,7 +45,7 @@ func NewHTTPProviderWithMaxTokensFieldAndRequestTimeout(
}
}
func NewAzureAIProvider(apiKey, apiBase, proxy string, requestTimeoutSeconds int) *HTTPProvider {
func NewAzureAIProvider(apiKey, apiBase, proxy, userAgent string, requestTimeoutSeconds int) *HTTPProvider {
return &HTTPProvider{
delegate: openai_compat.NewProvider(
apiKey,
@ -53,6 +53,7 @@ func NewAzureAIProvider(apiKey, apiBase, proxy string, requestTimeoutSeconds int
proxy,
openai_compat.WithAzureHeaders(true),
openai_compat.WithRequestTimeout(time.Duration(requestTimeoutSeconds)*time.Second),
openai_compat.WithUserAgent(userAgent),
),
}
}