mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-27 07:16:19 +09:00
feat(agent): relax provider http timeouts (#348)
This commit is contained in:
+10
-18
@@ -39,14 +39,16 @@ var (
|
||||
|
||||
// NewSDKChatModel builds a Twilight AI SDK Model from the resolved model config.
|
||||
func NewSDKChatModel(cfg SDKModelConfig) *sdk.Model {
|
||||
if cfg.HTTPClient == nil {
|
||||
cfg.HTTPClient = NewProviderHTTPClient(0)
|
||||
}
|
||||
|
||||
switch ClientType(cfg.ClientType) {
|
||||
case ClientTypeOpenAICompletions:
|
||||
opts := []openaicompletions.Option{
|
||||
openaicompletions.WithAPIKey(cfg.APIKey),
|
||||
}
|
||||
if cfg.HTTPClient != nil {
|
||||
opts = append(opts, openaicompletions.WithHTTPClient(cfg.HTTPClient))
|
||||
}
|
||||
opts = append(opts, openaicompletions.WithHTTPClient(cfg.HTTPClient))
|
||||
if cfg.BaseURL != "" {
|
||||
opts = append(opts, openaicompletions.WithBaseURL(cfg.BaseURL))
|
||||
}
|
||||
@@ -57,9 +59,7 @@ func NewSDKChatModel(cfg SDKModelConfig) *sdk.Model {
|
||||
opts := []openairesponses.Option{
|
||||
openairesponses.WithAPIKey(cfg.APIKey),
|
||||
}
|
||||
if cfg.HTTPClient != nil {
|
||||
opts = append(opts, openairesponses.WithHTTPClient(cfg.HTTPClient))
|
||||
}
|
||||
opts = append(opts, openairesponses.WithHTTPClient(cfg.HTTPClient))
|
||||
if cfg.BaseURL != "" {
|
||||
opts = append(opts, openairesponses.WithBaseURL(cfg.BaseURL))
|
||||
}
|
||||
@@ -70,9 +70,7 @@ func NewSDKChatModel(cfg SDKModelConfig) *sdk.Model {
|
||||
opts := []openaicodex.Option{
|
||||
openaicodex.WithAccessToken(cfg.APIKey),
|
||||
}
|
||||
if cfg.HTTPClient != nil {
|
||||
opts = append(opts, openaicodex.WithHTTPClient(cfg.HTTPClient))
|
||||
}
|
||||
opts = append(opts, openaicodex.WithHTTPClient(cfg.HTTPClient))
|
||||
if cfg.CodexAccountID != "" {
|
||||
opts = append(opts, openaicodex.WithAccountID(cfg.CodexAccountID))
|
||||
}
|
||||
@@ -85,9 +83,7 @@ func NewSDKChatModel(cfg SDKModelConfig) *sdk.Model {
|
||||
opts := []anthropicmessages.Option{
|
||||
anthropicmessages.WithAPIKey(cfg.APIKey),
|
||||
}
|
||||
if cfg.HTTPClient != nil {
|
||||
opts = append(opts, anthropicmessages.WithHTTPClient(cfg.HTTPClient))
|
||||
}
|
||||
opts = append(opts, anthropicmessages.WithHTTPClient(cfg.HTTPClient))
|
||||
if cfg.BaseURL != "" {
|
||||
opts = append(opts, anthropicmessages.WithBaseURL(cfg.BaseURL))
|
||||
}
|
||||
@@ -105,9 +101,7 @@ func NewSDKChatModel(cfg SDKModelConfig) *sdk.Model {
|
||||
opts := []googlegenerative.Option{
|
||||
googlegenerative.WithAPIKey(cfg.APIKey),
|
||||
}
|
||||
if cfg.HTTPClient != nil {
|
||||
opts = append(opts, googlegenerative.WithHTTPClient(cfg.HTTPClient))
|
||||
}
|
||||
opts = append(opts, googlegenerative.WithHTTPClient(cfg.HTTPClient))
|
||||
if cfg.BaseURL != "" {
|
||||
opts = append(opts, googlegenerative.WithBaseURL(cfg.BaseURL))
|
||||
}
|
||||
@@ -118,9 +112,7 @@ func NewSDKChatModel(cfg SDKModelConfig) *sdk.Model {
|
||||
opts := []openaicompletions.Option{
|
||||
openaicompletions.WithAPIKey(cfg.APIKey),
|
||||
}
|
||||
if cfg.HTTPClient != nil {
|
||||
opts = append(opts, openaicompletions.WithHTTPClient(cfg.HTTPClient))
|
||||
}
|
||||
opts = append(opts, openaicompletions.WithHTTPClient(cfg.HTTPClient))
|
||||
if cfg.BaseURL != "" {
|
||||
opts = append(opts, openaicompletions.WithBaseURL(cfg.BaseURL))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user