@lobehub/chat 0.80.0 → 0.80.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,56 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 0.80.2](https://github.com/lobehub/lobe-chat/compare/v0.80.1...v0.80.2)
6
+
7
+ <sup>Released on **2023-09-27**</sup>
8
+
9
+ #### 💄 Styles
10
+
11
+ - **misc**: Switch Modal components to @lobehub/ui.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Styles
19
+
20
+ - **misc**: Switch Modal components to @lobehub/ui ([d056015](https://github.com/lobehub/lobe-chat/commit/d056015))
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
+
30
+ ### [Version 0.80.1](https://github.com/lobehub/lobe-chat/compare/v0.80.0...v0.80.1)
31
+
32
+ <sup>Released on **2023-09-27**</sup>
33
+
34
+ #### 💄 Styles
35
+
36
+ - **misc**: Fix conversation mobile viewarea.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### Styles
44
+
45
+ - **misc**: Fix conversation mobile viewarea ([6668e11](https://github.com/lobehub/lobe-chat/commit/6668e11))
46
+
47
+ </details>
48
+
49
+ <div align="right">
50
+
51
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
52
+
53
+ </div>
54
+
5
55
  ## [Version 0.80.0](https://github.com/lobehub/lobe-chat/compare/v0.79.8...v0.80.0)
6
56
 
7
57
  <sup>Released on **2023-09-27**</sup>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.80.0",
3
+ "version": "0.80.2",
4
4
  "description": "An open-source, extensible (Function Calling), high-performance chatbot framework. It supports one-click free deployment of your private ChatGPT/LLM web application",
5
5
  "keywords": [
6
6
  "chatbot",
@@ -96,6 +96,7 @@
96
96
  "react-i18next": "^13",
97
97
  "react-intersection-observer": "^9",
98
98
  "react-layout-kit": "^1",
99
+ "satori": "^0.10",
99
100
  "swr": "^2",
100
101
  "systemjs": "^6",
101
102
  "ts-md5": "^1",
@@ -1,5 +1,4 @@
1
1
  import { ChatList, RenderMessage } from '@lobehub/ui';
2
- import { createStyles } from 'antd-style';
3
2
  import isEqual from 'fast-deep-equal';
4
3
  import { memo, useCallback } from 'react';
5
4
  import { useTranslation } from 'react-i18next';
@@ -16,22 +15,9 @@ import FunctionCall from './Plugins/FunctionCall';
16
15
  import PluginMessage from './Plugins/PluginMessage';
17
16
  import SkeletonList from './SkeletonList';
18
17
 
19
- const useStyles = createStyles(({ css, responsive, cx, stylish }) =>
20
- cx(
21
- stylish.noScrollbar,
22
- css`
23
- overflow-x: hidden;
24
- ${responsive.mobile} {
25
- width: 100vw;
26
- }
27
- `,
28
- ),
29
- );
30
-
31
18
  const List = memo(() => {
32
19
  const init = useSessionChatInit();
33
20
  const { t } = useTranslation('common');
34
- const { styles } = useStyles();
35
21
  const data = useSessionStore(chatSelectors.currentChatsWithGuideMessage, isEqual);
36
22
 
37
23
  const [
@@ -96,7 +82,6 @@ const List = memo(() => {
96
82
 
97
83
  return (
98
84
  <ChatList
99
- className={styles}
100
85
  data={data}
101
86
  enableHistoryCount={enableHistoryCount}
102
87
  historyCount={historyCount}
@@ -1,4 +1,5 @@
1
1
  import { BackBottom } from '@lobehub/ui';
2
+ import { createStyles } from 'antd-style';
2
3
  import { memo, useRef } from 'react';
3
4
  import { useTranslation } from 'react-i18next';
4
5
  import { Flexbox } from 'react-layout-kit';
@@ -10,9 +11,22 @@ import ChatList from './ChatList';
10
11
  import ChatInput from './Input';
11
12
  import ChatScrollAnchor from './ScrollAnchor';
12
13
 
14
+ const useStyles = createStyles(
15
+ ({ css, responsive, stylish }) => css`
16
+ overflow-x: hidden;
17
+ overflow-y: scroll;
18
+ height: 100%;
19
+ ${responsive.mobile} {
20
+ ${stylish.noScrollbar}
21
+ width: 100vw;
22
+ }
23
+ `,
24
+ );
25
+
13
26
  const Conversation = memo<{ mobile?: boolean }>(({ mobile }) => {
14
27
  const ref = useRef(null);
15
28
  const { t } = useTranslation('common');
29
+ const { styles } = useStyles();
16
30
 
17
31
  const useFetchPluginList = usePluginStore((s) => s.useFetchPluginList);
18
32
  useFetchPluginList();
@@ -20,7 +34,7 @@ const Conversation = memo<{ mobile?: boolean }>(({ mobile }) => {
20
34
  return (
21
35
  <Flexbox flex={1} style={{ position: 'relative' }}>
22
36
  <div style={{ flex: 1, overflow: 'hidden', position: 'relative' }}>
23
- <div ref={ref} style={{ height: '100%', overflowY: 'scroll' }}>
37
+ <div className={styles} ref={ref}>
24
38
  {!mobile && <SafeSpacing />}
25
39
  <ChatList />
26
40
  <ChatScrollAnchor />
@@ -0,0 +1,28 @@
1
+ import { ActionIcon, Icon } from '@lobehub/ui';
2
+ import { Loader2, Share2 } from 'lucide-react';
3
+ import { memo } from 'react';
4
+ import { useTranslation } from 'react-i18next';
5
+
6
+ import { useSessionStore } from '@/store/session';
7
+
8
+ const ShareButton = memo(() => {
9
+ const { t } = useTranslation('common');
10
+
11
+ const [shareLoading, shareToShareGPT] = useSessionStore((s) => [
12
+ s.shareLoading,
13
+ s.shareToShareGPT,
14
+ ]);
15
+
16
+ return shareLoading ? (
17
+ <Icon icon={Loader2} size={{ fontSize: 24 }} spin />
18
+ ) : (
19
+ <ActionIcon
20
+ icon={Share2}
21
+ onClick={shareToShareGPT}
22
+ size={{ fontSize: 24 }}
23
+ title={t('share')}
24
+ />
25
+ );
26
+ });
27
+
28
+ export default ShareButton;
@@ -1,28 +1,31 @@
1
- import { ActionIcon, Icon } from '@lobehub/ui';
2
- import { Loader2, Share2 } from 'lucide-react';
3
- import { memo } from 'react';
1
+ import { ActionIcon, Modal } from '@lobehub/ui';
2
+ import { Share2 } from 'lucide-react';
3
+ import { memo, useState } from 'react';
4
4
  import { useTranslation } from 'react-i18next';
5
5
 
6
6
  import { useSessionStore } from '@/store/session';
7
7
 
8
8
  const ShareButton = memo(() => {
9
+ const [isModalOpen, setIsModalOpen] = useState(false);
9
10
  const { t } = useTranslation('common');
11
+ const [shareLoading] = useSessionStore((s) => [s.shareLoading]);
10
12
 
11
- const [shareLoading, shareToShareGPT] = useSessionStore((s) => [
12
- s.shareLoading,
13
-
14
- s.shareToShareGPT,
15
- ]);
16
-
17
- return shareLoading ? (
18
- <Icon icon={Loader2} size={{ fontSize: 24 }} spin />
19
- ) : (
20
- <ActionIcon
21
- icon={Share2}
22
- onClick={shareToShareGPT}
23
- size={{ fontSize: 24 }}
24
- title={t('share')}
25
- />
13
+ return (
14
+ <>
15
+ <ActionIcon
16
+ icon={Share2}
17
+ loading={shareLoading}
18
+ onClick={() => setIsModalOpen(true)}
19
+ size={{ fontSize: 24 }}
20
+ title={t('share')}
21
+ />
22
+ <Modal
23
+ footer={null}
24
+ onCancel={() => setIsModalOpen(false)}
25
+ open={isModalOpen}
26
+ title={t('share')}
27
+ />
28
+ </>
26
29
  );
27
30
  });
28
31
 
@@ -4,7 +4,7 @@ export const HEADER_HEIGHT = 64;
4
4
  export const MOBILE_NABBAR_HEIGHT = 44;
5
5
  export const MOBILE_TABBAR_HEIGHT = 48;
6
6
  export const CHAT_TEXTAREA_HEIGHT = 200;
7
- export const CHAT_TEXTAREA_HEIGHT_MOBILE = 180;
7
+ export const CHAT_TEXTAREA_HEIGHT_MOBILE = 120;
8
8
  export const CHAT_SIDEBAR_WIDTH = 280;
9
9
  export const MARKET_SIDEBAR_WIDTH = 400;
10
10
  export const FOLDER_WIDTH = 256;
@@ -1,26 +1,11 @@
1
- import { Icon, Input, Tooltip } from '@lobehub/ui';
2
- import { ConfigProvider, Form, Modal } from 'antd';
3
- import { createStyles } from 'antd-style';
4
- import { LucideSettings } from 'lucide-react';
5
- import { lighten } from 'polished';
1
+ import { Input, Modal, Tooltip } from '@lobehub/ui';
2
+ import { Form } from 'antd';
6
3
  import { memo } from 'react';
7
4
  import { useTranslation } from 'react-i18next';
8
5
  import { Flexbox } from 'react-layout-kit';
9
6
 
10
7
  import { PLUGINS_INDEX_URL } from '@/const/url';
11
8
 
12
- const useStyles = createStyles(({ css, token, prefixCls }) => ({
13
- content: css`
14
- .${prefixCls}-modal-content {
15
- border: 1px solid ${token.colorSplit};
16
- border-radius: 12px;
17
- }
18
- `,
19
- root: css`
20
- backdrop-filter: blur(2px);
21
- `,
22
- }));
23
-
24
9
  interface MarketSettingModalProps {
25
10
  onOpenChange: (open: boolean) => void;
26
11
  open?: boolean;
@@ -28,48 +13,24 @@ interface MarketSettingModalProps {
28
13
 
29
14
  const MarketSettingModal = memo<MarketSettingModalProps>(({ open, onOpenChange }) => {
30
15
  const { t } = useTranslation('plugin');
31
- const { styles, theme } = useStyles();
32
16
 
33
17
  return (
34
- <ConfigProvider
35
- theme={{
36
- token: {
37
- colorBgElevated: lighten(0.005, theme.colorBgContainer),
38
- },
39
- }}
18
+ <Modal
19
+ footer={null}
20
+ onCancel={() => onOpenChange(false)}
21
+ open={open}
22
+ title={t('settings.title')}
40
23
  >
41
- <Modal
42
- centered
43
- closable
44
- maskClosable
45
- onCancel={() => {
46
- onOpenChange(false);
47
- }}
48
- open={open}
49
- title={
50
- <Flexbox gap={8} horizontal style={{ marginBottom: 24 }}>
51
- <Icon icon={LucideSettings} />
52
- {t('settings.title')}
53
- </Flexbox>
54
- }
55
- width={700}
56
- wrapClassName={styles.root}
57
- >
58
- <Flexbox gap={12}>
59
- <Form layout={'vertical'}>
60
- <Form.Item extra={t('settings.modalDesc')} label={t('settings.indexUrl.title')}>
61
- <Tooltip title={t('settings.indexUrl.tooltip')}>
62
- <Input
63
- defaultValue={PLUGINS_INDEX_URL}
64
- disabled
65
- placeholder={'https://xxxxx.com'}
66
- />
67
- </Tooltip>
68
- </Form.Item>
69
- </Form>
70
- </Flexbox>
71
- </Modal>
72
- </ConfigProvider>
24
+ <Flexbox gap={12}>
25
+ <Form layout={'vertical'}>
26
+ <Form.Item extra={t('settings.modalDesc')} label={t('settings.indexUrl.title')}>
27
+ <Tooltip title={t('settings.indexUrl.tooltip')}>
28
+ <Input defaultValue={PLUGINS_INDEX_URL} disabled placeholder={'https://xxxxx.com'} />
29
+ </Tooltip>
30
+ </Form.Item>
31
+ </Form>
32
+ </Flexbox>
33
+ </Modal>
73
34
  );
74
35
  });
75
36
 
@@ -1,8 +1,5 @@
1
- import { Icon } from '@lobehub/ui';
2
- import { App, Button, ConfigProvider, Form, Modal, Popconfirm } from 'antd';
3
- import { createStyles } from 'antd-style';
4
- import { LucideBlocks } from 'lucide-react';
5
- import { lighten } from 'polished';
1
+ import { Modal } from '@lobehub/ui';
2
+ import { App, Button, Form, Popconfirm } from 'antd';
6
3
  import { memo, useEffect, useState } from 'react';
7
4
  import { useTranslation } from 'react-i18next';
8
5
  import { Flexbox } from 'react-layout-kit';
@@ -13,18 +10,6 @@ import ManifestForm from './ManifestForm';
13
10
  import MetaForm from './MetaForm';
14
11
  import PluginPreview from './PluginPreview';
15
12
 
16
- const useStyles = createStyles(({ css, token, prefixCls }) => ({
17
- content: css`
18
- .${prefixCls}-modal-content {
19
- border: 1px solid ${token.colorSplit};
20
- border-radius: 12px;
21
- }
22
- `,
23
- root: css`
24
- backdrop-filter: blur(2px);
25
- `,
26
- }));
27
-
28
13
  interface DevModalProps {
29
14
  mode?: 'edit' | 'create';
30
15
  onDelete?: () => void;
@@ -39,7 +24,6 @@ const DevModal = memo<DevModalProps>(
39
24
  ({ open, mode = 'create', value, onValueChange, onSave, onOpenChange, onDelete }) => {
40
25
  const isEditMode = mode === 'edit';
41
26
  const { t } = useTranslation('plugin');
42
- const { styles, theme } = useStyles();
43
27
  const { message } = App.useApp();
44
28
 
45
29
  const [submitting, setSubmitting] = useState(false);
@@ -105,49 +89,28 @@ const DevModal = memo<DevModalProps>(
105
89
  onOpenChange(false);
106
90
  }}
107
91
  >
108
- <ConfigProvider
109
- theme={{
110
- token: {
111
- colorBgElevated: lighten(0.005, theme.colorBgContainer),
112
- },
113
- }}
92
+ <Modal
93
+ cancelText={t('cancel', { ns: 'common' })}
94
+ footer={footer}
95
+ okText={t('dev.save')}
96
+ onCancel={() => onOpenChange(false)}
97
+ onOk={() => form.submit()}
98
+ open={open}
99
+ title={t('dev.title')}
114
100
  >
115
- <Modal
116
- centered
117
- closable
118
- footer={footer}
119
- maskClosable
120
- okText={t('dev.save')}
121
- onCancel={() => {
122
- onOpenChange(false);
123
- }}
124
- onOk={() => {
125
- form.submit();
126
- }}
127
- open={open}
128
- title={
129
- <Flexbox gap={8} horizontal>
130
- <Icon icon={LucideBlocks} />
131
- {t('dev.title')}
132
- </Flexbox>
133
- }
134
- width={700}
135
- wrapClassName={styles.root}
136
- >
137
- <Flexbox gap={12}>
138
- {t('dev.modalDesc')}
139
- {/*<Tabs*/}
140
- {/* items={[*/}
141
- {/* { children: <MetaForm />, key: 'meta', label: t('dev.tabs.meta') },*/}
142
- {/* { children: <ManifestForm />, key: 'manifest', label: t('dev.tabs.manifest') },*/}
143
- {/* ]}*/}
144
- {/*/>*/}
145
- <PluginPreview form={form} />
146
- <ManifestForm form={form} />
147
- <MetaForm form={form} mode={mode} />
148
- </Flexbox>
149
- </Modal>
150
- </ConfigProvider>
101
+ <Flexbox gap={12}>
102
+ {t('dev.modalDesc')}
103
+ {/*<Tabs*/}
104
+ {/* items={[*/}
105
+ {/* { children: <MetaForm />, key: 'meta', label: t('dev.tabs.meta') },*/}
106
+ {/* { children: <ManifestForm />, key: 'manifest', label: t('dev.tabs.manifest') },*/}
107
+ {/* ]}*/}
108
+ {/*/>*/}
109
+ <PluginPreview form={form} />
110
+ <ManifestForm form={form} />
111
+ <MetaForm form={form} mode={mode} />
112
+ </Flexbox>
113
+ </Modal>
151
114
  </Form.Provider>
152
115
  );
153
116
  },