mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: expose PromptCacheKey in OpenAI model config form (#23185)
## Summary Remove the `hidden` tag from the `PromptCacheKey` field on `ChatModelOpenAIProviderOptions` so the auto-generated JSON schema no longer marks it as hidden. This allows the admin model configuration UI to render a "Prompt Cache Key" text input for OpenAI models alongside other visible options like Reasoning Effort, Service Tier, and Web Search. ## Changes - **`codersdk/chats.go`**: Remove `hidden:"true"` from `PromptCacheKey` struct tag. - **`site/src/api/chatModelOptionsGenerated.json`**: Regenerated via `make gen` — `hidden: true` removed from the `prompt_cache_key` entry. - **`modelConfigFormLogic.test.ts`**: Extend existing "all fields set" tests to cover extract and build roundtrip for `promptCacheKey`. ## How it works The `hidden` Go struct tag propagates through the code generation pipeline: 1. Go struct tag → `scripts/modeloptionsgen` → `chatModelOptionsGenerated.json` 2. The frontend `getVisibleProviderFields()` filters out fields with `hidden: true` 3. Removing the tag makes the field visible in the schema-driven form renderer No new UI components are needed — the existing `ModelConfigFields` component automatically renders the field as a text input based on the schema (`type: "string"`, `input_type: "input"`). The field appears as **"Prompt Cache Key"** with description "Key for enabling cross-request prompt caching" in the OpenAI provider section of the admin model configuration form.
This commit is contained in:
+1
-1
@@ -404,7 +404,7 @@ type ChatModelOpenAIProviderOptions struct {
|
||||
Prediction map[string]any `json:"prediction,omitempty" description:"Predicted output content to speed up responses" hidden:"true"`
|
||||
Store *bool `json:"store,omitempty" description:"Whether to store the output for model distillation or evals" hidden:"true"`
|
||||
Metadata map[string]any `json:"metadata,omitempty" description:"Arbitrary metadata to attach to the request" hidden:"true"`
|
||||
PromptCacheKey *string `json:"prompt_cache_key,omitempty" description:"Key for enabling cross-request prompt caching" hidden:"true"`
|
||||
PromptCacheKey *string `json:"prompt_cache_key,omitempty" description:"Key for enabling cross-request prompt caching"`
|
||||
SafetyIdentifier *string `json:"safety_identifier,omitempty" description:"Developer-specific safety identifier for the request" hidden:"true"`
|
||||
ServiceTier *string `json:"service_tier,omitempty" description:"Latency tier to use for processing the request"`
|
||||
StructuredOutputs *bool `json:"structured_outputs,omitempty" description:"Whether to enable structured JSON output mode" hidden:"true"`
|
||||
|
||||
Reference in New Issue
Block a user