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
50.23k stars 7.2k forks source link

api bug!'/chat-messages' does not support ' parent_message_id ', resulting in a lack of functionality to modify historical messages in the conversation #10124

Closed glacierck closed 22 minutes ago

glacierck commented 2 hours ago

Self Checks

Dify version

0.10.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

curl -X POST 'http://192.168.1.210/v1/chat-messages' \ --header 'Authorization: Bearer {api_key}' \ --header 'Content-Type: application/json' \ --data-raw '{ "inputs": {}, "query": "historical message", "response_mode": "streaming", "conversation_id": "64e25005-442f-41aa-97e3-f3e282e5a918", "parent_message_id":"ms-2", "user": "abc-123" }'

✔️ Expected Behavior

Restart the conversation from message ID "ms-2".

❌ Actual Behavior

Continue the conversation with the last message(id:ms-10) in the conversation.

dosubot[bot] commented 2 hours ago

I found a couple of similar discussions that might be relevant to your issue:

  1. How to Send a Conversation Message using "conversation_id" - This discussion is still open and might provide insights or solutions related to using conversation_id and parent_message_id.

  2. Why doesn't the /chat-messages API allow passes context messages as a list? - This is another open discussion that could be related to your issue with modifying historical messages.

Additionally, there is a closed issue that might be related:

These discussions and issues might provide more context or potential solutions to the problem you're experiencing with the /chat-messages API and the parent_message_id parameter [1][2][3].

To continue talking to Dosu, mention @dosu.

glacierck commented 2 hours ago

@dosu Suggest replying with support for 'parent_message_id' and reopening the ability to modify historical messages!

dosubot[bot] commented 2 hours ago

To implement support for parent_message_id in the /chat-messages API and enable modifying historical messages, you can follow the approach used in the ChatWrapper component. The doSend function is responsible for sending messages and includes logic to set the parent_message_id. Here's a brief overview of how it works:

The parent_message_id is set to the ID of the last answer or the last message in the chat list if available. This allows the API to understand the context of the message being sent and enables modifications to historical messages by referencing their IDs. Ensure that this logic is correctly integrated into your API handling to support the desired functionality [1].

Additionally, there are existing tests for the /chat-messages API that cover the use of parent_message_id, indicating that the functionality is considered in the testing phase [2][3].

To continue talking to Dosu, mention @dosu.

crazywoola commented 1 hour ago

https://github.com/langgenius/dify/issues/10121 Please don't open duplicate questions. If you continue doing this, we will ban you from this repo. Thanks for your cooperation.

glacierck commented 1 hour ago

@crazywoola Where do you see the same issue? Please take my question seriously and have reviewed your recovery before closing. https://github.com/langgenius/dify/issues/10121 Are you sure you're responding to the question I asked?

glacierck commented 1 hour ago

@dosu They have turned off 'parent_message_id' in the new version

glacierck commented 1 hour ago

10121 Please don't open duplicate questions. If you continue doing this, we will ban you from this repo. Thanks for your cooperation.

Your hasty and repetitive closures have annoyed me