Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3cf8f60

Browse files
committed
fix(coderd/ai): support overriding base URL for OpenAI provider, required for OpenRouter
1 parent40c3d5e commit3cf8f60

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

‎cli/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2680,7 +2680,7 @@ func ReadAIProvidersFromEnv(environ []string) ([]codersdk.AIProviderConfig, erro
26802680
case"BASE_URL":
26812681
provider.BaseURL=v.Value
26822682
case"MODELS":
2683-
provider.Models=strings.Split(v.Value,"")
2683+
provider.Models=strings.Split(v.Value,",")
26842684
}
26852685
providers[providerNum]=provider
26862686
}

‎coderd/ai/ai.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,13 @@ func ModelsFromConfig(ctx context.Context, configs []codersdk.AIProviderConfig)
4040

4141
switchconfig.Type {
4242
case"openai":
43-
client:=openai.NewClient(openaioption.WithAPIKey(config.APIKey))
43+
opts:= []openaioption.RequestOption{
44+
openaioption.WithAPIKey(config.APIKey),
45+
}
46+
ifconfig.BaseURL!="" {
47+
opts=append(opts,openaioption.WithBaseURL(config.BaseURL))
48+
}
49+
client:=openai.NewClient(opts...)
4450
streamFunc=func(ctx context.Context,optionsStreamOptions) (aisdk.DataStream,error) {
4551
openaiMessages,err:=aisdk.MessagesToOpenAI(options.Messages)
4652
iferr!=nil {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp