diff --git a/.github/workflows/release-enjoy-app.yml b/.github/workflows/release-enjoy-app.yml index e3d85f1b..ca0f59cc 100644 --- a/.github/workflows/release-enjoy-app.yml +++ b/.github/workflows/release-enjoy-app.yml @@ -21,4 +21,5 @@ jobs: - if: matrix.os == 'macos-latest' env: GITHUB_TOKEN: ${{ secrets.PUBLISH_TOKEN }} + PACKAGE_OS_ARCH: arm64 run: yarn run publish:enjoy --arch=arm64 diff --git a/enjoy/lib/whisper.cpp/x64/win32/SDL2.dll b/enjoy/lib/whisper.cpp/x64/win32/SDL2.dll index 98b4d6b8..e26bcb1c 100644 Binary files a/enjoy/lib/whisper.cpp/x64/win32/SDL2.dll and b/enjoy/lib/whisper.cpp/x64/win32/SDL2.dll differ diff --git a/enjoy/lib/whisper.cpp/x64/win32/bench.exe b/enjoy/lib/whisper.cpp/x64/win32/bench.exe index 61534e8d..dca5fb6f 100644 Binary files a/enjoy/lib/whisper.cpp/x64/win32/bench.exe and b/enjoy/lib/whisper.cpp/x64/win32/bench.exe differ diff --git a/enjoy/lib/whisper.cpp/x64/win32/main.exe b/enjoy/lib/whisper.cpp/x64/win32/main.exe index ba81cd26..53c47058 100644 Binary files a/enjoy/lib/whisper.cpp/x64/win32/main.exe and b/enjoy/lib/whisper.cpp/x64/win32/main.exe differ diff --git a/enjoy/lib/whisper.cpp/x64/win32/quantize.exe b/enjoy/lib/whisper.cpp/x64/win32/quantize.exe index 30dfd4fc..8105373b 100644 Binary files a/enjoy/lib/whisper.cpp/x64/win32/quantize.exe and b/enjoy/lib/whisper.cpp/x64/win32/quantize.exe differ diff --git a/enjoy/lib/whisper.cpp/x64/win32/whisper.dll b/enjoy/lib/whisper.cpp/x64/win32/whisper.dll index e94b0f11..addfc979 100644 Binary files a/enjoy/lib/whisper.cpp/x64/win32/whisper.dll and b/enjoy/lib/whisper.cpp/x64/win32/whisper.dll differ diff --git a/enjoy/src/i18n/en.json b/enjoy/src/i18n/en.json index 31752947..14fa5daa 100644 --- a/enjoy/src/i18n/en.json +++ b/enjoy/src/i18n/en.json @@ -178,6 +178,7 @@ "failedToLogin": "Failed to login", "invalidRedirectUrl": "Invalid redirect url", "transcribe": "Transcribe", + "stillTranscribing": "AI is still working on the transcription. Please wait or switch to a smaller model to make it faster.", "unableToSetLibraryPath": "Unable to set library path to {{path}}", "nthStep": "{{current}}/{{totalSteps}} Step", "open": "Open", @@ -265,6 +266,7 @@ "allResources": "all resources", "playbackRate": "playback rate", "transcription": "transcription", + "transcript": "transcript", "regenerate": "regenerate", "holdAndSpeak": "Hold and speak", "releaseToStop": "Release to stop", diff --git a/enjoy/src/i18n/zh-CN.json b/enjoy/src/i18n/zh-CN.json index f0b6e705..a60f1171 100644 --- a/enjoy/src/i18n/zh-CN.json +++ b/enjoy/src/i18n/zh-CN.json @@ -178,6 +178,7 @@ "invalidRedirectUrl": "无效的重定向 URL", "delete": "删除", "transcribe": "语音转文本", + "stillTranscribing": "语音转文本仍在进行中,请耐心等候。或者您可以切换到另一个更小的模型以加快速度。", "unableToSetLibraryPath": "无法设置资源库保存路径 {{path}}", "nthStep": "第 {{current}}/{{totalSteps}} 步", "open": "打开", @@ -265,6 +266,7 @@ "allResources": "所有资源", "playbackRate": "播放速度", "transcription": "语音文本", + "transcript": "字幕", "regenerate": "重新生成", "holdAndSpeak": "按住并说话", "releaseToStop": "松开停止", diff --git a/enjoy/src/main/db/handlers/audios-handler.ts b/enjoy/src/main/db/handlers/audios-handler.ts index 3b3ecd0a..20a70a03 100644 --- a/enjoy/src/main/db/handlers/audios-handler.ts +++ b/enjoy/src/main/db/handlers/audios-handler.ts @@ -80,12 +80,24 @@ class AudiosHandler { }); } - audio.transcribe().catch((err) => { + const timeout = setTimeout(() => { event.sender.send("on-notification", { - type: "error", - message: err.message, + type: "warning", + message: t("stillTranscribing"), + }); + }, 1000 * 10); + + audio + .transcribe() + .catch((err) => { + event.sender.send("on-notification", { + type: "error", + message: err.message, + }); + }) + .finally(() => { + clearTimeout(timeout); }); - }); } private async create( diff --git a/enjoy/src/main/db/handlers/transcriptions-handler.ts b/enjoy/src/main/db/handlers/transcriptions-handler.ts index 31e63dab..3dc3e21a 100644 --- a/enjoy/src/main/db/handlers/transcriptions-handler.ts +++ b/enjoy/src/main/db/handlers/transcriptions-handler.ts @@ -1,6 +1,7 @@ import { ipcMain, IpcMainEvent } from "electron"; import { Transcription, Audio, Video } from "@main/db/models"; import { WhereOptions, Attributes } from "sequelize"; +import { t } from "i18next"; import log from "electron-log/main"; const logger = log.scope("db/handlers/transcriptions-handler"); @@ -30,12 +31,24 @@ class TranscriptionsHandler { }); if (transcription.state === "pending") { - transcription.process().catch((err) => { + const timeout = setTimeout(() => { event.sender.send("on-notification", { - type: "error", - message: err.message, + 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(); @@ -86,7 +99,24 @@ class TranscriptionsHandler { throw new Error("models.transcription.notFound"); } - transcription.process({ force: true }); + const timeout = setTimeout(() => { + event.sender.send("on-notification", { + type: "warning", + message: t("stillTranscribing"), + }); + }, 1000 * 10); + + transcription + .process({ force: true }) + .catch((err) => { + event.sender.send("on-notification", { + type: "error", + message: err.message, + }); + }) + .finally(() => { + clearTimeout(timeout); + }); }) .catch((err) => { logger.error(err); diff --git a/enjoy/src/main/db/handlers/videos-handler.ts b/enjoy/src/main/db/handlers/videos-handler.ts index 546e7a88..10988854 100644 --- a/enjoy/src/main/db/handlers/videos-handler.ts +++ b/enjoy/src/main/db/handlers/videos-handler.ts @@ -80,12 +80,24 @@ class VideosHandler { }); } - video.transcribe().catch((err) => { + const timeout = setTimeout(() => { event.sender.send("on-notification", { - type: "error", - message: err.message, + type: "warning", + message: t("stillTranscribing"), + }); + }, 1000 * 10); + + video + .transcribe() + .catch((err) => { + event.sender.send("on-notification", { + type: "error", + message: err.message, + }); + }) + .finally(() => { + clearTimeout(timeout); }); - }); } private async create( diff --git a/enjoy/src/main/db/index.ts b/enjoy/src/main/db/index.ts index e183c70f..fe5d0c6d 100644 --- a/enjoy/src/main/db/index.ts +++ b/enjoy/src/main/db/index.ts @@ -65,19 +65,20 @@ db.connect = async () => { await sequelize.sync(); await sequelize.authenticate(); - // TODO: - // clear the large waveform data in DB. - // Remove this in next release - const caches = await CacheObject.findAll({ - attributes: ["id", "key"], + // kill the zombie transcribe processes + Transcription.findAll({ + where: { + state: "processing", + }, + }).then((transcriptions) => { + transcriptions.forEach((transcription) => { + if (transcription.result) { + transcription.update({ state: "finished" }); + } else { + transcription.update({ state: "pending" }); + } + }); }); - const cacheIds: string[] = []; - caches.forEach((cache) => { - if (cache.key.startsWith("waveform")) { - cacheIds.push(cache.id); - } - }); - await CacheObject.destroy({ where: { id: cacheIds } }); // vacuum the database await sequelize.query("VACUUM"); diff --git a/enjoy/src/main/db/models/audio.ts b/enjoy/src/main/db/models/audio.ts index d678f4bd..b5c17ee6 100644 --- a/enjoy/src/main/db/models/audio.ts +++ b/enjoy/src/main/db/models/audio.ts @@ -257,6 +257,16 @@ export class Audio extends Model