diff --git a/enjoy/src/main.ts b/enjoy/src/main.ts
index ac9d7b0a..53ae17fd 100644
--- a/enjoy/src/main.ts
+++ b/enjoy/src/main.ts
@@ -14,7 +14,7 @@ log.errorHandler.startCatching();
// Fix "getRandomValues() not supported"
global.crypto = crypto;
-app.commandLine.appendSwitch('enable-features','SharedArrayBuffer')
+app.commandLine.appendSwitch("enable-features", "SharedArrayBuffer");
// Handle creating/removing shortcuts on Windows when installing/uninstalling.
if (require("electron-squirrel-startup")) {
@@ -58,7 +58,7 @@ app.on("ready", async () => {
// for applications and their menu bar to stay active until the user quits
// explicitly with Cmd + Q.
app.on("window-all-closed", () => {
- app.quit();
+ app.quit();
});
app.on("activate", () => {
diff --git a/enjoy/src/main/db/models/audio.ts b/enjoy/src/main/db/models/audio.ts
index ae4cfd78..ff901df9 100644
--- a/enjoy/src/main/db/models/audio.ts
+++ b/enjoy/src/main/db/models/audio.ts
@@ -16,7 +16,7 @@ import {
} from "sequelize-typescript";
import { Recording, Speech, Transcription, Video } from "@main/db/models";
import settings from "@main/settings";
-import { AudioFormats, VideoFormats } from "@/constants";
+import { AudioFormats, VideoFormats , WEB_API_URL } from "@/constants";
import { hashFile } from "@/utils";
import path from "path";
import fs from "fs-extra";
@@ -26,7 +26,6 @@ import log from "electron-log/main";
import storage from "@main/storage";
import Ffmpeg from "@main/ffmpeg";
import { Client } from "@/api";
-import { WEB_API_URL } from "@/constants";
import startCase from "lodash/startCase";
import { v5 as uuidv5 } from "uuid";
diff --git a/enjoy/src/main/db/models/video.ts b/enjoy/src/main/db/models/video.ts
index 1b409d6f..d5f35183 100644
--- a/enjoy/src/main/db/models/video.ts
+++ b/enjoy/src/main/db/models/video.ts
@@ -16,7 +16,7 @@ import {
} from "sequelize-typescript";
import { Audio, Recording, Speech, Transcription } from "@main/db/models";
import settings from "@main/settings";
-import { AudioFormats, VideoFormats } from "@/constants";
+import { AudioFormats, VideoFormats , WEB_API_URL } from "@/constants";
import { hashFile } from "@/utils";
import path from "path";
import fs from "fs-extra";
@@ -26,7 +26,6 @@ import log from "electron-log/main";
import storage from "@main/storage";
import Ffmpeg from "@main/ffmpeg";
import { Client } from "@/api";
-import { WEB_API_URL } from "@/constants";
import startCase from "lodash/startCase";
import { v5 as uuidv5 } from "uuid";
diff --git a/enjoy/src/main/ffmpeg.ts b/enjoy/src/main/ffmpeg.ts
index 4a24a490..35cf7dc9 100644
--- a/enjoy/src/main/ffmpeg.ts
+++ b/enjoy/src/main/ffmpeg.ts
@@ -9,7 +9,7 @@ import downloader from "@main/downloader";
import storage from "@main/storage";
import readdirp from "readdirp";
import { t } from "i18next";
-import uniq from "lodash/uniq";
+import uniq from "lodash/uniq";
const logger = log.scope("ffmpeg");
export default class FfmpegWrapper {
diff --git a/enjoy/src/main/whisper.ts b/enjoy/src/main/whisper.ts
index 31b86903..e54fd5a1 100644
--- a/enjoy/src/main/whisper.ts
+++ b/enjoy/src/main/whisper.ts
@@ -5,7 +5,7 @@ import {
WHISPER_MODELS_OPTIONS,
PROCESS_TIMEOUT,
AI_WORKER_ENDPOINT,
-} from "@/constants";
+ WEB_API_URL } from "@/constants";
import { exec } from "child_process";
import fs from "fs-extra";
import log from "electron-log/main";
@@ -14,7 +14,6 @@ import axios from "axios";
import { milisecondsToTimestamp } from "@/utils";
import { AzureSpeechSdk } from "@main/azure-speech-sdk";
import { Client } from "@/api";
-import { WEB_API_URL } from "@/constants";
import take from "lodash/take";
import sortedUniqBy from "lodash/sortedUniqBy";
diff --git a/enjoy/src/main/window.ts b/enjoy/src/main/window.ts
index b913db4b..672faa32 100644
--- a/enjoy/src/main/window.ts
+++ b/enjoy/src/main/window.ts
@@ -225,6 +225,7 @@ main.init = () => {
const bounds = view.getBounds();
logger.debug("current view bounds", bounds);
+ if (bounds.width === 0 && bounds.height === 0) return;
view.setBounds({
x: -Math.round(bounds.width),
diff --git a/enjoy/src/renderer/components/lookup-result.tsx b/enjoy/src/renderer/components/lookup-result.tsx
index 0cd454ca..c29a621e 100644
--- a/enjoy/src/renderer/components/lookup-result.tsx
+++ b/enjoy/src/renderer/components/lookup-result.tsx
@@ -1,6 +1,6 @@
import { useState, useEffect } from "react";
import { LoaderSpin, MeaningCard } from "@renderer/components";
-import { Button } from "@renderer/components/ui";
+import { Button, toast } from "@renderer/components/ui";
import { t } from "i18next";
import { XCircleIcon } from "lucide-react";
import { useAiCommand } from "@renderer/hooks";
@@ -36,6 +36,9 @@ export const LookupResult = (props: {
onResult && onResult(lookup.meaning);
}
})
+ .catch((error) => {
+ toast.error(error.message);
+ })
.finally(() => {
setLoading(false);
});
diff --git a/enjoy/src/renderer/components/medias/media-player-controls.tsx b/enjoy/src/renderer/components/medias/media-player-controls.tsx
index cf8e3205..dade06a7 100644
--- a/enjoy/src/renderer/components/medias/media-player-controls.tsx
+++ b/enjoy/src/renderer/components/medias/media-player-controls.tsx
@@ -319,7 +319,7 @@ export const MediaPlayerControls = (props: {
-
{sentences.map((sentence, i: number) => { - if (sentence.text.match(/\!\[\]\(\S+\)/g)) { - const [img] = sentence.text.match(/\!\[\]\(\S+\)/g); - const src = img.replace(/\!\[\]\(/g, "").replace(/\)/g, ""); + if (sentence.text.match(/!\[\]\(\S+\)/g)) { + const [img] = sentence.text.match(/!\[\]\(\S+\)/g); + const src = img.replace(/!\[\]\(/g, "").replace(/\)/g, ""); return (
diff --git a/enjoy/src/renderer/components/stories/story-viewer.tsx b/enjoy/src/renderer/components/stories/story-viewer.tsx
index 890dc9e6..e067d009 100644
--- a/enjoy/src/renderer/components/stories/story-viewer.tsx
+++ b/enjoy/src/renderer/components/stories/story-viewer.tsx
@@ -54,7 +54,7 @@ export const StoryViewer = (props: {
const word = selection
.toString()
.trim()
- .replace(/[.,\/#!$%\^&\*;:{}=\-_`~()]+$/, "");
+ .replace(/[.,/#!$%^&*;:{}=\-_`~()]+$/, "");
if (!word) return;
const position = {
@@ -152,9 +152,9 @@ export const StoryViewer = (props: {
{paragraphs.map((sentences, i: number) => (
{sentences.map((sentence, j: number) => {
- if (sentence.text.match(/\!\[\]\(\S+\)/g)) {
- const [img] = sentence.text.match(/\!\[\]\(\S+\)/g);
- const src = img.replace(/\!\[\]\(/g, "").replace(/\)/g, "");
+ if (sentence.text.match(/!\[\]\(\S+\)/g)) {
+ const [img] = sentence.text.match(/!\[\]\(\S+\)/g);
+ const src = img.replace(/!\[\]\(/g, "").replace(/\)/g, "");
return ;
} else {
return (
diff --git a/enjoy/src/renderer/hooks/useAiCommand.tsx b/enjoy/src/renderer/hooks/useAiCommand.tsx
index 0ea840be..a4b34d30 100644
--- a/enjoy/src/renderer/hooks/useAiCommand.tsx
+++ b/enjoy/src/renderer/hooks/useAiCommand.tsx
@@ -9,8 +9,6 @@ import {
translateCommand,
ipaCommand,
} from "@commands";
-import { toast } from "@renderer/components/ui";
-import { t } from "i18next";
import { md5 } from "js-md5";
export const useAiCommand = () => {
diff --git a/enjoy/src/renderer/hooks/useConversation.tsx b/enjoy/src/renderer/hooks/useConversation.tsx
index 1f5f771d..e1687cfc 100644
--- a/enjoy/src/renderer/hooks/useConversation.tsx
+++ b/enjoy/src/renderer/hooks/useConversation.tsx
@@ -9,7 +9,7 @@ import { ChatOpenAI } from "langchain/chat_models/openai";
import { ChatOllama } from "langchain/chat_models/ollama";
import { ChatGoogleGenerativeAI } from "@langchain/google-genai";
import { ChatPromptTemplate, MessagesPlaceholder } from "langchain/prompts";
-import OpenAI, { type ClientOptions } from "openai";
+import OpenAI from "openai";
import { type Generation } from "langchain/dist/schema";
import { v4 } from "uuid";
@@ -124,7 +124,7 @@ export const useConversation = () => {
const llm = pickLlm(conversation);
const chain = new ConversationChain({
- // @ts-ignore
+ // @ts-expect-error
llm,
memory,
prompt,
diff --git a/enjoy/src/renderer/pages/conversation.tsx b/enjoy/src/renderer/pages/conversation.tsx
index b1bdeb07..64301bd5 100644
--- a/enjoy/src/renderer/pages/conversation.tsx
+++ b/enjoy/src/renderer/pages/conversation.tsx
@@ -23,7 +23,7 @@ import { useConversation } from "@renderer/hooks";
export default () => {
const { id } = useParams<{ id: string }>();
- const [searchParams, _] = useSearchParams();
+ const [searchParams] = useSearchParams();
const [editting, setEditting] = useState