Open wjsoj opened 2 days ago
๐ @wjsoj
Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible. Please make sure you have given us as much context as possible.\ ้ๅธธๆ่ฐขๆจๆไบค issueใๆไปฌไผๅฐฝๅฟซ่ฐๆฅๆญคไบ๏ผๅนถๅฐฝๅฟซๅๅคๆจใ ่ฏท็กฎไฟๆจๅทฒ็ปๆไพไบๅฐฝๅฏ่ฝๅค็่ๆฏไฟกๆฏใ
Hey @wjsoj! I'm here to help you with any bugs, questions, or contributions. Let's work together to solve this issue.
The issue you're experiencing with the EditableMessage
component in the Assistant chat interface seems to be related to how the defaultValue
is handled in the MessageInput
component. The current implementation retains the previous value, which causes the input box to not reflect the updated content after a second edit.
Here are a couple of potential solutions:
Modify the EditableMessage
Component:
key
prop to the EditableMessage
component in the SystemRoleContent.tsx
file. This would force a re-render of the component whenever the key changes, ensuring that the input box displays the updated content. However, this approach might cause the modal to flicker, which could affect the user experience.Update the MessageInput
Component:
MessageInput
component in the lobe-ui
library to listen for changes to the defaultValue
prop. This would involve updating the state whenever defaultValue
changes, ensuring that the input box reflects the latest content. While this solution might add complexity to the UI component, it would provide a more seamless user experience.Both solutions have their trade-offs, and the best approach depends on the desired user experience and the complexity you're willing to introduce into the codebase. If you're comfortable with the potential flicker, the first solution might be simpler to implement. Otherwise, updating the MessageInput
component to handle defaultValue
changes could provide a more robust solution.
To continue talking to Dosu, mention @dosu.
I submitted a similar issue at #4686
Bot detected the issue body's language is not English, translate it automatically. ๐ฏ๐ญ๐ป๐งโ๐คโ๐ง๐ซ๐ง๐ฟโ๐คโ๐ง๐ป๐ฉ๐พโ๐คโ๐จ๐ฟ๐ฌ๐ฟ
I submitted a similar issue at #4686
I submitted a similar issue at #4686
I am unable to reproduce your issue in the local development environment. Your reported issue seems to be related to the logic of the tRPC interface and I don't understand why.
๐ฆ Environment
Docker
๐ Version
1.31.5
๐ป Operating System
Other Linux
๐ Browser
Chrome, Firefox
๐ Bug Description
In the Assistant chat interface, there is an issue where editing the Role Setting a second time results in incorrect content being displayed in the input box.
๐ท Recurrence Steps
๐ฆ Expected Behavior
I expected the input box to show the updated content after editing the Role Setting a second time.This will be helpful for people who want to Modify the Role Setting again after click OK.
๐ Additional Information
I have noticed that the issue is caused by the implementation in the lobe-ui component. The
EditableMessage
component internally specifiesdefaultValue
to create aMessageInput
component, but in theMessageInput
component,defaultValue
is handled as follows:This implementation retains the previous value in the input box, making it inconvenient for users to edit again.
Possible Solutions:
EditableMessage
component in/src/app/(main)/chat/(workspace)/@topic/features/SystemRole/SystemRoleContent.tsx
to trigger a re-render (this would cause the Modal to flicker).defaultValue
in theMessageInput
component, but this could make the UI component library unnecessarily complex.I hope a better solution can be found, and I would be happy to submit a PR.