Iteration 2: Multi-threaded conversations - List & CRUD (GitLab Web Page)
### Release Post: Manage multiple conversations in GitLab Duo Chat
Maintaining context across different topics in GitLab Duo Chat is now easier with multiple conversations. You can create new conversations, browse your conversation history, and switch between conversations.
Previously, starting a new conversation meant losing the context of your existing chat. Now, you can manage multiple conversations on different topics. Each conversation maintains its own context, so for example, you can ask follow-up questions about code explanations in one conversation, whilst preparing a work-plan in another conversation.
When you need to revisit previous discussions, select the new chat history icon to see all your recent conversations. Conversations are automatically organized by most recent activity, making it easy to pick up where you left off.
For your privacy, conversations with no activity for 30 days are automatically deleted, and you can manually delete any conversation at any time.
This feature is currently available only on GitLab.com in the web UI. It is not available in GitLab Self-Managed instances, or in IDE integrations.
* Demo: https://www.youtube-nocookie.com/embed/h9ooN05cNbw
* Documentation link: https://docs.gitlab.com/user/gitlab_duo_chat/#have-multiple-conversations-with-chat
* Feedback: please create an issue in https://gitlab.com/gitlab-org/gitlab/-/issues or comment on this feedback issue: https://gitlab.com/gitlab-org/gitlab/-/issues/522957
### Proposal
This feature will be guarded by the `duo_chat_multi_thread` feature flag.
- :point_up_2: :white_check_mark: UNCHANGED: all requirements checked green in iteration 1 will remain unchanged
* This iteration 2 does not effect the quick chat but only the standard chat
* The Duo Chat window will display the duo_chat thread which was most recently updated.
- :raising_hand: :white_check_mark: List and CRUD (create, read, update, delete) in **GitLab web page**
* :raising_hand: :white_check_mark: : There is a UI that lists all stored conversations;
* :raising_hand: :white_check_mark: : User can select one of those conversations to switch to it, to review the conversation or to continue the conversation
* :raising_hand: :white_check_mark: : User can create new conversations via the UI
* § / :raising_hand: :white_check_mark: : User can delete conversations via the UI
* :raising_hand: :white_check_mark: The list in the UI shows a note that threads are deleted 30 days after they have been last interacted with.
- § / :dollar: :white_check_mark: When a user's permission or role in any project or group changes, all their chat conversations are deleted, to address [regulated buyers' need 1](https://gitlab.com/groups/gitlab-org/-/epics/15551#dollar-buyer-needs). (Even when they move to a higher role the conversations are purged as there are some edge cases where one has more rights in a lower role as we want our implementation to be simple and independent of changes in the role permissions.) ([See decision](https://gitlab.com/groups/gitlab-org/-/epics/16108#note_2250450819))
* § / :dollar: this behavior needs to be documented
{width="324" height="318"}
##### WHAT NOT TO EXPECT from iteration 2:
The following is a list of requirements that will not need to be met in this second iteration. This list provides transparency for stakeholders what not to expect from this second iteration. These are may be done in later iterations:
- :raising_hand: :x: no editing of individual conversations
- § :x: conversations will not be deleted when the account is deleted (deletion will happen after 30 days anyway);
- § :x: users will not be enabled to delete all conversations other than by deleting each individual conversations (within 30 days they will not accumulate too many conversations anyway so a one by one deletion is acceptable);
- § :x: retention is not controllable by admins (as it is fixed to 30 days anyway)
- :gear: :x: Context is not stored in form of references to the context
- § :x: When a Quick Chat is closed its conversation is not deleted but it is not reachable anymore. The conversation is deleted after 30 days.
- :raising_hand: :x: the title of a conversation shown in the conversation list will not be generated by an LLM but by will simply be a truncated version of the first question.
#### Details about the UI in Iteration 2
* More Details can be found in the :point_right: [Figma File](https://www.figma.com/design/Q9vfBQ65zPFEYERyKLKTsA/Multi-threaded-chat?node-id=768-2651&t=pQ3wwxtng3IXvRTr-1) :sparkles:
<table>
<tr>
<th>Design - Duo Chat</th>
<th>Design - History with Hover Examples</th>
<th>Design Delete Functionality</th>
<th>Loading State</th>
</tr>
<tr>
<td>
{width="93" height="232"}
</td>
<td>
{width=827 height=684}
</td>
<td>
{width="89" height="225"}
</td>
<td>
{width="1269" height="3191"}
</td>
</tr>
<tr>
<td>
**Changes:** Two new icons are added to the top of the Chat. One for History (https://gitlab.com/gitlab-org/gitlab-svgs/blob/main/sprite_icons/history.svg) and one for New Chat (New Icon).
**New Chat** - Clears chat and opens a new chat.
**History** - Opens chat history.
</td>
<td>
**Changes:** A new submenu is created that shows a list of previous chats, as well as the ability to delete them when hovered. We also provide a warning that Chats with no activity will be deleted within 30 days.
**To navigate back**: Users must click on the chat history icon again.
**Order:** The list would be ordered by when the last message was sent in the thread rather than when the thread was started.
</td>
<td>
~~**Changes:** When a chat is deleted, we show a toast that allows users to undo the deletion if it was on accident.~~
Update: undo feature is moved to a later iteration.
</td>
<td>
**Changes:** Loading state is added to the page.
</td>
</tr>
</table>
### Managing Synchronization Between Single-threaded and Multi-threaded Interfaces
The multi-threaded Duo-Chat interface will be kept isolated from syncing with other single-threaded systems for a start
There will be no syncing between single-threaded interfaces (IDEs) and the multi-threaded web for now
In Iteration 3 we will roll out the multi-threaded interface to IDEs and with that re-enable the syncing between multi-threaded interfaces
Tracked in: https://gitlab.com/gitlab-org/gitlab/-/issues/517666
epic