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
51.81k stars 7.51k forks source link

when the tool authorization raise credential *** should be string #8784

Closed hjlarry closed 1 month ago

hjlarry commented 1 month ago

Self Checks

Dify version

0.8.3

Cloud or Self Hosted

Cloud, Self Hosted (Source)

Steps to reproduce

  1. open the tools page
  2. find a tool's authorization panel which have a none required field, for example: firecrawl tool or Image-1X tool
  3. make the none required field empty and click authorization button

✔️ Expected Behavior

No response

❌ Actual Behavior

01bbe42d0f4333a1475503aee6eb80d

dosubot[bot] commented 1 month ago

I found a similar unsolved discussion regarding an "Invalid variable" error, which might be related to your issue. You can check it out here [1].

To resolve the "credential stepfun_base_url should be string" error, ensure that the stepfun_base_url credential is provided as a string in the credentials dictionary. This error typically occurs when the value of stepfun_base_url is not a string, which is required by the StepfunTool during the authorization process.

Here is an example of how you might structure the credentials dictionary to avoid this error:

credentials = {
    "stepfun_base_url": "https://example.com/api",  # Ensure this is a string
    # other credentials
}

# Example usage
try:
    StepfunTool().fork_tool_runtime(
        runtime={
            "credentials": credentials,
        }
    ).invoke(
        user_id="",
        tool_parameters={
            "prompt": "cute girl, blue eyes, white hair, anime style",
            "size": "1024x1024",
            "n": 1,
        },
    )
except ToolProviderCredentialValidationError as e:
    print(f"Credential validation error: {e}")

Make sure that the stepfun_base_url is correctly set as a string in the credentials dictionary. The Dify documentation specifies that stepfun_base_url should be a text input, so ensure it is provided in the correct format [2][3][4][5].

To continue talking to Dosu, mention @dosu.