langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
53.48k stars 7.81k forks source link

The variable function based on API is not working, and the variable tool for adding code in the old version is invalid. #2480

Closed onlywangyh closed 9 months ago

onlywangyh commented 9 months ago

Self Checks

Dify version

0.5.5

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

image

I used the API-based variable feature, but it is not working. It only supports text paragraphs and dropdown options. The code based on local development cannot implement the loading of variable functions.

✔️ Expected Behavior

The weather plugin is working normally.

❌ Actual Behavior

I got the wrong response { "code": "invalid_param", "message": "weather is required in input form", "status": 400 }

dosubot[bot] commented 9 months ago

🤖

Hey there, @onlywangyh! Great to see you reaching out again. Hope you're doing well!

Based on the error message you provided, it seems like the issue is related to the "weather" parameter not being provided in the input form. This could be due to a variety of reasons, such as the parameter not existing in the API schema, the parameter being duplicated, the parameter being required but not provided, or the parameter not having a default value and no value being provided.

To troubleshoot this issue, you could check the following:

  1. Ensure that the "weather" parameter exists in the API schema. The parser checks for parameters in the 'parameters' field of the operation object (interface['operation']['parameters']). If the "weather" parameter is not listed there, it will not be recognized and could result in an "invalid_param" error.

  2. Check if the "weather" parameter is duplicated. The parser checks for duplicate parameters and raises a warning if it finds any ('Parameter {name} is duplicated.'). If the API or the tool you're using does not handle duplicate parameters correctly, this could result in an "invalid_param" error.

  3. Verify if the "weather" parameter is required but not provided. The parser checks if a parameter is required (parameter.get('required', False)). If a required parameter like "weather" is not provided, this could result in an "invalid_param" error.

  4. Check if the "weather" parameter does not have a default value and no value is provided. The parser checks if a parameter has a default value (parameter['default'] if 'default' in parameter else None). If a parameter like "weather" does not have a default value and no value is provided, this could result in an "invalid_param" error.

You can find more information about the parser in the parser.py file.

If you're still encountering issues after checking these possibilities, could you please provide more specific information about the "weather" parameter and the API schema? This would help in providing a more precise solution.

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.
zxhlyh commented 9 months ago

fixed. #2490