mirror of
https://github.com/wavetermdev/waveterm
synced 2026-05-24 09:18:27 +00:00
# Add configurable verbosity for OpenAI Responses API Fixes #2775 ## Problem Models like `gpt-5.2-codex` and other newer OpenAI models only support `medium` reasoning and verbosity levels, but the codebase was using `low` by default. This caused 400 Bad Request errors: ``` Failed to stream openai-responses chat: openai 400 Bad Request: Unsupported value: 'low' is not supported with the 'gpt-5.2-codex' model. Supported values are: 'medium'. ``` ## Solution This PR implements a scalable, user-configurable approach instead of hardcoding model-specific constraints: 1. **Changed default verbosity** from `"low"` to `"medium"` - more widely supported across OpenAI models 2. **Added `ai:verbosity` config option** - allows users to configure verbosity per model in `waveai.json` 3. **Changed rate limit fallback** from `low` to `medium` thinking level for better compatibility 4. **Removed hardcoded model checks** - solution is scalable for future models ## Changes ### Backend Changes - `pkg/aiusechat/openai/openai-convertmessage.go` - Use configurable verbosity with safe defaults - `pkg/aiusechat/uctypes/uctypes.go` - Add `Verbosity` field to `AIOptsType` - `pkg/aiusechat/usechat.go` - Pass verbosity from config to options - `pkg/wconfig/settingsconfig.go` - Add `Verbosity` to `AIModeConfigType` ### Schema Changes - `schema/waveai.json` - Add `ai:verbosity` with enum values (low/medium/high) - `frontend/types/gotypes.d.ts` - Auto-generated TypeScript types ### Configuration Example Users can now configure both thinking level and verbosity per model: ```json { "openai-gpt52-codex": { "display:name": "GPT-5.2 Codex", "ai:provider": "openai", "ai:model": "gpt-5.2-codex", "ai:thinkinglevel": "medium", "ai:verbosity": "medium" } } ```
111 lines
No EOL
2.4 KiB
JSON
111 lines
No EOL
2.4 KiB
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$defs": {
|
|
"AIModeConfigType": {
|
|
"properties": {
|
|
"display:name": {
|
|
"type": "string"
|
|
},
|
|
"display:order": {
|
|
"type": "number"
|
|
},
|
|
"display:icon": {
|
|
"type": "string"
|
|
},
|
|
"display:description": {
|
|
"type": "string"
|
|
},
|
|
"ai:provider": {
|
|
"type": "string",
|
|
"enum": [
|
|
"wave",
|
|
"google",
|
|
"openrouter",
|
|
"openai",
|
|
"azure",
|
|
"azure-legacy",
|
|
"custom"
|
|
]
|
|
},
|
|
"ai:apitype": {
|
|
"type": "string",
|
|
"enum": [
|
|
"google-gemini",
|
|
"openai-responses",
|
|
"openai-chat"
|
|
]
|
|
},
|
|
"ai:model": {
|
|
"type": "string"
|
|
},
|
|
"ai:thinkinglevel": {
|
|
"type": "string",
|
|
"enum": [
|
|
"low",
|
|
"medium",
|
|
"high"
|
|
]
|
|
},
|
|
"ai:verbosity": {
|
|
"type": "string",
|
|
"enum": [
|
|
"low",
|
|
"medium",
|
|
"high"
|
|
],
|
|
"description": "Text verbosity level (OpenAI Responses API only)"
|
|
},
|
|
"ai:endpoint": {
|
|
"type": "string"
|
|
},
|
|
"ai:azureapiversion": {
|
|
"type": "string"
|
|
},
|
|
"ai:apitoken": {
|
|
"type": "string"
|
|
},
|
|
"ai:apitokensecretname": {
|
|
"type": "string"
|
|
},
|
|
"ai:azureresourcename": {
|
|
"type": "string"
|
|
},
|
|
"ai:azuredeployment": {
|
|
"type": "string"
|
|
},
|
|
"ai:capabilities": {
|
|
"items": {
|
|
"type": "string",
|
|
"enum": [
|
|
"pdfs",
|
|
"images",
|
|
"tools"
|
|
]
|
|
},
|
|
"type": "array"
|
|
},
|
|
"ai:switchcompat": {
|
|
"items": {
|
|
"type": "string"
|
|
},
|
|
"type": "array"
|
|
},
|
|
"waveai:cloud": {
|
|
"type": "boolean"
|
|
},
|
|
"waveai:premium": {
|
|
"type": "boolean"
|
|
}
|
|
},
|
|
"additionalProperties": false,
|
|
"type": "object",
|
|
"required": [
|
|
"display:name"
|
|
]
|
|
}
|
|
},
|
|
"additionalProperties": {
|
|
"$ref": "#/$defs/AIModeConfigType"
|
|
},
|
|
"type": "object"
|
|
} |