Skip to content

Commit

Permalink
chore(version): 0.8.23
Browse files Browse the repository at this point in the history
  • Loading branch information
kangfenmao committed Dec 5, 2024
1 parent ae1960f commit e5c1791
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 41 deletions.
1 change: 0 additions & 1 deletion electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,3 @@ releaseInfo:
修复快捷键设置错误导致的无法启动问题
修复翻译按钮无法正常输出内容问题
修复检测更新按钮逻辑错误
没有语言标识的代码块支持复制
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "CherryStudio",
"version": "0.8.22",
"version": "0.8.23",
"private": true,
"description": "A powerful AI assistant for producer.",
"main": "./out/main/index.js",
Expand Down
12 changes: 3 additions & 9 deletions src/main/services/AppUpdater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ export default class AppUpdater {
autoUpdater: _AppUpdater = autoUpdater

constructor(mainWindow: BrowserWindow) {
logger.transports.file.level = 'debug'
logger.transports.file.level = 'info'

autoUpdater.logger = logger
autoUpdater.forceDevUpdateConfig = !app.isPackaged
autoUpdater.autoDownload = true
Expand All @@ -18,15 +19,8 @@ export default class AppUpdater {
})

autoUpdater.on('update-available', (releaseInfo: UpdateInfo) => {
autoUpdater.logger?.info('检测到新版本,开始自动下载')
logger.info('检测到新版本', releaseInfo)
mainWindow.webContents.send('update-available', releaseInfo)

dialog.showMessageBox({
type: 'info',
title: '正在下载新版本',
message: `新版本 ${releaseInfo.version}`,
detail: this.formatReleaseNotes(releaseInfo.releaseNotes)
})
})

// 检测到不需要更新时
Expand Down
1 change: 0 additions & 1 deletion src/renderer/src/assets/styles/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ body[os='mac'] {
border-top-left-radius: 10px;
border-bottom-left-radius: 10px;
border-left: 0.5px solid var(--color-border);
box-shadow: 0 0 15px 1px rgba(0, 0, 0, 0.05);
}
}

