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
+6
-4
@@ -82,6 +82,12 @@ export interface AIBridgeConfig {
|
||||
readonly circuit_breaker_interval: number;
|
||||
readonly circuit_breaker_timeout: number;
|
||||
readonly circuit_breaker_max_requests: number;
|
||||
/**
|
||||
* APIDumpDir is the base directory under which each provider's
|
||||
* request/response dumps are written, in a subdirectory named after
|
||||
* the provider. Empty disables dumping.
|
||||
*/
|
||||
readonly api_dump_dir: string;
|
||||
}
|
||||
|
||||
// From codersdk/aibridge.go
|
||||
@@ -384,10 +390,6 @@ export interface AIProviderConfig {
|
||||
* BaseURL is the base URL of the upstream provider API.
|
||||
*/
|
||||
readonly base_url: string;
|
||||
/**
|
||||
* DumpDir is the directory path for dumping API requests and responses.
|
||||
*/
|
||||
readonly dump_dir?: string;
|
||||
readonly bedrock_region?: string;
|
||||
readonly bedrock_model?: string;
|
||||
readonly bedrock_small_fast_model?: string;
|
||||
|
||||
Reference in New Issue
Block a user