The code extension using "schema.json" with type select, the "options" is invalid for using dropdowns in the frontend. #1062

Closed
opened 2026-02-21 17:29:46 -05:00 by yindo · 4 comments
Owner

Originally created by @onlywangyh on GitHub (Feb 18, 2024).

Originally assigned to: @zxhlyh, @Yeuoly on GitHub.

Self Checks

Dify version

langgenius/dify-web latest

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

this is schema.json:
{
"label": {
"en-US": "Weather Search",
"zh-Hans": "天气查询"
},
"form_schema": [
{
"type": "select",
"label": {
"en-US": "Temperature Unit",
"zh-Hans": "温度单位"
},
"variable": "temperature_unit",
"required": true,
"options": [
{
"label": {
"en-US": "Fahrenheit",
"zh-Hans": "华氏度"
},
"value": "fahrenheit"
},
{
"label": {
"en-US": "Centigrade",
"zh-Hans": "摄氏度"
},
"value": "centigrade"
}
],
"default": "fahrenheit",
"placeholder": "Please select temperature unit"
}
]
}

✔️ Expected Behavior

image
Options can choose Celsius or Fahrenheit.

Actual Behavior

Options is gray and use the defaule value fahrenheit

Originally created by @onlywangyh on GitHub (Feb 18, 2024). Originally assigned to: @zxhlyh, @Yeuoly on GitHub. ### Self Checks - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to file this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). ### Dify version langgenius/dify-web latest ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce this is schema.json: { "label": { "en-US": "Weather Search", "zh-Hans": "天气查询" }, "form_schema": [ { "type": "select", "label": { "en-US": "Temperature Unit", "zh-Hans": "温度单位" }, "variable": "temperature_unit", "required": true, "options": [ { "label": { "en-US": "Fahrenheit", "zh-Hans": "华氏度" }, "value": "fahrenheit" }, { "label": { "en-US": "Centigrade", "zh-Hans": "摄氏度" }, "value": "centigrade" } ], "default": "fahrenheit", "placeholder": "Please select temperature unit" } ] } ### ✔️ Expected Behavior ![image](https://github.com/langgenius/dify/assets/16820412/54f95ba4-cdb1-41f2-8f83-8408d747db2f) Options can choose Celsius or Fahrenheit. ### ❌ Actual Behavior Options is gray and use the defaule value fahrenheit
yindo added the 🐞 bug label 2026-02-21 17:29:46 -05:00
yindo closed this issue 2026-02-21 17:29:46 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Feb 18, 2024):

🤖

Hey there, @onlywangyh! Great to see you back. Let's dive into what's going on with those dropdowns.

Based on the provided schema.json, it seems like your configuration is correct. The "options" field is correctly set up as an array of objects, each containing a "label" and "value" field. This should indeed create a dropdown menu with the options "Fahrenheit" and "Centigrade".

However, you mentioned that the options are grayed out and only the default value "Fahrenheit" is used. This could be due to a few reasons:

  1. There might be a bug in the dify codebase that is causing this issue. However, without access to the codebase, I can't confirm this. You might want to check the recent commits or changes in the codebase that might have affected the functionality of the "options" field.

  2. There might be an issue with the frontend code that is rendering the dropdown menu. It's possible that the frontend code is not correctly interpreting the "options" field and is therefore not rendering the dropdown options correctly.

  3. There might be an issue with the data that is being passed to the frontend. If the data that is being passed to the frontend is not correctly formatted or is missing some fields, this could cause the dropdown options to not be rendered correctly.

To further investigate this issue, you could try the following:

  • Check the frontend code that is responsible for rendering the dropdown menu. Make sure it is correctly interpreting the "options" field and is able to render the dropdown options.

  • Check the data that is being passed to the frontend. Make sure it is correctly formatted and contains all the necessary fields.

  • Check the recent commits or changes in the dify codebase. Look for any changes that might have affected the functionality of the "options" field.

I hope this helps! If you have any more information or if there's anything else I can assist you with, please let me know.

Sources

About Dosu

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@dosubot[bot] commented on GitHub (Feb 18, 2024): _🤖_ <!-- Greeting --> Hey there, @onlywangyh! Great to see you back. Let's dive into what's going on with those dropdowns. <!-- Answer --> Based on the provided schema.json, it seems like your configuration is correct. The "options" field is correctly set up as an array of objects, each containing a "label" and "value" field. This should indeed create a dropdown menu with the options "Fahrenheit" and "Centigrade". However, you mentioned that the options are grayed out and only the default value "Fahrenheit" is used. This could be due to a few reasons: 1. There might be a bug in the dify codebase that is causing this issue. However, without access to the codebase, I can't confirm this. You might want to check the recent commits or changes in the codebase that might have affected the functionality of the "options" field. 2. There might be an issue with the frontend code that is rendering the dropdown menu. It's possible that the frontend code is not correctly interpreting the "options" field and is therefore not rendering the dropdown options correctly. 3. There might be an issue with the data that is being passed to the frontend. If the data that is being passed to the frontend is not correctly formatted or is missing some fields, this could cause the dropdown options to not be rendered correctly. To further investigate this issue, you could try the following: - Check the frontend code that is responsible for rendering the dropdown menu. Make sure it is correctly interpreting the "options" field and is able to render the dropdown options. - Check the data that is being passed to the frontend. Make sure it is correctly formatted and contains all the necessary fields. - Check the recent commits or changes in the dify codebase. Look for any changes that might have affected the functionality of the "options" field. I hope this helps! If you have any more information or if there's anything else I can assist you with, please let me know. ## Sources - [api/core/model_runtime/docs/en_US/schema.md](https://github.com/langgenius/dify/blob/main/api/core/model_runtime/docs/en_US/schema.md) <!-- Dosu Comment Footer --> <details open> <summary> #### About Dosu </summary> This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. </details>
Author
Owner

@Yeuoly commented on GitHub (Feb 18, 2024):

which version are you using? it seems that it's an old one.

@Yeuoly commented on GitHub (Feb 18, 2024): which version are you using? it seems that it's an old one.
Author
Owner

@onlywangyh commented on GitHub (Feb 19, 2024):

which version are you using? it seems that it's an old one.

This issue still exists in version 0.5.5

@onlywangyh commented on GitHub (Feb 19, 2024): > which version are you using? it seems that it's an old one. This issue still exists in version 0.5.5
Author
Owner

@zxhlyh commented on GitHub (Feb 20, 2024):

fixed. #2490

@zxhlyh commented on GitHub (Feb 20, 2024): fixed. #2490
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#1062