Add Collection Chat to universal search

This commit is contained in:
Claudio Ortolina
2026-04-13 10:15:43 +01:00
parent a509248625
commit 3b8415d8c4
3 changed files with 26 additions and 1 deletions
@@ -217,6 +217,12 @@ defmodule MusicLibraryWeb.CollectionLive.Index do
placeholder={gettext("Ask about your collection...")}
empty_prompt={gettext("Ask anything about your music collection")}
/>
<div
:if={@open_chat}
id="auto-open-chat"
phx-mounted={MusicLibraryWeb.Components.Chat.open("collection-chat-sheet")}
/>
</Layouts.app>
"""
end
@@ -228,6 +234,7 @@ defmodule MusicLibraryWeb.CollectionLive.Index do
|> assign(:current_section, :collection)
|> assign(:import_query, "")
|> assign(:display, :grid)
|> assign(:open_chat, false)
|> assign(:collection_summary, Collection.collection_summary())
|> assign(:chat_count, Chats.count_chats(:collection, Chats.collection_musicbrainz_id()))}
end
@@ -274,7 +281,9 @@ defmodule MusicLibraryWeb.CollectionLive.Index do
|> merge_order(order)
|> merge_pagination(params, total_records)
load_and_assign_records(socket, record_list_params)
socket
|> load_and_assign_records(record_list_params)
|> assign(:open_chat, params["chat"] == "open")
end
@impl true
@@ -362,6 +362,12 @@ defmodule MusicLibraryWeb.UniversalSearchLive.Index do
icon: "hero-circle-stack",
keywords: ["collection", "collected", "records"]
},
%{
label: "Collection Chat",
path: ~p"/collection?chat=open",
icon: "hero-chat-bubble-left-right",
keywords: ["chat", "collection", "ask", "ai"]
},
%{
label: "Wishlist",
path: ~p"/wishlist",