lint: fix eslint error
This commit is contained in:
parent
3290ac4b1b
commit
9c6de71fbb
@ -42,7 +42,12 @@ export default defineConfig({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
preload: {
|
preload: {
|
||||||
plugins: [externalizeDepsPlugin()]
|
plugins: [externalizeDepsPlugin()],
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
'@shared': resolve('packages/shared')
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
renderer: {
|
renderer: {
|
||||||
plugins: [
|
plugins: [
|
||||||
@ -70,7 +75,7 @@ export default defineConfig({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
optimizeDeps: {
|
optimizeDeps: {
|
||||||
exclude: ['chunk-PZ64DZKH.js', 'chunk-JMKENWIY.js', 'chunk-UXYB6GHG.js', 'chunk-ALDIEZMG.js', 'chunk-4X6ZJEXY.js']
|
exclude: []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -146,5 +146,5 @@ export enum IpcChannel {
|
|||||||
MiniWindowReload = 'miniwindow-reload',
|
MiniWindowReload = 'miniwindow-reload',
|
||||||
|
|
||||||
ReduxStateChange = 'redux-state-change',
|
ReduxStateChange = 'redux-state-change',
|
||||||
ReduxStoreReady = 'redux-store-ready',
|
ReduxStoreReady = 'redux-store-ready'
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import { electronApp, optimizer } from '@electron-toolkit/utils'
|
import { electronApp, optimizer } from '@electron-toolkit/utils'
|
||||||
import { replaceDevtoolsFont } from '@main/utils/windowUtil'
|
import { replaceDevtoolsFont } from '@main/utils/windowUtil'
|
||||||
|
import { IpcChannel } from '@shared/IpcChannel'
|
||||||
import { app, ipcMain } from 'electron'
|
import { app, ipcMain } from 'electron'
|
||||||
import installExtension, { REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS } from 'electron-devtools-installer'
|
import installExtension, { REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS } from 'electron-devtools-installer'
|
||||||
|
|
||||||
@ -9,7 +10,6 @@ import { CHERRY_STUDIO_PROTOCOL, handleProtocolUrl, registerProtocolClient } fro
|
|||||||
import { registerShortcuts } from './services/ShortcutService'
|
import { registerShortcuts } from './services/ShortcutService'
|
||||||
import { TrayService } from './services/TrayService'
|
import { TrayService } from './services/TrayService'
|
||||||
import { windowService } from './services/WindowService'
|
import { windowService } from './services/WindowService'
|
||||||
import { IpcChannel } from '@shared/IpcChannel'
|
|
||||||
|
|
||||||
// Check for single instance lock
|
// Check for single instance lock
|
||||||
if (!app.requestSingleInstanceLock()) {
|
if (!app.requestSingleInstanceLock()) {
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import fs from 'node:fs'
|
|||||||
|
|
||||||
import { isMac, isWin } from '@main/constant'
|
import { isMac, isWin } from '@main/constant'
|
||||||
import { getBinaryPath, isBinaryExists, runInstallScript } from '@main/utils/process'
|
import { getBinaryPath, isBinaryExists, runInstallScript } from '@main/utils/process'
|
||||||
|
import { IpcChannel } from '@shared/IpcChannel'
|
||||||
import { Shortcut, ThemeMode } from '@types'
|
import { Shortcut, ThemeMode } from '@types'
|
||||||
import { BrowserWindow, ipcMain, session, shell } from 'electron'
|
import { BrowserWindow, ipcMain, session, shell } from 'electron'
|
||||||
import log from 'electron-log'
|
import log from 'electron-log'
|
||||||
@ -27,7 +28,6 @@ import { getResourcePath } from './utils'
|
|||||||
import { decrypt, encrypt } from './utils/aes'
|
import { decrypt, encrypt } from './utils/aes'
|
||||||
import { getFilesDir } from './utils/file'
|
import { getFilesDir } from './utils/file'
|
||||||
import { compress, decompress } from './utils/zip'
|
import { compress, decompress } from './utils/zip'
|
||||||
import { IpcChannel } from '@shared/IpcChannel'
|
|
||||||
|
|
||||||
const fileManager = new FileStorage()
|
const fileManager = new FileStorage()
|
||||||
const backupManager = new BackupManager()
|
const backupManager = new BackupManager()
|
||||||
@ -303,11 +303,3 @@ export function registerIpc(mainWindow: BrowserWindow, app: Electron.App) {
|
|||||||
NutstoreService.getDirectoryContents(token, path)
|
NutstoreService.getDirectoryContents(token, path)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Listen for changes in MCP servers and notify renderer
|
|
||||||
mcpService.on('servers-updated', (servers) => {
|
|
||||||
mainWindow?.webContents.send(IpcChannel.Mcp_ServersUpdated, servers)
|
|
||||||
})
|
|
||||||
|
|
||||||
app.on('before-quit', () => mcpService.cleanup())
|
|
||||||
|
|
||||||
@ -1,10 +1,10 @@
|
|||||||
|
import { IpcChannel } from '@shared/IpcChannel'
|
||||||
import { UpdateInfo } from 'builder-util-runtime'
|
import { UpdateInfo } from 'builder-util-runtime'
|
||||||
import { app, BrowserWindow, dialog } from 'electron'
|
import { app, BrowserWindow, dialog } from 'electron'
|
||||||
import logger from 'electron-log'
|
import logger from 'electron-log'
|
||||||
import { AppUpdater as _AppUpdater, autoUpdater } from 'electron-updater'
|
import { AppUpdater as _AppUpdater, autoUpdater } from 'electron-updater'
|
||||||
|
|
||||||
import icon from '../../../build/icon.png?asset'
|
import icon from '../../../build/icon.png?asset'
|
||||||
import { IpcChannel } from '@shared/IpcChannel'
|
|
||||||
|
|
||||||
export default class AppUpdater {
|
export default class AppUpdater {
|
||||||
autoUpdater: _AppUpdater = autoUpdater
|
autoUpdater: _AppUpdater = autoUpdater
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import { IpcChannel } from '@shared/IpcChannel'
|
||||||
import { WebDavConfig } from '@types'
|
import { WebDavConfig } from '@types'
|
||||||
import AdmZip from 'adm-zip'
|
import AdmZip from 'adm-zip'
|
||||||
import { exec } from 'child_process'
|
import { exec } from 'child_process'
|
||||||
@ -9,7 +10,6 @@ import { createClient, CreateDirectoryOptions, FileStat } from 'webdav'
|
|||||||
|
|
||||||
import WebDav from './WebDav'
|
import WebDav from './WebDav'
|
||||||
import { windowService } from './WindowService'
|
import { windowService } from './WindowService'
|
||||||
import { IpcChannel } from '@shared/IpcChannel'
|
|
||||||
|
|
||||||
class BackupManager {
|
class BackupManager {
|
||||||
private tempDir = path.join(app.getPath('temp'), 'cherry-studio', 'backup', 'temp')
|
private tempDir = path.join(app.getPath('temp'), 'cherry-studio', 'backup', 'temp')
|
||||||
|
|||||||
@ -26,13 +26,13 @@ import { addFileLoader } from '@main/loader'
|
|||||||
import Reranker from '@main/reranker/Reranker'
|
import Reranker from '@main/reranker/Reranker'
|
||||||
import { windowService } from '@main/services/WindowService'
|
import { windowService } from '@main/services/WindowService'
|
||||||
import { getAllFiles } from '@main/utils/file'
|
import { getAllFiles } from '@main/utils/file'
|
||||||
|
import { MB } from '@shared/config/constant'
|
||||||
import type { LoaderReturn } from '@shared/config/types'
|
import type { LoaderReturn } from '@shared/config/types'
|
||||||
|
import { IpcChannel } from '@shared/IpcChannel'
|
||||||
import { FileType, KnowledgeBaseParams, KnowledgeItem } from '@types'
|
import { FileType, KnowledgeBaseParams, KnowledgeItem } from '@types'
|
||||||
import { app } from 'electron'
|
import { app } from 'electron'
|
||||||
import Logger from 'electron-log'
|
import Logger from 'electron-log'
|
||||||
import { v4 as uuidv4 } from 'uuid'
|
import { v4 as uuidv4 } from 'uuid'
|
||||||
import { IpcChannel } from '@shared/IpcChannel'
|
|
||||||
import { MB } from '@shared/config/constant'
|
|
||||||
|
|
||||||
export interface KnowledgeBaseAddItemOptions {
|
export interface KnowledgeBaseAddItemOptions {
|
||||||
base: KnowledgeBaseParams
|
base: KnowledgeBaseParams
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
|
import { IpcChannel } from '@shared/IpcChannel'
|
||||||
import { ipcMain } from 'electron'
|
import { ipcMain } from 'electron'
|
||||||
import { EventEmitter } from 'events'
|
import { EventEmitter } from 'events'
|
||||||
|
|
||||||
import { windowService } from './WindowService'
|
import { windowService } from './WindowService'
|
||||||
import { IpcChannel } from '@shared/IpcChannel'
|
|
||||||
|
|
||||||
type StoreValue = any
|
type StoreValue = any
|
||||||
type Unsubscribe = () => void
|
type Unsubscribe = () => void
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { is } from '@electron-toolkit/utils'
|
import { is } from '@electron-toolkit/utils'
|
||||||
import { isDev, isLinux, isMac, isWin } from '@main/constant'
|
import { isDev, isLinux, isMac, isWin } from '@main/constant'
|
||||||
import { getFilesDir } from '@main/utils/file'
|
import { getFilesDir } from '@main/utils/file'
|
||||||
|
import { IpcChannel } from '@shared/IpcChannel'
|
||||||
import { app, BrowserWindow, ipcMain, Menu, MenuItem, shell } from 'electron'
|
import { app, BrowserWindow, ipcMain, Menu, MenuItem, shell } from 'electron'
|
||||||
import Logger from 'electron-log'
|
import Logger from 'electron-log'
|
||||||
import windowStateKeeper from 'electron-window-state'
|
import windowStateKeeper from 'electron-window-state'
|
||||||
@ -10,7 +11,6 @@ import icon from '../../../build/icon.png?asset'
|
|||||||
import { titleBarOverlayDark, titleBarOverlayLight } from '../config'
|
import { titleBarOverlayDark, titleBarOverlayLight } from '../config'
|
||||||
import { locales } from '../utils/locales'
|
import { locales } from '../utils/locales'
|
||||||
import { configManager } from './ConfigManager'
|
import { configManager } from './ConfigManager'
|
||||||
import { IpcChannel } from '@shared/IpcChannel'
|
|
||||||
|
|
||||||
export class WindowService {
|
export class WindowService {
|
||||||
private static instance: WindowService | null = null
|
private static instance: WindowService | null = null
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import type { ExtractChunkData } from '@cherrystudio/embedjs-interfaces'
|
import type { ExtractChunkData } from '@cherrystudio/embedjs-interfaces'
|
||||||
import { electronAPI } from '@electron-toolkit/preload'
|
import { electronAPI } from '@electron-toolkit/preload'
|
||||||
|
import { IpcChannel } from '@shared/IpcChannel'
|
||||||
import { FileType, KnowledgeBaseParams, KnowledgeItem, MCPServer, Shortcut, WebDavConfig } from '@types'
|
import { FileType, KnowledgeBaseParams, KnowledgeItem, MCPServer, Shortcut, WebDavConfig } from '@types'
|
||||||
import { contextBridge, ipcRenderer, OpenDialogOptions, shell } from 'electron'
|
import { contextBridge, ipcRenderer, OpenDialogOptions, shell } from 'electron'
|
||||||
import { CreateDirectoryOptions } from 'webdav'
|
import { CreateDirectoryOptions } from 'webdav'
|
||||||
import { IpcChannel } from '@shared/IpcChannel'
|
|
||||||
|
|
||||||
// Custom APIs for renderer
|
// Custom APIs for renderer
|
||||||
const api = {
|
const api = {
|
||||||
@ -35,9 +35,12 @@ const api = {
|
|||||||
restore: (backupPath: string) => ipcRenderer.invoke(IpcChannel.Backup_Restore, backupPath),
|
restore: (backupPath: string) => ipcRenderer.invoke(IpcChannel.Backup_Restore, backupPath),
|
||||||
backupToWebdav: (data: string, webdavConfig: WebDavConfig) =>
|
backupToWebdav: (data: string, webdavConfig: WebDavConfig) =>
|
||||||
ipcRenderer.invoke(IpcChannel.Backup_BackupToWebdav, data, webdavConfig),
|
ipcRenderer.invoke(IpcChannel.Backup_BackupToWebdav, data, webdavConfig),
|
||||||
restoreFromWebdav: (webdavConfig: WebDavConfig) => ipcRenderer.invoke(IpcChannel.Backup_RestoreFromWebdav, webdavConfig),
|
restoreFromWebdav: (webdavConfig: WebDavConfig) =>
|
||||||
listWebdavFiles: (webdavConfig: WebDavConfig) => ipcRenderer.invoke(IpcChannel.Backup_ListWebdavFiles, webdavConfig),
|
ipcRenderer.invoke(IpcChannel.Backup_RestoreFromWebdav, webdavConfig),
|
||||||
checkConnection: (webdavConfig: WebDavConfig) => ipcRenderer.invoke(IpcChannel.Backup_CheckConnection, webdavConfig),
|
listWebdavFiles: (webdavConfig: WebDavConfig) =>
|
||||||
|
ipcRenderer.invoke(IpcChannel.Backup_ListWebdavFiles, webdavConfig),
|
||||||
|
checkConnection: (webdavConfig: WebDavConfig) =>
|
||||||
|
ipcRenderer.invoke(IpcChannel.Backup_CheckConnection, webdavConfig),
|
||||||
createDirectory: (webdavConfig: WebDavConfig, path: string, options?: CreateDirectoryOptions) =>
|
createDirectory: (webdavConfig: WebDavConfig, path: string, options?: CreateDirectoryOptions) =>
|
||||||
ipcRenderer.invoke(IpcChannel.Backup_CreateDirectory, webdavConfig, path, options)
|
ipcRenderer.invoke(IpcChannel.Backup_CreateDirectory, webdavConfig, path, options)
|
||||||
},
|
},
|
||||||
@ -114,7 +117,7 @@ const api = {
|
|||||||
show: () => ipcRenderer.invoke(IpcChannel.MiniWindow_Show),
|
show: () => ipcRenderer.invoke(IpcChannel.MiniWindow_Show),
|
||||||
hide: () => ipcRenderer.invoke(IpcChannel.MiniWindow_Hide),
|
hide: () => ipcRenderer.invoke(IpcChannel.MiniWindow_Hide),
|
||||||
close: () => ipcRenderer.invoke(IpcChannel.MiniWindow_Close),
|
close: () => ipcRenderer.invoke(IpcChannel.MiniWindow_Close),
|
||||||
toggle: () => ipcRenderer.invoke(IpcChannel.MiniWindow_Toggle)
|
toggle: () => ipcRenderer.invoke(IpcChannel.MiniWindow_Toggle),
|
||||||
setPin: (isPinned: boolean) => ipcRenderer.invoke(IpcChannel.MiniWindow_SetPin, isPinned)
|
setPin: (isPinned: boolean) => ipcRenderer.invoke(IpcChannel.MiniWindow_SetPin, isPinned)
|
||||||
},
|
},
|
||||||
aes: {
|
aes: {
|
||||||
@ -150,7 +153,7 @@ const api = {
|
|||||||
isBinaryExist: (name: string) => ipcRenderer.invoke(IpcChannel.App_IsBinaryExist, name),
|
isBinaryExist: (name: string) => ipcRenderer.invoke(IpcChannel.App_IsBinaryExist, name),
|
||||||
getBinaryPath: (name: string) => ipcRenderer.invoke(IpcChannel.App_GetBinaryPath, name),
|
getBinaryPath: (name: string) => ipcRenderer.invoke(IpcChannel.App_GetBinaryPath, name),
|
||||||
installUVBinary: () => ipcRenderer.invoke(IpcChannel.App_InstallUvBinary),
|
installUVBinary: () => ipcRenderer.invoke(IpcChannel.App_InstallUvBinary),
|
||||||
installBunBinary: () => ipcRenderer.invoke(IpcChannel.App_InstallBunBinary)
|
installBunBinary: () => ipcRenderer.invoke(IpcChannel.App_InstallBunBinary),
|
||||||
protocol: {
|
protocol: {
|
||||||
onReceiveData: (callback: (data: { url: string; params: any }) => void) => {
|
onReceiveData: (callback: (data: { url: string; params: any }) => void) => {
|
||||||
const listener = (_event: Electron.IpcRendererEvent, data: { url: string; params: any }) => {
|
const listener = (_event: Electron.IpcRendererEvent, data: { url: string; params: any }) => {
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
import { backup } from '@renderer/services/BackupService'
|
import { backup } from '@renderer/services/BackupService'
|
||||||
|
import { IpcChannel } from '@shared/IpcChannel'
|
||||||
import { Modal, Progress } from 'antd'
|
import { Modal, Progress } from 'antd'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
|
|
||||||
import { TopView } from '../TopView'
|
import { TopView } from '../TopView'
|
||||||
import { IpcChannel } from '@shared/IpcChannel'
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
resolve: (data: any) => void
|
resolve: (data: any) => void
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
import { restore } from '@renderer/services/BackupService'
|
import { restore } from '@renderer/services/BackupService'
|
||||||
|
import { IpcChannel } from '@shared/IpcChannel'
|
||||||
import { Modal, Progress } from 'antd'
|
import { Modal, Progress } from 'antd'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
|
|
||||||
import { TopView } from '../TopView'
|
import { TopView } from '../TopView'
|
||||||
import { IpcChannel } from '@shared/IpcChannel'
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
resolve: (data: any) => void
|
resolve: (data: any) => void
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
import { isMac } from '@renderer/config/constant'
|
import { isMac } from '@renderer/config/constant'
|
||||||
import { useSettings } from '@renderer/hooks/useSettings'
|
import { useSettings } from '@renderer/hooks/useSettings'
|
||||||
import { ThemeMode } from '@renderer/types'
|
import { ThemeMode } from '@renderer/types'
|
||||||
import React, { createContext, PropsWithChildren, use, useEffect, useState } from 'react'
|
|
||||||
import { IpcChannel } from '@shared/IpcChannel'
|
import { IpcChannel } from '@shared/IpcChannel'
|
||||||
|
import React, { createContext, PropsWithChildren, use, useEffect, useState } from 'react'
|
||||||
|
|
||||||
interface ThemeContextType {
|
interface ThemeContextType {
|
||||||
theme: ThemeMode
|
theme: ThemeMode
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import i18n from '@renderer/i18n'
|
|||||||
import { useAppDispatch } from '@renderer/store'
|
import { useAppDispatch } from '@renderer/store'
|
||||||
import { setAvatar, setFilesPath, setResourcesPath, setUpdateState } from '@renderer/store/runtime'
|
import { setAvatar, setFilesPath, setResourcesPath, setUpdateState } from '@renderer/store/runtime'
|
||||||
import { delay, runAsyncFunction } from '@renderer/utils'
|
import { delay, runAsyncFunction } from '@renderer/utils'
|
||||||
|
import { defaultLanguage } from '@shared/config/constant'
|
||||||
import { useLiveQuery } from 'dexie-react-hooks'
|
import { useLiveQuery } from 'dexie-react-hooks'
|
||||||
import { useEffect } from 'react'
|
import { useEffect } from 'react'
|
||||||
|
|
||||||
@ -15,8 +16,6 @@ import { useRuntime } from './useRuntime'
|
|||||||
import { useSettings } from './useSettings'
|
import { useSettings } from './useSettings'
|
||||||
import useUpdateHandler from './useUpdateHandler'
|
import useUpdateHandler from './useUpdateHandler'
|
||||||
|
|
||||||
import { defaultLanguage } from '@shared/config/constant'
|
|
||||||
|
|
||||||
export function useAppInit() {
|
export function useAppInit() {
|
||||||
const dispatch = useAppDispatch()
|
const dispatch = useAppDispatch()
|
||||||
const { proxyUrl, language, windowStyle, autoCheckUpdate, proxyMode, customCss } = useSettings()
|
const { proxyUrl, language, windowStyle, autoCheckUpdate, proxyMode, customCss } = useSettings()
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { isWindows } from '@renderer/config/constant'
|
import { isWindows } from '@renderer/config/constant'
|
||||||
|
import { IpcChannel } from '@shared/IpcChannel'
|
||||||
import { useEffect } from 'react'
|
import { useEffect } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { IpcChannel } from '@shared/IpcChannel'
|
|
||||||
|
|
||||||
export function useFullScreenNotice() {
|
export function useFullScreenNotice() {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
|
|||||||
@ -21,13 +21,13 @@ import {
|
|||||||
} from '@renderer/store/knowledge'
|
} from '@renderer/store/knowledge'
|
||||||
import { FileType, KnowledgeBase, KnowledgeItem, ProcessingStatus } from '@renderer/types'
|
import { FileType, KnowledgeBase, KnowledgeItem, ProcessingStatus } from '@renderer/types'
|
||||||
import { runAsyncFunction } from '@renderer/utils'
|
import { runAsyncFunction } from '@renderer/utils'
|
||||||
|
import { IpcChannel } from '@shared/IpcChannel'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { useDispatch, useSelector } from 'react-redux'
|
import { useDispatch, useSelector } from 'react-redux'
|
||||||
import { v4 as uuidv4 } from 'uuid'
|
import { v4 as uuidv4 } from 'uuid'
|
||||||
|
|
||||||
import { useAgents } from './useAgents'
|
import { useAgents } from './useAgents'
|
||||||
import { useAssistants } from './useAssistant'
|
import { useAssistants } from './useAssistant'
|
||||||
import { IpcChannel } from '@shared/IpcChannel'
|
|
||||||
|
|
||||||
export const useKnowledge = (baseId: string) => {
|
export const useKnowledge = (baseId: string) => {
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import { useAppDispatch } from '@renderer/store'
|
import { useAppDispatch } from '@renderer/store'
|
||||||
import { setUpdateState } from '@renderer/store/runtime'
|
import { setUpdateState } from '@renderer/store/runtime'
|
||||||
|
import { IpcChannel } from '@shared/IpcChannel'
|
||||||
import type { ProgressInfo, UpdateInfo } from 'builder-util-runtime'
|
import type { ProgressInfo, UpdateInfo } from 'builder-util-runtime'
|
||||||
import { useEffect } from 'react'
|
import { useEffect } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { IpcChannel } from '@shared/IpcChannel'
|
|
||||||
|
|
||||||
export default function useUpdateHandler() {
|
export default function useUpdateHandler() {
|
||||||
const dispatch = useAppDispatch()
|
const dispatch = useAppDispatch()
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import { defaultLanguage } from '@shared/config/constant'
|
||||||
import i18n from 'i18next'
|
import i18n from 'i18next'
|
||||||
import { initReactI18next } from 'react-i18next'
|
import { initReactI18next } from 'react-i18next'
|
||||||
|
|
||||||
@ -13,8 +14,6 @@ import esES from './translate/es-es.json'
|
|||||||
import frFR from './translate/fr-fr.json'
|
import frFR from './translate/fr-fr.json'
|
||||||
import ptPT from './translate/pt-pt.json'
|
import ptPT from './translate/pt-pt.json'
|
||||||
|
|
||||||
import { defaultLanguage } from '@shared/config/constant'
|
|
||||||
|
|
||||||
const resources = {
|
const resources = {
|
||||||
'el-GR': elGR,
|
'el-GR': elGR,
|
||||||
'en-US': enUS,
|
'en-US': enUS,
|
||||||
|
|||||||
@ -2,13 +2,13 @@ import { DeleteOutlined } from '@ant-design/icons'
|
|||||||
import type { FileMetadataResponse } from '@google/generative-ai/server'
|
import type { FileMetadataResponse } from '@google/generative-ai/server'
|
||||||
import { useProvider } from '@renderer/hooks/useProvider'
|
import { useProvider } from '@renderer/hooks/useProvider'
|
||||||
import { runAsyncFunction } from '@renderer/utils'
|
import { runAsyncFunction } from '@renderer/utils'
|
||||||
|
import { MB } from '@shared/config/constant'
|
||||||
import { Spin } from 'antd'
|
import { Spin } from 'antd'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import { FC, useCallback, useEffect, useState } from 'react'
|
import { FC, useCallback, useEffect, useState } from 'react'
|
||||||
import styled from 'styled-components'
|
import styled from 'styled-components'
|
||||||
|
|
||||||
import FileItem from './FileItem'
|
import FileItem from './FileItem'
|
||||||
import { MB } from '@shared/config/constant'
|
|
||||||
|
|
||||||
interface GeminiFilesProps {
|
interface GeminiFilesProps {
|
||||||
id: string
|
id: string
|
||||||
|
|||||||
@ -6,12 +6,12 @@ import { setLanguage } from '@renderer/store/settings'
|
|||||||
import { setProxyMode, setProxyUrl as _setProxyUrl } from '@renderer/store/settings'
|
import { setProxyMode, setProxyUrl as _setProxyUrl } from '@renderer/store/settings'
|
||||||
import { LanguageVarious } from '@renderer/types'
|
import { LanguageVarious } from '@renderer/types'
|
||||||
import { isValidProxyUrl } from '@renderer/utils'
|
import { isValidProxyUrl } from '@renderer/utils'
|
||||||
|
import { defaultLanguage } from '@shared/config/constant'
|
||||||
import { Input, Select, Space, Switch } from 'antd'
|
import { Input, Select, Space, Switch } from 'antd'
|
||||||
import { FC, useState } from 'react'
|
import { FC, useState } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
|
|
||||||
import { SettingContainer, SettingDivider, SettingGroup, SettingRow, SettingRowTitle, SettingTitle } from '.'
|
import { SettingContainer, SettingDivider, SettingGroup, SettingRow, SettingRowTitle, SettingTitle } from '.'
|
||||||
import { defaultLanguage } from '@shared/config/constant'
|
|
||||||
|
|
||||||
const GeneralSettings: FC = () => {
|
const GeneralSettings: FC = () => {
|
||||||
const {
|
const {
|
||||||
|
|||||||
@ -38,13 +38,13 @@ import {
|
|||||||
mcpToolsToGeminiTools,
|
mcpToolsToGeminiTools,
|
||||||
upsertMCPToolResponse
|
upsertMCPToolResponse
|
||||||
} from '@renderer/utils/mcp-tools'
|
} from '@renderer/utils/mcp-tools'
|
||||||
|
import { MB } from '@shared/config/constant'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { isEmpty, takeRight } from 'lodash'
|
import { isEmpty, takeRight } from 'lodash'
|
||||||
import OpenAI from 'openai'
|
import OpenAI from 'openai'
|
||||||
|
|
||||||
import { ChunkCallbackData, CompletionsParams } from '.'
|
import { ChunkCallbackData, CompletionsParams } from '.'
|
||||||
import BaseProvider from './BaseProvider'
|
import BaseProvider from './BaseProvider'
|
||||||
import { MB } from '@shared/config/constant'
|
|
||||||
|
|
||||||
export default class GeminiProvider extends BaseProvider {
|
export default class GeminiProvider extends BaseProvider {
|
||||||
private sdk: GoogleGenerativeAI
|
private sdk: GoogleGenerativeAI
|
||||||
|
|||||||
@ -2,8 +2,8 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit'
|
|||||||
import { isLocalAi } from '@renderer/config/env'
|
import { isLocalAi } from '@renderer/config/env'
|
||||||
import { SYSTEM_MODELS } from '@renderer/config/models'
|
import { SYSTEM_MODELS } from '@renderer/config/models'
|
||||||
import { Model, Provider } from '@renderer/types'
|
import { Model, Provider } from '@renderer/types'
|
||||||
import { uniqBy } from 'lodash'
|
|
||||||
import { IpcChannel } from '@shared/IpcChannel'
|
import { IpcChannel } from '@shared/IpcChannel'
|
||||||
|
import { uniqBy } from 'lodash'
|
||||||
|
|
||||||
type LlmSettings = {
|
type LlmSettings = {
|
||||||
ollama: {
|
ollama: {
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import i18n from '@renderer/i18n'
|
import i18n from '@renderer/i18n'
|
||||||
import { Model } from '@renderer/types'
|
import { Model } from '@renderer/types'
|
||||||
|
import { KB, MB } from '@shared/config/constant'
|
||||||
import { ModalFuncProps } from 'antd/es/modal/interface'
|
import { ModalFuncProps } from 'antd/es/modal/interface'
|
||||||
import imageCompression from 'browser-image-compression'
|
import imageCompression from 'browser-image-compression'
|
||||||
import * as htmlToImage from 'html-to-image'
|
import * as htmlToImage from 'html-to-image'
|
||||||
@ -7,7 +8,6 @@ import * as htmlToImage from 'html-to-image'
|
|||||||
import { v4 as uuidv4 } from 'uuid'
|
import { v4 as uuidv4 } from 'uuid'
|
||||||
|
|
||||||
import { classNames } from './style'
|
import { classNames } from './style'
|
||||||
import { KB, MB } from '@shared/config/constant'
|
|
||||||
|
|
||||||
export const runAsyncFunction = async (fn: () => void) => {
|
export const runAsyncFunction = async (fn: () => void) => {
|
||||||
await fn()
|
await fn()
|
||||||
|
|||||||
@ -4,6 +4,8 @@ import { useSettings } from '@renderer/hooks/useSettings'
|
|||||||
import i18n from '@renderer/i18n'
|
import i18n from '@renderer/i18n'
|
||||||
import { EVENT_NAMES, EventEmitter } from '@renderer/services/EventService'
|
import { EVENT_NAMES, EventEmitter } from '@renderer/services/EventService'
|
||||||
import { uuid } from '@renderer/utils'
|
import { uuid } from '@renderer/utils'
|
||||||
|
import { defaultLanguage } from '@shared/config/constant'
|
||||||
|
import { IpcChannel } from '@shared/IpcChannel'
|
||||||
import { Divider } from 'antd'
|
import { Divider } from 'antd'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import { isEmpty } from 'lodash'
|
import { isEmpty } from 'lodash'
|
||||||
@ -18,9 +20,6 @@ import ClipboardPreview from './components/ClipboardPreview'
|
|||||||
import FeatureMenus, { FeatureMenusRef } from './components/FeatureMenus'
|
import FeatureMenus, { FeatureMenusRef } from './components/FeatureMenus'
|
||||||
import Footer from './components/Footer'
|
import Footer from './components/Footer'
|
||||||
import InputBar from './components/InputBar'
|
import InputBar from './components/InputBar'
|
||||||
import { IpcChannel } from '@shared/IpcChannel'
|
|
||||||
|
|
||||||
import { defaultLanguage } from '@shared/config/constant'
|
|
||||||
|
|
||||||
const HomeWindow: FC = () => {
|
const HomeWindow: FC = () => {
|
||||||
const [route, setRoute] = useState<'home' | 'chat' | 'translate' | 'summary' | 'explanation'>('home')
|
const [route, setRoute] = useState<'home' | 'chat' | 'translate' | 'summary' | 'explanation'>('home')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user