Skip to content

Commit ca1f6b1

Browse files
authored
feat: remove legacy chat provider tables (coder#25416)
1 parent ddec110 commit ca1f6b1

46 files changed

Lines changed: 1320 additions & 3555 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

coderd/coderdtest/chat.go

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,37 +47,29 @@ func FakeOpenAICompatProviderAPIKeys(t testing.TB) chatprovider.ProviderAPIKeys
4747
}
4848

4949
// CreateOpenAICompatChatModelConfig creates the default provider and model
50-
// config used by chat runtime tests. Tests that create chats should also set
51-
// Options.ChatProviderAPIKeys, usually via FakeOpenAICompatProviderAPIKeys, so
52-
// background chat work routes to a local provider until coderd closes. baseURL,
53-
// when non-empty, is stored on the provider config.
50+
// config used by chat runtime tests. Tests can pass a baseURL to route chat work
51+
// to a specific local provider. If baseURL is empty, this helper starts a fake
52+
// OpenAI-compatible provider.
5453
func CreateOpenAICompatChatModelConfig(
5554
t testing.TB,
5655
client *codersdk.ExperimentalClient,
5756
baseURL string,
5857
) codersdk.ChatModelConfig {
5958
t.Helper()
6059

61-
ctx := testutil.Context(t, testutil.WaitLong)
62-
_, err := client.CreateChatProvider(ctx, codersdk.CreateChatProviderConfigRequest{
63-
Provider: TestChatProviderOpenAICompat,
64-
APIKey: TestChatProviderAPIKey,
65-
BaseURL: baseURL,
66-
})
67-
require.NoError(t, err)
68-
aiProviderBaseURL := baseURL
69-
if aiProviderBaseURL == "" {
70-
aiProviderBaseURL = "https://api.example.com/v1"
60+
if baseURL == "" {
61+
baseURL = chattest.OpenAI(t)
7162
}
63+
64+
ctx := testutil.Context(t, testutil.WaitLong)
7265
provider, err := client.CreateAIProvider(ctx, codersdk.CreateAIProviderRequest{
7366
Type: codersdk.AIProviderType(TestChatProviderOpenAICompat),
7467
Name: "test-" + uuid.NewString(),
75-
BaseURL: aiProviderBaseURL,
68+
BaseURL: baseURL,
7669
Enabled: true,
7770
APIKeys: []string{TestChatProviderAPIKey},
7871
})
7972
require.NoError(t, err)
80-
8173
contextLimit := int64(4096)
8274
isDefault := true
8375
modelConfig, err := client.CreateChatModelConfig(ctx, codersdk.CreateChatModelConfigRequest{

coderd/database/check_constraint.go

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

0 commit comments

Comments
 (0)