feat: add local module
This commit is contained in:
parent
24cf3bb043
commit
c8711c5804
4
.gitignore
vendored
4
.gitignore
vendored
@ -46,5 +46,5 @@ out
|
|||||||
.env
|
.env
|
||||||
.env.*
|
.env.*
|
||||||
|
|
||||||
# Ollama
|
# Local
|
||||||
ollama
|
local
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
"homepage": "https://github.com/kangfenmao/cherry-studio",
|
"homepage": "https://github.com/kangfenmao/cherry-studio",
|
||||||
"workspaces": {
|
"workspaces": {
|
||||||
"packages": [
|
"packages": [
|
||||||
"ollama"
|
"local"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
<html lang="zh-CN">
|
<html lang="zh-CN">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<title>Cherry Studio</title>
|
|
||||||
<meta name="viewport" content="initial-scale=1, width=device-width" />
|
<meta name="viewport" content="initial-scale=1, width=device-width" />
|
||||||
<meta
|
<meta
|
||||||
http-equiv="Content-Security-Policy"
|
http-equiv="Content-Security-Policy"
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { TranslationOutlined } from '@ant-design/icons'
|
import { TranslationOutlined } from '@ant-design/icons'
|
||||||
import Logo from '@renderer/assets/images/logo.png'
|
import { AppLogo } from '@renderer/config/app'
|
||||||
import { isMac } from '@renderer/config/constant'
|
import { isMac } from '@renderer/config/constant'
|
||||||
import useAvatar from '@renderer/hooks/useAvatar'
|
import useAvatar from '@renderer/hooks/useAvatar'
|
||||||
import { useRuntime } from '@renderer/hooks/useStore'
|
import { useRuntime } from '@renderer/hooks/useStore'
|
||||||
@ -25,7 +25,7 @@ const Sidebar: FC = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Container style={{ backgroundColor: minappShow ? 'var(--navbar-background)' : sidebarBackgroundColor }}>
|
<Container style={{ backgroundColor: minappShow ? 'var(--navbar-background)' : sidebarBackgroundColor }}>
|
||||||
<AvatarImg src={avatar || Logo} draggable={false} className="nodrag" onClick={onEditUser} />
|
<AvatarImg src={avatar || AppLogo} draggable={false} className="nodrag" onClick={onEditUser} />
|
||||||
<MainMenus>
|
<MainMenus>
|
||||||
<Menus>
|
<Menus>
|
||||||
<StyledLink to="/">
|
<StyledLink to="/">
|
||||||
|
|||||||
3
src/renderer/src/config/app.ts
Normal file
3
src/renderer/src/config/app.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export { default as AppLogo } from '@renderer/assets/images/logo.png'
|
||||||
|
|
||||||
|
export const APP_NAME = 'Cherry Studio'
|
||||||
@ -1,6 +1,7 @@
|
|||||||
import KeyvStorage from '@kangfenmao/keyv-storage'
|
import KeyvStorage from '@kangfenmao/keyv-storage'
|
||||||
import localforage from 'localforage'
|
import localforage from 'localforage'
|
||||||
|
|
||||||
|
import { APP_NAME } from './config/app'
|
||||||
import { ThemeMode } from './store/settings'
|
import { ThemeMode } from './store/settings'
|
||||||
import { loadScript } from './utils'
|
import { loadScript } from './utils'
|
||||||
|
|
||||||
@ -22,7 +23,7 @@ function init() {
|
|||||||
name: 'CherryAI',
|
name: 'CherryAI',
|
||||||
version: 1.0,
|
version: 1.0,
|
||||||
storeName: 'cherryai',
|
storeName: 'cherryai',
|
||||||
description: 'Cherry Studio Storage'
|
description: `${APP_NAME} Storage`
|
||||||
})
|
})
|
||||||
|
|
||||||
window.keyv = new KeyvStorage()
|
window.keyv = new KeyvStorage()
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
import { GithubOutlined } from '@ant-design/icons'
|
import { GithubOutlined } from '@ant-design/icons'
|
||||||
import { FileProtectOutlined, GlobalOutlined, MailOutlined, SoundOutlined } from '@ant-design/icons'
|
import { FileProtectOutlined, GlobalOutlined, MailOutlined, SoundOutlined } from '@ant-design/icons'
|
||||||
import Logo from '@renderer/assets/images/logo.png'
|
|
||||||
import { HStack } from '@renderer/components/Layout'
|
import { HStack } from '@renderer/components/Layout'
|
||||||
import MinApp from '@renderer/components/MinApp'
|
import MinApp from '@renderer/components/MinApp'
|
||||||
|
import { APP_NAME, AppLogo } from '@renderer/config/app'
|
||||||
import { runAsyncFunction } from '@renderer/utils'
|
import { runAsyncFunction } from '@renderer/utils'
|
||||||
import { Avatar, Button, Progress, Row, Tag } from 'antd'
|
import { Avatar, Button, Progress, Row, Tag } from 'antd'
|
||||||
import { ProgressInfo } from 'electron-updater'
|
import { ProgressInfo } from 'electron-updater'
|
||||||
@ -44,7 +44,7 @@ const AboutSettings: FC = () => {
|
|||||||
|
|
||||||
const mailto = async () => {
|
const mailto = async () => {
|
||||||
const email = 'kangfenmao@qq.com'
|
const email = 'kangfenmao@qq.com'
|
||||||
const subject = 'Cherry Studio Feedback'
|
const subject = `${APP_NAME} Feedback`
|
||||||
const version = (await window.api.getAppInfo()).version
|
const version = (await window.api.getAppInfo()).version
|
||||||
const platform = window.electron.process.platform
|
const platform = window.electron.process.platform
|
||||||
const url = `mailto:${email}?subject=${subject}&body=%0A%0AVersion: ${version} | Platform: ${platform}`
|
const url = `mailto:${email}?subject=${subject}&body=%0A%0AVersion: ${version} | Platform: ${platform}`
|
||||||
@ -117,10 +117,10 @@ const AboutSettings: FC = () => {
|
|||||||
strokeColor="#67ad5b"
|
strokeColor="#67ad5b"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<Avatar src={Logo} size={80} style={{ minHeight: 80 }} />
|
<Avatar src={AppLogo} size={80} style={{ minHeight: 80 }} />
|
||||||
</AvatarWrapper>
|
</AvatarWrapper>
|
||||||
<VersionWrapper>
|
<VersionWrapper>
|
||||||
<Title>Cherry Studio</Title>
|
<Title>{APP_NAME}</Title>
|
||||||
<Description>{t('settings.about.description')}</Description>
|
<Description>{t('settings.about.description')}</Description>
|
||||||
<Tag
|
<Tag
|
||||||
onClick={() => onOpenWebsite('https://github.com/kangfenmao/cherry-studio/releases')}
|
onClick={() => onOpenWebsite('https://github.com/kangfenmao/cherry-studio/releases')}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { createSlice, PayloadAction } from '@reduxjs/toolkit'
|
import { createSlice, PayloadAction } from '@reduxjs/toolkit'
|
||||||
import Logo from '@renderer/assets/images/logo.png'
|
import { AppLogo } from '@renderer/config/app'
|
||||||
|
|
||||||
export interface RuntimeState {
|
export interface RuntimeState {
|
||||||
avatar: string
|
avatar: string
|
||||||
@ -8,7 +8,7 @@ export interface RuntimeState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const initialState: RuntimeState = {
|
const initialState: RuntimeState = {
|
||||||
avatar: Logo,
|
avatar: AppLogo,
|
||||||
generating: false,
|
generating: false,
|
||||||
minappShow: false
|
minappShow: false
|
||||||
}
|
}
|
||||||
@ -18,7 +18,7 @@ const runtimeSlice = createSlice({
|
|||||||
initialState,
|
initialState,
|
||||||
reducers: {
|
reducers: {
|
||||||
setAvatar: (state, action: PayloadAction<string | null>) => {
|
setAvatar: (state, action: PayloadAction<string | null>) => {
|
||||||
state.avatar = action.payload || Logo
|
state.avatar = action.payload || AppLogo
|
||||||
},
|
},
|
||||||
setGenerating: (state, action: PayloadAction<boolean>) => {
|
setGenerating: (state, action: PayloadAction<boolean>) => {
|
||||||
state.generating = action.payload
|
state.generating = action.payload
|
||||||
|
|||||||
@ -1,4 +1,11 @@
|
|||||||
{
|
{
|
||||||
"files": [],
|
"files": [],
|
||||||
"references": [{ "path": "./tsconfig.node.json" }, { "path": "./tsconfig.web.json" }]
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.node.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.web.json"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,8 +4,7 @@
|
|||||||
"electron.vite.config.*",
|
"electron.vite.config.*",
|
||||||
"src/main/**/*",
|
"src/main/**/*",
|
||||||
"src/preload/**/*",
|
"src/preload/**/*",
|
||||||
"src/ollma/**/*",
|
"src/main/env.d.ts",
|
||||||
"src/main/env.d.ts"
|
|
||||||
],
|
],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"composite": true,
|
"composite": true,
|
||||||
|
|||||||
@ -4,7 +4,8 @@
|
|||||||
"src/renderer/src/env.d.ts",
|
"src/renderer/src/env.d.ts",
|
||||||
"src/renderer/src/**/*",
|
"src/renderer/src/**/*",
|
||||||
"src/renderer/src/**/*.tsx",
|
"src/renderer/src/**/*.tsx",
|
||||||
"src/preload/*.d.ts"
|
"src/preload/*.d.ts",
|
||||||
|
"local/src/renderer/**/*",
|
||||||
],
|
],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"composite": true,
|
"composite": true,
|
||||||
|
|||||||
40
yarn.lock
40
yarn.lock
@ -5,6 +5,26 @@ __metadata:
|
|||||||
version: 8
|
version: 8
|
||||||
cacheKey: 10c0
|
cacheKey: 10c0
|
||||||
|
|
||||||
|
"700AI@workspace:local":
|
||||||
|
version: 0.0.0-use.local
|
||||||
|
resolution: "700AI@workspace:local"
|
||||||
|
dependencies:
|
||||||
|
"@electron-toolkit/preload": "npm:^3.0.0"
|
||||||
|
"@electron-toolkit/utils": "npm:^3.0.0"
|
||||||
|
"@types/adm-zip": "npm:^0"
|
||||||
|
adm-zip: "npm:^0.5.15"
|
||||||
|
dotenv-cli: "npm:^7.4.2"
|
||||||
|
electron: "npm:^28.3.3"
|
||||||
|
electron-builder: "npm:^24.9.1"
|
||||||
|
electron-log: "npm:^5.1.5"
|
||||||
|
electron-store: "npm:^8.2.0"
|
||||||
|
electron-updater: "npm:^6.1.7"
|
||||||
|
electron-vite: "npm:^2.0.0"
|
||||||
|
electron-window-state: "npm:^5.0.3"
|
||||||
|
eslint-plugin-simple-import-sort: "npm:^12.1.1"
|
||||||
|
languageName: unknown
|
||||||
|
linkType: soft
|
||||||
|
|
||||||
"7zip-bin@npm:~5.2.0":
|
"7zip-bin@npm:~5.2.0":
|
||||||
version: 5.2.0
|
version: 5.2.0
|
||||||
resolution: "7zip-bin@npm:5.2.0"
|
resolution: "7zip-bin@npm:5.2.0"
|
||||||
@ -1949,26 +1969,6 @@ __metadata:
|
|||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
"SevenAI@workspace:ollama":
|
|
||||||
version: 0.0.0-use.local
|
|
||||||
resolution: "SevenAI@workspace:ollama"
|
|
||||||
dependencies:
|
|
||||||
"@electron-toolkit/preload": "npm:^3.0.0"
|
|
||||||
"@electron-toolkit/utils": "npm:^3.0.0"
|
|
||||||
"@types/adm-zip": "npm:^0"
|
|
||||||
adm-zip: "npm:^0.5.15"
|
|
||||||
dotenv-cli: "npm:^7.4.2"
|
|
||||||
electron: "npm:^28.3.3"
|
|
||||||
electron-builder: "npm:^24.9.1"
|
|
||||||
electron-log: "npm:^5.1.5"
|
|
||||||
electron-store: "npm:^8.2.0"
|
|
||||||
electron-updater: "npm:^6.1.7"
|
|
||||||
electron-vite: "npm:^2.0.0"
|
|
||||||
electron-window-state: "npm:^5.0.3"
|
|
||||||
eslint-plugin-simple-import-sort: "npm:^12.1.1"
|
|
||||||
languageName: unknown
|
|
||||||
linkType: soft
|
|
||||||
|
|
||||||
"abbrev@npm:^2.0.0":
|
"abbrev@npm:^2.0.0":
|
||||||
version: 2.0.0
|
version: 2.0.0
|
||||||
resolution: "abbrev@npm:2.0.0"
|
resolution: "abbrev@npm:2.0.0"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user