Chainlit / chainlit

Build Conversational AI in minutes ⚡️
https://docs.chainlit.io
Apache License 2.0
7.18k stars 943 forks source link

Chat Settings Button disappears when Resuming Chat #1391

Open hadarsharon opened 1 month ago

hadarsharon commented 1 month ago

Describe the bug When ChatSettings are defined in the application, they appear fine and usable upon a chat/thread instantiation, and are active and visible for the duration of the chat.

However when using Data Persistence (in my case I am using SQLAlchemyDataLayer), the chat settings button is not visible anymore once the chat is resumed (Resume Chat button).

This is a limitation that impairs the user experience when the thread is not the initial/active thread, and while it might be a feature rather than a bug, I think the settings should always be accessible.

FWIW, the settings are persisted from their last state (not sure if last state for that thread or last state in general), which might be even more confusing for certain use cases.

To Reproduce Steps to reproduce the behavior:

  1. Enable Data Persistence in your Chainlit application
  2. Define ChatSettings for your application to enable the settings button in the UI
  3. Create a new chat and send a message - note that the settings option should be available on the left side of the input bar
  4. Create another chat, send another message if you will - the settings option should just as well be available like before
  5. Go back to the chat from step 2 - now the chat settings button should not be visible, and you basically have no access to settings anymore in this chat.

Expected behavior The Chat Settings button should be visible and accessible in the input bar at all times.

Screenshots Fresh start without chat history (note settings button is visible to the left):

image

After sending a message in the same thread:

image

After moving to a new chat and returning to the same thread:

image

Clicking Resume Chat - then the chat settings button is no longer there:

image

¯_(ツ)_/¯

Desktop (please complete the following information):

dosubot[bot] commented 1 month ago

The issue you're experiencing with the Chat Settings button disappearing when resuming a chat using data persistence, such as with SQLAlchemyDataLayer, seems to be a known limitation. The Chat Settings button should ideally remain visible and accessible at all times, even when resuming a chat. However, it appears that the current implementation does not support this behavior, which can indeed impair the user experience.

The settings are persisted from their last state, which might add to the confusion if the button is not visible upon resuming a chat. This behavior might be due to how the UI state is managed when a chat is resumed, possibly not reinitializing the visibility of certain UI components like the Chat Settings button.

To address this, you might need to look into how the UI state is restored during the chat resumption process and ensure that the Chat Settings button is explicitly set to be visible. This could involve modifying the logic that handles UI state restoration to include the visibility of the Chat Settings button.

To continue talking to Dosu, mention @dosu.

LucasMagnum commented 2 weeks ago

+1 here