@lobehub/chat 0.116.2 → 0.116.4

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.116.4](https://github.com/lobehub/lobe-chat/compare/v0.116.3...v0.116.4)
6
+
7
+ <sup>Released on **2023-12-26**</sup>
8
+
9
+ #### 🐛 Bug Fixes
10
+
11
+ - **misc**: Fix ShareModal.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's fixed
19
+
20
+ - **misc**: Fix ShareModal ([4592515](https://github.com/lobehub/lobe-chat/commit/4592515))
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.116.3](https://github.com/lobehub/lobe-chat/compare/v0.116.2...v0.116.3)
31
+
32
+ <sup>Released on **2023-12-26**</sup>
33
+
34
+ #### 💄 Styles
35
+
36
+ - **misc**: Fix typo.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### Styles
44
+
45
+ - **misc**: Fix typo ([9d329a9](https://github.com/lobehub/lobe-chat/commit/9d329a9))
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.116.2](https://github.com/lobehub/lobe-chat/compare/v0.116.1...v0.116.2)
6
56
 
7
57
  <sup>Released on **2023-12-26**</sup>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.116.2",
3
+ "version": "0.116.4",
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",
@@ -1,6 +1,5 @@
1
1
  import { SiOpenai } from '@icons-pack/react-simple-icons';
2
2
  import { Avatar, ChatHeaderTitle, Logo, Markdown, Tag } from '@lobehub/ui';
3
- import { SegmentedProps } from 'antd';
4
3
  import { memo } from 'react';
5
4
  import { useTranslation } from 'react-i18next';
6
5
  import { Flexbox } from 'react-layout-kit';
@@ -14,32 +13,6 @@ import PluginTag from '../../ChatHeader/PluginTag';
14
13
  import { useStyles } from './style';
15
14
  import { FieldType } from './type';
16
15
 
17
- export enum ImageType {
18
- JPG = 'jpg',
19
- PNG = 'png',
20
- SVG = 'svg',
21
- WEBP = 'webp',
22
- }
23
-
24
- export const imageTypeOptions: SegmentedProps['options'] = [
25
- {
26
- label: 'JPG',
27
- value: ImageType.JPG,
28
- },
29
- {
30
- label: 'PNG',
31
- value: ImageType.PNG,
32
- },
33
- {
34
- label: 'SVG',
35
- value: ImageType.SVG,
36
- },
37
- {
38
- label: 'WEBP',
39
- value: ImageType.WEBP,
40
- },
41
- ];
42
-
43
16
  const Preview = memo<FieldType & { title?: string }>(
44
17
  ({ title, withSystemRole, withBackground, withFooter }) => {
45
18
  const [isInbox, description, avatar, backgroundColor, model, plugins, systemRole] =
@@ -9,14 +9,33 @@ import { FORM_STYLE } from '@/const/layoutTokens';
9
9
  import { useChatStore } from '@/store/chat';
10
10
  import { useGlobalStore } from '@/store/global';
11
11
 
12
- import Preview, { ImageType, imageTypeOptions } from './Preview';
13
- import { FieldType } from './type';
12
+ import Preview from './Preview';
13
+ import { FieldType, ImageType } from './type';
14
14
 
15
15
  enum Tab {
16
16
  Screenshot = 'screenshot',
17
17
  ShareGPT = 'sharegpt',
18
18
  }
19
19
 
20
+ export const imageTypeOptions: SegmentedProps['options'] = [
21
+ {
22
+ label: 'JPG',
23
+ value: ImageType.JPG,
24
+ },
25
+ {
26
+ label: 'PNG',
27
+ value: ImageType.PNG,
28
+ },
29
+ {
30
+ label: 'SVG',
31
+ value: ImageType.SVG,
32
+ },
33
+ {
34
+ label: 'WEBP',
35
+ value: ImageType.WEBP,
36
+ },
37
+ ];
38
+
20
39
  const DEFAULT_FIELD_VALUE: FieldType = {
21
40
  imageType: ImageType.JPG,
22
41
  withBackground: true,
@@ -31,7 +50,7 @@ const ShareModal = memo<ModalProps>(({ onCancel, open }) => {
31
50
  const { t } = useTranslation('chat');
32
51
  const avatar = useGlobalStore((s) => s.settings.avatar);
33
52
  const [shareLoading, shareToShareGPT] = useChatStore((s) => [s.shareLoading, s.shareToShareGPT]);
34
- const { loading, onDwnload, title } = useScreenshot(fieldValue.imageType);
53
+ const { loading, onDownload, title } = useScreenshot(fieldValue.imageType);
35
54
 
36
55
  const options: SegmentedProps['options'] = useMemo(
37
56
  () => [
@@ -57,35 +76,39 @@ const ShareModal = memo<ModalProps>(({ onCancel, open }) => {
57
76
  name: 'withSystemRole',
58
77
  valuePropName: 'checked',
59
78
  },
60
- tab === Tab.Screenshot && {
79
+ {
61
80
  children: <Switch />,
81
+ hidden: tab !== Tab.Screenshot,
62
82
  label: t('shareModal.withBackground'),
63
83
  minWidth: undefined,
64
84
  name: 'withBackground',
65
85
  valuePropName: 'checked',
66
86
  },
67
- tab === Tab.Screenshot && {
87
+ {
68
88
  children: <Switch />,
89
+ hidden: tab !== Tab.Screenshot,
69
90
  label: t('shareModal.withFooter'),
70
91
  minWidth: undefined,
71
92
  name: 'withFooter',
72
93
  valuePropName: 'checked',
73
94
  },
74
- tab === Tab.Screenshot && {
95
+ {
75
96
  children: <Segmented options={imageTypeOptions} />,
97
+ hidden: tab !== Tab.Screenshot,
76
98
  label: t('shareModal.imageType'),
77
99
  minWidth: undefined,
78
100
  name: 'imageType',
79
101
  },
80
- tab === Tab.ShareGPT && {
102
+ {
81
103
  children: <Switch />,
104
+ hidden: tab !== Tab.ShareGPT,
82
105
  label: t('shareModal.withPluginInfo'),
83
106
  minWidth: undefined,
84
107
  name: 'withPluginInfo',
85
108
  valuePropName: 'checked',
86
109
  },
87
- ].filter(Boolean) as FormItemProps[],
88
- [],
110
+ ],
111
+ [tab],
89
112
  );
90
113
 
91
114
  return (
@@ -95,7 +118,7 @@ const ShareModal = memo<ModalProps>(({ onCancel, open }) => {
95
118
  footer={
96
119
  <>
97
120
  {tab === Tab.Screenshot && (
98
- <Button block loading={loading} onClick={onDwnload} size={'large'} type={'primary'}>
121
+ <Button block loading={loading} onClick={onDownload} size={'large'} type={'primary'}>
99
122
  {t('shareModal.download')}
100
123
  </Button>
101
124
  )}
@@ -54,7 +54,7 @@ export const useScreenshot = (imageType: ImageType) => {
54
54
 
55
55
  return {
56
56
  loading,
57
- onDwnload: handleDownload,
57
+ onDownload: handleDownload,
58
58
  title,
59
59
  };
60
60
  };