mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
refactor: load AI providers from the database at startup (#25672)
Replace the env-based `BuildProviders` with a DB-backed loader. The database is now the single source of truth for runtime provider configuration; env config arrives via `SeedAIProvidersFromEnv` (run at boot) and `BuildProviders` reads it back as `aibridge.Provider` instances. `cli/server.go` and `enterprise/cli/server.go` both call the same path, so aibridged and aibridgeproxyd see the same provider set. Per-provider `DumpDir` is replaced by a top-level `CODER_AI_GATEWAY_DUMP_DIR` base; each provider's effective dump path is `<base>/<provider name>`.
This commit is contained in:
Generated
+1
-1
@@ -185,6 +185,7 @@ curl -X GET http://coder-server:8080/api/v2/deployment/config \
|
||||
"base_url": "string",
|
||||
"key": "string"
|
||||
},
|
||||
"api_dump_dir": "string",
|
||||
"bedrock": {
|
||||
"access_key": "string",
|
||||
"access_key_secret": "string",
|
||||
@@ -213,7 +214,6 @@ curl -X GET http://coder-server:8080/api/v2/deployment/config \
|
||||
"bedrock_model": "string",
|
||||
"bedrock_region": "string",
|
||||
"bedrock_small_fast_model": "string",
|
||||
"dump_dir": "string",
|
||||
"name": "string",
|
||||
"type": "string"
|
||||
}
|
||||
|
||||
Generated
+5
-6
@@ -442,6 +442,7 @@
|
||||
"base_url": "string",
|
||||
"key": "string"
|
||||
},
|
||||
"api_dump_dir": "string",
|
||||
"bedrock": {
|
||||
"access_key": "string",
|
||||
"access_key_secret": "string",
|
||||
@@ -470,7 +471,6 @@
|
||||
"bedrock_model": "string",
|
||||
"bedrock_region": "string",
|
||||
"bedrock_small_fast_model": "string",
|
||||
"dump_dir": "string",
|
||||
"name": "string",
|
||||
"type": "string"
|
||||
}
|
||||
@@ -488,6 +488,7 @@
|
||||
|-------------------------------------|----------------------------------------------------------------------|----------|--------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `allow_byok` | boolean | false | | |
|
||||
| `anthropic` | [codersdk.AIBridgeAnthropicConfig](#codersdkaibridgeanthropicconfig) | false | | Deprecated: Use Providers with indexed CODER_AI_GATEWAY_PROVIDER_<N>_* env vars instead. |
|
||||
| `api_dump_dir` | string | false | | Api dump dir is the base directory under which each provider's request/response dumps are written, in a subdirectory named after the provider. Empty disables dumping. |
|
||||
| `bedrock` | [codersdk.AIBridgeBedrockConfig](#codersdkaibridgebedrockconfig) | false | | Deprecated: Use Providers with indexed CODER_AI_GATEWAY_PROVIDER_<N>_* env vars instead. |
|
||||
| `budget_period` | string | false | | |
|
||||
| `budget_policy` | string | false | | Budget settings for AI Governance cost controls. |
|
||||
@@ -1245,6 +1246,7 @@
|
||||
"base_url": "string",
|
||||
"key": "string"
|
||||
},
|
||||
"api_dump_dir": "string",
|
||||
"bedrock": {
|
||||
"access_key": "string",
|
||||
"access_key_secret": "string",
|
||||
@@ -1273,7 +1275,6 @@
|
||||
"bedrock_model": "string",
|
||||
"bedrock_region": "string",
|
||||
"bedrock_small_fast_model": "string",
|
||||
"dump_dir": "string",
|
||||
"name": "string",
|
||||
"type": "string"
|
||||
}
|
||||
@@ -1344,7 +1345,6 @@
|
||||
"bedrock_model": "string",
|
||||
"bedrock_region": "string",
|
||||
"bedrock_small_fast_model": "string",
|
||||
"dump_dir": "string",
|
||||
"name": "string",
|
||||
"type": "string"
|
||||
}
|
||||
@@ -1358,7 +1358,6 @@
|
||||
| `bedrock_model` | string | false | | |
|
||||
| `bedrock_region` | string | false | | |
|
||||
| `bedrock_small_fast_model` | string | false | | |
|
||||
| `dump_dir` | string | false | | Dump dir is the directory path for dumping API requests and responses. |
|
||||
| `name` | string | false | | Name is the unique instance identifier used for routing. Defaults to Type if not provided. |
|
||||
| `type` | string | false | | Type is the provider type: "openai", "anthropic", or "copilot". |
|
||||
|
||||
@@ -5706,6 +5705,7 @@ CreateWorkspaceRequest provides options for creating a new workspace. Only one o
|
||||
"base_url": "string",
|
||||
"key": "string"
|
||||
},
|
||||
"api_dump_dir": "string",
|
||||
"bedrock": {
|
||||
"access_key": "string",
|
||||
"access_key_secret": "string",
|
||||
@@ -5734,7 +5734,6 @@ CreateWorkspaceRequest provides options for creating a new workspace. Only one o
|
||||
"bedrock_model": "string",
|
||||
"bedrock_region": "string",
|
||||
"bedrock_small_fast_model": "string",
|
||||
"dump_dir": "string",
|
||||
"name": "string",
|
||||
"type": "string"
|
||||
}
|
||||
@@ -6305,6 +6304,7 @@ CreateWorkspaceRequest provides options for creating a new workspace. Only one o
|
||||
"base_url": "string",
|
||||
"key": "string"
|
||||
},
|
||||
"api_dump_dir": "string",
|
||||
"bedrock": {
|
||||
"access_key": "string",
|
||||
"access_key_secret": "string",
|
||||
@@ -6333,7 +6333,6 @@ CreateWorkspaceRequest provides options for creating a new workspace. Only one o
|
||||
"bedrock_model": "string",
|
||||
"bedrock_region": "string",
|
||||
"bedrock_small_fast_model": "string",
|
||||
"dump_dir": "string",
|
||||
"name": "string",
|
||||
"type": "string"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user