@lobehub/chat 0.138.1 → 0.138.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,31 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 0.138.2](https://github.com/lobehub/lobe-chat/compare/v0.138.1...v0.138.2)
6
+
7
+ <sup>Released on **2024-03-15**</sup>
8
+
9
+ #### 💄 Styles
10
+
11
+ - **misc**: Update Markdown in ChatItem.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Styles
19
+
20
+ - **misc**: Update Markdown in ChatItem ([be75549](https://github.com/lobehub/lobe-chat/commit/be75549))
21
+
22
+ </details>
23
+
24
+ <div align="right">
25
+
26
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
27
+
28
+ </div>
29
+
5
30
  ### [Version 0.138.1](https://github.com/lobehub/lobe-chat/compare/v0.138.0...v0.138.1)
6
31
 
7
32
  <sup>Released on **2024-03-15**</sup>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.138.1",
3
+ "version": "0.138.2",
4
4
  "description": "Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
5
5
  "keywords": [
6
6
  "framework",
@@ -88,9 +88,9 @@
88
88
  "@icons-pack/react-simple-icons": "^9",
89
89
  "@lobehub/chat-plugin-sdk": "latest",
90
90
  "@lobehub/chat-plugins-gateway": "latest",
91
- "@lobehub/icons": "^1.13.0",
91
+ "@lobehub/icons": "latest",
92
92
  "@lobehub/tts": "latest",
93
- "@lobehub/ui": "^1.129.2",
93
+ "@lobehub/ui": "latest",
94
94
  "@vercel/analytics": "^1",
95
95
  "ahooks": "^3",
96
96
  "ai": "^3.0.0",
@@ -51,7 +51,7 @@ const Preview = memo<FieldType & { title?: string }>(
51
51
  </Flexbox>
52
52
  {withSystemRole && systemRole && (
53
53
  <div className={styles.role}>
54
- <Markdown className={styles.markdown}>{systemRole}</Markdown>
54
+ <Markdown variant={'chat'}>{systemRole}</Markdown>
55
55
  </div>
56
56
  )}
57
57
  </div>
@@ -33,7 +33,6 @@ export const useStyles = createStyles(({ css, token, stylish, cx }, withBackgrou
33
33
  background: ${token.colorBgContainer};
34
34
  border-bottom: 1px solid ${token.colorBorder};
35
35
  `,
36
- markdown: stylish.markdownInChat,
37
36
  preview: cx(
38
37
  stylish.noScrollbar,
39
38
  css`
@@ -60,7 +60,7 @@ const AgentModalInner = memo(() => {
60
60
  </Flexbox>
61
61
  <Flexbox style={{ padding: 16 }}>
62
62
  {tab === InfoTabs.prompt && (
63
- <Markdown className={styles.markdown} fullFeaturedCodeBlock>
63
+ <Markdown fullFeaturedCodeBlock variant={'chat'}>
64
64
  {systemRole}
65
65
  </Markdown>
66
66
  )}
@@ -1,6 +1,6 @@
1
1
  import { createStyles } from 'antd-style';
2
2
 
3
- export const useStyles = createStyles(({ css, token, prefixCls, stylish }) => ({
3
+ export const useStyles = createStyles(({ css, token, prefixCls }) => ({
4
4
  author: css`
5
5
  font-size: 12px;
6
6
  `,
@@ -27,7 +27,6 @@ export const useStyles = createStyles(({ css, token, prefixCls, stylish }) => ({
27
27
  flex-direction: column;
28
28
  }
29
29
  `,
30
- markdown: stylish.markdownInChat,
31
30
  nav: css`
32
31
  padding-top: 8px;
33
32
  `,
@@ -14,12 +14,7 @@ import { LLMProviderApiTokenKey, LLMProviderBaseUrlKey, LLMProviderConfigKey } f
14
14
 
15
15
  const useStyles = createStyles(({ css, token }) => ({
16
16
  markdown: css`
17
- a {
18
- font-size: 12px !important;
19
- }
20
-
21
17
  p {
22
- font-size: 12px !important;
23
18
  color: ${token.colorTextDescription} !important;
24
19
  }
25
20
  `,
@@ -73,7 +68,7 @@ const AzureOpenAIProvider = memo(() => {
73
68
  />
74
69
  ),
75
70
  desc: (
76
- <Markdown className={styles.markdown}>
71
+ <Markdown className={styles.markdown} fontSize={12} variant={'chat'}>
77
72
  {t('llm.AzureOpenAI.azureApiVersion.desc')}
78
73
  </Markdown>
79
74
  ),
@@ -89,7 +84,9 @@ const AzureOpenAIProvider = memo(() => {
89
84
  />
90
85
  ),
91
86
  desc: (
92
- <Markdown className={styles.markdown}>{t('llm.AzureOpenAI.deployments.desc')}</Markdown>
87
+ <Markdown className={styles.markdown} fontSize={12} variant={'chat'}>
88
+ {t('llm.AzureOpenAI.deployments.desc')}
89
+ </Markdown>
93
90
  ),
94
91
 
95
92
  label: t('llm.AzureOpenAI.deployments.title'),
@@ -15,12 +15,7 @@ import { LLMProviderConfigKey } from '../const';
15
15
 
16
16
  const useStyles = createStyles(({ css, token }) => ({
17
17
  markdown: css`
18
- a {
19
- font-size: 12px !important;
20
- }
21
-
22
18
  p {
23
- font-size: 12px !important;
24
19
  color: ${token.colorTextDescription} !important;
25
20
  }
26
21
  `,
@@ -110,7 +105,9 @@ const LLM = memo(() => {
110
105
  />
111
106
  ),
112
107
  desc: (
113
- <Markdown className={styles.markdown}>{t('llm.OpenAI.azureApiVersion.desc')}</Markdown>
108
+ <Markdown className={styles.markdown} fontSize={12} variant={'chat'}>
109
+ {t('llm.OpenAI.azureApiVersion.desc')}
110
+ </Markdown>
114
111
  ),
115
112
  hidden: !useAzure,
116
113
  label: t('llm.OpenAI.azureApiVersion.title'),
@@ -7,7 +7,7 @@ import { Center } from 'react-layout-kit';
7
7
 
8
8
  import { MetaData } from '@/types/meta';
9
9
 
10
- const useStyles = createStyles(({ css, token, stylish }) => ({
10
+ const useStyles = createStyles(({ css, token }) => ({
11
11
  avatar: css`
12
12
  flex: none;
13
13
  `,
@@ -15,8 +15,6 @@ const useStyles = createStyles(({ css, token, stylish }) => ({
15
15
  color: ${token.colorTextDescription};
16
16
  text-align: center;
17
17
  `,
18
- markdown: stylish.markdownInChat,
19
-
20
18
  title: css`
21
19
  font-size: 20px;
22
20
  font-weight: 600;
@@ -62,7 +60,7 @@ const AgentInfo = memo<AgentInfoProps>(({ systemRole, style, meta, onAvatarClick
62
60
  {systemRole && (
63
61
  <>
64
62
  <Divider style={{ margin: '8px 0' }} />
65
- <Markdown className={styles.markdown}>{systemRole}</Markdown>
63
+ <Markdown variant={'chat'}>{systemRole}</Markdown>
66
64
  </>
67
65
  )}
68
66
  </Center>
@@ -1,6 +1,6 @@
1
1
  import { ActionIcon, Icon, Markdown, Tag, copyToClipboard } from '@lobehub/ui';
2
2
  import { App } from 'antd';
3
- import { createStyles } from 'antd-style';
3
+ import { useTheme } from 'antd-style';
4
4
  import { ChevronDown, ChevronUp, ChevronsRight, CopyIcon, TrashIcon } from 'lucide-react';
5
5
  import { memo, useState } from 'react';
6
6
  import { useTranslation } from 'react-i18next';
@@ -11,17 +11,13 @@ import { ChatTranslate } from '@/types/message';
11
11
 
12
12
  import BubblesLoading from '../components/BubblesLoading';
13
13
 
14
- const useStyles = createStyles(({ stylish }) => ({
15
- markdown: stylish.markdownInChat,
16
- }));
17
-
18
14
  interface TranslateProps extends ChatTranslate {
19
15
  id: string;
20
16
  loading?: boolean;
21
17
  }
22
18
 
23
19
  const Translate = memo<TranslateProps>(({ content = '', from, to, id, loading }) => {
24
- const { theme, styles } = useStyles();
20
+ const theme = useTheme();
25
21
  const { t } = useTranslation('common');
26
22
  const [show, setShow] = useState(true);
27
23
  const clearTranslate = useChatStore((s) => s.clearTranslate);
@@ -67,7 +63,7 @@ const Translate = memo<TranslateProps>(({ content = '', from, to, id, loading })
67
63
  {!show ? null : loading && !content ? (
68
64
  <BubblesLoading />
69
65
  ) : (
70
- <Markdown className={styles.markdown}>{content}</Markdown>
66
+ <Markdown variant={'chat'}>{content}</Markdown>
71
67
  )}
72
68
  </Flexbox>
73
69
  );
@@ -1,6 +1,9 @@
1
1
  import { Markdown } from '@lobehub/ui';
2
2
  import { memo } from 'react';
3
3
 
4
+ import { useGlobalStore } from '@/store/global';
5
+ import { settingsSelectors } from '@/store/global/selectors';
6
+
4
7
  import Loading from '../Loading';
5
8
 
6
9
  export interface PluginMarkdownTypeProps {
@@ -9,9 +12,14 @@ export interface PluginMarkdownTypeProps {
9
12
  }
10
13
 
11
14
  const PluginMarkdownType = memo<PluginMarkdownTypeProps>(({ content, loading }) => {
15
+ const fontSize = useGlobalStore((s) => settingsSelectors.currentSettings(s).fontSize);
12
16
  if (loading) return <Loading />;
13
17
 
14
- return <Markdown>{content}</Markdown>;
18
+ return (
19
+ <Markdown fontSize={fontSize} variant={'chat'}>
20
+ {content}
21
+ </Markdown>
22
+ );
15
23
  });
16
24
 
17
25
  export default PluginMarkdownType;
@@ -6,6 +6,8 @@ import { useTranslation } from 'react-i18next';
6
6
 
7
7
  import { useChatStore } from '@/store/chat';
8
8
  import { chatSelectors } from '@/store/chat/selectors';
9
+ import { useGlobalStore } from '@/store/global';
10
+ import { settingsSelectors } from '@/store/global/selectors';
9
11
  import { useSessionStore } from '@/store/session';
10
12
  import { agentSelectors } from '@/store/session/selectors';
11
13
  import { ChatMessage } from '@/types/message';
@@ -31,6 +33,7 @@ export interface ChatListItemProps {
31
33
  }
32
34
 
33
35
  const Item = memo<ChatListItemProps>(({ index, id }) => {
36
+ const fontSize = useGlobalStore((s) => settingsSelectors.currentSettings(s).fontSize);
34
37
  const { t } = useTranslation('common');
35
38
  const { styles } = useStyles();
36
39
  const [editing, setEditing] = useState(false);
@@ -111,6 +114,7 @@ const Item = memo<ChatListItemProps>(({ index, id }) => {
111
114
  editing={editing}
112
115
  error={error}
113
116
  errorMessage={<ErrorMessageExtra data={item} />}
117
+ fontSize={fontSize}
114
118
  loading={loading}
115
119
  message={item.content}
116
120
  messageExtra={<MessageExtra data={item} />}
@@ -3,40 +3,22 @@ import { ReactNode, memo } from 'react';
3
3
  import { Flexbox } from 'react-layout-kit';
4
4
 
5
5
  import ChatHydration from '@/components/StoreHydration/ChatHydration';
6
- import { useGlobalStore } from '@/store/global';
7
- import { settingsSelectors } from '@/store/global/selectors';
8
6
 
9
7
  import SkeletonList from './components/SkeletonList';
10
8
  import ChatList from './components/VirtualizedList';
11
9
  import { useInitConversation } from './hooks/useInitConversation';
12
10
 
13
- const useStyles = createStyles(({ css, responsive, stylish, cx }, fontSize: number = 14) =>
14
- cx(
15
- css`
16
- position: relative;
17
- overflow-y: auto;
18
- height: 100%;
19
-
20
- ${responsive.mobile} {
21
- ${stylish.noScrollbar}
22
- width: 100vw;
23
- }
24
- `,
25
- fontSize !== 14 &&
26
- css`
27
- article[data-code-type='markdown'] {
28
- p,
29
- code,
30
- pre,
31
- ul,
32
- ol,
33
- li,
34
- blockquote {
35
- font-size: ${fontSize}px;
36
- }
37
- }
38
- `,
39
- ),
11
+ const useStyles = createStyles(
12
+ ({ css, responsive, stylish }) => css`
13
+ position: relative;
14
+ overflow-y: auto;
15
+ height: 100%;
16
+
17
+ ${responsive.mobile} {
18
+ ${stylish.noScrollbar}
19
+ width: 100vw;
20
+ }
21
+ `,
40
22
  );
41
23
 
42
24
  interface ConversationProps {
@@ -45,8 +27,7 @@ interface ConversationProps {
45
27
  }
46
28
 
47
29
  const Conversation = memo<ConversationProps>(({ chatInput, mobile }) => {
48
- const fontSize = useGlobalStore((s) => settingsSelectors.currentSettings(s).fontSize);
49
- const { styles } = useStyles(fontSize);
30
+ const { styles } = useStyles();
50
31
 
51
32
  const init = useInitConversation();
52
33
 
@@ -8,7 +8,7 @@ import { Center } from 'react-layout-kit';
8
8
  import { pluginHelpers, useToolStore } from '@/store/tool';
9
9
  import { pluginSelectors } from '@/store/tool/selectors';
10
10
 
11
- const useStyles = createStyles(({ css, token, stylish }) => ({
11
+ const useStyles = createStyles(({ css, token }) => ({
12
12
  avatar: css`
13
13
  flex: none;
14
14
  `,
@@ -16,8 +16,6 @@ const useStyles = createStyles(({ css, token, stylish }) => ({
16
16
  color: ${token.colorTextDescription};
17
17
  text-align: center;
18
18
  `,
19
- markdown: stylish.markdownInChat,
20
-
21
19
  title: css`
22
20
  font-size: 20px;
23
21
  font-weight: 600;
@@ -31,15 +31,12 @@ interface PluginSettingsConfigProps {
31
31
  schema: PluginSchema;
32
32
  }
33
33
 
34
- const useStyles = createStyles(({ css, token, stylish, cx }) => ({
35
- markdown: cx(
36
- stylish.markdownInChat,
37
- css`
38
- p {
39
- color: ${token.colorTextDescription};
40
- }
41
- `,
42
- ),
34
+ const useStyles = createStyles(({ css, token }) => ({
35
+ markdown: css`
36
+ p {
37
+ color: ${token.colorTextDescription};
38
+ }
39
+ `,
43
40
  }));
44
41
 
45
42
  const PluginSettingsConfig = memo<PluginSettingsConfigProps>(({ schema, id }) => {
@@ -59,7 +56,13 @@ const PluginSettingsConfig = memo<PluginSettingsConfigProps>(({ schema, id }) =>
59
56
  <Form form={form} layout={'vertical'} style={{ width: '100%' }}>
60
57
  {items.map((item) => (
61
58
  <Form.Item
62
- desc={item.desc && <Markdown className={styles.markdown}>{item.desc as string}</Markdown>}
59
+ desc={
60
+ item.desc && (
61
+ <Markdown className={styles.markdown} variant={'chat'}>
62
+ {item.desc as string}
63
+ </Markdown>
64
+ )
65
+ }
63
66
  key={item.label}
64
67
  label={item.label}
65
68
  tag={item.tag}