Force alignment for tts audio (#418)

* add originalText as param

* save original text when added from tts speech

* fix player in conversation sheet

* minor fix
This commit is contained in:
an-lee
2024-03-18 12:55:28 +08:00
committed by GitHub
parent 94dfabfec8
commit de89ae73bf
10 changed files with 123 additions and 61 deletions

View File

@@ -26,6 +26,10 @@ export const AudioPlayer = (props: { id?: string; md5?: string }) => {
useEffect(() => {
setRef(ref);
return () => {
setRef(null);
};
}, [ref]);
return (

View File

@@ -72,6 +72,7 @@ export const MediaCurrentRecording = (props: { height?: number }) => {
const removeComparingPitchContour = () => {
if (!wavesurfer) return;
if (!regions) return;
regions
.getRegions()

View File

@@ -72,7 +72,7 @@ export const MediaTranscription = () => {
} as ScrollIntoViewOptions);
}, [currentSegmentIndex, transcription, containerRef]);
if (!transcription?.result) {
if (!transcription?.result?.timeline) {
return null;
}

View File

@@ -104,6 +104,7 @@ export const AssistantMessageComponent = (props: {
speech.text.length > 20
? speech.text.substring(0, 17).trim() + "..."
: speech.text,
originalText: speech.text,
});
setResourcing(false);
}
@@ -251,7 +252,7 @@ export const AssistantMessageComponent = (props: {
</SheetClose>
</SheetHeader>
{Boolean(speech) && <AudioPlayer md5={speech.md5} />}
{Boolean(speech) && shadowing && <AudioPlayer md5={speech.md5} />}
</SheetContent>
</Sheet>
</div>