@lobehub/chat 1.47.10 → 1.47.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 +50 -0
- package/changelog/v1.json +18 -0
- package/package.json +2 -2
- package/src/app/(main)/{@nav/_layout/Desktop → _layout/Desktop/SideBar}/PinList/index.tsx +49 -24
- package/src/app/(main)/_layout/{Desktop.tsx → Desktop/index.tsx} +4 -4
- package/src/app/(main)/{@nav/_layout/Mobile.tsx → _layout/Mobile/NavBar.tsx} +3 -3
- package/src/app/(main)/_layout/{Mobile.tsx → Mobile/index.tsx} +4 -4
- package/src/app/(main)/layout.tsx +1 -2
- package/src/app/(main)/settings/provider/(list)/ProviderGrid/Card.tsx +2 -10
- package/src/app/(main)/settings/provider/(list)/ProviderGrid/EnableSwitch.tsx +29 -0
- package/src/app/(main)/settings/provider/(list)/ProviderGrid/index.tsx +5 -1
- package/src/app/(main)/settings/provider/ProviderMenu/SkeletonList.tsx +1 -1
- package/src/app/(main)/settings/provider/ProviderMenu/index.tsx +1 -1
- package/src/layout/GlobalProvider/StoreInitialization.tsx +0 -1
- package/src/app/(main)/@nav/default.tsx +0 -10
- package/src/app/(main)/_layout/type.ts +0 -6
- package/src/app/(main)/settings/modal/page.tsx +0 -27
- /package/src/app/(main)/{@nav/_layout/Desktop → _layout/Desktop/SideBar}/Avatar.test.tsx +0 -0
- /package/src/app/(main)/{@nav/_layout/Desktop → _layout/Desktop/SideBar}/Avatar.tsx +0 -0
- /package/src/app/(main)/{@nav/_layout/Desktop → _layout/Desktop/SideBar}/BottomActions.tsx +0 -0
- /package/src/app/(main)/{@nav/_layout/Desktop → _layout/Desktop/SideBar}/TopActions.test.tsx +0 -0
- /package/src/app/(main)/{@nav/_layout/Desktop → _layout/Desktop/SideBar}/TopActions.tsx +0 -0
- /package/src/app/(main)/{@nav/_layout/Desktop → _layout/Desktop/SideBar}/index.tsx +0 -0
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,56 @@
|
|
2
2
|
|
3
3
|
# Changelog
|
4
4
|
|
5
|
+
### [Version 1.47.12](https://github.com/lobehub/lobe-chat/compare/v1.47.11...v1.47.12)
|
6
|
+
|
7
|
+
<sup>Released on **2025-01-21**</sup>
|
8
|
+
|
9
|
+
#### 💄 Styles
|
10
|
+
|
11
|
+
- **misc**: Refactor `[@nav](https://github.com/nav)` layout and improve pin list style.
|
12
|
+
|
13
|
+
<br/>
|
14
|
+
|
15
|
+
<details>
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
17
|
+
|
18
|
+
#### Styles
|
19
|
+
|
20
|
+
- **misc**: Refactor `[@nav](https://github.com/nav)` layout and improve pin list style, closes [#5533](https://github.com/lobehub/lobe-chat/issues/5533) ([cc8a7f4](https://github.com/lobehub/lobe-chat/commit/cc8a7f4))
|
21
|
+
|
22
|
+
</details>
|
23
|
+
|
24
|
+
<div align="right">
|
25
|
+
|
26
|
+
[](#readme-top)
|
27
|
+
|
28
|
+
</div>
|
29
|
+
|
30
|
+
### [Version 1.47.11](https://github.com/lobehub/lobe-chat/compare/v1.47.10...v1.47.11)
|
31
|
+
|
32
|
+
<sup>Released on **2025-01-21**</sup>
|
33
|
+
|
34
|
+
#### ♻ Code Refactoring
|
35
|
+
|
36
|
+
- **misc**: Improve code for ai provider.
|
37
|
+
|
38
|
+
<br/>
|
39
|
+
|
40
|
+
<details>
|
41
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
42
|
+
|
43
|
+
#### Code refactoring
|
44
|
+
|
45
|
+
- **misc**: Improve code for ai provider, closes [#5532](https://github.com/lobehub/lobe-chat/issues/5532) ([ea59e24](https://github.com/lobehub/lobe-chat/commit/ea59e24))
|
46
|
+
|
47
|
+
</details>
|
48
|
+
|
49
|
+
<div align="right">
|
50
|
+
|
51
|
+
[](#readme-top)
|
52
|
+
|
53
|
+
</div>
|
54
|
+
|
5
55
|
### [Version 1.47.10](https://github.com/lobehub/lobe-chat/compare/v1.47.9...v1.47.10)
|
6
56
|
|
7
57
|
<sup>Released on **2025-01-21**</sup>
|
package/changelog/v1.json
CHANGED
@@ -1,4 +1,22 @@
|
|
1
1
|
[
|
2
|
+
{
|
3
|
+
"children": {
|
4
|
+
"improvements": [
|
5
|
+
"Refactor [@nav](https://github.com/nav) layout and improve pin list style."
|
6
|
+
]
|
7
|
+
},
|
8
|
+
"date": "2025-01-21",
|
9
|
+
"version": "1.47.12"
|
10
|
+
},
|
11
|
+
{
|
12
|
+
"children": {
|
13
|
+
"improvements": [
|
14
|
+
"Improve code for ai provider."
|
15
|
+
]
|
16
|
+
},
|
17
|
+
"date": "2025-01-21",
|
18
|
+
"version": "1.47.11"
|
19
|
+
},
|
2
20
|
{
|
3
21
|
"children": {
|
4
22
|
"improvements": [
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lobehub/chat",
|
3
|
-
"version": "1.47.
|
3
|
+
"version": "1.47.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",
|
@@ -316,7 +316,7 @@
|
|
316
316
|
"vitest": "~1.2.2",
|
317
317
|
"vitest-canvas-mock": "^0.3.3"
|
318
318
|
},
|
319
|
-
"packageManager": "pnpm@9.15.
|
319
|
+
"packageManager": "pnpm@9.15.4",
|
320
320
|
"publishConfig": {
|
321
321
|
"access": "public",
|
322
322
|
"registry": "https://registry.npmjs.org"
|
@@ -21,9 +21,29 @@ const useStyles = createStyles(({ css, token }) => ({
|
|
21
21
|
box-shadow: 0 0 0 2px ${token.colorPrimary};
|
22
22
|
}
|
23
23
|
`,
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
ink: css`
|
25
|
+
&::before {
|
26
|
+
content: '';
|
27
|
+
|
28
|
+
position: absolute;
|
29
|
+
inset-block-start: 50%;
|
30
|
+
inset-inline: -${12 + 3}px;
|
31
|
+
transform: translateY(-50%);
|
32
|
+
|
33
|
+
width: 4px;
|
34
|
+
height: 0;
|
35
|
+
border-radius: 50px;
|
36
|
+
|
37
|
+
background: ${token.colorPrimary};
|
38
|
+
|
39
|
+
transition: height 150ms ease-out;
|
40
|
+
}
|
41
|
+
`,
|
42
|
+
inkActive: css`
|
43
|
+
&::before {
|
44
|
+
width: 8px;
|
45
|
+
height: 32px;
|
46
|
+
}
|
27
47
|
`,
|
28
48
|
}));
|
29
49
|
|
@@ -61,28 +81,33 @@ const PinList = () => {
|
|
61
81
|
<Divider style={{ margin: '8px 12px' }} />
|
62
82
|
<Flexbox flex={1} gap={12} height={'100%'}>
|
63
83
|
{list.slice(0, 9).map((item, index) => (
|
64
|
-
<
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
84
|
+
<Flexbox key={item.id} style={{ position: 'relative' }}>
|
85
|
+
<Tooltip
|
86
|
+
placement={'right'}
|
87
|
+
title={
|
88
|
+
<Flexbox gap={8} horizontal>
|
89
|
+
{sessionHelpers.getTitle(item.meta)}
|
90
|
+
<HotKeys inverseTheme keys={`ctrl+${index + 1}`} />
|
91
|
+
</Flexbox>
|
92
|
+
}
|
93
|
+
>
|
94
|
+
<Flexbox
|
95
|
+
className={cx(
|
96
|
+
styles.ink,
|
97
|
+
isPinned && activeId === item.id ? styles.inkActive : undefined,
|
98
|
+
)}
|
99
|
+
>
|
100
|
+
<Avatar
|
101
|
+
avatar={sessionHelpers.getAvatar(item.meta)}
|
102
|
+
background={item.meta.backgroundColor}
|
103
|
+
className={cx(styles.avatar)}
|
104
|
+
onClick={() => {
|
105
|
+
switchAgent(item.id);
|
106
|
+
}}
|
107
|
+
/>
|
71
108
|
</Flexbox>
|
72
|
-
|
73
|
-
>
|
74
|
-
<Avatar
|
75
|
-
avatar={sessionHelpers.getAvatar(item.meta)}
|
76
|
-
background={item.meta.backgroundColor}
|
77
|
-
className={cx(
|
78
|
-
styles.avatar,
|
79
|
-
isPinned && activeId === item.id ? styles.avatarActive : undefined,
|
80
|
-
)}
|
81
|
-
onClick={() => {
|
82
|
-
switchAgent(item.id);
|
83
|
-
}}
|
84
|
-
/>
|
85
|
-
</Tooltip>
|
109
|
+
</Tooltip>
|
110
|
+
</Flexbox>
|
86
111
|
))}
|
87
112
|
</Flexbox>
|
88
113
|
</>
|
@@ -2,18 +2,18 @@
|
|
2
2
|
|
3
3
|
import { useTheme } from 'antd-style';
|
4
4
|
import dynamic from 'next/dynamic';
|
5
|
-
import { memo } from 'react';
|
5
|
+
import { PropsWithChildren, memo } from 'react';
|
6
6
|
import { Flexbox } from 'react-layout-kit';
|
7
7
|
|
8
8
|
import { BANNER_HEIGHT } from '@/features/AlertBanner/CloudBanner';
|
9
9
|
import { usePlatform } from '@/hooks/usePlatform';
|
10
10
|
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
|
11
11
|
|
12
|
-
import
|
12
|
+
import SideBar from './SideBar';
|
13
13
|
|
14
14
|
const CloudBanner = dynamic(() => import('@/features/AlertBanner/CloudBanner'));
|
15
15
|
|
16
|
-
const Layout = memo<
|
16
|
+
const Layout = memo<PropsWithChildren>(({ children }) => {
|
17
17
|
const { isPWA } = usePlatform();
|
18
18
|
const theme = useTheme();
|
19
19
|
|
@@ -31,7 +31,7 @@ const Layout = memo<LayoutProps>(({ children, nav }) => {
|
|
31
31
|
}}
|
32
32
|
width={'100%'}
|
33
33
|
>
|
34
|
-
|
34
|
+
<SideBar />
|
35
35
|
{children}
|
36
36
|
</Flexbox>
|
37
37
|
</>
|
@@ -27,7 +27,7 @@ const useStyles = createStyles(({ css, token }) => ({
|
|
27
27
|
`,
|
28
28
|
}));
|
29
29
|
|
30
|
-
const
|
30
|
+
const NavBar = memo(() => {
|
31
31
|
const { t } = useTranslation('common');
|
32
32
|
const { styles } = useStyles();
|
33
33
|
const activeKey = useActiveTabKey();
|
@@ -75,6 +75,6 @@ const Nav = memo(() => {
|
|
75
75
|
return <MobileTabBar activeKey={activeKey} className={styles.container} items={items} />;
|
76
76
|
});
|
77
77
|
|
78
|
-
|
78
|
+
NavBar.displayName = 'NavBar';
|
79
79
|
|
80
|
-
export default
|
80
|
+
export default NavBar;
|
@@ -3,12 +3,12 @@
|
|
3
3
|
import dynamic from 'next/dynamic';
|
4
4
|
import { usePathname } from 'next/navigation';
|
5
5
|
import qs from 'query-string';
|
6
|
-
import { memo } from 'react';
|
6
|
+
import { PropsWithChildren, memo } from 'react';
|
7
7
|
|
8
8
|
import { useQuery } from '@/hooks/useQuery';
|
9
9
|
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
|
10
10
|
|
11
|
-
import
|
11
|
+
import NavBar from './NavBar';
|
12
12
|
|
13
13
|
const CloudBanner = dynamic(() => import('@/features/AlertBanner/CloudBanner'));
|
14
14
|
const MOBILE_NAV_ROUTES = new Set([
|
@@ -21,7 +21,7 @@ const MOBILE_NAV_ROUTES = new Set([
|
|
21
21
|
'/me',
|
22
22
|
]);
|
23
23
|
|
24
|
-
const Layout = memo(({ children
|
24
|
+
const Layout = memo(({ children }: PropsWithChildren) => {
|
25
25
|
const { showMobileWorkspace } = useQuery();
|
26
26
|
const pathname = usePathname();
|
27
27
|
const { url } = qs.parseUrl(pathname);
|
@@ -33,7 +33,7 @@ const Layout = memo(({ children, nav }: LayoutProps) => {
|
|
33
33
|
<>
|
34
34
|
{showCloudPromotion && <CloudBanner mobile />}
|
35
35
|
{children}
|
36
|
-
{showNav &&
|
36
|
+
{showNav && <NavBar />}
|
37
37
|
</>
|
38
38
|
);
|
39
39
|
});
|
@@ -2,9 +2,8 @@ import ServerLayout from '@/components/server/ServerLayout';
|
|
2
2
|
|
3
3
|
import Desktop from './_layout/Desktop';
|
4
4
|
import Mobile from './_layout/Mobile';
|
5
|
-
import { LayoutProps } from './_layout/type';
|
6
5
|
|
7
|
-
const MainLayout = ServerLayout
|
6
|
+
const MainLayout = ServerLayout({ Desktop, Mobile });
|
8
7
|
|
9
8
|
MainLayout.displayName = 'MainLayout';
|
10
9
|
|
@@ -6,10 +6,9 @@ import { memo } from 'react';
|
|
6
6
|
import { useTranslation } from 'react-i18next';
|
7
7
|
import { Flexbox } from 'react-layout-kit';
|
8
8
|
|
9
|
-
import InstantSwitch from '@/components/InstantSwitch';
|
10
|
-
import { useAiInfraStore } from '@/store/aiInfra';
|
11
9
|
import { AiProviderListItem } from '@/types/aiProvider';
|
12
10
|
|
11
|
+
import EnableSwitch from './EnableSwitch';
|
13
12
|
import { useStyles } from './style';
|
14
13
|
|
15
14
|
const { Paragraph } = Typography;
|
@@ -21,7 +20,6 @@ const ProviderCard = memo<ProviderCardProps>(
|
|
21
20
|
({ id, description, name, enabled, source, logo, loading }) => {
|
22
21
|
const { t } = useTranslation('providers');
|
23
22
|
const { cx, styles, theme } = useStyles();
|
24
|
-
const toggleProviderEnabled = useAiInfraStore((s) => s.toggleProviderEnabled);
|
25
23
|
|
26
24
|
if (loading)
|
27
25
|
return (
|
@@ -73,13 +71,7 @@ const ProviderCard = memo<ProviderCardProps>(
|
|
73
71
|
<Divider style={{ margin: '4px 0' }} />
|
74
72
|
<Flexbox horizontal justify={'space-between'} paddingBlock={'8px 0'}>
|
75
73
|
<div />
|
76
|
-
<
|
77
|
-
enabled={enabled}
|
78
|
-
onChange={async (checked) => {
|
79
|
-
await toggleProviderEnabled(id, checked);
|
80
|
-
}}
|
81
|
-
size={'small'}
|
82
|
-
/>
|
74
|
+
<EnableSwitch enabled={enabled} id={id} />
|
83
75
|
</Flexbox>
|
84
76
|
</Flexbox>
|
85
77
|
</Flexbox>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { FC } from 'react';
|
2
|
+
|
3
|
+
import InstantSwitch from '@/components/InstantSwitch';
|
4
|
+
import { useAiInfraStore } from '@/store/aiInfra';
|
5
|
+
|
6
|
+
interface SwitchProps {
|
7
|
+
Component?: FC<{ enabled: boolean, id: string; }>;
|
8
|
+
enabled: boolean;
|
9
|
+
id: string;
|
10
|
+
}
|
11
|
+
|
12
|
+
const Switch = ({ id, Component, enabled }: SwitchProps) => {
|
13
|
+
const [toggleProviderEnabled] = useAiInfraStore((s) => [s.toggleProviderEnabled]);
|
14
|
+
|
15
|
+
// slot for cloud
|
16
|
+
if (Component) return <Component enabled={enabled} id={id} />;
|
17
|
+
|
18
|
+
return (
|
19
|
+
<InstantSwitch
|
20
|
+
enabled={enabled}
|
21
|
+
onChange={async (checked) => {
|
22
|
+
await toggleProviderEnabled(id, checked);
|
23
|
+
}}
|
24
|
+
size={'small'}
|
25
|
+
/>
|
26
|
+
);
|
27
|
+
};
|
28
|
+
|
29
|
+
export default Switch;
|
@@ -29,6 +29,10 @@ const useStyles = createStyles(({ css, responsive, token }) => ({
|
|
29
29
|
${responsive.desktop} {
|
30
30
|
grid-template-columns: repeat(3, 1fr);
|
31
31
|
}
|
32
|
+
|
33
|
+
${responsive.md} {
|
34
|
+
grid-template-columns: repeat(1, 1fr);
|
35
|
+
}
|
32
36
|
`,
|
33
37
|
}));
|
34
38
|
|
@@ -51,7 +55,7 @@ const List = memo(() => {
|
|
51
55
|
{t('list.title.enabled')}
|
52
56
|
</Typography.Text>
|
53
57
|
</Flexbox>
|
54
|
-
<Grid>
|
58
|
+
<Grid className={styles.grid}>
|
55
59
|
{loadingArr.map((item) => (
|
56
60
|
<Card enabled={false} id={item} key={item} loading source={'builtin'} />
|
57
61
|
))}
|
@@ -50,7 +50,7 @@ export const Placeholder = memo(() => {
|
|
50
50
|
});
|
51
51
|
|
52
52
|
export const SkeletonList = memo(() => (
|
53
|
-
<Flexbox gap={4} style={{ paddingTop: 6 }}>
|
53
|
+
<Flexbox flex={1} gap={4} style={{ paddingTop: 6 }}>
|
54
54
|
{Array.from({ length: 6 }).map((_, i) => (
|
55
55
|
<Placeholder key={i} />
|
56
56
|
))}
|
@@ -31,7 +31,7 @@ const Layout = memo(({ children, mobile }: ProviderMenuProps) => {
|
|
31
31
|
|
32
32
|
const width = mobile ? undefined : 260;
|
33
33
|
return (
|
34
|
-
<Flexbox style={{ minWidth: width, overflow: 'scroll' }} width={width}>
|
34
|
+
<Flexbox style={{ minWidth: width, overflow: mobile ? undefined : 'scroll' }} width={width}>
|
35
35
|
<Flexbox
|
36
36
|
gap={8}
|
37
37
|
horizontal
|
@@ -1,27 +0,0 @@
|
|
1
|
-
'use client';
|
2
|
-
|
3
|
-
import { useLayoutEffect } from 'react';
|
4
|
-
import urlJoin from 'url-join';
|
5
|
-
|
6
|
-
import { useQuery } from '@/hooks/useQuery';
|
7
|
-
import { useQueryRoute } from '@/hooks/useQueryRoute';
|
8
|
-
import { SettingsTabs } from '@/store/global/initialState';
|
9
|
-
|
10
|
-
/**
|
11
|
-
* @description: Settings Modal (intercepting routes fallback when hard refresh)
|
12
|
-
* @example: /settings/modal?tab=common => /settings/common
|
13
|
-
* @refs: https://github.com/lobehub/lobe-chat/discussions/2295#discussioncomment-9290942
|
14
|
-
*/
|
15
|
-
|
16
|
-
const SettingsModalFallback = () => {
|
17
|
-
const { tab = SettingsTabs.Common } = useQuery();
|
18
|
-
const router = useQueryRoute();
|
19
|
-
|
20
|
-
useLayoutEffect(() => {
|
21
|
-
router.replace(urlJoin('/settings', tab as SettingsTabs), { query: { tab: '' } });
|
22
|
-
}, []);
|
23
|
-
|
24
|
-
return null;
|
25
|
-
};
|
26
|
-
|
27
|
-
export default SettingsModalFallback;
|
File without changes
|
File without changes
|
File without changes
|
/package/src/app/(main)/{@nav/_layout/Desktop → _layout/Desktop/SideBar}/TopActions.test.tsx
RENAMED
File without changes
|
File without changes
|
File without changes
|