From ebbf47b8956b341221c1b7e72f3033f8bd6ae260 Mon Sep 17 00:00:00 2001 From: Koper Date: Wed, 16 Aug 2023 17:55:47 +0700 Subject: [PATCH 1/5] Migrate to typescript --- www/app/{layout.js => layout.tsx} | 8 +- .../CustomRecordPlugin.js | 0 www/app/lib/{random.js => random.tsx} | 6 +- www/app/lib/{time.js => time.tsx} | 2 +- www/app/{page.js => page.tsx} | 2 +- .../{dashboard.js => dashboard.tsx} | 73 ++++----- www/app/transcripts/disconnectedIndicator.tsx | 13 ++ www/app/transcripts/finalSummary.tsx | 12 ++ www/app/transcripts/liveTranscription.tsx | 11 ++ www/app/transcripts/new/{page.js => page.tsx} | 5 +- www/app/transcripts/recorder.js | 2 +- www/app/transcripts/scrollToBottom.tsx | 23 +++ .../{useTranscript.js => useTranscript.tsx} | 20 ++- .../{useWebRTC.js => useWebRTC.tsx} | 30 ++-- .../{useWebSockets.js => useWebSockets.tsx} | 24 ++- www/app/transcripts/webSocketTypes.tsx | 19 +++ www/next.config.js | 2 +- www/package.json | 2 +- www/pages/api/sentry-example-api.js | 5 + www/pages/sentry-example-page.js | 87 +++++++++++ ...ient.config.js => sentry.client.config.ts} | 0 ...y.edge.config.js => sentry.edge.config.ts} | 0 ...rver.config.js => sentry.server.config.ts} | 0 www/yarn.lock | 138 +++++++++--------- 24 files changed, 329 insertions(+), 155 deletions(-) rename www/app/{layout.js => layout.tsx} (94%) rename www/app/{transcripts => lib}/CustomRecordPlugin.js (100%) rename www/app/lib/{random.js => random.tsx} (68%) rename www/app/lib/{time.js => time.tsx} (83%) rename www/app/{page.js => page.tsx} (60%) rename www/app/transcripts/{dashboard.js => dashboard.tsx} (59%) create mode 100644 www/app/transcripts/disconnectedIndicator.tsx create mode 100644 www/app/transcripts/finalSummary.tsx create mode 100644 www/app/transcripts/liveTranscription.tsx rename www/app/transcripts/new/{page.js => page.tsx} (91%) create mode 100644 www/app/transcripts/scrollToBottom.tsx rename www/app/transcripts/{useTranscript.js => useTranscript.tsx} (66%) rename www/app/transcripts/{useWebRTC.js => useWebRTC.tsx} (63%) rename www/app/transcripts/{useWebSockets.js => useWebSockets.tsx} (68%) create mode 100644 www/app/transcripts/webSocketTypes.tsx create mode 100644 www/pages/api/sentry-example-api.js create mode 100644 www/pages/sentry-example-page.js rename www/{sentry.client.config.js => sentry.client.config.ts} (100%) rename www/{sentry.edge.config.js => sentry.edge.config.ts} (100%) rename www/{sentry.server.config.js => sentry.server.config.ts} (100%) diff --git a/www/app/layout.js b/www/app/layout.tsx similarity index 94% rename from www/app/layout.js rename to www/app/layout.tsx index 824a8e16..99733717 100644 --- a/www/app/layout.js +++ b/www/app/layout.tsx @@ -1,11 +1,10 @@ import "./styles/globals.scss"; import { Roboto } from "next/font/google"; - -import Head from "next/head"; +import { Metadata } from "next"; const roboto = Roboto({ subsets: ["latin"], weight: "400" }); -export const metadata = { +export const metadata: Metadata = { title: { template: "%s – Reflector", default: "Reflector - AI-Powered Meeting Transcriptions by Monadical", @@ -52,9 +51,6 @@ export const metadata = { export default function RootLayout({ children }) { return ( - - Test - {children} diff --git a/www/app/transcripts/CustomRecordPlugin.js b/www/app/lib/CustomRecordPlugin.js similarity index 100% rename from www/app/transcripts/CustomRecordPlugin.js rename to www/app/lib/CustomRecordPlugin.js diff --git a/www/app/lib/random.js b/www/app/lib/random.tsx similarity index 68% rename from www/app/lib/random.js rename to www/app/lib/random.tsx index 37c4dee7..eebe0212 100644 --- a/www/app/lib/random.js +++ b/www/app/lib/random.tsx @@ -1,15 +1,15 @@ -export function getRandomNumber(min, max) { +export function getRandomNumber(min: number, max: number): number { return Math.floor(Math.random() * (max - min + 1)) + min; } -export function SeededRand(seed) { +export function SeededRand(seed: number): number { seed ^= seed << 13; seed ^= seed >> 17; seed ^= seed << 5; return seed / 2 ** 32; } -export function Mulberry32(seed) { +export function Mulberry32(seed: number) { return function () { var t = (seed += 0x6d2b79f5); t = Math.imul(t ^ (t >>> 15), t | 1); diff --git a/www/app/lib/time.js b/www/app/lib/time.tsx similarity index 83% rename from www/app/lib/time.js rename to www/app/lib/time.tsx index a6204ade..6d8a4e76 100644 --- a/www/app/lib/time.js +++ b/www/app/lib/time.tsx @@ -1,4 +1,4 @@ -export const formatTime = (seconds) => { +export const formatTime = (seconds: number): string => { let hours = Math.floor(seconds / 3600); let minutes = Math.floor((seconds % 3600) / 60); let secs = Math.floor(seconds % 60); diff --git a/www/app/page.js b/www/app/page.tsx similarity index 60% rename from www/app/page.js rename to www/app/page.tsx index d2835cf1..aff9fc3a 100644 --- a/www/app/page.js +++ b/www/app/page.tsx @@ -1,4 +1,4 @@ import { redirect } from "next/navigation"; -export default async function Index({ params }) { +export default async function Index() { redirect("/transcripts/new"); } diff --git a/www/app/transcripts/dashboard.js b/www/app/transcripts/dashboard.tsx similarity index 59% rename from www/app/transcripts/dashboard.js rename to www/app/transcripts/dashboard.tsx index 94bae58c..b426c670 100644 --- a/www/app/transcripts/dashboard.js +++ b/www/app/transcripts/dashboard.tsx @@ -3,17 +3,29 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faChevronRight, faChevronDown, - faLinkSlash, } from "@fortawesome/free-solid-svg-icons"; +import { formatTime } from "../lib/time"; +import ScrollToBottom from "./scrollToBottom"; +import FinalSummary from "./finalSummary"; +import DisconnectedIndicator from "./disconnectedIndicator"; +import LiveTrancription from "./liveTranscription"; +import { TopicType, FinalSummaryType } from "./webSocketTypes"; + +type DashboardProps = { + transcriptionText: string; + finalSummary: FinalSummaryType; + topics: TopicType[]; + disconnected: boolean; +}; export function Dashboard({ transcriptionText, finalSummary, topics, disconnected, -}) { - const [openIndex, setOpenIndex] = useState(null); - const [autoscrollEnabled, setAutoscrollEnabled] = useState(true); +}: DashboardProps) { + const [openIndex, setOpenIndex] = useState(null); + const [autoscrollEnabled, setAutoscrollEnabled] = useState(true); useEffect(() => { if (autoscrollEnabled) scrollToBottom(); @@ -21,7 +33,10 @@ export function Dashboard({ const scrollToBottom = () => { const topicsDiv = document.getElementById("topics-div"); - topicsDiv.scrollTop = topicsDiv.scrollHeight; + + if (!topicsDiv) + console.error("Could not find topics div to scroll to bottom"); + else topicsDiv.scrollTop = topicsDiv.scrollHeight; }; const handleScroll = (e) => { @@ -34,18 +49,6 @@ export function Dashboard({ } }; - const formatTime = (seconds) => { - let hours = Math.floor(seconds / 3600); - let minutes = Math.floor((seconds % 3600) / 60); - let secs = Math.floor(seconds % 60); - - let timeString = `${hours > 0 ? hours + ":" : ""}${minutes - .toString() - .padStart(2, "0")}:${secs.toString().padStart(2, "0")}`; - - return timeString; - }; - return ( <>
@@ -57,16 +60,12 @@ export function Dashboard({
Topic
-
- ⬇ -
+ +
- {finalSummary && ( -
-

Final Summary

-

{finalSummary.summary}

-
- )} + {finalSummary && }
- {disconnected && ( -
-
- - Disconnected -
-
- )} + {disconnected && } -
-  {transcriptionText}  -
+ ); } diff --git a/www/app/transcripts/disconnectedIndicator.tsx b/www/app/transcripts/disconnectedIndicator.tsx new file mode 100644 index 00000000..275a54f5 --- /dev/null +++ b/www/app/transcripts/disconnectedIndicator.tsx @@ -0,0 +1,13 @@ +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { faLinkSlash } from "@fortawesome/free-solid-svg-icons"; + +export default function DisconnectedIndicator() { + return ( +
+
+ + Disconnected +
+
+ ); +} diff --git a/www/app/transcripts/finalSummary.tsx b/www/app/transcripts/finalSummary.tsx new file mode 100644 index 00000000..4036b2ba --- /dev/null +++ b/www/app/transcripts/finalSummary.tsx @@ -0,0 +1,12 @@ +type FinalSummaryProps = { + text: string; +}; + +export default function FinalSummary(props: FinalSummaryProps) { + return ( +
+

Final Summary

+

{props.text}

+
+ ); +} diff --git a/www/app/transcripts/liveTranscription.tsx b/www/app/transcripts/liveTranscription.tsx new file mode 100644 index 00000000..6241cdb2 --- /dev/null +++ b/www/app/transcripts/liveTranscription.tsx @@ -0,0 +1,11 @@ +type LiveTranscriptionProps = { + text: string; +}; + +export default function LiveTrancription(props: LiveTranscriptionProps) { + return ( +
+  {props.text}  +
+ ); +} diff --git a/www/app/transcripts/new/page.js b/www/app/transcripts/new/page.tsx similarity index 91% rename from www/app/transcripts/new/page.js rename to www/app/transcripts/new/page.tsx index 60f4642b..80bbe9fe 100644 --- a/www/app/transcripts/new/page.js +++ b/www/app/transcripts/new/page.tsx @@ -8,8 +8,8 @@ import { useWebSockets } from "../useWebSockets"; import "../../styles/button.css"; const App = () => { - const [stream, setStream] = useState(null); - const [disconnected, setDisconnected] = useState(false); + const [stream, setStream] = useState(null); + const [disconnected, setDisconnected] = useState(false); useEffect(() => { if (process.env.NEXT_PUBLIC_ENV === "development") { @@ -46,7 +46,6 @@ const App = () => { transcriptionText={webSockets.transcriptText} finalSummary={webSockets.finalSummary} topics={webSockets.topics} - stream={stream} disconnected={disconnected} /> diff --git a/www/app/transcripts/recorder.js b/www/app/transcripts/recorder.js index 41284236..5eb06c82 100644 --- a/www/app/transcripts/recorder.js +++ b/www/app/transcripts/recorder.js @@ -8,7 +8,7 @@ import { faDownload } from "@fortawesome/free-solid-svg-icons"; import Dropdown from "react-dropdown"; import "react-dropdown/style.css"; -import CustomRecordPlugin from "./CustomRecordPlugin"; +import CustomRecordPlugin from "../lib/CustomRecordPlugin"; import { formatTime } from "../lib/time"; const AudioInputsDropdown = (props) => { diff --git a/www/app/transcripts/scrollToBottom.tsx b/www/app/transcripts/scrollToBottom.tsx new file mode 100644 index 00000000..9c267a66 --- /dev/null +++ b/www/app/transcripts/scrollToBottom.tsx @@ -0,0 +1,23 @@ +type ScrollToBottomProps = { + visible: boolean; + hasFinalSummary: boolean; + handleScrollBottom: () => void; +}; + +export default function ScrollToBottom(props: ScrollToBottomProps) { + return ( +
{ + props.handleScrollBottom(); + return false; + }} + > + ⬇ +
+ ); +} diff --git a/www/app/transcripts/useTranscript.js b/www/app/transcripts/useTranscript.tsx similarity index 66% rename from www/app/transcripts/useTranscript.js rename to www/app/transcripts/useTranscript.tsx index e846d626..ddb77bed 100644 --- a/www/app/transcripts/useTranscript.js +++ b/www/app/transcripts/useTranscript.tsx @@ -1,11 +1,19 @@ import { useEffect, useState } from "react"; -import { DefaultApi } from "../api/apis/DefaultApi"; +import { DefaultApi, V1TranscriptsCreateRequest } from "../api/apis/DefaultApi"; import { Configuration } from "../api/runtime"; +import { GetTranscript } from "../api"; -const useTranscript = () => { - const [response, setResponse] = useState(null); - const [loading, setLoading] = useState(false); - const [error, setError] = useState(null); +type UseTranscriptReturnType = { + response: GetTranscript | null; + loading: boolean; + error: string | null; + createTranscript: () => void; +}; + +const useTranscript = (): UseTranscriptReturnType => { + const [response, setResponse] = useState(null); + const [loading, setLoading] = useState(false); + const [error, setError] = useState(null); const apiConfiguration = new Configuration({ basePath: process.env.NEXT_PUBLIC_API_URL, @@ -14,7 +22,7 @@ const useTranscript = () => { const createTranscript = () => { setLoading(true); - const requestParameters = { + const requestParameters: V1TranscriptsCreateRequest = { createTranscript: { name: "Weekly All-Hands", // Hardcoded for now }, diff --git a/www/app/transcripts/useWebRTC.js b/www/app/transcripts/useWebRTC.tsx similarity index 63% rename from www/app/transcripts/useWebRTC.js rename to www/app/transcripts/useWebRTC.tsx index d34b0696..ea622bb2 100644 --- a/www/app/transcripts/useWebRTC.js +++ b/www/app/transcripts/useWebRTC.tsx @@ -1,12 +1,16 @@ import { useEffect, useState } from "react"; import Peer from "simple-peer"; -import { DefaultApi } from "../api/apis/DefaultApi"; +import { + DefaultApi, + V1TranscriptRecordWebrtcRequest, +} from "../api/apis/DefaultApi"; import { Configuration } from "../api/runtime"; -const useWebRTC = (stream, transcriptId) => { - const [data, setData] = useState({ - peer: null, - }); +const useWebRTC = ( + stream: MediaStream | null, + transcriptId: string | null, +): Peer => { + const [peer, setPeer] = useState(null); useEffect(() => { if (!stream || !transcriptId) { @@ -18,11 +22,11 @@ const useWebRTC = (stream, transcriptId) => { }); const api = new DefaultApi(apiConfiguration); - let peer = new Peer({ initiator: true, stream: stream }); + let p: Peer = new Peer({ initiator: true, stream: stream }); - peer.on("signal", (data) => { + p.on("signal", (data: any) => { if ("sdp" in data) { - const requestParameters = { + const requestParameters: V1TranscriptRecordWebrtcRequest = { transcriptId: transcriptId, rtcOffer: { sdp: data.sdp, @@ -33,7 +37,7 @@ const useWebRTC = (stream, transcriptId) => { api .v1TranscriptRecordWebrtc(requestParameters) .then((answer) => { - peer.signal(answer); + p.signal(answer); }) .catch((err) => { console.error("WebRTC signaling error:", err); @@ -41,17 +45,17 @@ const useWebRTC = (stream, transcriptId) => { } }); - peer.on("connect", () => { + p.on("connect", () => { console.log("WebRTC connected"); - setData((prevData) => ({ ...prevData, peer: peer })); + setPeer(p); }); return () => { - peer.destroy(); + p.destroy(); }; }, [stream, transcriptId]); - return data; + return peer; }; export default useWebRTC; diff --git a/www/app/transcripts/useWebSockets.js b/www/app/transcripts/useWebSockets.tsx similarity index 68% rename from www/app/transcripts/useWebSockets.js rename to www/app/transcripts/useWebSockets.tsx index 8b64790d..5e872ccb 100644 --- a/www/app/transcripts/useWebSockets.js +++ b/www/app/transcripts/useWebSockets.tsx @@ -1,10 +1,22 @@ import { useEffect, useState } from "react"; +import { TopicType, FinalSummaryType, StatusType } from "./webSocketTypes"; -export const useWebSockets = (transcriptId) => { - const [transcriptText, setTranscriptText] = useState(""); - const [topics, setTopics] = useState([]); - const [finalSummary, setFinalSummary] = useState(""); - const [status, setStatus] = useState("disconnected"); +type UseWebSocketsReturnType = { + transcriptText: string; + topics: TopicType[]; + finalSummary: FinalSummaryType; + status: StatusType; +}; + +export const useWebSockets = ( + transcriptId: string | null, +): UseWebSocketsReturnType => { + const [transcriptText, setTranscriptText] = useState(""); + const [topics, setTopics] = useState([]); + const [finalSummary, setFinalSummary] = useState({ + summary: "", + }); + const [status, setStatus] = useState({ value: "disconnected" }); useEffect(() => { if (!transcriptId) return; @@ -40,7 +52,7 @@ export const useWebSockets = (transcriptId) => { break; case "STATUS": - setStatus(message.data.status); + setStatus(message.data); break; default: diff --git a/www/app/transcripts/webSocketTypes.tsx b/www/app/transcripts/webSocketTypes.tsx new file mode 100644 index 00000000..6ae6cac6 --- /dev/null +++ b/www/app/transcripts/webSocketTypes.tsx @@ -0,0 +1,19 @@ +export type TopicType = { + timestamp: number; + title: string; + transcript: string; + summary: string; + id: string; +}; + +export type TranscriptType = { + text: string; +}; + +export type FinalSummaryType = { + summary: string; +}; + +export type StatusType = { + value: string; +}; diff --git a/www/next.config.js b/www/next.config.js index 610b5be8..e5be889f 100644 --- a/www/next.config.js +++ b/www/next.config.js @@ -5,7 +5,7 @@ const nextConfig = { module.exports = nextConfig; -// Sentry content below +// Injected content via Sentry wizard below const { withSentryConfig } = require("@sentry/nextjs"); diff --git a/www/package.json b/www/package.json index af1434e0..ee03840a 100644 --- a/www/package.json +++ b/www/package.json @@ -14,7 +14,7 @@ "@fortawesome/fontawesome-svg-core": "^6.4.0", "@fortawesome/free-solid-svg-icons": "^6.4.0", "@fortawesome/react-fontawesome": "^0.2.0", - "@sentry/nextjs": "^7.61.0", + "@sentry/nextjs": "^7.64.0", "autoprefixer": "10.4.14", "axios": "^1.4.0", "fontawesome": "^5.6.3", diff --git a/www/pages/api/sentry-example-api.js b/www/pages/api/sentry-example-api.js new file mode 100644 index 00000000..ac07eec0 --- /dev/null +++ b/www/pages/api/sentry-example-api.js @@ -0,0 +1,5 @@ +// A faulty API route to test Sentry's error monitoring +export default function handler(_req, res) { + throw new Error("Sentry Example API Route Error"); + res.status(200).json({ name: "John Doe" }); +} diff --git a/www/pages/sentry-example-page.js b/www/pages/sentry-example-page.js new file mode 100644 index 00000000..bcace78b --- /dev/null +++ b/www/pages/sentry-example-page.js @@ -0,0 +1,87 @@ +import Head from "next/head"; +import * as Sentry from "@sentry/nextjs"; + +export default function Home() { + return ( +
+ + Sentry Onboarding + + + +
+

+ + + +

+ +

Get started by sending us a sample error:

+ + +

+ Next, look for the error on the{" "} + + Issues Page + + . +

+

+ For more information, see{" "} + + https://docs.sentry.io/platforms/javascript/guides/nextjs/ + +

+
+
+ ); +} diff --git a/www/sentry.client.config.js b/www/sentry.client.config.ts similarity index 100% rename from www/sentry.client.config.js rename to www/sentry.client.config.ts diff --git a/www/sentry.edge.config.js b/www/sentry.edge.config.ts similarity index 100% rename from www/sentry.edge.config.js rename to www/sentry.edge.config.ts diff --git a/www/sentry.server.config.js b/www/sentry.server.config.ts similarity index 100% rename from www/sentry.server.config.js rename to www/sentry.server.config.ts diff --git a/www/yarn.lock b/www/yarn.lock index 27d8c54e..d2ae9035 100644 --- a/www/yarn.lock +++ b/www/yarn.lock @@ -252,26 +252,26 @@ estree-walker "^2.0.2" picomatch "^2.3.1" -"@sentry-internal/tracing@7.61.0": - version "7.61.0" - resolved "https://registry.yarnpkg.com/@sentry-internal/tracing/-/tracing-7.61.0.tgz#5a0dd4a9a0b41f2e22904430f3fe0216f36ee086" - integrity sha512-zTr+MXEG4SxNxif42LIgm2RQn+JRXL2NuGhRaKSD2i4lXKFqHVGlVdoWqY5UfqnnJPokiTWIj9ejR8I5HV8Ogw== +"@sentry-internal/tracing@7.64.0": + version "7.64.0" + resolved "https://registry.yarnpkg.com/@sentry-internal/tracing/-/tracing-7.64.0.tgz#3e110473b8edf805b799cc91d6ee592830237bb4" + integrity sha512-1XE8W6ki7hHyBvX9hfirnGkKDBKNq3bDJyXS86E0bYVDl94nvbRM9BD9DHsCFetqYkVm1yDGEK+6aUVs4CztoQ== dependencies: - "@sentry/core" "7.61.0" - "@sentry/types" "7.61.0" - "@sentry/utils" "7.61.0" + "@sentry/core" "7.64.0" + "@sentry/types" "7.64.0" + "@sentry/utils" "7.64.0" tslib "^2.4.1 || ^1.9.3" -"@sentry/browser@7.61.0": - version "7.61.0" - resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-7.61.0.tgz#04f4122e444d8b5ffefed97af3cde2bc1c71bb80" - integrity sha512-IGEkJZRP16Oe5CkXkmhU3QdV5RugW6Vds16yJFFYsgp87NprWtRZgqzldFDYkINStfBHVdctj/Rh/ZrLf8QlkQ== +"@sentry/browser@7.64.0": + version "7.64.0" + resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-7.64.0.tgz#76db08a5d32ffe7c5aa907f258e6c845ce7f10d7" + integrity sha512-lB2IWUkZavEDclxfLBp554dY10ZNIEvlDZUWWathW+Ws2wRb6PNLtuPUNu12R7Q7z0xpkOLrM1kRNN0OdldgKA== dependencies: - "@sentry-internal/tracing" "7.61.0" - "@sentry/core" "7.61.0" - "@sentry/replay" "7.61.0" - "@sentry/types" "7.61.0" - "@sentry/utils" "7.61.0" + "@sentry-internal/tracing" "7.64.0" + "@sentry/core" "7.64.0" + "@sentry/replay" "7.64.0" + "@sentry/types" "7.64.0" + "@sentry/utils" "7.64.0" tslib "^2.4.1 || ^1.9.3" "@sentry/cli@^1.74.6": @@ -286,88 +286,88 @@ proxy-from-env "^1.1.0" which "^2.0.2" -"@sentry/core@7.61.0": - version "7.61.0" - resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.61.0.tgz#0de4f73055bd156c5c0cbac50bb814b272567188" - integrity sha512-zl0ZKRjIoYJQWYTd3K/U6zZfS4GDY9yGd2EH4vuYO4kfYtEp/nJ8A+tfAeDo0c9FGxZ0Q+5t5F4/SfwbgyyQzg== +"@sentry/core@7.64.0": + version "7.64.0" + resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.64.0.tgz#9d61cdc29ba299dedbdcbe01cfadf94bd0b7df48" + integrity sha512-IzmEyl5sNG7NyEFiyFHEHC+sizsZp9MEw1+RJRLX6U5RITvcsEgcajSkHQFafaBPzRrcxZMdm47Cwhl212LXcw== dependencies: - "@sentry/types" "7.61.0" - "@sentry/utils" "7.61.0" + "@sentry/types" "7.64.0" + "@sentry/utils" "7.64.0" tslib "^2.4.1 || ^1.9.3" -"@sentry/integrations@7.61.0": - version "7.61.0" - resolved "https://registry.yarnpkg.com/@sentry/integrations/-/integrations-7.61.0.tgz#49c97a59ceb0438bd5ec070415d95f8c6c708d5f" - integrity sha512-NEQ+CatBfUM1TmA4FOOyHfsMvSIwSg4pA55Lxiq9quDykzkEtrXFzUfFpZbTunz4cegG8hucPOqbzKFrDPfGjQ== +"@sentry/integrations@7.64.0": + version "7.64.0" + resolved "https://registry.yarnpkg.com/@sentry/integrations/-/integrations-7.64.0.tgz#a392ddeebeec0c08ae5ca1f544c80ab15977fe10" + integrity sha512-6gbSGiruOifAmLtXw//Za19GWiL5qugDMEFxSvc5WrBWb+A8UK+foPn3K495OcivLS68AmqAQCUGb+6nlVowwA== dependencies: - "@sentry/types" "7.61.0" - "@sentry/utils" "7.61.0" + "@sentry/types" "7.64.0" + "@sentry/utils" "7.64.0" localforage "^1.8.1" tslib "^2.4.1 || ^1.9.3" -"@sentry/nextjs@^7.61.0": - version "7.61.0" - resolved "https://registry.yarnpkg.com/@sentry/nextjs/-/nextjs-7.61.0.tgz#5a30faa6fb04d9148853edbb5c148dd522126097" - integrity sha512-zSEcAITqVmJpR4hhah1jUyCzm/hjlq9vjmO6BmTnQjr84OgOdeKJGWtRdktXId+9zzHdCOehs/JPtmO7y+yG6Q== +"@sentry/nextjs@^7.64.0": + version "7.64.0" + resolved "https://registry.yarnpkg.com/@sentry/nextjs/-/nextjs-7.64.0.tgz#5c0bd7ccc6637e0b925dec25ca247dcb8476663c" + integrity sha512-hKlIQpFugdRlWj0wcEG9I8JyVm/osdsE72zwMBGnmCw/jf7U63vjOjfxMe/gRuvllCf/AvoGHEkR5jPufcO+bw== dependencies: "@rollup/plugin-commonjs" "24.0.0" - "@sentry/core" "7.61.0" - "@sentry/integrations" "7.61.0" - "@sentry/node" "7.61.0" - "@sentry/react" "7.61.0" - "@sentry/types" "7.61.0" - "@sentry/utils" "7.61.0" + "@sentry/core" "7.64.0" + "@sentry/integrations" "7.64.0" + "@sentry/node" "7.64.0" + "@sentry/react" "7.64.0" + "@sentry/types" "7.64.0" + "@sentry/utils" "7.64.0" "@sentry/webpack-plugin" "1.20.0" chalk "3.0.0" rollup "2.78.0" stacktrace-parser "^0.1.10" tslib "^2.4.1 || ^1.9.3" -"@sentry/node@7.61.0": - version "7.61.0" - resolved "https://registry.yarnpkg.com/@sentry/node/-/node-7.61.0.tgz#1309330f2ad136af532ad2a03b2a312e885705de" - integrity sha512-oTCqD/h92uvbRCrtCdiAqN6Mfe3vF7ywVHZ8Nq3hHmJp6XadUT+fCBwNQ7rjMyqJAOYAnx/vp6iN9n8C5qcYZQ== +"@sentry/node@7.64.0": + version "7.64.0" + resolved "https://registry.yarnpkg.com/@sentry/node/-/node-7.64.0.tgz#c6f7a67c1442324298f0525e7191bc18572ee1ce" + integrity sha512-wRi0uTnp1WSa83X2yLD49tV9QPzGh5e42IKdIDBiQ7lV9JhLILlyb34BZY1pq6p4dp35yDasDrP3C7ubn7wo6A== dependencies: - "@sentry-internal/tracing" "7.61.0" - "@sentry/core" "7.61.0" - "@sentry/types" "7.61.0" - "@sentry/utils" "7.61.0" + "@sentry-internal/tracing" "7.64.0" + "@sentry/core" "7.64.0" + "@sentry/types" "7.64.0" + "@sentry/utils" "7.64.0" cookie "^0.4.1" https-proxy-agent "^5.0.0" lru_map "^0.3.3" tslib "^2.4.1 || ^1.9.3" -"@sentry/react@7.61.0": - version "7.61.0" - resolved "https://registry.yarnpkg.com/@sentry/react/-/react-7.61.0.tgz#21dc8eb5168fdb45f994e62738313b50c710d6a4" - integrity sha512-17ZPDdzx3hzJSHsVFAiw4hUT701LUVIcm568q38sPlSUmnOmNmPeHx/xcQkuxMoVsw/xgf/82B/BKKnIP5/diA== +"@sentry/react@7.64.0": + version "7.64.0" + resolved "https://registry.yarnpkg.com/@sentry/react/-/react-7.64.0.tgz#edee24ac232990204e0fb43dd83994642d4b0f54" + integrity sha512-wOyJUQi7OoT1q+F/fVVv1fzbyO4OYbTu6m1DliLOGQPGEHPBsgPc722smPIExd1/rAMK/FxOuNN5oNhubH8nhg== dependencies: - "@sentry/browser" "7.61.0" - "@sentry/types" "7.61.0" - "@sentry/utils" "7.61.0" + "@sentry/browser" "7.64.0" + "@sentry/types" "7.64.0" + "@sentry/utils" "7.64.0" hoist-non-react-statics "^3.3.2" tslib "^2.4.1 || ^1.9.3" -"@sentry/replay@7.61.0": - version "7.61.0" - resolved "https://registry.yarnpkg.com/@sentry/replay/-/replay-7.61.0.tgz#f816d6a2fc7511877efee2e328681d659433d147" - integrity sha512-1ugk0yZssOPkSg6uTVcysjxlBydycXiOgV0PCU7DsXCFOV1ua5YpyPZFReTz9iFTtwD0LwGFM1LW9wJeQ67Fzg== +"@sentry/replay@7.64.0": + version "7.64.0" + resolved "https://registry.yarnpkg.com/@sentry/replay/-/replay-7.64.0.tgz#bdf09b0c4712f9dc6b24b3ebefa55a4ac76708e6" + integrity sha512-alaMCZDZhaAVmEyiUnszZnvfdbiZx5MmtMTGrlDd7tYq3K5OA9prdLqqlmfIJYBfYtXF3lD0iZFphOZQD+4CIw== dependencies: - "@sentry/core" "7.61.0" - "@sentry/types" "7.61.0" - "@sentry/utils" "7.61.0" + "@sentry/core" "7.64.0" + "@sentry/types" "7.64.0" + "@sentry/utils" "7.64.0" -"@sentry/types@7.61.0": - version "7.61.0" - resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.61.0.tgz#4243b5ef4658f6b0673bc4372c90e6ec920f78d8" - integrity sha512-/GLlIBNR35NKPE/SfWi9W10dK9hE8qTShzsuPVn5wAJxpT3Lb4+dkwmKCTLUYxdkmvRDEudkfOxgalsfQGTAWA== +"@sentry/types@7.64.0": + version "7.64.0" + resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.64.0.tgz#21fc545ea05c3c8c4c3e518583eca1a8c5429506" + integrity sha512-LqjQprWXjUFRmzIlUjyA+KL+38elgIYmAeoDrdyNVh8MK5IC1W2Lh1Q87b4yOiZeMiIhIVNBd7Ecoh2rodGrGA== -"@sentry/utils@7.61.0": - version "7.61.0" - resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.61.0.tgz#16944afb2b851af045fb528c0c35b7dea3e1cd3b" - integrity sha512-jfj14d0XBFiCU0G6dZZ12SizATiF5Mt4stBGzkM5iS9nXFj8rh1oTT7/p+aZoYzP2JTF+sDzkNjWxyKZkcTo0Q== +"@sentry/utils@7.64.0": + version "7.64.0" + resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.64.0.tgz#6fe3ce9a56d3433ed32119f914907361a54cc184" + integrity sha512-HRlM1INzK66Gt+F4vCItiwGKAng4gqzCR4C5marsL3qv6SrKH98dQnCGYgXluSWaaa56h97FRQu7TxCk6jkSvQ== dependencies: - "@sentry/types" "7.61.0" + "@sentry/types" "7.64.0" tslib "^2.4.1 || ^1.9.3" "@sentry/webpack-plugin@1.20.0": From 5e2afa599e8d80cc6065b9dc85400056618bceb0 Mon Sep 17 00:00:00 2001 From: Koper Date: Wed, 16 Aug 2023 17:59:01 +0700 Subject: [PATCH 2/5] Deleted sentry example pages --- www/pages/api/sentry-example-api.js | 5 -- www/pages/sentry-example-page.js | 87 ----------------------------- 2 files changed, 92 deletions(-) delete mode 100644 www/pages/api/sentry-example-api.js delete mode 100644 www/pages/sentry-example-page.js diff --git a/www/pages/api/sentry-example-api.js b/www/pages/api/sentry-example-api.js deleted file mode 100644 index ac07eec0..00000000 --- a/www/pages/api/sentry-example-api.js +++ /dev/null @@ -1,5 +0,0 @@ -// A faulty API route to test Sentry's error monitoring -export default function handler(_req, res) { - throw new Error("Sentry Example API Route Error"); - res.status(200).json({ name: "John Doe" }); -} diff --git a/www/pages/sentry-example-page.js b/www/pages/sentry-example-page.js deleted file mode 100644 index bcace78b..00000000 --- a/www/pages/sentry-example-page.js +++ /dev/null @@ -1,87 +0,0 @@ -import Head from "next/head"; -import * as Sentry from "@sentry/nextjs"; - -export default function Home() { - return ( -
- - Sentry Onboarding - - - -
-

- - - -

- -

Get started by sending us a sample error:

- - -

- Next, look for the error on the{" "} - - Issues Page - - . -

-

- For more information, see{" "} - - https://docs.sentry.io/platforms/javascript/guides/nextjs/ - -

-
-
- ); -} From e297b8269d67c37ae4ebbf419138ecfd0e35d189 Mon Sep 17 00:00:00 2001 From: Koper Date: Thu, 17 Aug 2023 15:30:35 +0700 Subject: [PATCH 3/5] Removed unnecessary suffix "Type" --- www/app/transcripts/dashboard.tsx | 6 +++--- www/app/transcripts/useTranscript.tsx | 4 ++-- www/app/transcripts/useWebSockets.tsx | 20 +++++++++----------- www/app/transcripts/webSocketTypes.tsx | 8 ++++---- 4 files changed, 18 insertions(+), 20 deletions(-) diff --git a/www/app/transcripts/dashboard.tsx b/www/app/transcripts/dashboard.tsx index b426c670..6fc2cfbe 100644 --- a/www/app/transcripts/dashboard.tsx +++ b/www/app/transcripts/dashboard.tsx @@ -6,15 +6,15 @@ import { } from "@fortawesome/free-solid-svg-icons"; import { formatTime } from "../lib/time"; import ScrollToBottom from "./scrollToBottom"; -import FinalSummary from "./finalSummary"; import DisconnectedIndicator from "./disconnectedIndicator"; import LiveTrancription from "./liveTranscription"; -import { TopicType, FinalSummaryType } from "./webSocketTypes"; +import FinalSummary from "./finalSummary"; +import { Topic, FinalSummary as FinalSummaryType } from "./webSocketTypes"; type DashboardProps = { transcriptionText: string; finalSummary: FinalSummaryType; - topics: TopicType[]; + topics: Topic[]; disconnected: boolean; }; diff --git a/www/app/transcripts/useTranscript.tsx b/www/app/transcripts/useTranscript.tsx index ddb77bed..11510020 100644 --- a/www/app/transcripts/useTranscript.tsx +++ b/www/app/transcripts/useTranscript.tsx @@ -3,14 +3,14 @@ import { DefaultApi, V1TranscriptsCreateRequest } from "../api/apis/DefaultApi"; import { Configuration } from "../api/runtime"; import { GetTranscript } from "../api"; -type UseTranscriptReturnType = { +type UseTranscript = { response: GetTranscript | null; loading: boolean; error: string | null; createTranscript: () => void; }; -const useTranscript = (): UseTranscriptReturnType => { +const useTranscript = (): UseTranscript => { const [response, setResponse] = useState(null); const [loading, setLoading] = useState(false); const [error, setError] = useState(null); diff --git a/www/app/transcripts/useWebSockets.tsx b/www/app/transcripts/useWebSockets.tsx index 5e872ccb..80d4f560 100644 --- a/www/app/transcripts/useWebSockets.tsx +++ b/www/app/transcripts/useWebSockets.tsx @@ -1,22 +1,20 @@ import { useEffect, useState } from "react"; -import { TopicType, FinalSummaryType, StatusType } from "./webSocketTypes"; +import { Topic, FinalSummary, Status } from "./webSocketTypes"; -type UseWebSocketsReturnType = { +type UseWebSockets = { transcriptText: string; - topics: TopicType[]; - finalSummary: FinalSummaryType; - status: StatusType; + topics: Topic[]; + finalSummary: FinalSummary; + status: Status; }; -export const useWebSockets = ( - transcriptId: string | null, -): UseWebSocketsReturnType => { +export const useWebSockets = (transcriptId: string | null): UseWebSockets => { const [transcriptText, setTranscriptText] = useState(""); - const [topics, setTopics] = useState([]); - const [finalSummary, setFinalSummary] = useState({ + const [topics, setTopics] = useState([]); + const [finalSummary, setFinalSummary] = useState({ summary: "", }); - const [status, setStatus] = useState({ value: "disconnected" }); + const [status, setStatus] = useState({ value: "disconnected" }); useEffect(() => { if (!transcriptId) return; diff --git a/www/app/transcripts/webSocketTypes.tsx b/www/app/transcripts/webSocketTypes.tsx index 6ae6cac6..4b9358a5 100644 --- a/www/app/transcripts/webSocketTypes.tsx +++ b/www/app/transcripts/webSocketTypes.tsx @@ -1,4 +1,4 @@ -export type TopicType = { +export type Topic = { timestamp: number; title: string; transcript: string; @@ -6,14 +6,14 @@ export type TopicType = { id: string; }; -export type TranscriptType = { +export type Transcript = { text: string; }; -export type FinalSummaryType = { +export type FinalSummary = { summary: string; }; -export type StatusType = { +export type Status = { value: string; }; From ca4a4d24324474c086f76e7a3d010c498f9c6e6a Mon Sep 17 00:00:00 2001 From: Koper Date: Thu, 17 Aug 2023 21:36:48 +0700 Subject: [PATCH 4/5] Update dashboard.tsx --- www/app/transcripts/dashboard.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/app/transcripts/dashboard.tsx b/www/app/transcripts/dashboard.tsx index 6fc2cfbe..9eb05536 100644 --- a/www/app/transcripts/dashboard.tsx +++ b/www/app/transcripts/dashboard.tsx @@ -98,7 +98,7 @@ export function Dashboard({ )} - {finalSummary && } + {finalSummary.summary && } {disconnected && } From b43bd00fc0cc8a53087d54dd21ec57aaaa12c970 Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Thu, 17 Aug 2023 16:49:22 +0200 Subject: [PATCH 5/5] server: fixes wav not saved correctly and mp3 generation invalid if started from /tmp from another device --- server/.gitignore | 1 + server/reflector/processors/audio_file_writer.py | 6 +++--- server/reflector/views/transcripts.py | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/server/.gitignore b/server/.gitignore index 7d66d6f0..dbabe979 100644 --- a/server/.gitignore +++ b/server/.gitignore @@ -178,3 +178,4 @@ audio_*.wav # ignore local database reflector.sqlite3 +data/ diff --git a/server/reflector/processors/audio_file_writer.py b/server/reflector/processors/audio_file_writer.py index d67db65e..00ab2529 100644 --- a/server/reflector/processors/audio_file_writer.py +++ b/server/reflector/processors/audio_file_writer.py @@ -26,13 +26,13 @@ class AudioFileWriterProcessor(Processor): self.out_stream = self.out_container.add_stream( "pcm_s16le", rate=data.sample_rate ) - for packet in self.out_stream.encode(data): - self.out_container.mux(packet) + for packet in self.out_stream.encode(data): + self.out_container.mux(packet) await self.emit(data) async def _flush(self): if self.out_container: - for packet in self.out_stream.encode(None): + for packet in self.out_stream.encode(): self.out_container.mux(packet) self.out_container.close() self.out_container = None diff --git a/server/reflector/views/transcripts.py b/server/reflector/views/transcripts.py index 6f952938..beaafb76 100644 --- a/server/reflector/views/transcripts.py +++ b/server/reflector/views/transcripts.py @@ -108,7 +108,9 @@ class Transcript(BaseModel): out.close() # move temporary file to final location - Path(tmp.name).rename(fn) + import shutil + + shutil.move(tmp.name, fn.as_posix()) def unlink(self): self.data_path.unlink(missing_ok=True)