@lobehub/chat 0.54.1 → 0.54.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.54.2](https://github.com/lobehub/lobe-chat/compare/v0.54.1...v0.54.2)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2023-08-16**</sup>
|
|
8
|
+
|
|
9
|
+
#### 💄 Styles
|
|
10
|
+
|
|
11
|
+
- **misc**: 修正图片选项的样式问题.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### Styles
|
|
19
|
+
|
|
20
|
+
- **misc**: 修正图片选项的样式问题 ([5f576cb](https://github.com/lobehub/lobe-chat/commit/5f576cb))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
5
30
|
### [Version 0.54.1](https://github.com/lobehub/lobe-chat/compare/v0.54.0...v0.54.1)
|
|
6
31
|
|
|
7
32
|
<sup>Released on **2023-08-16**</sup>
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Icon, IconProps } from '@lobehub/ui';
|
|
2
2
|
import { SelectProps } from 'antd';
|
|
3
|
-
import { type CSSProperties, ReactNode, memo
|
|
3
|
+
import { type CSSProperties, ReactNode, memo } from 'react';
|
|
4
4
|
import { Flexbox } from 'react-layout-kit';
|
|
5
|
+
import useControlledState from 'use-merge-value';
|
|
5
6
|
|
|
6
7
|
import { useStyles } from './styles';
|
|
7
8
|
|
|
@@ -14,14 +15,20 @@ export interface SelectWithImgOptionItem {
|
|
|
14
15
|
|
|
15
16
|
export interface SelectWithImgProps {
|
|
16
17
|
className?: string;
|
|
18
|
+
classNames?: {
|
|
19
|
+
img?: string;
|
|
20
|
+
};
|
|
17
21
|
defaultValue?: SelectProps['defaultValue'];
|
|
18
|
-
|
|
19
|
-
imgStyle?: CSSProperties;
|
|
22
|
+
height: number;
|
|
20
23
|
onChange?: (value: this['value']) => void;
|
|
21
24
|
options?: SelectWithImgOptionItem[];
|
|
22
|
-
size?: number;
|
|
23
25
|
style?: CSSProperties;
|
|
26
|
+
|
|
27
|
+
styles?: {
|
|
28
|
+
img?: CSSProperties;
|
|
29
|
+
};
|
|
24
30
|
value?: SelectProps['value'];
|
|
31
|
+
width: number;
|
|
25
32
|
}
|
|
26
33
|
|
|
27
34
|
const SelectWithImg = memo<SelectWithImgProps>(
|
|
@@ -32,21 +39,23 @@ const SelectWithImg = memo<SelectWithImgProps>(
|
|
|
32
39
|
defaultValue,
|
|
33
40
|
onChange,
|
|
34
41
|
options,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
42
|
+
width,
|
|
43
|
+
height,
|
|
44
|
+
styles: outStyles = {},
|
|
45
|
+
classNames = {},
|
|
38
46
|
}) => {
|
|
39
|
-
const [currentValue, setCurrentValue] =
|
|
40
|
-
|
|
47
|
+
const [currentValue, setCurrentValue] = useControlledState<string>(defaultValue, {
|
|
48
|
+
defaultValue,
|
|
49
|
+
onChange,
|
|
50
|
+
value,
|
|
51
|
+
});
|
|
41
52
|
|
|
42
|
-
|
|
43
|
-
onChange?.(currentValue);
|
|
44
|
-
}, [currentValue]);
|
|
53
|
+
const { styles, cx } = useStyles();
|
|
45
54
|
|
|
46
55
|
return (
|
|
47
|
-
<Flexbox className={className} gap={
|
|
56
|
+
<Flexbox className={className} gap={16} horizontal style={style}>
|
|
48
57
|
{options?.map((item) => {
|
|
49
|
-
const isActive =
|
|
58
|
+
const isActive = item.value === currentValue;
|
|
50
59
|
return (
|
|
51
60
|
<Flexbox
|
|
52
61
|
align={'center'}
|
|
@@ -55,13 +64,24 @@ const SelectWithImg = memo<SelectWithImgProps>(
|
|
|
55
64
|
key={item.value}
|
|
56
65
|
onClick={() => setCurrentValue(item.value)}
|
|
57
66
|
>
|
|
58
|
-
<
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
67
|
+
<div
|
|
68
|
+
className={cx(styles.imgCtn, isActive && styles.imgActive, classNames.img)}
|
|
69
|
+
style={{
|
|
70
|
+
...outStyles.img,
|
|
71
|
+
height,
|
|
72
|
+
width,
|
|
73
|
+
}}
|
|
74
|
+
>
|
|
75
|
+
<div
|
|
76
|
+
className={styles.img}
|
|
77
|
+
style={{
|
|
78
|
+
backgroundImage: `url(${item.img})`,
|
|
79
|
+
backgroundSize: 'contain',
|
|
80
|
+
height,
|
|
81
|
+
width,
|
|
82
|
+
}}
|
|
83
|
+
/>
|
|
84
|
+
</div>
|
|
65
85
|
<Flexbox align={'center'} gap={4} horizontal>
|
|
66
86
|
{item.icon && <Icon icon={item.icon} />}
|
|
67
87
|
{item.label}
|
|
@@ -1,27 +1,42 @@
|
|
|
1
1
|
import { createStyles } from 'antd-style';
|
|
2
2
|
|
|
3
|
-
export const useStyles = createStyles(({ css, token }) =>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
box-shadow: 0 0 0 1px ${token.colorTextDescription};
|
|
3
|
+
export const useStyles = createStyles(({ css, token, cx }) => {
|
|
4
|
+
const hover = css`
|
|
5
|
+
&:hover {
|
|
6
|
+
border-color: ${token.colorText};
|
|
7
|
+
box-shadow: 0 0 0 2px ${token.colorText};
|
|
9
8
|
}
|
|
10
|
-
|
|
11
|
-
container: css`
|
|
12
|
-
cursor: pointer;
|
|
13
|
-
color: ${token.colorTextDescription};
|
|
9
|
+
`;
|
|
14
10
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
const img = cx(css`
|
|
12
|
+
box-shadow: inset 0 0 0 2px ${token.colorSplit};
|
|
13
|
+
transition: all 100ms ${token.motionEaseOut};
|
|
14
|
+
border-radius: ${token.borderRadius}px;
|
|
15
|
+
|
|
16
|
+
${hover}
|
|
17
|
+
`);
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
active: css`
|
|
21
|
+
color: ${token.colorText};
|
|
22
|
+
`,
|
|
23
|
+
container: css`
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
color: ${token.colorTextDescription};
|
|
26
|
+
`,
|
|
27
|
+
img,
|
|
28
|
+
imgActive: css`
|
|
29
|
+
box-shadow: 0 0 0 2px ${token.colorTextTertiary};
|
|
20
30
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
box-shadow: 0 0 0 2px ${token.colorText};
|
|
31
|
+
.${img} {
|
|
32
|
+
box-shadow: none;
|
|
24
33
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
34
|
+
`,
|
|
35
|
+
imgCtn: css`
|
|
36
|
+
background: ${token.colorFillTertiary};
|
|
37
|
+
border-radius: ${token.borderRadius}px;
|
|
38
|
+
|
|
39
|
+
${hover}
|
|
40
|
+
`,
|
|
41
|
+
};
|
|
42
|
+
});
|
|
@@ -35,13 +35,7 @@ const AgentConfig = memo<AgentConfigProps>(({ config, updateConfig }) => {
|
|
|
35
35
|
{
|
|
36
36
|
children: (
|
|
37
37
|
<SelectWithImg
|
|
38
|
-
|
|
39
|
-
background: `linear-gradient(
|
|
40
|
-
to bottom,
|
|
41
|
-
${isDarkMode ? theme.colorBgElevated : theme.colorBgLayout},
|
|
42
|
-
${theme.colorBgContainer}
|
|
43
|
-
)`,
|
|
44
|
-
}}
|
|
38
|
+
height={86}
|
|
45
39
|
options={[
|
|
46
40
|
{
|
|
47
41
|
icon: MessagesSquare,
|
|
@@ -56,7 +50,16 @@ const AgentConfig = memo<AgentConfigProps>(({ config, updateConfig }) => {
|
|
|
56
50
|
value: 'docs',
|
|
57
51
|
},
|
|
58
52
|
]}
|
|
59
|
-
|
|
53
|
+
styles={{
|
|
54
|
+
img: {
|
|
55
|
+
background: `linear-gradient(
|
|
56
|
+
to bottom,
|
|
57
|
+
${isDarkMode ? theme.colorBgElevated : theme.colorBgLayout},
|
|
58
|
+
${theme.colorBgContainer}
|
|
59
|
+
)`,
|
|
60
|
+
},
|
|
61
|
+
}}
|
|
62
|
+
width={144}
|
|
60
63
|
/>
|
|
61
64
|
),
|
|
62
65
|
label: t('settingChat.chatStyleType.title'),
|
|
@@ -79,6 +79,7 @@ const Common = memo(() => {
|
|
|
79
79
|
children: (
|
|
80
80
|
<SelectWithImg
|
|
81
81
|
defaultValue={settings.themeMode}
|
|
82
|
+
height={60}
|
|
82
83
|
onChange={setThemeMode}
|
|
83
84
|
options={[
|
|
84
85
|
{
|
|
@@ -100,6 +101,7 @@ const Common = memo(() => {
|
|
|
100
101
|
value: 'auto',
|
|
101
102
|
},
|
|
102
103
|
]}
|
|
104
|
+
width={100}
|
|
103
105
|
/>
|
|
104
106
|
),
|
|
105
107
|
label: t('settingTheme.themeMode.title'),
|