Closed girassolar closed 1 month ago
Hey @girassolar! 👋 I'm here to help you with any bugs, questions, or contributions you have for Dify. Let's squash those bugs together!
Dify generates a new conversation_id
despite passing an existing conversation_id
in the request payload because when a previous conversation_id
is passed, any new inputs
will be ignored. Only the query
is processed for the ongoing conversation [1][2][3].
To ensure that Dify reuses the provided conversation_id
instead of generating a new one, make sure that your payload includes the conversation_id
and that you are only passing the query
for the ongoing conversation. Here is an example of how to structure your API call:
curl --location --request POST 'https://api.dify.ai/v1/chat-messages' \
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"inputs": {},
"query": "your_query_here",
"response_mode": "streaming",
"conversation_id": "ec16132d-9b1c-4679-921b-110e3515da11",
"user": "your_user_id_here"
}'
import requests
import json
url = 'https://api.dify.ai/v1/chat-messages'
headers = {
'Authorization': 'Bearer ENTER-YOUR-SECRET-KEY',
'Content-Type': 'application/json',
}
data = {
"inputs": {},
"query": "your_query_here",
"response_mode": "streaming",
"conversation_id": "ec16132d-9b1c-4679-921b-110e3515da11",
"user": "your_user_id_here"
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())
Ensure that the conversation_id
and user
fields are correctly populated and that no new inputs
are being passed in the payload. This should help maintain the continuity of the conversation without generating a new conversation_id
.
To continue talking to Dosu, mention @dosu.
curl --location --request POST 'https://api.dify.ai/v1/chat-messages' \
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"inputs": {},
"query": "your_query_here",
"response_mode": "streaming",
"conversation_id": "ec16132d-9b1c-4679-921b-110e3515da11",
"user": "your_user_id_here"
}'
I don' think you have passed it in the right way.
Self Checks
Dify version
0.8.3
Cloud or Self Hosted
Cloud
Steps to reproduce
I'm encountering an issue where Dify continuously generates a new conversation_id for each interaction, even when I provide an existing conversation_id. This behavior wasn't happening before.
For example:
I pass the conversation ID ec16132d-9b1c-4679-921b-110e3515da11, which is an ID previously generated by Dify, but despite this, Dify creates a new conversation with a different ID (1aa1db7d-786a-4cb8-a674-303d9a31edca). The same payload worked fine before, reusing the conversation_id I passed, but now it's consistently generating new IDs.
Here’s a screenshot of the issue showing the input and the unexpected new conversation_id in the output: (attached screenshot)
Any ideas on why this is happening or how to ensure that Dify reuses the provided conversation_id instead of generating a new one?
✔️ Expected Behavior
I expect Dify to use the conversation_id that I provide in the request payload and continue the conversation within the same thread. I think the system should not generate a new conversation_id if an existing one is passed.
❌ Actual Behavior
Despite providing an existing conversation_id (e.g., ec16132d-9b1c-4679-921b-110e3515da11), Dify generates a new conversation_id each time (e.g., 1aa1db7d-786a-4cb8-a674-303d9a31edca), resulting in new conversations being started instead of continuing the existing one