From 6a4fc49fb864009b54892e07de0eb5862eee2e0e Mon Sep 17 00:00:00 2001 From: BFlat Date: Tue, 19 Jul 2022 02:13:05 +0100 Subject: [PATCH] session tts fix --- .../SessionTtsInferenceResultsListFc.tsx | 145 ++++++++++-------- 1 file changed, 84 insertions(+), 61 deletions(-) diff --git a/packages/fakeyou/src/v2/view/_common/SessionTtsInferenceResultsListFc.tsx b/packages/fakeyou/src/v2/view/_common/SessionTtsInferenceResultsListFc.tsx index 6eb90241a2..e6cc7d8f60 100644 --- a/packages/fakeyou/src/v2/view/_common/SessionTtsInferenceResultsListFc.tsx +++ b/packages/fakeyou/src/v2/view/_common/SessionTtsInferenceResultsListFc.tsx @@ -1,90 +1,109 @@ -import React from 'react'; -import { Link } from 'react-router-dom'; -import { TtsInferenceJob } from '../../../App' -import { BucketConfig } from '@storyteller/components/src/api/BucketConfig'; -import { JobState } from '@storyteller/components/src/jobs/JobStates'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { faLink, faList, faMicrophone } from '@fortawesome/free-solid-svg-icons'; +import React from "react"; +import { Link } from "react-router-dom"; +import { TtsInferenceJob } from "../../../App"; +import { BucketConfig } from "@storyteller/components/src/api/BucketConfig"; +import { JobState } from "@storyteller/components/src/jobs/JobStates"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { + faLink, + faList, + faMicrophone, +} from "@fortawesome/free-solid-svg-icons"; +import { distance, delay, delay2, duration } from "../../../data/animation"; +const Fade = require("react-reveal/Fade"); + interface Props { - ttsInferenceJobs: Array, + ttsInferenceJobs: Array; } function SessionTtsInferenceResultListFc(props: Props) { + let results: Array = []; - let results : Array = []; - - props.ttsInferenceJobs.forEach(job => { - + props.ttsInferenceJobs.forEach((job) => { if (!job.maybeResultToken) { - let cssStyle = "alert alert-secondary my-4 alert text-black"; + let cssStyle = "alert alert-secondary mx-3 mx-md-0"; let stateDescription = "Pending..."; switch (job.jobState) { case JobState.PENDING: case JobState.UNKNOWN: - stateDescription = job.maybeExtraStatusDescription == null ? "Pending..." : job.maybeExtraStatusDescription; + stateDescription = + job.maybeExtraStatusDescription == null + ? "Pending..." + : job.maybeExtraStatusDescription; break; case JobState.STARTED: - cssStyle = "alert alert-success my-4 alert"; - stateDescription = job.maybeExtraStatusDescription == null ? "Started..." : job.maybeExtraStatusDescription; + cssStyle = "alert alert-success mx-3 mx-md-0"; + stateDescription = + job.maybeExtraStatusDescription == null + ? "Started..." + : job.maybeExtraStatusDescription; break; case JobState.ATTEMPT_FAILED: - cssStyle = "alert alert-danger my-4 alert"; + cssStyle = "alert alert-danger mx-3 mx-md-0"; stateDescription = `Failed ${job.attemptCount} attempt(s). Will retry...`; break; case JobState.COMPLETE_FAILURE: case JobState.DEAD: - cssStyle = "alert alert-danger my-4 alert"; - stateDescription = "Failed Permanently. Please tell us in Discord so we can fix. :("; + cssStyle = "alert alert-danger mx-3 mx-md-0"; + stateDescription = + "Failed Permanently. Please tell us in Discord so we can fix. :("; break; case JobState.COMPLETE_SUCCESS: - cssStyle = "message is-success"; + cssStyle = "message is-success mx-3 mx-md-0"; stateDescription = "Success!"; // Not sure why we're here instead of other branch! break; } results.push(
-
-
-

- {stateDescription} -

-
-
-   +
+ +
+ +
{stateDescription}
+
+
+
+
); } else { - let audioLink = new BucketConfig().getGcsUrl(job.maybePublicBucketWavAudioPath); - let ttsPermalink = `/tts/result/${job.maybeResultToken}` + let audioLink = new BucketConfig().getGcsUrl( + job.maybePublicBucketWavAudioPath + ); + let ttsPermalink = `/tts/result/${job.maybeResultToken}`; results.push(
-
- {/*
+ {/*

{job.title}

*/} -
-

{job.title}

-

{job.rawInferenceText}

- - - +
- Permalink & download +
+
+

+ + {job.title} +

+

{job.rawInferenceText}

+
+ + + +
+ + + Permalink & download + +
-
-
-   +
+ ); } @@ -95,9 +114,13 @@ function SessionTtsInferenceResultListFc(props: Props) { } let title = ; - if (results.length !== 0) { - title =

Session TTS Results

; + if (results.length !== 0) { + title = ( +

+ + Session TTS Results +

+ ); } // Users have requested reverse chronological results @@ -105,20 +128,20 @@ function SessionTtsInferenceResultListFc(props: Props) { return (
-
-
- {title} - {/*
+
+
+ {title} + + {/*
Working on speeding this up

Sorry this is slow. I'm scaling the cluster and fixing the caching strategy.

*/} - {results} +
{results}
+
+
-
-
- ); }