mirror of
https://github.com/coder/coder.git
synced 2026-10-16 14:48:56 +08:00
fix: make the upsert 1h price key optional
The endpoint and the CLI treat a missing cache_write_1h_price like null, and tiers is already omitempty. Without omitempty the generated AIModelPriceUpsert type required the key, so a TypeScript client that built the four-price upsert stopped compiling.
This commit is contained in:
@@ -77,8 +77,8 @@ type UpsertAIModelPricesRequest struct {
|
||||
}
|
||||
|
||||
// AIModelPriceUpsert is one model's prices in an upsert request. It carries
|
||||
// only the writable fields of AIModelPrice. A null CacheWrite1hPrice, or a
|
||||
// missing or null Tiers, clears it.
|
||||
// only the writable fields of AIModelPrice. A missing or null
|
||||
// CacheWrite1hPrice or Tiers clears it.
|
||||
type AIModelPriceUpsert struct {
|
||||
Provider string `json:"provider"`
|
||||
Model string `json:"model"`
|
||||
@@ -86,7 +86,7 @@ type AIModelPriceUpsert struct {
|
||||
OutputPrice *int64 `json:"output_price"`
|
||||
CacheReadPrice *int64 `json:"cache_read_price"`
|
||||
CacheWritePrice *int64 `json:"cache_write_price"`
|
||||
CacheWrite1hPrice *int64 `json:"cache_write_1h_price"`
|
||||
CacheWrite1hPrice *int64 `json:"cache_write_1h_price,omitempty"`
|
||||
Tiers []AIModelPriceTier `json:"tiers,omitempty"`
|
||||
}
|
||||
|
||||
|
||||
Generated
+3
-3
@@ -415,8 +415,8 @@ export interface AIModelPriceTier {
|
||||
// From codersdk/aimodelprices.go
|
||||
/**
|
||||
* AIModelPriceUpsert is one model's prices in an upsert request. It carries
|
||||
* only the writable fields of AIModelPrice. A null CacheWrite1hPrice, or a
|
||||
* missing or null Tiers, clears it.
|
||||
* only the writable fields of AIModelPrice. A missing or null
|
||||
* CacheWrite1hPrice or Tiers clears it.
|
||||
*/
|
||||
export interface AIModelPriceUpsert {
|
||||
readonly provider: string;
|
||||
@@ -425,7 +425,7 @@ export interface AIModelPriceUpsert {
|
||||
readonly output_price: number | null;
|
||||
readonly cache_read_price: number | null;
|
||||
readonly cache_write_price: number | null;
|
||||
readonly cache_write_1h_price: number | null;
|
||||
readonly cache_write_1h_price?: number;
|
||||
readonly tiers?: readonly AIModelPriceTier[];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user