Open yuhp-zts opened 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:
inputs
field is an object containing key-value pairs.query
field is a string.response_mode
field is either streaming
or blocking
.user
field is a string.files
field is an array of objects, each containing the required fields (type
, transfer_method
, url
or upload_file_id
).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.
Self Checks
Dify version
0.8.0
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
In workflow mode. first:
second:
error:
✔️ Expected Behavior
No response
❌ Actual Behavior
No response