From d37d6e6871315a6e93201d7129acc5712f4fd474 Mon Sep 17 00:00:00 2001 From: stevef Date: Thu, 2 Apr 2026 08:15:29 +0200 Subject: [PATCH] chore: fixes for userAgent support and host detection after rebase stabilization --- pkg/providers/factory_provider.go | 1 + pkg/providers/http_provider.go | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/providers/factory_provider.go b/pkg/providers/factory_provider.go index 60311ba18..e3b15297e 100644 --- a/pkg/providers/factory_provider.go +++ b/pkg/providers/factory_provider.go @@ -269,6 +269,7 @@ func CreateProviderFromConfig(cfg *config.ModelConfig) (LLMProvider, string, err cfg.APIKey(), cfg.APIBase, cfg.Proxy, + userAgent, cfg.RequestTimeout, ), modelID, nil diff --git a/pkg/providers/http_provider.go b/pkg/providers/http_provider.go index 0e197d754..2e97bd8f2 100644 --- a/pkg/providers/http_provider.go +++ b/pkg/providers/http_provider.go @@ -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), ), } }