dify icon indicating copy to clipboard operation
dify copied to clipboard

Ensure the 'inputs' field in /chat-messages takes effect every time

Open Wu-Jiayang opened this issue 1 year ago • 33 comments

Checklist:

[!IMPORTANT]
Please review the checklist below before submitting your pull request.

  • [x] Please open an issue before creating a PR or link to an existing issue
  • [x] I have performed a self-review of my own code
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods

Description

Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue. Close issue syntax: Fixes #<issue number>, see documentation for more details.

Close #7952 Close https://github.com/langgenius/dify/issues/7846 Close https://github.com/langgenius/dify/issues/8063 Close https://github.com/langgenius/dify/issues/8839 Close https://github.com/langgenius/dify/issues/8546 Close https://github.com/langgenius/dify/issues/10522 Close https://github.com/langgenius/dify/issues/10055 Close https://github.com/langgenius/dify/pull/10643

Type of Change

  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] This change requires a documentation update, included: Dify Document
  • [ ] Improvement, including but not limited to code refactoring, performance optimization, and UI/UX improvement
  • [ ] Dependency upgrade

Testing Instructions

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • [ ] Test A
  • [ ] Test B

Wu-Jiayang avatar Sep 04 '24 04:09 Wu-Jiayang

This PR does not resolve, using the conversation id to link to previous sessions but the input works

cubxxw avatar Sep 09 '24 06:09 cubxxw

This PR does not resolve, using the conversation id to link to previous sessions but the input works

I don't understand "using the conversation id to link to previous sessions but the input works". As for "This PR does not resolve", I have tried and I think it works.

Wu-Jiayang avatar Sep 09 '24 08:09 Wu-Jiayang

This PR does not resolve, using the conversation id to link to previous sessions but the input works

This PR is to make sure the 'inputs' field in the API "/chat-messages" takes effect every time, is that what you mean "using the conversation id to link to previous sessions but the input works"?

Wu-Jiayang avatar Sep 09 '24 08:09 Wu-Jiayang

Yes, you mean that the input field of the conversation can be updated under the same conversation, because the input is only effective when the conversation link is first established

cubxxw avatar Sep 10 '24 05:09 cubxxw

Yes, you mean that the input field of the conversation can be updated under the same conversation, because the input is only effective when the conversation link is first established

@cubxxw

I noticed that both table 'messages' and table 'conversations' have an 'inputs' field. I think the 'inputs' field should be aligned with table 'messages'. The 'inputs' field in table 'conversations' may not be very useful.

In this PR, the 'inputs' field in table 'conversations' means the 'inputs' in the first message, and the 'inputs' field in table 'messages' means the true inputs in this message.

Wu-Jiayang avatar Sep 10 '24 05:09 Wu-Jiayang

This PR does not resolve, using the conversation id to link to previous sessions but the input works

What's the mean of 'This PR does not resolve'? Is that any problems?

Wu-Jiayang avatar Sep 10 '24 05:09 Wu-Jiayang

https://github.com/langgenius/dify/issues/8063

This is the problem I encountered,

maybe I understand wrong, this PR can't solve the problem of the video in issue?

cubxxw avatar Sep 10 '24 06:09 cubxxw

I understand that the conversation table input is valid for the first time. The message table is used for every subsequent interaction, right?

cubxxw avatar Sep 10 '24 06:09 cubxxw

#8063

This is the problem I encountered,

maybe I understand wrong, this PR can't solve the problem of the video in issue?

This PR can solve the problem of the video in issue. @cubxxw

https://github.com/user-attachments/assets/78f2b50a-1688-436f-b8dd-eb6153a5bb51

Wu-Jiayang avatar Sep 10 '24 08:09 Wu-Jiayang

I understand that the conversation table input is valid for the first time. The message table is used for every subsequent interaction, right?

right

Wu-Jiayang avatar Oct 17 '24 08:10 Wu-Jiayang

I think it's great, too

Hope to support this feature

cubxxw avatar Oct 17 '24 14:10 cubxxw

Has this feature not been merged?

liuzixiao666 avatar Nov 11 '24 03:11 liuzixiao666

Has this feature not been merged?

I don't know why they don't merge it, maybe we need more people to push them.

Wu-Jiayang avatar Nov 11 '24 03:11 Wu-Jiayang

Author

I highly appreciate your functionality and have submitted a new issue. If they do not merge, I will download your branch https://github.com/langgenius/dify/issues/10522 #10522

liuzixiao666 avatar Nov 11 '24 03:11 liuzixiao666

I have already talked to our team about this pr. :) We will evaluate this later.

crazywoola avatar Nov 13 '24 09:11 crazywoola

I have opened a discussion here, please forward this to other community groups, we would like to gather some information regarding this feature.

