diff --git a/lib/music_library_web/components/chat.ex b/lib/music_library_web/components/chat.ex index 0d77bfe0..e662d90c 100644 --- a/lib/music_library_web/components/chat.ex +++ b/lib/music_library_web/components/chat.ex @@ -245,9 +245,19 @@ defmodule MusicLibraryWeb.Components.Chat do ]} >

{message.content}

-
+
{raw(Markdown.to_html(message.content, link_target: "_blank"))}
+
+ <.copy_to_clipboard + target_id={"chat-msg-#{message.id}"} + label={gettext("Copy message")} + /> +
id}, socket) do chat = Chats.get_chat!(id) - messages = Enum.map(chat.messages, &%{role: &1.role, content: &1.content}) {:noreply, socket |> assign(:chat, chat) - |> assign(:messages, messages) + |> assign(:messages, chat.messages) |> assign(:current_response, "") |> assign(:streaming_doc, nil) |> assign(:error, nil) diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot index 88b5a4f6..39cdd6e3 100644 --- a/priv/gettext/default.pot +++ b/priv/gettext/default.pot @@ -2402,3 +2402,8 @@ msgid "Importing %{count} record in the background..." msgid_plural "Importing %{count} records in the background..." msgstr[0] "" msgstr[1] "" + +#: lib/music_library_web/components/chat.ex +#, elixir-autogen, elixir-format +msgid "Copy message" +msgstr "" diff --git a/priv/gettext/en/LC_MESSAGES/default.po b/priv/gettext/en/LC_MESSAGES/default.po index 8756ef95..f1a8fe7e 100644 --- a/priv/gettext/en/LC_MESSAGES/default.po +++ b/priv/gettext/en/LC_MESSAGES/default.po @@ -2402,3 +2402,8 @@ msgid "Importing %{count} record in the background..." msgid_plural "Importing %{count} records in the background..." msgstr[0] "" msgstr[1] "" + +#: lib/music_library_web/components/chat.ex +#, elixir-autogen, elixir-format +msgid "Copy message" +msgstr ""