Regenerate embedding from collection record page

This commit is contained in:
Claudio Ortolina
2026-02-04 16:17:21 +00:00
parent 610e153439
commit ebeeaeae71
4 changed files with 42 additions and 0 deletions
@@ -142,6 +142,25 @@ defmodule MusicLibraryWeb.CollectionLive.Show do
end
end
def handle_event("regenerate_embeddings", %{"id" => id}, socket) do
record = Records.get_record!(id)
case Similarity.generate_embedding_async(record) do
{:ok, _worker} ->
{:noreply,
socket
|> put_toast(:info, gettext("In progress - record will update automatically"))}
{:error, reason} ->
{:noreply,
socket
|> put_toast(
:error,
gettext("Error") <> "," <> inspect(reason)
)}
end
end
@impl true
def handle_info({MusicLibraryWeb.Components.RecordForm, {:saved, record}}, socket) do
{:noreply,