Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6e8245d

Browse files
committed
chore: remove leftover pieces from #18535
Signed-off-by: Danny Kopping <[email protected]>
1 parent c22233f commit 6e8245d

File tree

5 files changed

+4
-99
lines changed

5 files changed

+4
-99
lines changed

cli/server.go

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -2624,77 +2624,6 @@ func redirectHTTPToHTTPSDeprecation(ctx context.Context, logger slog.Logger, inv
26242624
}
26252625
}
26262626

2627-
func ReadAIProvidersFromEnv(environ []string) ([]codersdk.AIProviderConfig, error) {
2628-
// The index numbers must be in-order.
2629-
sort.Strings(environ)
2630-
2631-
var providers []codersdk.AIProviderConfig
2632-
for _, v := range serpent.ParseEnviron(environ, "CODER_AI_PROVIDER_") {
2633-
tokens := strings.SplitN(v.Name, "_", 2)
2634-
if len(tokens) != 2 {
2635-
return nil, xerrors.Errorf("invalid env var: %s", v.Name)
2636-
}
2637-
2638-
providerNum, err := strconv.Atoi(tokens[0])
2639-
if err != nil {
2640-
return nil, xerrors.Errorf("parse number: %s", v.Name)
2641-
}
2642-
2643-
var provider codersdk.AIProviderConfig
2644-
switch {
2645-
case len(providers) < providerNum:
2646-
return nil, xerrors.Errorf(
2647-
"provider num %v skipped: %s",
2648-
len(providers),
2649-
v.Name,
2650-
)
2651-
case len(providers) == providerNum:
2652-
// At the next next provider.
2653-
providers = append(providers, provider)
2654-
case len(providers) == providerNum+1:
2655-
// At the current provider.
2656-
provider = providers[providerNum]
2657-
}
2658-
2659-
key := tokens[1]
2660-
switch key {
2661-
case "TYPE":
2662-
provider.Type = v.Value
2663-
case "API_KEY":
2664-
provider.APIKey = v.Value
2665-
case "BASE_URL":
2666-
provider.BaseURL = v.Value
2667-
case "MODELS":
2668-
provider.Models = strings.Split(v.Value, ",")
2669-
}
2670-
providers[providerNum] = provider
2671-
}
2672-
for _, envVar := range environ {
2673-
tokens := strings.SplitN(envVar, "=", 2)
2674-
if len(tokens) != 2 {
2675-
continue
2676-
}
2677-
switch tokens[0] {
2678-
case "OPENAI_API_KEY":
2679-
providers = append(providers, codersdk.AIProviderConfig{
2680-
Type: "openai",
2681-
APIKey: tokens[1],
2682-
})
2683-
case "ANTHROPIC_API_KEY":
2684-
providers = append(providers, codersdk.AIProviderConfig{
2685-
Type: "anthropic",
2686-
APIKey: tokens[1],
2687-
})
2688-
case "GOOGLE_API_KEY":
2689-
providers = append(providers, codersdk.AIProviderConfig{
2690-
Type: "google",
2691-
APIKey: tokens[1],
2692-
})
2693-
}
2694-
}
2695-
return providers, nil
2696-
}
2697-
26982627
// ReadExternalAuthProvidersFromEnv is provided for compatibility purposes with
26992628
// the viper CLI.
27002629
func ReadExternalAuthProvidersFromEnv(environ []string) ([]codersdk.ExternalAuthConfig, error) {

codersdk/deployment.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3122,21 +3122,6 @@ Write out the current server config as YAML to stdout.`,
31223122
return opts
31233123
}
31243124

3125-
type AIProviderConfig struct {
3126-
// Type is the type of the API provider.
3127-
Type string `json:"type" yaml:"type"`
3128-
// APIKey is the API key to use for the API provider.
3129-
APIKey string `json:"-" yaml:"api_key"`
3130-
// Models is the list of models to use for the API provider.
3131-
Models []string `json:"models" yaml:"models"`
3132-
// BaseURL is the base URL to use for the API provider.
3133-
BaseURL string `json:"base_url" yaml:"base_url"`
3134-
}
3135-
3136-
type AIConfig struct {
3137-
Providers []AIProviderConfig `json:"providers,omitempty" yaml:"providers,omitempty"`
3138-
}
3139-
31403125
type SupportConfig struct {
31413126
Links serpent.Struct[[]LinkConfig] `json:"links" typescript:",notnull"`
31423127
}

codersdk/toolsdk/toolsdk.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ import (
77
"encoding/json"
88
"io"
99

10-
"github.com/coder/aisdk-go"
1110
"github.com/google/uuid"
1211
"golang.org/x/xerrors"
1312

13+
"github.com/coder/aisdk-go"
14+
1415
"github.com/coder/coder/v2/codersdk"
1516
)
1617

codersdk/toolsdk/toolsdk_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import (
1414
"github.com/stretchr/testify/require"
1515
"go.uber.org/goleak"
1616

17+
"github.com/coder/aisdk-go"
18+
1719
"github.com/coder/coder/v2/coderd/coderdtest"
1820
"github.com/coder/coder/v2/coderd/database"
1921
"github.com/coder/coder/v2/coderd/database/dbfake"

site/src/api/typesGenerated.ts

Lines changed: 0 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)