@lobehub/chat 0.152.11 → 0.152.12

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.152.12](https://github.com/lobehub/lobe-chat/compare/v0.152.11...v0.152.12)
6
+
7
+ <sup>Released on **2024-05-04**</sup>
8
+
9
+ #### 🐛 Bug Fixes
10
+
11
+ - **misc**: Disabled autogenerate field icon when empty system role.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's fixed
19
+
20
+ - **misc**: Disabled autogenerate field icon when empty system role, closes [#2076](https://github.com/lobehub/lobe-chat/issues/2076) ([27095f5](https://github.com/lobehub/lobe-chat/commit/27095f5))
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.152.11](https://github.com/lobehub/lobe-chat/compare/v0.152.10...v0.152.11)
6
31
 
7
32
  <sup>Released on **2024-05-03**</sup>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.152.11",
3
+ "version": "0.152.12",
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",
@@ -5,37 +5,42 @@ import { Wand2 } from 'lucide-react';
5
5
  import { memo } from 'react';
6
6
  import { useTranslation } from 'react-i18next';
7
7
 
8
+
8
9
  export interface AutoGenerateInputProps extends InputProps {
10
+ canAutoGenerate?: boolean;
9
11
  loading?: boolean;
10
12
  onGenerate?: () => void;
11
13
  }
12
14
 
13
- const AutoGenerateInput = memo<AutoGenerateInputProps>(({ loading, onGenerate, ...props }) => {
14
- const { t } = useTranslation('common');
15
- const theme = useTheme();
15
+ const AutoGenerateInput = memo<AutoGenerateInputProps>(
16
+ ({ loading, onGenerate, canAutoGenerate, ...props }) => {
17
+ const { t } = useTranslation('common');
18
+ const theme = useTheme();
16
19
 
17
- return (
18
- <Input
19
- suffix={
20
- onGenerate && (
21
- <ActionIcon
22
- active
23
- icon={Wand2}
24
- loading={loading}
25
- onClick={onGenerate}
26
- size={'small'}
27
- style={{
28
- color: theme.colorInfo,
29
- marginRight: -4,
30
- }}
31
- title={t('autoGenerate')}
32
- />
33
- )
34
- }
35
- type={'block'}
36
- {...props}
37
- />
38
- );
39
- });
20
+ return (
21
+ <Input
22
+ suffix={
23
+ onGenerate && (
24
+ <ActionIcon
25
+ active
26
+ disable={!canAutoGenerate}
27
+ icon={Wand2}
28
+ loading={loading}
29
+ onClick={onGenerate}
30
+ size="small"
31
+ style={{
32
+ color: theme.colorInfo,
33
+ marginRight: -4,
34
+ }}
35
+ title={t('autoGenerate')}
36
+ />
37
+ )
38
+ }
39
+ type="block"
40
+ {...props}
41
+ />
42
+ );
43
+ },
44
+ );
40
45
 
41
46
  export default AutoGenerateInput;
@@ -7,12 +7,13 @@ import { memo } from 'react';
7
7
  import { useTranslation } from 'react-i18next';
8
8
 
9
9
  export interface AutoGenerateInputProps extends SelectProps {
10
+ canAutoGenerate?: boolean;
10
11
  loading?: boolean;
11
12
  onGenerate?: () => void;
12
13
  }
13
14
 
14
15
  const AutoGenerateSelect = memo<AutoGenerateInputProps>(
15
- ({ loading, onGenerate, value, ...props }) => {
16
+ ({ loading, onGenerate, value, canAutoGenerate, ...props }) => {
16
17
  const { t } = useTranslation('common');
17
18
  const theme = useTheme();
18
19
 
@@ -25,6 +26,7 @@ const AutoGenerateSelect = memo<AutoGenerateInputProps>(
25
26
  onGenerate && (
26
27
  <ActionIcon
27
28
  active
29
+ disable={!canAutoGenerate}
28
30
  icon={Wand2}
29
31
  loading={loading}
30
32
  onClick={onGenerate}
@@ -63,6 +63,8 @@ const AgentMeta = memo(() => {
63
63
  return {
64
64
  children: (
65
65
  <AutoGenerate
66
+ canAutoGenerate={hasSystemRole}
67
+ disabled={!hasSystemRole}
66
68
  loading={loading[item.key as keyof SessionLoadingState]}
67
69
  onChange={item.onChange}
68
70
  onGenerate={() => {