From e5c1791135fcdaaa8b032e14809e205e0d6297af Mon Sep 17 00:00:00 2001 From: kangfenmao Date: Thu, 5 Dec 2024 22:38:03 +0800 Subject: [PATCH] chore(version): 0.8.23 --- electron-builder.yml | 1 - package.json | 2 +- src/main/services/AppUpdater.ts | 12 +++--------- src/renderer/src/assets/styles/index.scss | 1 - src/renderer/src/i18n/locales/en-us.json | 15 ++++++++------- src/renderer/src/i18n/locales/ru-ru.json | 1 + src/renderer/src/i18n/locales/zh-cn.json | 3 ++- src/renderer/src/i18n/locales/zh-tw.json | 1 + src/renderer/src/pages/agents/AgentsPage.tsx | 2 +- src/renderer/src/pages/home/Markdown/Markdown.tsx | 4 ++-- src/renderer/src/pages/home/Tabs/index.tsx | 4 ++-- src/renderer/src/pages/settings/AboutSettings.tsx | 15 +++++++++++++-- src/renderer/src/utils/formula.ts | 14 -------------- 13 files changed, 34 insertions(+), 41 deletions(-) diff --git a/electron-builder.yml b/electron-builder.yml index 3302c5dd9..d264fd0aa 100644 --- a/electron-builder.yml +++ b/electron-builder.yml @@ -66,4 +66,3 @@ releaseInfo: 修复快捷键设置错误导致的无法启动问题 修复翻译按钮无法正常输出内容问题 修复检测更新按钮逻辑错误 - 没有语言标识的代码块支持复制 diff --git a/package.json b/package.json index 942b2ef79..1bcf4e4ef 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/main/services/AppUpdater.ts b/src/main/services/AppUpdater.ts index d534de81b..f8bccfe13 100644 --- a/src/main/services/AppUpdater.ts +++ b/src/main/services/AppUpdater.ts @@ -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 @@ -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) - }) }) // 检测到不需要更新时 diff --git a/src/renderer/src/assets/styles/index.scss b/src/renderer/src/assets/styles/index.scss index e35aaf2e8..f3f6068e3 100644 --- a/src/renderer/src/assets/styles/index.scss +++ b/src/renderer/src/assets/styles/index.scss @@ -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); } } diff --git a/src/renderer/src/i18n/locales/en-us.json b/src/renderer/src/i18n/locales/en-us.json index e4ee848eb..f6eb407ab 100644 --- a/src/renderer/src/i18n/locales/en-us.json +++ b/src/renderer/src/i18n/locales/en-us.json @@ -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", @@ -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?", @@ -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", @@ -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", @@ -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", @@ -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": { diff --git a/src/renderer/src/i18n/locales/ru-ru.json b/src/renderer/src/i18n/locales/ru-ru.json index 5e8c49f77..3e7c9f5e7 100644 --- a/src/renderer/src/i18n/locales/ru-ru.json +++ b/src/renderer/src/i18n/locales/ru-ru.json @@ -328,6 +328,7 @@ "about.releases.button": "Релизы", "about.releases.title": "Заметки о релизах", "about.title": "О программе", + "about.updateAvailable": "Найдено новое обновление {{version}}", "about.updateError": "Ошибка обновления", "about.updateNotAvailable": "Вы используете последнюю версию", "about.website.button": "Сайт", diff --git a/src/renderer/src/i18n/locales/zh-cn.json b/src/renderer/src/i18n/locales/zh-cn.json index 78f56c6c6..9b89665e7 100644 --- a/src/renderer/src/i18n/locales/zh-cn.json +++ b/src/renderer/src/i18n/locales/zh-cn.json @@ -328,6 +328,7 @@ "about.releases.button": "查看", "about.releases.title": "更新日志", "about.title": "关于我们", + "about.updateAvailable": "发现新版本 {{version}}", "about.updateError": "更新出错", "about.updateNotAvailable": "你的软件已是最新版本", "about.website.button": "查看", @@ -445,7 +446,7 @@ "action": "操作", "key": "按键", "new_topic": "新建话题", - "title": "快捷键", + "title": "快捷方式", "zoom_in": "放大界面", "zoom_out": "缩小界面", "zoom_reset": "重置缩放", diff --git a/src/renderer/src/i18n/locales/zh-tw.json b/src/renderer/src/i18n/locales/zh-tw.json index 768377d91..449587c88 100644 --- a/src/renderer/src/i18n/locales/zh-tw.json +++ b/src/renderer/src/i18n/locales/zh-tw.json @@ -328,6 +328,7 @@ "about.releases.button": "查看", "about.releases.title": "更新日誌", "about.title": "關於我們", + "about.updateAvailable": "發現新版本 {{version}}", "about.updateError": "更新錯誤", "about.updateNotAvailable": "您正在使用最新版本", "about.website.button": "網站", diff --git a/src/renderer/src/pages/agents/AgentsPage.tsx b/src/renderer/src/pages/agents/AgentsPage.tsx index 77669de46..82e62f18b 100644 --- a/src/renderer/src/pages/agents/AgentsPage.tsx +++ b/src/renderer/src/pages/agents/AgentsPage.tsx @@ -194,7 +194,7 @@ const AgentsPage: FC = () => { {Object.values(filteredAgentGroups) .flat() .map((agent, index, array) => ( - + onAddAgentConfirm(getAgentFromSystemAgent(agent as any))} agent={agent as any} diff --git a/src/renderer/src/pages/home/Markdown/Markdown.tsx b/src/renderer/src/pages/home/Markdown/Markdown.tsx index b33dda597..0448b94e0 100644 --- a/src/renderer/src/pages/home/Markdown/Markdown.tsx +++ b/src/renderer/src/pages/home/Markdown/Markdown.tsx @@ -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' @@ -35,7 +35,7 @@ const Markdown: FC = ({ 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(() => { diff --git a/src/renderer/src/pages/home/Tabs/index.tsx b/src/renderer/src/pages/home/Tabs/index.tsx index 7469c4b01..cc925dd65 100644 --- a/src/renderer/src/pages/home/Tabs/index.tsx +++ b/src/renderer/src/pages/home/Tabs/index.tsx @@ -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 { diff --git a/src/renderer/src/pages/settings/AboutSettings.tsx b/src/renderer/src/pages/settings/AboutSettings.tsx index 7c9cc7730..0716fafb0 100644 --- a/src/renderer/src/pages/settings/AboutSettings.tsx +++ b/src/renderer/src/pages/settings/AboutSettings.tsx @@ -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' @@ -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: ( + + {typeof releaseInfo.releaseNotes === 'string' + ? releaseInfo.releaseNotes + : releaseInfo.releaseNotes?.map((note) => note.note).join('\n')} + + ) + }) }), ipcRenderer.on('download-update', () => { setCheckUpdateLoading(false) diff --git a/src/renderer/src/utils/formula.ts b/src/renderer/src/utils/formula.ts index 373776a07..f8d50b7cd 100644 --- a/src/renderer/src/utils/formula.ts +++ b/src/renderer/src/utils/formula.ts @@ -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 - }) -}