Expand Down
15 changes: 8 additions & 7 deletions src/renderer/src/i18n/locales/en-us.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@
"settings.context_count": "Context",
"settings.context_count.tip": "The number of previous messages to keep in the context.",
"settings.max": "Max",
"settings.max_tokens": "Enable Max Tokens Limit",
"settings.max_tokens": "Enable max tokens limit",
"settings.max_tokens.tip": "The maximum number of tokens the model can generate. Normal chat suggests 500-800. Short text generation suggests 800-2000. Code generation suggests 2000-3600. Long text generation suggests above 4000.",
"settings.reset": "Reset",
"settings.set_as_default": "Apply to default assistant",
"settings.show_line_numbers": "Show Line Numbers in Code",
"settings.show_line_numbers": "Show line numbers in code",
"settings.temperature": "Temperature",
"settings.temperature.tip": "Lower values make the model more creative and unpredictable, while higher values make it more deterministic and precise.",
"suggestions.title": "Suggested Questions",
Expand Down Expand Up @@ -228,7 +228,7 @@
"message.code_style": "Code style",
"message.delete.content": "Are you sure you want to delete this message?",
"message.delete.title": "Delete Message",
"message.style": "Message Style",
"message.style": "Message style",
"message.style.bubble": "Bubble",
"message.style.plain": "Plain",
"reset.confirm.content": "Are you sure you want to clear all data?",
Expand All @@ -249,7 +249,7 @@
"model": {
"pinned": "Pinned",
"search": "Search models...",
"stream_output": "Stream Output",
"stream_output": "Stream output",
"type": {
"select": "Select Model Types",
"text": "Text",
Expand Down Expand Up @@ -328,6 +328,7 @@
"about.releases.button": "Releases",
"about.releases.title": "Release Notes",
"about.title": "About",
"about.updateAvailable": "Found new version {{version}}",
"about.updateError": "Update error",
"about.updateNotAvailable": "You are using the latest version",
"about.website.button": "Website",
Expand Down Expand Up @@ -360,7 +361,7 @@
"webdav.user": "WebDAV User"
},
"display.title": "Display Settings",
"font_size.title": "Message Font Size",
"font_size.title": "Message font size",
"general": "General Settings",
"general.backup.button": "Backup",
"general.backup.title": "Data Backup and Recovery",
Expand Down Expand Up @@ -477,10 +478,10 @@
"theme.window.style.title": "Window Style",
"theme.window.style.transparent": "Transparent Window",
"title": "Settings",
"topic.position": "Topic Position",
"topic.position": "Topic position",
"topic.position.left": "Left",
"topic.position.right": "Right",
"topic.show.time": "Show Topic Time",
"topic.show.time": "Show topic time",
"tray.title": "Enable System Tray Icon"
},
"translate": {
Expand Down
1 change: 1 addition & 0 deletions src/renderer/src/i18n/locales/ru-ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@
"about.releases.button": "Релизы",
"about.releases.title": "Заметки о релизах",
"about.title": "О программе",
"about.updateAvailable": "Найдено новое обновление {{version}}",
"about.updateError": "Ошибка обновления",
"about.updateNotAvailable": "Вы используете последнюю версию",
"about.website.button": "Сайт",
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/src/i18n/locales/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@
"about.releases.button": "查看",
"about.releases.title": "更新日志",
"about.title": "关于我们",
"about.updateAvailable": "发现新版本 {{version}}",
"about.updateError": "更新出错",
"about.updateNotAvailable": "你的软件已是最新版本",
"about.website.button": "查看",
Expand Down Expand Up @@ -445,7 +446,7 @@
"action": "操作",
"key": "按键",
"new_topic": "新建话题",
"title": "快捷键",
"title": "快捷方式",
"zoom_in": "放大界面",
"zoom_out": "缩小界面",
"zoom_reset": "重置缩放",
Expand Down
1 change: 1 addition & 0 deletions src/renderer/src/i18n/locales/zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@
"about.releases.button": "查看",
"about.releases.title": "更新日誌",
"about.title": "關於我們",
"about.updateAvailable": "發現新版本 {{version}}",
"about.updateError": "更新錯誤",
"about.updateNotAvailable": "您正在使用最新版本",
"about.website.button": "網站",
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/src/pages/agents/AgentsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ const AgentsPage: FC = () => {
{Object.values(filteredAgentGroups)
.flat()
.map((agent, index, array) => (
<Col span={array.length === 1 ? 8 : 6} key={index}>
<Col span={array.length === 1 ? 12 : 6} key={index}>
<AgentCard
onClick={() => onAddAgentConfirm(getAgentFromSystemAgent(agent as any))}
agent={agent as any}
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/src/pages/home/Markdown/Markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'katex/dist/katex.min.css'

import { useSettings } from '@renderer/hooks/useSettings'
import { Message } from '@renderer/types'
import { addPlaintextToCodeBlock, escapeBrackets } from '@renderer/utils/formula'
import { escapeBrackets } from '@renderer/utils/formula'
import { isEmpty } from 'lodash'
import { FC, useMemo } from 'react'
import { useTranslation } from 'react-i18next'
Expand Down Expand Up @@ -35,7 +35,7 @@ const Markdown: FC<Props> = ({ message }) => {
const empty = isEmpty(message.content)
const paused = message.status === 'paused'
const content = empty && paused ? t('message.chat.completion.paused') : message.content
return escapeBrackets(addPlaintextToCodeBlock(content))
return escapeBrackets(content)
}, [message.content, message.status, t])

const rehypePlugins = useMemo(() => {
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/src/pages/home/Tabs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ const Segmented = styled(AntSegmented)`
.ant-segmented-item {
overflow: hidden;
transition: none !important;
height: 30px;
line-height: 30px;
height: 34px;
line-height: 34px;
background-color: transparent;
}
.ant-segmented-item-selected {
Expand Down
15 changes: 13 additions & 2 deletions src/renderer/src/pages/settings/AboutSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ import { useAppDispatch } from '@renderer/store'
import { setManualUpdateCheck } from '@renderer/store/settings'
import { runAsyncFunction } from '@renderer/utils'
import { Avatar, Button, Progress, Row, Switch, Tag } from 'antd'
import { ProgressInfo } from 'electron-updater'
import { ProgressInfo, UpdateInfo } from 'electron-updater'
import { debounce } from 'lodash'
import { FC, useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import Markdown from 'react-markdown'
import { Link } from 'react-router-dom'
import styled from 'styled-components'

Expand Down Expand Up @@ -81,9 +82,19 @@ const AboutSettings: FC = () => {
setCheckUpdateLoading(false)
window.message.success(t('settings.about.updateNotAvailable'))
}),
ipcRenderer.on('update-available', () => {
ipcRenderer.on('update-available', (_, releaseInfo: UpdateInfo) => {
setCheckUpdateLoading(false)
setDownloading(true)
window.modal.info({
title: t('settings.about.updateAvailable', { version: releaseInfo.version }),
content: (
<Markdown>
{typeof releaseInfo.releaseNotes === 'string'
? releaseInfo.releaseNotes
: releaseInfo.releaseNotes?.map((note) => note.note).join('\n')}
</Markdown>
)
})
}),
ipcRenderer.on('download-update', () => {
setCheckUpdateLoading(false)
Expand Down
14 changes: 0 additions & 14 deletions src/renderer/src/utils/formula.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,3 @@ export function extractTitle(html: string): string | null {

return null
}

export function addPlaintextToCodeBlock(markdown: string): string {
// 修改正则表达式以匹配代码块的开始和结束,包括前后的换行符
const codeBlockRegex = /(^|\n)```([\w]*)\n([\s\S]*?)\n```/g

return markdown.replace(codeBlockRegex, (match, newline, language, code) => {
// 如果没有指定语言,使用 text
if (!language) {
return `${newline}\`\`\`text\n${code}\n\`\`\``
}
// 如果指定了语言,保持原样
return match
})
}

0 comments on commit e5c1791

Please sign in to comment.