diff --git a/core/src/node/api/restful/helper/builder.ts b/core/src/node/api/restful/helper/builder.ts index d0247c64c9..cd121cdb7e 100644 --- a/core/src/node/api/restful/helper/builder.ts +++ b/core/src/node/api/restful/helper/builder.ts @@ -335,7 +335,6 @@ export const chatCompletions = async (request: any, reply: any) => { headers['Authorization'] = `Bearer ${apiKey}` headers['api-key'] = apiKey } - console.debug(apiUrl) if (requestedModel.engine === 'openai' && request.body.stop) { // openai only allows max 4 stop words diff --git a/electron/managers/window.ts b/electron/managers/window.ts index 2faa794c98..8c7348651c 100644 --- a/electron/managers/window.ts +++ b/electron/managers/window.ts @@ -94,8 +94,10 @@ class WindowManager { } closeQuickAskWindow(): void { + if (this._quickAskWindow?.isDestroyed()) return this._quickAskWindow?.close() this._quickAskWindow?.destroy() + this._quickAskWindow = undefined this._quickAskWindowVisible = false } @@ -122,14 +124,18 @@ class WindowManager { } cleanUp(): void { - this.mainWindow?.close() - this.mainWindow?.destroy() - this.mainWindow = undefined - this._quickAskWindow?.close() - this._quickAskWindow?.destroy() - this._quickAskWindow = undefined - this._quickAskWindowVisible = false - this._mainWindowVisible = false + if (!this.mainWindow?.isDestroyed()) { + this.mainWindow?.close() + this.mainWindow?.destroy() + this.mainWindow = undefined + this._mainWindowVisible = false + } + if (!this._quickAskWindow?.isDestroyed()) { + this._quickAskWindow?.close() + this._quickAskWindow?.destroy() + this._quickAskWindow = undefined + this._quickAskWindowVisible = false + } } } diff --git a/web/hooks/useCreateNewThread.ts b/web/hooks/useCreateNewThread.ts index 9b4e4261ea..ef57bc982d 100644 --- a/web/hooks/useCreateNewThread.ts +++ b/web/hooks/useCreateNewThread.ts @@ -9,8 +9,6 @@ import { ThreadState, Model, AssistantTool, - events, - InferenceEvent, } from '@janhq/core' import { atom, useAtomValue, useSetAtom } from 'jotai' diff --git a/web/screens/Chat/ChatInput/index.tsx b/web/screens/Chat/ChatInput/index.tsx index f6fd299b9b..3dd53e01ee 100644 --- a/web/screens/Chat/ChatInput/index.tsx +++ b/web/screens/Chat/ChatInput/index.tsx @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { useEffect, useRef, useState } from 'react' -import { InferenceEvent, MessageStatus, events } from '@janhq/core' +import { MessageStatus } from '@janhq/core' import { Textarea, @@ -44,7 +44,7 @@ import { const ChatInput: React.FC = () => { const activeThread = useAtomValue(activeThreadAtom) - const { stateModel, activeModel } = useActiveModel() + const { stateModel } = useActiveModel() const messages = useAtomValue(getCurrentChatMessagesAtom) const [currentPrompt, setCurrentPrompt] = useAtom(currentPromptAtom) diff --git a/web/screens/Chat/EditChatInput/index.tsx b/web/screens/Chat/EditChatInput/index.tsx index 543817c6b0..fba4b0b8a7 100644 --- a/web/screens/Chat/EditChatInput/index.tsx +++ b/web/screens/Chat/EditChatInput/index.tsx @@ -4,10 +4,8 @@ import { useEffect, useRef, useState } from 'react' import { ConversationalExtension, ExtensionTypeEnum, - InferenceEvent, MessageStatus, ThreadMessage, - events, } from '@janhq/core' import {