- <.flash_group flash={@flash} />
+
+
{@inner_content}
diff --git a/whisper_live/lib/whisper_live_web/components/layouts/root.html.heex b/whisper_live/lib/whisper_live_web/components/layouts/root.html.heex
index 1a98bae9..534c60fd 100644
--- a/whisper_live/lib/whisper_live_web/components/layouts/root.html.heex
+++ b/whisper_live/lib/whisper_live_web/components/layouts/root.html.heex
@@ -11,7 +11,7 @@
-
+
{@inner_content}
diff --git a/whisper_live/lib/whisper_live_web/live/recorder.ex b/whisper_live/lib/whisper_live_web/live/recorder.ex
index 86c84129..f7307f98 100644
--- a/whisper_live/lib/whisper_live_web/live/recorder.ex
+++ b/whisper_live/lib/whisper_live_web/live/recorder.ex
@@ -1,160 +1,201 @@
defmodule WhisperLiveWeb.Live.Recorder do
- use WhisperLiveWeb, :live_view
- alias Phoenix.PubSub
+ use WhisperLiveWeb, :live_view
+ alias Phoenix.PubSub
- def mount(_, _, socket) do
- if connected?(socket), do: PubSub.subscribe(WhisperLive.PubSub, "transcription:#{socket_id(socket)}")
- {:ok, assign(socket, transcription: "")}
- end
+ def mount(_, _, socket) do
+ PubSub.subscribe(WhisperLive.PubSub, "transcription")
- def handle_info({:transcription, raw_json}, socket) do
- new_text =
- raw_json
- |> Jason.decode!()
- |> get_in(["chunks", Access.at(0), "text"])
+ socket =
+ socket
+ |> assign(:transcription, "")
+ |> assign(:transcription_m, "")
- {:noreply, update(socket, :transcription, &(&1 <> " " <> new_text))}
- end
+ {:ok, socket}
+ end
- def handle_event("start_recording", _params, socket) do
- push_event(socket, "start-recording", %{})
- {:noreply, socket}
- end
+ def handle_info({:transcription, raw_json}, socket) do
+ IO.inspect(raw_json, label: "en vivo ---------------->\n")
- def handle_event("stop_recording", _params, socket) do
- push_event(socket, "stop-recording", %{})
- {:noreply, socket}
- end
+ new_text =
+ raw_json
+ |> Jason.decode!()
+ |> get_in(["chunks", Access.at(0), "text"])
- defp socket_id(socket), do: socket.transport_pid |> :erlang.pid_to_list() |> List.to_string()
+ old_text = socket.assigns.transcription
- def render(assigns) do
- ~H"""
-
-
-
+ # Sacar lo ya incluido al inicio
+ added_part = String.replace_prefix(new_text, old_text, "")
-
-
<%= @transcription %>
-
-
+ {:noreply, update(socket, :transcription, &(&1 <> added_part))}
+ end
-
-
- """
- end
+ startButton.onclick = startRecording
+ stopButton.onclick = stopRecording
+
+
+ """
+ end
end
diff --git a/whisper_live/recordings/recording_1752601669350.wav b/whisper_live/recordings/recording_1752601669350.wav
deleted file mode 100644
index 0fa4041e..00000000
Binary files a/whisper_live/recordings/recording_1752601669350.wav and /dev/null differ
diff --git a/whisper_live/recordings/recording_1752602147301.wav b/whisper_live/recordings/recording_1752602147301.wav
deleted file mode 100644
index 581f28c0..00000000
Binary files a/whisper_live/recordings/recording_1752602147301.wav and /dev/null differ
diff --git a/whisper_live/recordings/recording_1752605184367.wav b/whisper_live/recordings/recording_1752605184367.wav
deleted file mode 100644
index 4f0c900f..00000000
Binary files a/whisper_live/recordings/recording_1752605184367.wav and /dev/null differ
diff --git a/whisper_live/recordings/recording_1752605420377.wav b/whisper_live/recordings/recording_1752605420377.wav
deleted file mode 100644
index 9c083894..00000000
Binary files a/whisper_live/recordings/recording_1752605420377.wav and /dev/null differ
diff --git a/whisper_live/recordings/recording_1752678344186.wav b/whisper_live/recordings/recording_1752678344186.wav
new file mode 100644
index 00000000..7b3dd449
Binary files /dev/null and b/whisper_live/recordings/recording_1752678344186.wav differ