diff --git a/enjoy/package.json b/enjoy/package.json index 83d894f7..baef5a6e 100644 --- a/enjoy/package.json +++ b/enjoy/package.json @@ -63,6 +63,8 @@ "zx": "^7.2.3" }, "dependencies": { + "@ffmpeg/ffmpeg": "^0.12.10", + "@ffmpeg/util": "^0.12.1", "@hookform/resolvers": "^3.3.4", "@langchain/google-genai": "^0.0.7", "@mozilla/readability": "^0.5.0", @@ -111,11 +113,11 @@ "fluent-ffmpeg": "^2.1.2", "fs-extra": "^11.2.0", "html-to-text": "^9.0.5", - "i18next": "^23.7.16", + "i18next": "^23.7.18", "js-md5": "^0.8.3", - "langchain": "^0.1.4", + "langchain": "^0.1.5", "lodash": "^4.17.21", - "lucide-react": "^0.312.0", + "lucide-react": "^0.314.0", "mark.js": "^8.11.1", "microsoft-cognitiveservices-speech-sdk": "^1.34.0", "next-themes": "^0.2.1", @@ -130,7 +132,7 @@ "react-i18next": "^14.0.0", "react-markdown": "^9.0.1", "react-router-dom": "^6.21.3", - "react-tooltip": "^5.25.2", + "react-tooltip": "^5.26.0", "reflect-metadata": "^0.2.1", "rimraf": "^5.0.5", "sequelize": "^6.35.2", @@ -139,7 +141,7 @@ "sqlite3": "^5.1.7", "tailwind-scrollbar-hide": "^1.1.7", "umzug": "^3.5.1", - "wavesurfer.js": "^7.6.4", + "wavesurfer.js": "^7.6.5", "zod": "^3.22.4" } } diff --git a/enjoy/src/constants.ts b/enjoy/src/constants.ts index 2c4deeab..a444f5fa 100644 --- a/enjoy/src/constants.ts +++ b/enjoy/src/constants.ts @@ -4,6 +4,8 @@ export const LIBRARY_PATH_SUFFIX = "EnjoyLibrary"; export const STORAGE_WORKER_ENDPOINT = "https://enjoy-storage.baizhiheizi.com"; export const WEB_API_URL = "https://enjoy-web.fly.dev"; +export const REPO_URL = "https://github.com/xiaolai/everyone-can-use-english" + // https://huggingface.co/ggerganov/whisper.cpp/tree/main export const WHISPER_MODELS_OPTIONS = [ { diff --git a/enjoy/src/i18n/en.json b/enjoy/src/i18n/en.json index c7e4fc81..f9483a31 100644 --- a/enjoy/src/i18n/en.json +++ b/enjoy/src/i18n/en.json @@ -171,6 +171,8 @@ "error": "Error", "errors": "Errors", "cancel": "Cancel", + "cancelled": "Cancelled", + "canceling": "Canceling", "confirm": "Confirm", "continue": "continue", "save": "Save", @@ -295,6 +297,9 @@ "checkingWhisper": "Checking whisper status", "whisperIsWorkingGood": "Whisper is working good", "whisperIsNotWorking": "Whisper is not working", + "checkingWhisperModel": "Checking whisper model", + "whisperModelIsWorkingGood": "Whisper model is working good", + "whisperModelIsNotWorking": "Whisper model is not working", "relaunchIsNeededAfterChanged": "Relaunch is needed after changed", "openaiKeySaved": "OpenAI key saved", "openaiConfigSaved": "OpenAI config saved", diff --git a/enjoy/src/i18n/zh-CN.json b/enjoy/src/i18n/zh-CN.json index e040d1e8..33600938 100644 --- a/enjoy/src/i18n/zh-CN.json +++ b/enjoy/src/i18n/zh-CN.json @@ -171,6 +171,8 @@ "error": "错误", "errors": "错误", "cancel": "取消", + "cancelled": "已取消", + "canceling": "正在取消", "confirm": "确认", "continue": "继续", "save": "保存", @@ -294,6 +296,9 @@ "checkingWhisper": "正在检查 Whisper", "whisperIsWorkingGood": "Whisper 正常工作", "whisperIsNotWorking": "Whisper 无法正常工作,请尝试更换模型后重试,或联系开发者", + "checkingWhisperModel": "正在检查 Whisper 模型", + "whisperModelIsWorkingGood": "Whisper 模型正常工作", + "whisperModelIsNotWorking": "Whisper 模型无法正常工作,请尝试更换模型后重试,或联系开发者", "relaunchIsNeededAfterChanged": "更改后需要重新启动", "openaiKeySaved": "OpenAI 密钥已保存", "openaiConfigSaved": "OpenAI 配置已保存", diff --git a/enjoy/src/main.ts b/enjoy/src/main.ts index 4f51ed9c..8f572947 100644 --- a/enjoy/src/main.ts +++ b/enjoy/src/main.ts @@ -14,6 +14,8 @@ log.errorHandler.startCatching(); // Fix "getRandomValues() not supported" global.crypto = crypto; +app.commandLine.appendSwitch('enable-features','SharedArrayBuffer') + // Handle creating/removing shortcuts on Windows when installing/uninstalling. if (require("electron-squirrel-startup")) { app.quit(); diff --git a/enjoy/src/main/db/handlers/audios-handler.ts b/enjoy/src/main/db/handlers/audios-handler.ts index 20a70a03..18b7b9dd 100644 --- a/enjoy/src/main/db/handlers/audios-handler.ts +++ b/enjoy/src/main/db/handlers/audios-handler.ts @@ -49,9 +49,8 @@ class AudiosHandler { }, }) .then((audio) => { - if (!audio) { - throw new Error(t("models.audio.notFound")); - } + if (!audio) return; + if (!audio.isSynced) { audio.sync().catch(() => {}); } diff --git a/enjoy/src/main/db/handlers/transcriptions-handler.ts b/enjoy/src/main/db/handlers/transcriptions-handler.ts index 3dc3e21a..6e665b6d 100644 --- a/enjoy/src/main/db/handlers/transcriptions-handler.ts +++ b/enjoy/src/main/db/handlers/transcriptions-handler.ts @@ -30,27 +30,6 @@ class TranscriptionsHandler { }, }); - if (transcription.state === "pending") { - const timeout = setTimeout(() => { - event.sender.send("on-notification", { - type: "warning", - message: t("stillTranscribing"), - }); - }, 1000 * 10); - - transcription - .process() - .catch((err) => { - event.sender.send("on-notification", { - type: "error", - message: err.message, - }); - }) - .finally(() => { - clearTimeout(timeout); - }); - } - return transcription.toJSON(); } catch (err) { event.sender.send("on-notification", { @@ -87,8 +66,16 @@ class TranscriptionsHandler { private async process( event: IpcMainEvent, - where: WhereOptions> + where: WhereOptions>, + options?: { + force?: boolean; + blob: { + type: string; + arrayBuffer: ArrayBuffer; + }; + } ) { + const { force = true, blob } = options || {}; return Transcription.findOne({ where: { ...where, @@ -107,7 +94,7 @@ class TranscriptionsHandler { }, 1000 * 10); transcription - .process({ force: true }) + .process({ force, wavFileBlob: blob }) .catch((err) => { event.sender.send("on-notification", { type: "error", diff --git a/enjoy/src/main/db/handlers/videos-handler.ts b/enjoy/src/main/db/handlers/videos-handler.ts index 10988854..7161ac8a 100644 --- a/enjoy/src/main/db/handlers/videos-handler.ts +++ b/enjoy/src/main/db/handlers/videos-handler.ts @@ -49,9 +49,8 @@ class VideosHandler { }, }) .then((video) => { - if (!video) { - throw new Error(t("models.video.notFound")); - } + if (!video) return; + if (!video.isSynced) { video.sync().catch(() => {}); } diff --git a/enjoy/src/main/db/models/audio.ts b/enjoy/src/main/db/models/audio.ts index b5c17ee6..e50e9374 100644 --- a/enjoy/src/main/db/models/audio.ts +++ b/enjoy/src/main/db/models/audio.ts @@ -178,6 +178,8 @@ export class Audio extends Model