https://github.com/langgenius/dify/discussions/10652

crazywoola avatar Nov 13 '24 10:11 crazywoola

Hope to merge

cubxxw avatar Nov 13 '24 16:11 cubxxw

I tried to merge your code in my project, but it didn't take effect. I modified the three lines of code in those three files and changed them to inputs=self_ Prepare_user_inputs (user_inputs=inputs, app_ config=app_ config), right?

liuzixiao666 avatar Nov 14 '24 13:11 liuzixiao666

I tried to merge your code in my project, but it didn't take effect. I modified the three lines of code in those three files and changed them to inputs=self_ Prepare_user_inputs (user_inputs=inputs, app_ config=app_ config), right?

right

Wu-Jiayang avatar Nov 14 '24 14:11 Wu-Jiayang

I tried to merge your code in my project, but it didn't take effect. I modified the three lines of code in those three files and changed them to inputs=self_ Prepare_user_inputs (user_inputs=inputs, app_ config=app_ config), right?

right

It seems to have failed? My DIY version is 0.11.0

liuzixiao666 avatar Nov 14 '24 14:11 liuzixiao666

https://github.com/user-attachments/assets/12839e0c-9c66-443c-8737-fba1158b631e

liuzixiao666 avatar Nov 14 '24 14:11 liuzixiao666

I tried to merge your code in my project, but it didn't take effect. I modified the three lines of code in those three files and changed them to inputs=self_ Prepare_user_inputs (user_inputs=inputs, app_ config=app_ config), right?

right

It seems to have failed? My DIY version is 0.11.0

It works well in 0.8.0. I will try 0.11.0 if I have time

Wu-Jiayang avatar Nov 14 '24 15:11 Wu-Jiayang

It seems to have failed? My DIY version is 0.11.0

@liuzixiao666 I merged the 'langgenius:main' branch into my branch and tested it on v0.11.1. It works well.

https://github.com/user-attachments/assets/6ea79025-14e8-420e-aec6-27b1a1aac9bf

Wu-Jiayang avatar Nov 15 '24 09:11 Wu-Jiayang

It seems to have failed? My DIY version is 0.11.0似乎失败了?我的DIY版本是0.11.0

@liuzixiao666 I merged the 'langgenius:main' branch into my branch and tested it on v0.11.1. It works well.我将"langgenius:main“分支合并到我的分支中,并在v0.11.1上进行了测试。很好用。

2024-11-15.17-36-33.mp4

i will have a try again

liuzixiao666 avatar Nov 15 '24 13:11 liuzixiao666

It seems to have failed? My DIY version is 0.11.0

@liuzixiao666 I merged the 'langgenius:main' branch into my branch and tested it on v0.11.1. It works well.

2024-11-15.17-36-33.mp4

Mine still hasn't taken effect. Is it because I started Docker? Are you starting from local source code

liuzixiao666 avatar Nov 16 '24 04:11 liuzixiao666

It seems to have failed? My DIY version is 0.11.0

@liuzixiao666 I merged the 'langgenius:main' branch into my branch and tested it on v0.11.1. It works well. 2024-11-15.17-36-33.mp4

Mine still hasn't taken effect. Is it because I started Docker? Are you starting from local source code

I built Docker from local source code and run docker run -d -e MODE=api --restart=unless-stopped --name "dify-api" --network host --env-file .env dify-api

Wu-Jiayang avatar Nov 16 '24 05:11 Wu-Jiayang

It seems to have failed? My DIY version is 0.11.0

@liuzixiao666 I merged the 'langgenius:main' branch into my branch and tested it on v0.11.1. It works well. 2024-11-15.17-36-33.mp4

Mine still hasn't taken effect. Is it because I started Docker? Are you starting from local source code

I built Docker from local source code and run docker run -d -e MODE=api --restart=unless-stopped --name "dify-api" --network host --env-file .env dify-api

I can't quite understand your code, it seems like you have rebuilt a new Docker container. Does that mean that stopping the container and using 'docker compose up - d' will not work when I run it in the Docker directory? Do you know how to make the modified code take effect

liuzixiao666 avatar Nov 16 '24 05:11 liuzixiao666

@liuzixiao666 I have read the default docker-compose.yaml and It seems not from local source code: image

If you want to use docker, you need to make sure the docker you use is built locally, or waiting for merging this PR. ^_^

Wu-Jiayang avatar Nov 16 '24 06:11 Wu-Jiayang

What a great PR! This will solve a lot of problems! Looking forward to merging

TheFu527 avatar Nov 21 '24 12:11 TheFu527

What a great PR! This will solve a lot of problems! Looking forward to merging

Remember to give a like here #10652

liuzixiao666 avatar Nov 21 '24 13:11 liuzixiao666