add more logs for echogarden

This commit is contained in:
an-lee
2024-03-17 10:56:20 +08:00
parent d516530440
commit 0f9c788aa4
2 changed files with 17 additions and 4 deletions

View File

@@ -9,7 +9,10 @@ import settings from "@main/settings";
import fs from "fs-extra";
import ffmpegPath from "ffmpeg-static";
Echogarden.setGlobalOption("ffmpegPath", ffmpegPath.replace("app.asar", "app.asar.unpacked"));
Echogarden.setGlobalOption(
"ffmpegPath",
ffmpegPath.replace("app.asar", "app.asar.unpacked")
);
const __filename = url.fileURLToPath(import.meta.url);
/*
@@ -53,12 +56,20 @@ class EchogardenWrapper {
ipcMain.handle(
"echogarden-align",
async (
_event,
event,
input: AudioSourceParam,
transcript: string,
options: AlignmentOptions
) => {
return this.align(input, transcript, options);
try {
return await this.align(input, transcript, options);
} catch (err) {
logger.error(err);
event.sender.send("on-notification", {
type: "error",
message: err.message,
});
}
}
);

View File

@@ -8,6 +8,7 @@ import {
import { toast } from "@renderer/components/ui";
import { TimelineEntry } from "echogarden/dist/utilities/Timeline.d.js";
import { MAGIC_TOKEN_REGEX, END_OF_SENTENCE_REGEX } from "@/constants";
import { t } from "i18next";
export const useTranscriptions = (media: AudioType | VideoType) => {
const { whisperConfig } = useContext(AISettingsProviderContext);
@@ -73,6 +74,8 @@ export const useTranscriptions = (media: AudioType | VideoType) => {
});
}
});
} else {
throw new Error(t("forceAlignmentFailed"));
}
/*
@@ -87,7 +90,6 @@ export const useTranscriptions = (media: AudioType | VideoType) => {
.match(END_OF_SENTENCE_REGEX) &&
nextSentence?.text
) {
console.log(sentence.text);
nextSentence.text = [sentence.text, nextSentence.text].join(" ");
nextSentence.timeline = [
...sentence.timeline,