Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c250124043 | ||
|
|
7aa6d6ebeb | ||
|
|
e962351b13 | ||
|
|
80e34688b1 | ||
|
|
8c23d6ec55 | ||
|
|
2cc09a52f4 | ||
|
|
6b872f58ed | ||
|
|
d5da7e4413 | ||
|
|
3e88aa3c36 | ||
|
|
d6fc1cb364 | ||
|
|
224f23aea0 | ||
|
|
8c186b757e | ||
|
|
3f32775b98 | ||
|
|
067819652b | ||
|
|
b3a023e4ac | ||
|
|
1da1b6622d | ||
|
|
78e1626e52 | ||
|
|
ec49cf61d6 |
16
README.md
16
README.md
@@ -2,6 +2,22 @@
|
||||
|
||||
Cherry Studio is a desktop client for multiple cutting-edge LLM models, available on Windows, Mac and Linux.
|
||||
|
||||
# Screenshot
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
# Feature
|
||||
|
||||
1. Supports multiple large language model service providers.
|
||||
2. Allows creation of multiple Assistants.
|
||||
3. Enables creation of multiple topics.
|
||||
4. Allows using multiple models to answer questions in the same conversation.
|
||||
5. Supports drag-and-drop sorting.
|
||||
6. Code highlighting.
|
||||
|
||||
# Develop
|
||||
## Recommended IDE Setup
|
||||
|
||||
- [VSCode](https://code.visualstudio.com/) + [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) + [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
provider: generic
|
||||
url: http://127.0.0.1:8080
|
||||
updaterCacheDirName: cherry-studio-updater
|
||||
# provider: generic
|
||||
# url: http://127.0.0.1:8080
|
||||
# updaterCacheDirName: cherry-studio-updater
|
||||
provider: github
|
||||
repo: cherry-studio
|
||||
owner: kangfenmao
|
||||
|
||||
@@ -56,6 +56,5 @@ electronDownload:
|
||||
afterSign: scripts/notarize.js
|
||||
releaseInfo:
|
||||
releaseNotes: |
|
||||
- 【功能】新增消息暂停发送功能
|
||||
- 【修复】修复多语言切换不彻底问题
|
||||
- 【构建】支持 macOS Intel 架构
|
||||
- 修复更新日志页面不能滚动问题
|
||||
- 新增检查更新按钮
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cherry-studio",
|
||||
"version": "0.2.1",
|
||||
"version": "0.2.4",
|
||||
"description": "A powerful AI assistant for producer.",
|
||||
"main": "./out/main/index.js",
|
||||
"author": "kangfenmao@qq.com",
|
||||
@@ -23,6 +23,7 @@
|
||||
"dependencies": {
|
||||
"@electron-toolkit/preload": "^3.0.0",
|
||||
"@electron-toolkit/utils": "^3.0.0",
|
||||
"@sentry/electron": "^5.2.0",
|
||||
"electron-log": "^5.1.5",
|
||||
"electron-updater": "^6.1.7",
|
||||
"electron-window-state": "^5.0.3"
|
||||
|
||||
@@ -6,9 +6,14 @@ exports.default = async function notarizing(context) {
|
||||
return
|
||||
}
|
||||
|
||||
if (!process.env.APPLE_ID || !process.env.APPLE_APP_SPECIFIC_PASSWORD || !process.env.APPLE_TEAM_ID) {
|
||||
console.log('Skipping notarization')
|
||||
return
|
||||
}
|
||||
|
||||
const appName = context.packager.appInfo.productFilename
|
||||
|
||||
const notarized = await notarize({
|
||||
await notarize({
|
||||
appPath: `${context.appOutDir}/${appName}.app`,
|
||||
appBundleId: 'com.kangfenmao.CherryStudio',
|
||||
appleId: process.env.APPLE_ID,
|
||||
@@ -16,7 +21,5 @@ exports.default = async function notarizing(context) {
|
||||
teamId: process.env.APPLE_TEAM_ID
|
||||
})
|
||||
|
||||
console.log('Notarized:', notarized)
|
||||
|
||||
return notarized
|
||||
console.log('Notarized app:', appName)
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import { electronApp, is, optimizer } from '@electron-toolkit/utils'
|
||||
import * as Sentry from '@sentry/electron/main'
|
||||
import { app, BrowserWindow, ipcMain, Menu, MenuItem, shell } from 'electron'
|
||||
import installExtension, { REDUX_DEVTOOLS } from 'electron-devtools-installer'
|
||||
import windowStateKeeper from 'electron-window-state'
|
||||
import { join } from 'path'
|
||||
import icon from '../../resources/icon.png?asset'
|
||||
import installExtension, { REDUX_DEVTOOLS } from 'electron-devtools-installer'
|
||||
import AppUpdater from './updater'
|
||||
|
||||
function createWindow(): void {
|
||||
function createWindow() {
|
||||
// Load the previous state with fallback to defaults
|
||||
const mainWindowState = windowStateKeeper({
|
||||
defaultWidth: 1080,
|
||||
@@ -61,6 +62,8 @@ function createWindow(): void {
|
||||
} else {
|
||||
mainWindow.loadFile(join(__dirname, '../renderer/index.html'))
|
||||
}
|
||||
|
||||
return mainWindow
|
||||
}
|
||||
|
||||
// This method will be called when Electron has finished
|
||||
@@ -77,24 +80,36 @@ app.whenReady().then(() => {
|
||||
optimizer.watchWindowShortcuts(window)
|
||||
})
|
||||
|
||||
// IPC
|
||||
ipcMain.handle('get-app-info', () => ({
|
||||
version: app.getVersion()
|
||||
}))
|
||||
|
||||
createWindow()
|
||||
|
||||
app.on('activate', function () {
|
||||
// On macOS it's common to re-create a window in the app when the
|
||||
// dock icon is clicked and there are no other windows open.
|
||||
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
||||
})
|
||||
|
||||
installExtension(REDUX_DEVTOOLS)
|
||||
.then((name) => console.log(`Added Extension: ${name}`))
|
||||
.catch((err) => console.log('An error occurred: ', err))
|
||||
const mainWindow = createWindow()
|
||||
|
||||
setTimeout(() => new AppUpdater(), 3000)
|
||||
const { autoUpdater } = new AppUpdater(mainWindow)
|
||||
|
||||
// IPC
|
||||
ipcMain.handle('get-app-info', () => ({
|
||||
version: app.getVersion(),
|
||||
isPackaged: app.isPackaged
|
||||
}))
|
||||
|
||||
ipcMain.handle('open-website', (_, url: string) => {
|
||||
shell.openExternal(url)
|
||||
})
|
||||
|
||||
// 触发检查更新(此方法用于被渲染线程调用,例如页面点击检查更新按钮来调用此方法)
|
||||
ipcMain.handle('check-for-update', async () => {
|
||||
autoUpdater.logger?.info('触发检查更新')
|
||||
return {
|
||||
currentVersion: autoUpdater.currentVersion,
|
||||
update: await autoUpdater.checkForUpdates()
|
||||
}
|
||||
})
|
||||
|
||||
installExtension(REDUX_DEVTOOLS)
|
||||
})
|
||||
|
||||
// Quit when all windows are closed, except on macOS. There, it's common
|
||||
@@ -108,3 +123,6 @@ app.on('window-all-closed', () => {
|
||||
|
||||
// In this file you can include the rest of your app"s specific main process
|
||||
// code. You can also put them in separate files and require them here.
|
||||
Sentry.init({
|
||||
dsn: 'https://f0e972deff79c2df3e887e232d8a46a3@o4507610668007424.ingest.us.sentry.io/4507610670563328'
|
||||
})
|
||||
|
||||
@@ -1,24 +1,20 @@
|
||||
import { autoUpdater, UpdateInfo } from 'electron-updater'
|
||||
import { AppUpdater as _AppUpdater, autoUpdater, UpdateInfo } from 'electron-updater'
|
||||
import logger from 'electron-log'
|
||||
import { dialog, ipcMain } from 'electron'
|
||||
import { BrowserWindow, dialog } from 'electron'
|
||||
|
||||
export default class AppUpdater {
|
||||
constructor() {
|
||||
autoUpdater: _AppUpdater = autoUpdater
|
||||
|
||||
constructor(mainWindow: BrowserWindow) {
|
||||
logger.transports.file.level = 'debug'
|
||||
autoUpdater.logger = logger
|
||||
autoUpdater.forceDevUpdateConfig = true
|
||||
autoUpdater.autoDownload = false
|
||||
autoUpdater.checkForUpdates()
|
||||
|
||||
// 触发检查更新(此方法用于被渲染线程调用,例如页面点击检查更新按钮来调用此方法)
|
||||
ipcMain.on('check-for-update', () => {
|
||||
logger.info('触发检查更新')
|
||||
return autoUpdater.checkForUpdates()
|
||||
})
|
||||
|
||||
// 检测下载错误
|
||||
autoUpdater.on('error', (error) => {
|
||||
logger.error('更新异常', error)
|
||||
mainWindow.webContents.send('update-error', error)
|
||||
})
|
||||
|
||||
// 检测是否需要更新
|
||||
@@ -28,6 +24,7 @@ export default class AppUpdater {
|
||||
|
||||
autoUpdater.on('update-available', (releaseInfo: UpdateInfo) => {
|
||||
autoUpdater.logger?.info('检测到新版本,确认是否下载')
|
||||
mainWindow.webContents.send('update-available', releaseInfo)
|
||||
const releaseNotes = releaseInfo.releaseNotes
|
||||
let releaseContent = ''
|
||||
if (releaseNotes) {
|
||||
@@ -49,10 +46,12 @@ export default class AppUpdater {
|
||||
title: '应用有新的更新',
|
||||
detail: releaseContent,
|
||||
message: '发现新版本,是否现在更新?',
|
||||
buttons: ['否', '是']
|
||||
buttons: ['下次再说', '更新']
|
||||
})
|
||||
.then(({ response }) => {
|
||||
if (response === 1) {
|
||||
logger.info('用户选择更新,准备下载更新')
|
||||
mainWindow.webContents.send('download-update')
|
||||
autoUpdater.downloadUpdate()
|
||||
}
|
||||
})
|
||||
@@ -61,11 +60,13 @@ export default class AppUpdater {
|
||||
// 检测到不需要更新时
|
||||
autoUpdater.on('update-not-available', () => {
|
||||
logger.info('现在使用的就是最新版本,不用更新')
|
||||
mainWindow.webContents.send('update-not-available')
|
||||
})
|
||||
|
||||
// 更新下载进度
|
||||
autoUpdater.on('download-progress', (progress) => {
|
||||
logger.info('下载进度', progress)
|
||||
mainWindow.webContents.send('download-progress', progress)
|
||||
})
|
||||
|
||||
// 当需要更新的内容下载完成后
|
||||
@@ -80,5 +81,7 @@ export default class AppUpdater {
|
||||
setImmediate(() => autoUpdater.quitAndInstall())
|
||||
})
|
||||
})
|
||||
|
||||
this.autoUpdater = autoUpdater
|
||||
}
|
||||
}
|
||||
|
||||
3
src/preload/index.d.ts
vendored
3
src/preload/index.d.ts
vendored
@@ -6,7 +6,10 @@ declare global {
|
||||
api: {
|
||||
getAppInfo: () => Promise<{
|
||||
version: string
|
||||
isPackaged: boolean
|
||||
}>
|
||||
checkForUpdate: () => void
|
||||
openWebsite: (url: string) => void
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,8 @@ import { electronAPI } from '@electron-toolkit/preload'
|
||||
// Custom APIs for renderer
|
||||
const api = {
|
||||
getAppInfo: () => ipcRenderer.invoke('get-app-info'),
|
||||
checkForUpdate: () => ipcRenderer.invoke('check-for-update')
|
||||
checkForUpdate: () => ipcRenderer.invoke('check-for-update'),
|
||||
openWebsite: (url: string) => ipcRenderer.invoke('open-website', url)
|
||||
}
|
||||
|
||||
// Use `contextBridge` APIs to expose Electron APIs to
|
||||
|
||||
25
src/renderer/src/CHANGELOG.en.md
Normal file
25
src/renderer/src/CHANGELOG.en.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# CHANGES LOG
|
||||
|
||||
### v0.2.4 - 2024-07-16
|
||||
|
||||
- Fixed the issue of the update log page cannot be scrolled
|
||||
- Added a check for updates button
|
||||
|
||||
### v0.2.3 - 2024-07-16
|
||||
|
||||
- Fixed multi-language prompt errors
|
||||
- Fixed default model error issues with ZHIPU AI
|
||||
- Fixed OpenRouter API detection error issues
|
||||
- Fixed multi-language translation errors with model providers
|
||||
|
||||
### v0.2.2 - 2024-07-15
|
||||
|
||||
- Fix the issue where the default assistant name is empty.
|
||||
- Fix the problem with default language detection during the first installation.
|
||||
- Adjust the changelog style.
|
||||
|
||||
### v0.2.1 - 2024-07-15
|
||||
|
||||
- **Feature**: Add new feature for pausing message sending
|
||||
- **Fix**: Resolve incomplete translation issue upon language switch
|
||||
- **Build**: Support for macOS Intel architecture
|
||||
26
src/renderer/src/CHANGELOG.zh.md
Normal file
26
src/renderer/src/CHANGELOG.zh.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# 更新日志
|
||||
|
||||
### v0.2.4 - 2024-07-16
|
||||
|
||||
- 修复更新日志页面不能滚动问题
|
||||
- 新增检查更新按钮
|
||||
|
||||
### v0.2.3 - 2024-07-16
|
||||
|
||||
- 修复多语言提示错误
|
||||
- 修复智谱AI默认模型错误问题
|
||||
- 修复 OpenRouter API 检测出错问题
|
||||
- 修复模型提供商多语言翻译错误问题
|
||||
|
||||
### v0.2.2 - 2024-07-15
|
||||
|
||||
- 修复默认助理名称为空的问题
|
||||
- 修复首次安装默认语言检测问题
|
||||
- 更新日志样式微调
|
||||
|
||||
### v0.2.1 - 2024-07-15
|
||||
|
||||
- 【功能】新增消息暂停发送功能
|
||||
- 【修复】修复多语言切换不彻底问题
|
||||
- 【构建】支持 macOS Intel 架构
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
# CHANGES LOG
|
||||
|
||||
### v0.2.1 - 2024-07-15
|
||||
|
||||
1. **Feature**: Add new feature for pausing message sending
|
||||
2. **Fix**: Resolve incomplete translation issue upon language switch
|
||||
3. **Build**: Support for macOS Intel architecture
|
||||
@@ -1,8 +0,0 @@
|
||||
# 更新日志
|
||||
|
||||
### v0.2.1 - 2024-07-15
|
||||
|
||||
1. 【功能】新增消息暂停发送功能
|
||||
2. 【修复】修复多语言切换不彻底问题
|
||||
3. 【构建】支持 macOS Intel 架构
|
||||
|
||||
@@ -15,4 +15,11 @@ export function useAppInitEffect() {
|
||||
})
|
||||
i18nInit()
|
||||
}, [dispatch])
|
||||
|
||||
useEffect(() => {
|
||||
runAsyncFunction(async () => {
|
||||
const { isPackaged } = await window.api.getAppInfo()
|
||||
isPackaged && setTimeout(window.api.checkForUpdate, 3000)
|
||||
})
|
||||
}, [])
|
||||
}
|
||||
|
||||
@@ -74,8 +74,8 @@ const resources = {
|
||||
moonshot: 'Moonshot',
|
||||
silicon: 'SiliconFlow',
|
||||
openrouter: 'OpenRouter',
|
||||
yi: 'Lingyiwanwu',
|
||||
zhipu: 'BigModel',
|
||||
yi: 'Yi',
|
||||
zhipu: 'ZHIPU AI',
|
||||
groq: 'Groq',
|
||||
ollama: 'Ollama'
|
||||
},
|
||||
@@ -108,7 +108,12 @@ const resources = {
|
||||
'models.add.group_name.placeholder': 'Optional e.g. ChatGPT',
|
||||
'models.empty': 'No models found',
|
||||
'assistant.title': 'Default Assistant',
|
||||
'about.description': 'A powerful AI assistant for producer'
|
||||
'about.description': 'A powerful AI assistant for producer',
|
||||
'about.updateNotAvailable': 'You are using the latest version',
|
||||
'about.checkingUpdate': 'Checking for updates...',
|
||||
'about.updateError': 'Update error',
|
||||
'about.checkUpdate': 'Check Update',
|
||||
'about.downloading': 'Downloading...'
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -217,7 +222,12 @@ const resources = {
|
||||
'models.add.group_name.placeholder': '例如 ChatGPT',
|
||||
'models.empty': '没有模型',
|
||||
'assistant.title': '默认助手',
|
||||
'about.description': '一个为创造者而生的 AI 助手'
|
||||
'about.description': '一个为创造者而生的 AI 助手',
|
||||
'about.updateNotAvailable': '你的软件已是最新版本',
|
||||
'about.checkingUpdate': '正在检查更新...',
|
||||
'about.updateError': '更新出错',
|
||||
'about.checkUpdate': '检查更新',
|
||||
'about.downloading': '正在下载更新...'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -225,7 +235,7 @@ const resources = {
|
||||
|
||||
i18n.use(initReactI18next).init({
|
||||
resources,
|
||||
lng: localStorage.getItem('language') || 'en-US',
|
||||
lng: localStorage.getItem('language') || navigator.language || 'en-US',
|
||||
fallbackLng: 'en-US',
|
||||
interpolation: {
|
||||
escapeValue: false
|
||||
|
||||
@@ -1,5 +1,25 @@
|
||||
import localforage from 'localforage'
|
||||
import KeyvStorage from '@kangfenmao/keyv-storage'
|
||||
import * as Sentry from '@sentry/electron/renderer'
|
||||
import { isProduction } from './utils'
|
||||
|
||||
async function initSentry() {
|
||||
if (await isProduction()) {
|
||||
Sentry.init({
|
||||
integrations: [Sentry.browserTracingIntegration(), Sentry.replayIntegration()],
|
||||
|
||||
// Set tracesSampleRate to 1.0 to capture 100%
|
||||
// of transactions for performance monitoring.
|
||||
// We recommend adjusting this value in production
|
||||
tracesSampleRate: 1.0,
|
||||
|
||||
// Capture Replay for 10% of all sessions,
|
||||
// plus for 100% of sessions with an error
|
||||
replaysSessionSampleRate: 0.1,
|
||||
replaysOnErrorSampleRate: 1.0
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function init() {
|
||||
localforage.config({
|
||||
@@ -9,8 +29,11 @@ function init() {
|
||||
storeName: 'cherryai',
|
||||
description: 'Cherry Studio Storage'
|
||||
})
|
||||
|
||||
window.keyv = new KeyvStorage()
|
||||
window.keyv.init()
|
||||
|
||||
initSentry()
|
||||
}
|
||||
|
||||
init()
|
||||
|
||||
@@ -1,14 +1,34 @@
|
||||
import { Avatar } from 'antd'
|
||||
import { Avatar, Button, Progress } from 'antd'
|
||||
import { FC, useEffect, useState } from 'react'
|
||||
import styled from 'styled-components'
|
||||
import Logo from '@renderer/assets/images/logo.png'
|
||||
import { runAsyncFunction } from '@renderer/utils'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import Changelog from './components/Changelog'
|
||||
import { debounce } from 'lodash'
|
||||
import { ProgressInfo } from 'electron-updater'
|
||||
|
||||
const AboutSettings: FC = () => {
|
||||
const [version, setVersion] = useState('')
|
||||
const { t } = useTranslation()
|
||||
const [percent, setPercent] = useState(0)
|
||||
const [checkUpdateLoading, setCheckUpdateLoading] = useState(false)
|
||||
const [downloading, setDownloading] = useState(false)
|
||||
|
||||
const onCheckUpdate = debounce(
|
||||
async () => {
|
||||
if (checkUpdateLoading || downloading) return
|
||||
setCheckUpdateLoading(true)
|
||||
await window.api.checkForUpdate()
|
||||
setCheckUpdateLoading(false)
|
||||
},
|
||||
2000,
|
||||
{ leading: true, trailing: false }
|
||||
)
|
||||
|
||||
const onOpenWebsite = (suffix = '') => {
|
||||
window.api.openWebsite('https://github.com/kangfenmao/cherry-studio' + suffix)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
runAsyncFunction(async () => {
|
||||
@@ -17,24 +37,74 @@ const AboutSettings: FC = () => {
|
||||
})
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
const ipcRenderer = window.electron.ipcRenderer
|
||||
const removers = [
|
||||
ipcRenderer.on('update-not-available', () => {
|
||||
setCheckUpdateLoading(false)
|
||||
window.message.success(t('settings.about.updateNotAvailable'))
|
||||
}),
|
||||
ipcRenderer.on('update-available', () => {
|
||||
setCheckUpdateLoading(false)
|
||||
}),
|
||||
ipcRenderer.on('download-update', () => {
|
||||
setCheckUpdateLoading(false)
|
||||
setDownloading(true)
|
||||
}),
|
||||
ipcRenderer.on('download-progress', (_, progress: ProgressInfo) => {
|
||||
setPercent(progress.percent)
|
||||
}),
|
||||
ipcRenderer.on('update-error', (_, error) => {
|
||||
setCheckUpdateLoading(false)
|
||||
setDownloading(false)
|
||||
setPercent(0)
|
||||
window.modal.info({
|
||||
title: t('settings.about.updateError'),
|
||||
content: error?.message || t('settings.about.updateError'),
|
||||
icon: null
|
||||
})
|
||||
})
|
||||
]
|
||||
return () => removers.forEach((remover) => remover())
|
||||
}, [t])
|
||||
|
||||
return (
|
||||
<Container>
|
||||
<Avatar src={Logo} size={100} style={{ marginTop: 50 }} />
|
||||
<AvatarWrapper onClick={() => onOpenWebsite()}>
|
||||
{percent > 0 && (
|
||||
<ProgressCircle
|
||||
type="circle"
|
||||
size={104}
|
||||
percent={percent}
|
||||
showInfo={false}
|
||||
strokeLinecap="butt"
|
||||
strokeColor="#67ad5b"
|
||||
/>
|
||||
)}
|
||||
<Avatar src={Logo} size={100} style={{ marginTop: 50, minHeight: 100 }} />
|
||||
</AvatarWrapper>
|
||||
<Title>
|
||||
Cherry Studio <Version>(v{version})</Version>
|
||||
Cherry Studio <Version onClick={() => onOpenWebsite('/releases')}>(v{version})</Version>
|
||||
</Title>
|
||||
<Description>{t('settings.about.description')}</Description>
|
||||
<CheckUpdateButton onClick={onCheckUpdate} loading={checkUpdateLoading}>
|
||||
{downloading ? t('settings.about.downloading') : t('settings.about.checkUpdate')}
|
||||
</CheckUpdateButton>
|
||||
<Changelog />
|
||||
</Container>
|
||||
)
|
||||
}
|
||||
|
||||
const Container = styled.div`
|
||||
padding: 20px;
|
||||
display: flex;
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
height: calc(100vh - var(--navbar-height));
|
||||
overflow-y: scroll;
|
||||
padding: 0;
|
||||
padding-bottom: 50px;
|
||||
`
|
||||
|
||||
const Title = styled.div`
|
||||
@@ -49,6 +119,7 @@ const Version = styled.span`
|
||||
color: var(--color-text-2);
|
||||
margin: 10px 0;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
`
|
||||
|
||||
const Description = styled.div`
|
||||
@@ -57,4 +128,19 @@ const Description = styled.div`
|
||||
text-align: center;
|
||||
`
|
||||
|
||||
const CheckUpdateButton = styled(Button)`
|
||||
margin-top: 10px;
|
||||
`
|
||||
|
||||
const AvatarWrapper = styled.div`
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
`
|
||||
|
||||
const ProgressCircle = styled(Progress)`
|
||||
position: absolute;
|
||||
top: 48px;
|
||||
left: -2px;
|
||||
`
|
||||
|
||||
export default AboutSettings
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import changelogEn from '@renderer/assets/changelog/CHANGELOG.en.md?raw'
|
||||
import changelogZh from '@renderer/assets/changelog/CHANGELOG.zh.md?raw'
|
||||
import i18next from 'i18next'
|
||||
import changelogEn from '@renderer/CHANGELOG.en.md?raw'
|
||||
import changelogZh from '@renderer/CHANGELOG.zh.md?raw'
|
||||
import { FC } from 'react'
|
||||
import Markdown from 'react-markdown'
|
||||
import styled from 'styled-components'
|
||||
import styles from '@renderer/assets/styles/changelog.module.scss'
|
||||
import styles from './changelog.module.scss'
|
||||
import i18n from '@renderer/i18n'
|
||||
|
||||
const Changelog: FC = () => {
|
||||
const language = i18next.language
|
||||
const language = i18n.language
|
||||
const changelog = language === 'zh-CN' ? changelogZh : changelogEn
|
||||
|
||||
return (
|
||||
|
||||
@@ -86,7 +86,7 @@ const PopupContainer: React.FC<Props> = ({ provider: _provider, resolve }) => {
|
||||
return (
|
||||
<Flex>
|
||||
<ModelHeaderTitle>
|
||||
{provider.name} {t('common.models')}
|
||||
{t(`provider.${provider.id}`)} {t('common.models')}
|
||||
</ModelHeaderTitle>
|
||||
{loading && <LoadingOutlined size={20} />}
|
||||
</Flex>
|
||||
|
||||
@@ -18,7 +18,8 @@ interface Props {
|
||||
provider: Provider
|
||||
}
|
||||
|
||||
const ProviderSetting: FC<Props> = ({ provider }) => {
|
||||
const ProviderSetting: FC<Props> = ({ provider: _provider }) => {
|
||||
const { provider } = useProvider(_provider.id)
|
||||
const [apiKey, setApiKey] = useState(provider.apiKey)
|
||||
const [apiHost, setApiHost] = useState(provider.apiHost)
|
||||
const [apiValid, setApiValid] = useState(false)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
$background-color: #121212;
|
||||
$text-color: #ffffff;
|
||||
$heading-color: #bb86fc;
|
||||
$heading-color: #00b96b;
|
||||
$link-color: #3498db;
|
||||
$code-background: #1e1e1e;
|
||||
$code-color: #f0e7db;
|
||||
@@ -22,6 +22,11 @@ $code-color: #f0e7db;
|
||||
color: $heading-color;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 22px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin: 10px 0;
|
||||
font-weight: 500;
|
||||
@@ -64,7 +69,8 @@ $code-color: #f0e7db;
|
||||
|
||||
ul,
|
||||
ol {
|
||||
padding-left: 30px;
|
||||
padding-left: 20px;
|
||||
list-style: disc;
|
||||
}
|
||||
|
||||
li {
|
||||
@@ -8,7 +8,7 @@ import { takeRight } from 'lodash'
|
||||
import dayjs from 'dayjs'
|
||||
import store from '@renderer/store'
|
||||
import { setGenerating } from '@renderer/store/runtime'
|
||||
import { t } from 'i18next'
|
||||
import i18n from '@renderer/i18n'
|
||||
|
||||
interface FetchChatCompletionParams {
|
||||
messages: Message[]
|
||||
@@ -127,17 +127,17 @@ export async function checkApi(provider: Provider) {
|
||||
const style = { marginTop: '3vh' }
|
||||
|
||||
if (!provider.apiKey) {
|
||||
window.message.error({ content: t('error.enter.api.key'), key, style })
|
||||
window.message.error({ content: i18n.t('message.error.enter.api.key'), key, style })
|
||||
return false
|
||||
}
|
||||
|
||||
if (!provider.apiHost) {
|
||||
window.message.error({ content: t('error.enter.api.host'), key, style })
|
||||
window.message.error({ content: i18n.t('message.error.enter.api.host'), key, style })
|
||||
return false
|
||||
}
|
||||
|
||||
if (!model) {
|
||||
window.message.error({ content: t('error.enter.model'), key, style })
|
||||
window.message.error({ content: i18n.t('message.error.enter.model'), key, style })
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -147,7 +147,8 @@ export async function checkApi(provider: Provider) {
|
||||
try {
|
||||
const response = await openaiProvider.chat.completions.create({
|
||||
model: model.id,
|
||||
messages: [{ role: 'user', content: 'hello' }],
|
||||
messages: [{ role: 'user', content: 'hi' }],
|
||||
max_tokens: 100,
|
||||
stream: false
|
||||
})
|
||||
|
||||
@@ -161,7 +162,9 @@ export async function checkApi(provider: Provider) {
|
||||
key: 'api-check',
|
||||
style: { marginTop: '3vh' },
|
||||
duration: valid ? 2 : 8,
|
||||
content: valid ? t('message.api.connection.successful') : t('message.api.connection.failed') + ' ' + errorMessage
|
||||
content: valid
|
||||
? i18n.t('message.api.connection.success')
|
||||
: i18n.t('message.api.connection.failed') + ' ' + errorMessage
|
||||
})
|
||||
|
||||
return valid
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { Assistant, Model, Provider, Topic } from '@renderer/types'
|
||||
import store from '@renderer/store'
|
||||
import { uuid } from '@renderer/utils'
|
||||
import i18next from 'i18next'
|
||||
import i18n from '@renderer/i18n'
|
||||
|
||||
export function getDefaultAssistant(): Assistant {
|
||||
return {
|
||||
id: 'default',
|
||||
name: i18next.t('assistant.default.name'),
|
||||
name: i18n.t('assistant.default.name'),
|
||||
prompt: '',
|
||||
topics: [getDefaultTopic()]
|
||||
}
|
||||
@@ -15,7 +15,7 @@ export function getDefaultAssistant(): Assistant {
|
||||
export function getDefaultTopic(): Topic {
|
||||
return {
|
||||
id: uuid(),
|
||||
name: i18next.t('assistant.default.topic.name'),
|
||||
name: i18n.t('assistant.default.topic.name'),
|
||||
messages: []
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ const persistedReducer = persistReducer(
|
||||
{
|
||||
key: 'cherry-studio',
|
||||
storage,
|
||||
version: 7,
|
||||
version: 9,
|
||||
blacklist: ['runtime'],
|
||||
migrate
|
||||
},
|
||||
|
||||
@@ -54,7 +54,7 @@ const initialState: LlmState = {
|
||||
name: 'ZhiPu',
|
||||
apiKey: '',
|
||||
apiHost: 'https://open.bigmodel.cn/api/paas/v4/',
|
||||
models: SYSTEM_MODELS.groq.filter((m) => m.defaultEnabled),
|
||||
models: SYSTEM_MODELS.zhipu.filter((m) => m.defaultEnabled),
|
||||
isSystem: true,
|
||||
enabled: false
|
||||
},
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { createMigrate } from 'redux-persist'
|
||||
import { RootState } from '.'
|
||||
import { SYSTEM_MODELS } from '@renderer/config/models'
|
||||
import { isEmpty } from 'lodash'
|
||||
import i18n from '@renderer/i18n'
|
||||
import { Assistant } from '@renderer/types'
|
||||
|
||||
const migrate = createMigrate({
|
||||
// @ts-ignore store type is unknown
|
||||
@@ -112,6 +115,47 @@ const migrate = createMigrate({
|
||||
language: navigator.language
|
||||
}
|
||||
}
|
||||
},
|
||||
// @ts-ignore store type is unknown
|
||||
'8': (state: RootState) => {
|
||||
const fixAssistantName = (assistant: Assistant) => {
|
||||
if (isEmpty(assistant.name)) {
|
||||
assistant.name = i18n.t(`assistant.${assistant.id}.name`)
|
||||
}
|
||||
|
||||
assistant.topics = assistant.topics.map((topic) => {
|
||||
if (isEmpty(topic.name)) {
|
||||
topic.name = i18n.t(`assistant.${assistant.id}.topic.name`)
|
||||
}
|
||||
return topic
|
||||
})
|
||||
|
||||
return assistant
|
||||
}
|
||||
|
||||
return {
|
||||
...state,
|
||||
assistants: {
|
||||
...state.assistants,
|
||||
defaultAssistant: fixAssistantName(state.assistants.defaultAssistant),
|
||||
assistants: state.assistants.assistants.map((assistant) => fixAssistantName(assistant))
|
||||
}
|
||||
}
|
||||
},
|
||||
// @ts-ignore store type is unknown
|
||||
'9': (state: RootState) => {
|
||||
return {
|
||||
...state,
|
||||
llm: {
|
||||
...state.llm,
|
||||
providers: state.llm.providers.map((provider) => {
|
||||
if (provider.id === 'zhipu' && provider.models[0] && provider.models[0].id === 'llama3-70b-8192') {
|
||||
provider.models = SYSTEM_MODELS.zhipu.filter((m) => m.defaultEnabled)
|
||||
}
|
||||
return provider
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -98,3 +98,13 @@ export const firstLetter = (str?: string) => {
|
||||
export function isFreeModel(model: Model) {
|
||||
return (model.id + model.name).toLocaleLowerCase().includes('free')
|
||||
}
|
||||
|
||||
export async function isProduction() {
|
||||
const { isPackaged } = await window.api.getAppInfo()
|
||||
return isPackaged
|
||||
}
|
||||
|
||||
export async function isDev() {
|
||||
const isProd = await isProduction()
|
||||
return !isProd
|
||||
}
|
||||
|
||||
176
src/website/index.html
Normal file
176
src/website/index.html
Normal file
@@ -0,0 +1,176 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta
|
||||
name="description"
|
||||
content="Cherry Studio 是一款强大的多模型 AI 助手,支持 iOS、macOS 和 Windows 平台。快速切换多个先进的 LLM 模型,提升工作学习效率。" />
|
||||
<meta name="keywords" content="Cherry Studio, AI 助手, GPT 客户端, 多模型, iOS, macOS, Windows, LLM" />
|
||||
<meta name="author" content="kangfenmao" />
|
||||
<link rel="canonical" href="https://easys.run/cherry-studio" />
|
||||
|
||||
<!-- Open Graph / Facebook -->
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:url" content="https://easys.run/cherry-studio" />
|
||||
<meta property="og:title" content="Cherry Studio - 多模型 AI 助手" />
|
||||
<meta
|
||||
property="og:description"
|
||||
content="Cherry Studio 是一款强大的多模型 AI 助手,支持 iOS、macOS 和 Windows 平台。快速切换多个先进的 LLM 模型,提升工作学习效率。" />
|
||||
<meta property="og:image" content="https://github.com/kangfenmao/cherry-studio/blob/main/build/icon.png?raw=true" />
|
||||
|
||||
<!-- Twitter -->
|
||||
<meta property="twitter:card" content="summary_large_image" />
|
||||
<meta property="twitter:url" content="https://x.com/kangfenmao" />
|
||||
<meta property="twitter:title" content="Cherry Studio - 多模型 AI 助手" />
|
||||
<meta
|
||||
property="twitter:description"
|
||||
content="Cherry Studio 是一款强大的多模型 AI 助手,支持 iOS、macOS 和 Windows 平台。快速切换多个先进的 LLM 模型,提升工作学习效率。" />
|
||||
<meta
|
||||
property="twitter:image"
|
||||
content="https://github.com/kangfenmao/cherry-studio/blob/main/build/icon.png?raw=true" />
|
||||
|
||||
<title>Cherry Studio - 多模型AI助手</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans',
|
||||
'Helvetica Neue', sans-serif;
|
||||
background-color: #000000;
|
||||
color: #ffffff;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100vh;
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
}
|
||||
.logo {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
margin-bottom: 20px;
|
||||
border-radius: 10%;
|
||||
}
|
||||
h1 {
|
||||
font-size: 48px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.description {
|
||||
font-size: 18px;
|
||||
margin-bottom: 30px;
|
||||
color: #a0a0a0;
|
||||
}
|
||||
.download-buttons {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 15px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
.download-btn {
|
||||
background-color: #ffffff;
|
||||
color: #000000;
|
||||
padding: 10px 20px;
|
||||
border-radius: 25px;
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
transition: background-color 0.3s;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.download-btn:hover {
|
||||
background-color: #e0e0e0;
|
||||
}
|
||||
.download-btn svg {
|
||||
margin-right: 10px;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
}
|
||||
.new-app {
|
||||
margin-top: 20px;
|
||||
font-size: 14px;
|
||||
color: #a0a0a0;
|
||||
}
|
||||
.footer {
|
||||
position: absolute;
|
||||
bottom: 20px;
|
||||
font-size: 14px;
|
||||
color: #a0a0a0;
|
||||
}
|
||||
.footer a {
|
||||
color: #a0a0a0;
|
||||
text-decoration: none;
|
||||
margin: 0 10px;
|
||||
}
|
||||
a {
|
||||
color: #ffffff;
|
||||
text-decoration: underline;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<img
|
||||
src="https://github.com/kangfenmao/cherry-studio/blob/main/resources/icon.png?raw=true"
|
||||
alt="Cherry Studio Logo"
|
||||
class="logo" />
|
||||
<h1>Cherry Studio</h1>
|
||||
<p class="description">Windows/macOS GPT 客户端</p>
|
||||
<div class="download-buttons">
|
||||
<a
|
||||
href="https://github.com/kangfenmao/cherry-studio/releases/download/v0.2.3/Cherry-Studio-0.2.3-x64.dmg"
|
||||
class="download-btn">
|
||||
<svg viewBox="0 0 384 512" width="24" height="24">
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z" />
|
||||
</svg>
|
||||
macOS Intel
|
||||
</a>
|
||||
<a
|
||||
href="https://github.com/kangfenmao/cherry-studio/releases/download/v0.2.3/Cherry-Studio-0.2.3-arm64.dmg"
|
||||
class="download-btn">
|
||||
<svg viewBox="0 0 384 512" width="24" height="24">
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z" />
|
||||
</svg>
|
||||
macOS Apple Silicon
|
||||
</a>
|
||||
<a
|
||||
href="https://github.com/kangfenmao/cherry-studio/releases/download/v0.2.3/Cherry-Studio-0.2.3-setup.exe"
|
||||
class="download-btn">
|
||||
<svg viewBox="0 0 448 512" width="24" height="24">
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M0 93.7l183.6-25.3v177.4H0V93.7zm0 324.6l183.6 25.3V268.4H0v149.9zm203.8 28L448 480V268.4H203.8v177.9zm0-380.6v180.1H448V32L203.8 65.7z" />
|
||||
</svg>
|
||||
下载 Windows 版本
|
||||
</a>
|
||||
</div>
|
||||
<p class="new-app">
|
||||
🎉 Cherry Studio 最新版本
|
||||
<a href="https://github.com/kangfenmao/cherry-studio/releases/tag/v0.2.3" target="_blank">v0.2.3</a> 发布啦!
|
||||
</p>
|
||||
<div class="footer">
|
||||
<a href="https://github.com/kangfenmao/cherry-studio" target="_blank">开源</a> |
|
||||
<a href="https://github.com/kangfenmao/cherry-studio/blob/main/README.md" target="_blank">帮助</a> |
|
||||
<a href="mailto:kangfenmao@qq.com" target="_blank">联系</a>
|
||||
</div>
|
||||
<!-- 结构化数据 -->
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "SoftwareApplication",
|
||||
"name": "Cherry Studio",
|
||||
"applicationCategory": "UtilitiesApplication",
|
||||
"operatingSystem": "iOS, macOS, Windows",
|
||||
"description": "Cherry Studio 是一款强大的多模型 AI 助手,支持 iOS、macOS 和 Windows 平台。快速切换多个先进的 LLM 模型,提升工作学习效率。",
|
||||
"offers": {
|
||||
"@type": "Offer",
|
||||
"price": "0",
|
||||
"priceCurrency": "USD"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user