Input parameter don't change while I provide the conversation_id in /chat-messages API #4965

Closed
opened 2026-02-21 18:08:47 -05:00 by yindo · 3 comments
Owner

Originally created by @delvin-sparkle on GitHub (Aug 8, 2024).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.6.15

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

I created a workflow in Dify and configured an input parameter called pet_story at the start node. I use the /chat-messages API for the chat, and since I need to continue the conversation based on previous chat records, I have to pass the conversation_id from earlier messages. However, I’ve found that as long as I provide the conversation_id, the value of the pet_story parameter in the workflow never changes, regardless of what value I pass for pet_story—it always stays the same as the first value I provided.

✔️ Expected Behavior

input parameter can be changed while I provide the conversation_id in /chat-messages API

Actual Behavior

input parameter don't change while I provide the conversation_id in /chat-messages API

Originally created by @delvin-sparkle on GitHub (Aug 8, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.6.15 ### Cloud or Self Hosted Self Hosted (Source) ### Steps to reproduce I created a workflow in Dify and configured an input parameter called pet_story at the start node. I use the /chat-messages API for the chat, and since I need to continue the conversation based on previous chat records, I have to pass the conversation_id from earlier messages. However, I’ve found that as long as I provide the conversation_id, the value of the pet_story parameter in the workflow never changes, regardless of what value I pass for pet_story—it always stays the same as the first value I provided. ### ✔️ Expected Behavior input parameter can be changed while I provide the conversation_id in /chat-messages API ### ❌ Actual Behavior input parameter don't change while I provide the conversation_id in /chat-messages API
yindo closed this issue 2026-02-21 18:08:47 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Aug 8, 2024):

To change the value of the pet_story input parameter in the /chat-messages API when providing the conversation_id in Dify version 0.6.15, you can use the create_chat_message method of the ChatClient class. Here is an example of how you can do it:

import requests
import json

url = 'https://api.dify.ai/v1/chat-messages'
headers = {
    'Authorization': 'Bearer your_api_key',
    'Content-Type': 'application/json',
}

# Define the inputs, including the new value for the pet_story parameter
data = {
    "inputs": {
        "pet_story": "Your new pet story value"
    },
    "query": "Your query",
    "response_mode": "streaming",
    "conversation_id": "your_conversation_id",
    "user": "user_identifier"
}

# Send the POST request to the /chat-messages endpoint
response = requests.post(url, headers=headers, data=json.dumps(data))

# Print the response
print(response.json())

In this example, replace "your_api_key", "Your new pet story value", "Your query", "user_identifier", and "your_conversation_id" with your actual values. This will send a POST request to the /chat-messages endpoint with the updated pet_story input parameter and the specified conversation_id [1][2].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Aug 8, 2024): <!-- Answer --> To change the value of the `pet_story` input parameter in the `/chat-messages` API when providing the `conversation_id` in Dify version 0.6.15, you can use the `create_chat_message` method of the `ChatClient` class. Here is an example of how you can do it: ```python import requests import json url = 'https://api.dify.ai/v1/chat-messages' headers = { 'Authorization': 'Bearer your_api_key', 'Content-Type': 'application/json', } # Define the inputs, including the new value for the pet_story parameter data = { "inputs": { "pet_story": "Your new pet story value" }, "query": "Your query", "response_mode": "streaming", "conversation_id": "your_conversation_id", "user": "user_identifier" } # Send the POST request to the /chat-messages endpoint response = requests.post(url, headers=headers, data=json.dumps(data)) # Print the response print(response.json()) ``` In this example, replace `"your_api_key"`, `"Your new pet story value"`, `"Your query"`, `"user_identifier"`, and `"your_conversation_id"` with your actual values. This will send a POST request to the `/chat-messages` endpoint with the updated `pet_story` input parameter and the specified `conversation_id` <sup>[[1]](https://github.com/langgenius/dify/blob/main/sdks/python-client/dify_client/client.py)</sup><sup>[[2]](https://github.com/langgenius/dify-docs/blob/main/en/guides/application-publishing/developing-with-apis.md)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@crazywoola commented on GitHub (Aug 8, 2024):

This is a known issue, or by design. We do not support modifying those parameters in this way.

@crazywoola commented on GitHub (Aug 8, 2024): This is a known issue, or by design. We do not support modifying those parameters in this way.
Author
Owner

@fxconfig commented on GitHub (Aug 16, 2024):

This is a known issue, or by design. We do not support modifying those parameters in this way.

but why?
user need the chat history, but some input var would changed when user's state changed,
LLM should using the diffrent var to continue chat with user

@fxconfig commented on GitHub (Aug 16, 2024): > This is a known issue, or by design. We do not support modifying those parameters in this way. but why? user need the chat history, but some input var would changed when user's state changed, LLM should using the diffrent var to continue chat with user
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#4965