mirror of
https://github.com/coder/coder.git
synced 2026-11-08 05:32:55 +08:00
## 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.