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
45.9k stars 6.47k forks source link

Error in item: Invalid variable. #8540

Open yuhp-zts opened 15 hours ago

yuhp-zts commented 15 hours ago

Self Checks

Dify version

0.8.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

In workflow mode. first: image

second: image

error:

image

✔️ Expected Behavior

No response

❌ Actual Behavior

No response

dosubot[bot] commented 15 hours ago

To resolve the "Invalid variable" error in the HTTP POST request configuration for the endpoint http://10.26.182.18:8888/v1/chat-messages in Dify version 0.8.0, ensure that all variables in the request body are correctly defined and match the expected types and formats as specified in the API documentation.

Here is an example of a correctly formatted cURL request:

curl -X POST 'http://10.26.182.18:8888/v1/chat-messages' \
-H 'Authorization: Bearer {api_key}' \
-H 'Content-Type: application/json' \
--data-raw '{
    "inputs": {
        "name": "dify"
    },
    "query": "What are the specs of the iPhone 13 Pro Max?",
    "response_mode": "streaming",
    "user": "abc-123",
    "files": [
      {
        "type": "image",
        "transfer_method": "remote_url",
        "url": "https://cloud.dify.ai/logo/logo-site.png"
      }
    ]
}'

Ensure that:

  1. The inputs field is an object containing key-value pairs.
  2. The query field is a string.
  3. The response_mode field is either streaming or blocking.
  4. The user field is a string.
  5. The files field is an array of objects, each containing the required fields (type, transfer_method, url or upload_file_id).
  6. Optionally, the conversation_id field can be included if you need to continue a previous conversation.

If any of these fields are missing or incorrectly formatted, it could result in an "Invalid variable" error. Additionally, ensure that the Authorization header contains a valid API-Key as required for authentication.

For more detailed information and examples, you can refer to the API documentation provided in the Applications -> Access API section of the Dify platform. This documentation includes example requests and key considerations for handling conversation_id and other dynamic variables during a session [1][2][3][4].

To continue talking to Dosu, mention @dosu.