diff --git a/src/renderer/src/assets/fonts/Poppins/Poppins-Black.ttf b/src/renderer/src/assets/fonts/Poppins/Poppins-Black.ttf deleted file mode 100644 index 71c0f995..00000000 Binary files a/src/renderer/src/assets/fonts/Poppins/Poppins-Black.ttf and /dev/null differ diff --git a/src/renderer/src/assets/fonts/Poppins/Poppins-Bold.ttf b/src/renderer/src/assets/fonts/Poppins/Poppins-Bold.ttf deleted file mode 100644 index 00559eeb..00000000 Binary files a/src/renderer/src/assets/fonts/Poppins/Poppins-Bold.ttf and /dev/null differ diff --git a/src/renderer/src/assets/fonts/Poppins/Poppins-ExtraBold.ttf b/src/renderer/src/assets/fonts/Poppins/Poppins-ExtraBold.ttf deleted file mode 100644 index df709360..00000000 Binary files a/src/renderer/src/assets/fonts/Poppins/Poppins-ExtraBold.ttf and /dev/null differ diff --git a/src/renderer/src/assets/fonts/Poppins/Poppins-ExtraLight.ttf b/src/renderer/src/assets/fonts/Poppins/Poppins-ExtraLight.ttf deleted file mode 100644 index e76ec69a..00000000 Binary files a/src/renderer/src/assets/fonts/Poppins/Poppins-ExtraLight.ttf and /dev/null differ diff --git a/src/renderer/src/assets/fonts/Poppins/Poppins-Light.ttf b/src/renderer/src/assets/fonts/Poppins/Poppins-Light.ttf deleted file mode 100644 index bc36bcc2..00000000 Binary files a/src/renderer/src/assets/fonts/Poppins/Poppins-Light.ttf and /dev/null differ diff --git a/src/renderer/src/assets/fonts/Poppins/Poppins-Medium.ttf b/src/renderer/src/assets/fonts/Poppins/Poppins-Medium.ttf deleted file mode 100644 index 6bcdcc27..00000000 Binary files a/src/renderer/src/assets/fonts/Poppins/Poppins-Medium.ttf and /dev/null differ diff --git a/src/renderer/src/assets/fonts/Poppins/Poppins-Regular.ttf b/src/renderer/src/assets/fonts/Poppins/Poppins-Regular.ttf deleted file mode 100644 index 9f0c71b7..00000000 Binary files a/src/renderer/src/assets/fonts/Poppins/Poppins-Regular.ttf and /dev/null differ diff --git a/src/renderer/src/assets/fonts/Poppins/Poppins-SemiBold.ttf b/src/renderer/src/assets/fonts/Poppins/Poppins-SemiBold.ttf deleted file mode 100644 index 74c726e3..00000000 Binary files a/src/renderer/src/assets/fonts/Poppins/Poppins-SemiBold.ttf and /dev/null differ diff --git a/src/renderer/src/assets/fonts/Poppins/Poppins-Thin.ttf b/src/renderer/src/assets/fonts/Poppins/Poppins-Thin.ttf deleted file mode 100644 index 03e73661..00000000 Binary files a/src/renderer/src/assets/fonts/Poppins/Poppins-Thin.ttf and /dev/null differ diff --git a/src/renderer/src/assets/fonts/Poppins/Poppins.css b/src/renderer/src/assets/fonts/Poppins/Poppins.css deleted file mode 100644 index bc72ccf6..00000000 --- a/src/renderer/src/assets/fonts/Poppins/Poppins.css +++ /dev/null @@ -1,47 +0,0 @@ -@font-face { - font-family: 'Poppins'; - src: url(Poppins-Thin.ttf) format('truetype'); - font-weight: 100; -} - -@font-face { - font-family: 'Poppins'; - src: url(Poppins-ExtraLight.ttf) format('truetype'); - font-weight: 200; -} - -@font-face { - font-family: 'Poppins'; - src: url(Poppins-Light.ttf) format('truetype'); - font-weight: 300; -} - -@font-face { - font-family: 'Poppins'; - src: url(Poppins-Regular.ttf) format('truetype'); - font-weight: 400; -} - -@font-face { - font-family: 'Poppins'; - src: url(Poppins-Medium.ttf) format('truetype'); - font-weight: 500; -} - -@font-face { - font-family: 'Poppins'; - src: url(Poppins-SemiBold.ttf) format('truetype'); - font-weight: 600; -} - -@font-face { - font-family: 'Poppins'; - src: url(Poppins-Bold.ttf) format('truetype'); - font-weight: 700; -} - -@font-face { - font-family: 'Poppins'; - src: url(Poppins-ExtraBold.ttf) format('truetype'); - font-weight: 800; -} diff --git a/src/renderer/src/assets/fonts/Ubuntu/Ubuntu-Bold.ttf b/src/renderer/src/assets/fonts/Ubuntu/Ubuntu-Bold.ttf new file mode 100644 index 00000000..c2293d5c Binary files /dev/null and b/src/renderer/src/assets/fonts/Ubuntu/Ubuntu-Bold.ttf differ diff --git a/src/renderer/src/assets/fonts/Ubuntu/Ubuntu-BoldItalic.ttf b/src/renderer/src/assets/fonts/Ubuntu/Ubuntu-BoldItalic.ttf new file mode 100644 index 00000000..ce6e784d Binary files /dev/null and b/src/renderer/src/assets/fonts/Ubuntu/Ubuntu-BoldItalic.ttf differ diff --git a/src/renderer/src/assets/fonts/Ubuntu/Ubuntu-Italic.ttf b/src/renderer/src/assets/fonts/Ubuntu/Ubuntu-Italic.ttf new file mode 100644 index 00000000..a599244e Binary files /dev/null and b/src/renderer/src/assets/fonts/Ubuntu/Ubuntu-Italic.ttf differ diff --git a/src/renderer/src/assets/fonts/Ubuntu/Ubuntu-Light.ttf b/src/renderer/src/assets/fonts/Ubuntu/Ubuntu-Light.ttf new file mode 100644 index 00000000..b310d150 Binary files /dev/null and b/src/renderer/src/assets/fonts/Ubuntu/Ubuntu-Light.ttf differ diff --git a/src/renderer/src/assets/fonts/Ubuntu/Ubuntu-LightItalic.ttf b/src/renderer/src/assets/fonts/Ubuntu/Ubuntu-LightItalic.ttf new file mode 100644 index 00000000..ad0741b4 Binary files /dev/null and b/src/renderer/src/assets/fonts/Ubuntu/Ubuntu-LightItalic.ttf differ diff --git a/src/renderer/src/assets/fonts/Ubuntu/Ubuntu-Medium.ttf b/src/renderer/src/assets/fonts/Ubuntu/Ubuntu-Medium.ttf new file mode 100644 index 00000000..7340a40a Binary files /dev/null and b/src/renderer/src/assets/fonts/Ubuntu/Ubuntu-Medium.ttf differ diff --git a/src/renderer/src/assets/fonts/Ubuntu/Ubuntu-MediumItalic.ttf b/src/renderer/src/assets/fonts/Ubuntu/Ubuntu-MediumItalic.ttf new file mode 100644 index 00000000..36ac1aed Binary files /dev/null and b/src/renderer/src/assets/fonts/Ubuntu/Ubuntu-MediumItalic.ttf differ diff --git a/src/renderer/src/assets/fonts/Ubuntu/Ubuntu-Regular.ttf b/src/renderer/src/assets/fonts/Ubuntu/Ubuntu-Regular.ttf new file mode 100644 index 00000000..f98a2dab Binary files /dev/null and b/src/renderer/src/assets/fonts/Ubuntu/Ubuntu-Regular.ttf differ diff --git a/src/renderer/src/assets/fonts/Ubuntu/Ubuntu.css b/src/renderer/src/assets/fonts/Ubuntu/Ubuntu.css new file mode 100644 index 00000000..0a0317a9 --- /dev/null +++ b/src/renderer/src/assets/fonts/Ubuntu/Ubuntu.css @@ -0,0 +1,55 @@ +@font-face { + font-family: 'Ubuntu'; + src: url('Ubuntu-Regular.ttf') format('truetype'); + font-weight: normal; + font-style: normal; +} + +@font-face { + font-family: 'Ubuntu'; + src: url('Ubuntu-Italic.ttf') format('truetype'); + font-weight: normal; + font-style: italic; +} + +@font-face { + font-family: 'Ubuntu'; + src: url('Ubuntu-Bold.ttf') format('truetype'); + font-weight: bold; + font-style: normal; +} + +@font-face { + font-family: 'Ubuntu'; + src: url('Ubuntu-BoldItalic.ttf') format('truetype'); + font-weight: bold; + font-style: italic; +} + +@font-face { + font-family: 'Ubuntu'; + src: url('Ubuntu-Light.ttf') format('truetype'); + font-weight: 300; + font-style: normal; +} + +@font-face { + font-family: 'Ubuntu'; + src: url('Ubuntu-LightItalic.ttf') format('truetype'); + font-weight: 300; + font-style: italic; +} + +@font-face { + font-family: 'Ubuntu'; + src: url('Ubuntu-Medium.ttf') format('truetype'); + font-weight: 500; + font-style: normal; +} + +@font-face { + font-family: 'Ubuntu'; + src: url('Ubuntu-MediumItalic.ttf') format('truetype'); + font-weight: 500; + font-style: italic; +} diff --git a/src/renderer/src/assets/styles/index.scss b/src/renderer/src/assets/styles/index.scss index b3dfc2a0..c65e0458 100644 --- a/src/renderer/src/assets/styles/index.scss +++ b/src/renderer/src/assets/styles/index.scss @@ -1,7 +1,7 @@ @import './markdown.scss'; @import './scrollbar.scss'; @import '../fonts/icon-fonts/iconfont.css'; -@import '../fonts/Poppins/Poppins.css'; +@import '../fonts/Ubuntu/Ubuntu.css'; :root { --color-white: #ffffff; @@ -108,18 +108,8 @@ body { line-height: 1.6; overflow: hidden; background: transparent !important; - font-family: - -apple-system, - BlinkMacSystemFont, - 'Microsoft YaHei', - 'Segoe UI', - Roboto, - Oxygen, - Ubuntu, - Cantarell, - 'Fira Sans', - 'Droid Sans', - 'Helvetica Neue' sans-serif; + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', + 'Helvetica Neue', sans-serif; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; diff --git a/src/renderer/src/assets/styles/markdown.scss b/src/renderer/src/assets/styles/markdown.scss index e763c3aa..c2877c52 100644 --- a/src/renderer/src/assets/styles/markdown.scss +++ b/src/renderer/src/assets/styles/markdown.scss @@ -4,14 +4,6 @@ line-height: 1.6; user-select: text; - p:last-child { - margin-bottom: 5px; - } - - p:first-child { - margin-top: 0; - } - h1:first-child, h2:first-child, h3:first-child, @@ -29,6 +21,8 @@ h6 { margin: 1em 0 1em 0; font-weight: 800; + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', + 'Helvetica Neue', sans-serif; } h1 { @@ -61,6 +55,13 @@ p { margin: 1em 0; + &:last-child { + margin-bottom: 5px; + } + + &:first-child { + margin-top: 0; + } } ul, @@ -105,6 +106,7 @@ padding: 1em; border-radius: 5px; overflow-x: auto; + font-family: 'Fira Code', 'Courier New', Courier, monospace; pre { margin: 0 !important; } @@ -120,6 +122,7 @@ padding-left: 1em; color: var(--color-text-light); border-left: 4px solid var(--color-border); + font-family: Georgia, 'Times New Roman', Times, serif; } table { @@ -137,6 +140,8 @@ th { background-color: var(--color-background-mute); font-weight: bold; + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', + 'Helvetica Neue', sans-serif; } img { diff --git a/src/renderer/src/components/Layout/index.ts b/src/renderer/src/components/Layout/index.ts index e9246dca..f3ff7203 100644 --- a/src/renderer/src/components/Layout/index.ts +++ b/src/renderer/src/components/Layout/index.ts @@ -150,11 +150,12 @@ export const BaseTypography = styled(Box)<{ ` export const TypographyNormal = styled(BaseTypography)` - font-family: 'Poppins'; + font-family: 'Ubuntu'; ` export const TypographyBold = styled(BaseTypography)` - font-family: 'Poppins Bold'; + font-family: 'Ubuntu'; + font-weight: bold; ` export const Container = styled.main` diff --git a/src/renderer/src/config/constant.ts b/src/renderer/src/config/constant.ts index 109efdb9..63a83792 100644 --- a/src/renderer/src/config/constant.ts +++ b/src/renderer/src/config/constant.ts @@ -1,5 +1,7 @@ export const DEFAULT_TEMPERATURE = 0.7 export const DEFAULT_CONEXTCOUNT = 5 +export const FONT_FAMILY = + "Ubuntu, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif" export const platform = window.electron?.process?.platform === 'darwin' ? 'macos' : 'windows' export const isMac = platform === 'macos' export const isWindows = platform === 'windows' diff --git a/src/renderer/src/pages/home/components/Assistants.tsx b/src/renderer/src/pages/home/components/Assistants.tsx index 2e871c58..6f1bb852 100644 --- a/src/renderer/src/pages/home/components/Assistants.tsx +++ b/src/renderer/src/pages/home/components/Assistants.tsx @@ -147,7 +147,7 @@ const AssistantItem = styled.div` position: relative; border-radius: 8px; cursor: pointer; - font-family: Poppins; + font-family: Ubuntu; .anticon { display: none; } diff --git a/src/renderer/src/pages/home/components/Message.tsx b/src/renderer/src/pages/home/components/Message.tsx index f2f9bcff..e4f27324 100644 --- a/src/renderer/src/pages/home/components/Message.tsx +++ b/src/renderer/src/pages/home/components/Message.tsx @@ -8,6 +8,7 @@ import { SaveOutlined, SyncOutlined } from '@ant-design/icons' +import { FONT_FAMILY } from '@renderer/config/constant' import { getModelLogo } from '@renderer/config/provider' import { useAssistant } from '@renderer/hooks/useAssistant' import useAvatar from '@renderer/hooks/useAvatar' @@ -70,8 +71,10 @@ const MessageItem: FC = ({ message, index, showMenu, onDeleteMessage }) = return userName || t('common.you') }, [assistant?.name, message.id, message.modelId, message.role, t, userName]) - const serifFonts = "Georgia, Cambria, 'Times New Roman', Times, serif" - const fontFamily = messageFont === 'serif' ? serifFonts : 'Poppins, -apple-system, sans-serif' + const fontFamily = useMemo(() => { + return messageFont === 'serif' ? FONT_FAMILY.replace('sans-serif', 'serif').replace('Ubuntu, ', '') : FONT_FAMILY + }, [messageFont]) + const messageBorder = showMessageDivider ? undefined : 'none' const avatarSource = useMemo(() => (message.modelId ? getModelLogo(message.modelId) : undefined), [message.modelId]) const avatarName = useMemo(() => firstLetter(assistant?.name).toUpperCase(), [assistant?.name]) diff --git a/src/renderer/src/pages/home/components/Messages.tsx b/src/renderer/src/pages/home/components/Messages.tsx index 0d2df042..e705ae2d 100644 --- a/src/renderer/src/pages/home/components/Messages.tsx +++ b/src/renderer/src/pages/home/components/Messages.tsx @@ -100,14 +100,14 @@ const Messages: FC = ({ assistant, topic }) => { }, [assistant, messages, provider, topic, autoRenameTopic, updateTopic, onSendMessage]) useEffect(() => { - runAsyncFunction(async () => setMessages((await LocalStorage.getTopicMessages(topic.id)) || [])) + runAsyncFunction(async () => { + const messages = (await LocalStorage.getTopicMessages(topic.id)) || [] + setMessages(messages) + }) }, [topic.id]) const scrollTop = useCallback( - debounce(() => containerRef.current?.scrollTo({ top: 100000, behavior: 'auto' }), 500, { - leading: true, - trailing: false - }), + debounce(() => containerRef.current?.scrollTo({ top: 100000, behavior: 'auto' }), 500), [] ) diff --git a/src/renderer/src/pages/home/components/NavigationCenter.tsx b/src/renderer/src/pages/home/components/NavigationCenter.tsx index 21c54527..c92172e1 100644 --- a/src/renderer/src/pages/home/components/NavigationCenter.tsx +++ b/src/renderer/src/pages/home/components/NavigationCenter.tsx @@ -37,6 +37,7 @@ const AssistantName = styled.span` font-weight: bold; margin-left: 5px; margin-right: 10px; + font-family: Ubuntu; ` export default NavigationCenter diff --git a/src/renderer/src/pages/home/components/sidebar/TopicsTab.tsx b/src/renderer/src/pages/home/components/sidebar/TopicsTab.tsx index 093e0f41..eb0b1c1c 100644 --- a/src/renderer/src/pages/home/components/sidebar/TopicsTab.tsx +++ b/src/renderer/src/pages/home/components/sidebar/TopicsTab.tsx @@ -147,7 +147,7 @@ const TopicListItem = styled.div` white-space: nowrap; overflow: hidden; text-overflow: ellipsis; - font-family: Poppins; + font-family: Ubuntu; &:hover { background-color: var(--color-background-soft); } diff --git a/src/renderer/src/pages/settings/ProviderSettings.tsx b/src/renderer/src/pages/settings/ProviderSettings.tsx index c8f8e32e..a61e50ec 100644 --- a/src/renderer/src/pages/settings/ProviderSettings.tsx +++ b/src/renderer/src/pages/settings/ProviderSettings.tsx @@ -192,6 +192,7 @@ const ProviderItemName = styled.div` white-space: nowrap; text-overflow: ellipsis; font-weight: 500; + font-family: Ubuntu; ` const AddButtonWrapper = styled.div` diff --git a/src/renderer/src/pages/settings/components/index.tsx b/src/renderer/src/pages/settings/components/index.tsx index ead68519..366266b1 100644 --- a/src/renderer/src/pages/settings/components/index.tsx +++ b/src/renderer/src/pages/settings/components/index.tsx @@ -8,6 +8,7 @@ export const SettingContainer = styled.div` height: calc(100vh - var(--navbar-height)); padding: 15px; overflow-y: scroll; + font-family: Ubuntu; &::-webkit-scrollbar { display: none;