From 216fc46410302c0b4c35f02a693850dda6eb36df Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Mon, 26 May 2025 07:25:01 -0500 Subject: [PATCH] frontend changes for speech events --- .../overlay/detail/SearchDetailDialog.tsx | 39 +++++++++++++++++++ web/src/pages/Explore.tsx | 8 ++-- web/src/views/explore/ExploreView.tsx | 10 ++--- 3 files changed, 47 insertions(+), 10 deletions(-) diff --git a/web/src/components/overlay/detail/SearchDetailDialog.tsx b/web/src/components/overlay/detail/SearchDetailDialog.tsx index 28ef5c45b..02957a8de 100644 --- a/web/src/components/overlay/detail/SearchDetailDialog.tsx +++ b/web/src/components/overlay/detail/SearchDetailDialog.tsx @@ -77,6 +77,7 @@ import { Trans, useTranslation } from "react-i18next"; import { TbFaceId } from "react-icons/tb"; import { useIsAdmin } from "@/hooks/use-is-admin"; import FaceSelectionDialog from "../FaceSelectionDialog"; +import { CgTranscript } from "react-icons/cg"; const SEARCH_TABS = [ "details", @@ -709,6 +710,34 @@ function ObjectDetailsTab({ [search, t], ); + // speech transcription + + const onTranscribe = useCallback(() => { + axios + .put(`/audio/transcribe`, { event_id: search.id }) + .then((resp) => { + if (resp.status == 202) { + toast.success(t("details.item.toast.success.audioTranscription"), { + position: "top-center", + }); + } + }) + .catch((error) => { + const errorMessage = + error.response?.data?.message || + error.response?.data?.detail || + "Unknown error"; + toast.error( + t("details.item.toast.error.audioTranscription", { + errorMessage, + }), + { + position: "top-center", + }, + ); + }); + }, [search, t]); + return (