Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the input field of tool panel not worked as expected #6002

Closed
5 tasks done
hjlarry opened this issue Jul 5, 2024 · 2 comments · Fixed by #6003
Closed
5 tasks done

the input field of tool panel not worked as expected #6002

hjlarry opened this issue Jul 5, 2024 · 2 comments · Fixed by #6003
Assignees
Labels
🐞 bug Something isn't working

Comments

@hjlarry
Copy link
Contributor

hjlarry commented Jul 5, 2024

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.6.12-fix1

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

when you develop a tool, add this config in the yaml file:

parameters:
  - name: test_select
    type: select
    options:
      - value: 0
        label:
          en_US: value_is_0
    required: true
    label:
      en_US: Test Select
    human_description:
      en_US: Test Select
    form: form
  - name: test_secret_input
    type: secret-input
    required: true
    label:
      en_US: Test Secret Input
    human_description:
      en_US: Test Secret Input
    form: form
  - name: test_number
    type: number
    required: true
    label:
      en_US: Test Number
    human_description:
      en_US: Test Number
    form: form
  - name: test_boolean
    type: boolean
    required: true
    label:
      en_US: Test Boolean
    human_description:
      en_US: Test Boolean
    form: form

you will get some input fields like this:
image

the problem is:

  • secret input field, it is not mask the input text
  • number input field, you can't enter a 0, it will not display; if you enter the 0.23, it will display .23
  • number input field, if the default value is 0, when you run this node, it will raise tool parameter test_number not found in tool config
  • select field, when you choose an option run once, and then click the clear btn run once again, it will submit the first time's value
  • boolean field, it is not display the required star
  • boolean field, there is no default value, but the False is selected in the page. when you click run btn, it will raise Test Boolean 不能为空
  • boolean field, when you click again to choose False, it will raise tool parameter test_boolean not found in tool config

✔️ Expected Behavior

No response

❌ Actual Behavior

No response

@hjlarry
Copy link
Contributor Author

hjlarry commented Jul 5, 2024

I will make a PR later to fix this.

@dosubot dosubot bot added the 🐞 bug Something isn't working label Jul 5, 2024
Copy link

dosubot bot commented Jul 5, 2024

Hey @hjlarry, I'm here to help you with any bugs, questions, or contributions while waiting for a human maintainer. Let me know how I can assist you!

The issues you've encountered with the input fields in the tool panel can be addressed as follows:

  1. Secret Input Field Not Masking Text:

    • Ensure that the type for the secret input field is set to secret-input in the YAML configuration. This should mask the input text on the frontend and encrypt it on the backend [1].
  2. Number Input Field Issues:

    • Entering 0 Not Displaying: This might be due to the input field not handling the value 0 correctly. Ensure that the input field component properly handles and displays 0.
    • Displaying .23 Instead of 0.23: This could be due to improper handling of number formatting. Ensure that the input field component correctly formats and displays numbers.
    • Default Value 0 Not Found: Ensure that the default value is correctly set and handled in the validate_parameters method. The default value should be assigned if the parameter is not set [2].
  3. Select Field Issues:

    • Submitting First Value After Clearing: This might be due to the state not being reset correctly. Ensure that the state is properly cleared when the clear button is clicked.
    • Boolean Field Issues:
      • Required Star Not Displayed: Ensure that the required attribute is correctly set and displayed for boolean fields.
      • Default Value Handling: Ensure that the default value for boolean fields is correctly handled. If no default value is set, the field should not default to False unless explicitly specified.
      • Error on Selecting False: Ensure that the boolean field correctly handles the False value and does not raise an error when it is selected [1].
  4. General Validation and State Management:

    • Ensure that the validation mechanisms for each input field type are correctly implemented and configured. This includes handling default values, required fields, and proper state management [1][2].

By addressing these issues, you should be able to resolve the problems with the input fields in the tool panel. If you need further assistance or specific code examples, feel free to ask!

To continue talking to Dosu, mention @dosu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant