mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-28 11:41:04 +00:00
fix(scripts): avoid 'undefined Options: ...' for enums without description (#2963)
schema.description is only assigned when setting.description is truthy. For enum settings missing a description, the subsequent += produced the literal string 'undefined Options: foo, bar' in the generated JSON schema. Initialize the field when absent instead of concatenating onto undefined.
This commit is contained in:
parent
fc75913e50
commit
db4b76576a
1 changed files with 5 additions and 2 deletions
|
|
@ -121,8 +121,11 @@ function convertSettingToJsonSchema(
|
|||
case 'enum':
|
||||
if (setting.options && setting.options.length > 0) {
|
||||
schema.enum = setting.options.map((o) => o.value);
|
||||
schema.description +=
|
||||
' Options: ' + setting.options.map((o) => `${o.value}`).join(', ');
|
||||
const optionsText =
|
||||
'Options: ' + setting.options.map((o) => `${o.value}`).join(', ');
|
||||
schema.description = schema.description
|
||||
? `${schema.description} ${optionsText}`
|
||||
: optionsText;
|
||||
} else {
|
||||
// Enum without predefined options - accept any string
|
||||
schema.type = 'string';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue