@lobehub/chat 0.142.5 → 0.142.6

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.142.6](https://github.com/lobehub/lobe-chat/compare/v0.142.5...v0.142.6)
6
+
7
+ <sup>Released on **2024-03-26**</sup>
8
+
9
+ #### 🐛 Bug Fixes
10
+
11
+ - **misc**: Fix normalize german locale.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's fixed
19
+
20
+ - **misc**: Fix normalize german locale, closes [#1750](https://github.com/lobehub/lobe-chat/issues/1750) ([69fcc78](https://github.com/lobehub/lobe-chat/commit/69fcc78))
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.142.5](https://github.com/lobehub/lobe-chat/compare/v0.142.4...v0.142.5)
6
31
 
7
32
  <sup>Released on **2024-03-26**</sup>
package/next.config.mjs CHANGED
@@ -8,7 +8,6 @@ const buildWithDocker = process.env.DOCKER === 'true';
8
8
  const API_PROXY_ENDPOINT = process.env.API_PROXY_ENDPOINT || '';
9
9
 
10
10
  const basePath = process.env.NEXT_PUBLIC_BASE_PATH;
11
- const docsBasePath = process.env.NEXT_PUBLIC_LOBE_CHAT_DOCS || '';
12
11
 
13
12
  const withBundleAnalyzer = analyzer({
14
13
  enabled: process.env.ANALYZE === 'true',
@@ -38,27 +37,13 @@ const nextConfig = {
38
37
  ],
39
38
  webVitalsAttribution: ['CLS', 'LCP'],
40
39
  },
41
- images: {
42
- remotePatterns: [
43
- {
44
- hostname: 'registry.npmmirror.com',
45
- pathname: '/@lobehub/**',
46
- port: '',
47
- protocol: 'https',
48
- },
49
- ],
50
- unoptimized: !isProd,
51
- },
40
+
52
41
  output: buildWithDocker ? 'standalone' : undefined,
53
42
 
54
43
  rewrites: async () => [
55
44
  // due to google api not work correct in some countries
56
45
  // we need a proxy to bypass the restriction
57
46
  { source: '/api/chat/google', destination: `${API_PROXY_ENDPOINT}/api/chat/google` },
58
- { source: '/docs', destination: `${docsBasePath}/docs` },
59
- { source: '/docs/zh', destination: `${docsBasePath}/docs/zh` },
60
- { source: '/docs/en', destination: `${docsBasePath}/docs/en` },
61
- { source: '/docs/:path*', destination: `${docsBasePath}/docs/:path*` },
62
47
  ],
63
48
  reactStrictMode: true,
64
49
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.142.5",
3
+ "version": "0.142.6",
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",
@@ -90,7 +90,7 @@
90
90
  "@lobehub/chat-plugins-gateway": "latest",
91
91
  "@lobehub/icons": "latest",
92
92
  "@lobehub/tts": "latest",
93
- "@lobehub/ui": "^1.135.4",
93
+ "@lobehub/ui": "^1.137.4",
94
94
  "@next/third-parties": "^14.1.4",
95
95
  "@vercel/analytics": "^1",
96
96
  "@vercel/speed-insights": "^1.0.10",
@@ -7,7 +7,7 @@ const Sessions = memo(() => {
7
7
  return (
8
8
  <>
9
9
  <div style={{ padding: '8px 16px' }}>
10
- <SessionSearchBar />
10
+ <SessionSearchBar mobile />
11
11
  </div>
12
12
  <SessionListContent />
13
13
  </>
@@ -1,18 +1,20 @@
1
1
  import { SearchBar } from '@lobehub/ui';
2
- import { useResponsive } from 'antd-style';
3
2
  import { memo, useState } from 'react';
4
3
  import { useTranslation } from 'react-i18next';
5
4
 
5
+ import { useIsMobile } from '@/hooks/useIsMobile';
6
6
  import { useSessionStore } from '@/store/session';
7
7
 
8
- const SessionSearchBar = memo(() => {
8
+ const SessionSearchBar = memo<{ mobile?: boolean }>(({ mobile: controlledMobile }) => {
9
9
  const { t } = useTranslation('chat');
10
10
  const [keywords, setKeywords] = useState<string | undefined>(undefined);
11
11
  const [useSearchSessions] = useSessionStore((s) => [s.useSearchSessions]);
12
12
 
13
13
  useSearchSessions(keywords);
14
14
 
15
- const { mobile } = useResponsive();
15
+ const isMobile = useIsMobile();
16
+ const mobile = controlledMobile ?? isMobile;
17
+
16
18
  return (
17
19
  <SearchBar
18
20
  allowClear
@@ -1,18 +1,26 @@
1
1
  'use client';
2
2
 
3
3
  import { SpotlightCard, SpotlightCardProps } from '@lobehub/ui';
4
- import { FC, memo } from 'react';
4
+ import { FC, memo, useEffect } from 'react';
5
5
 
6
6
  import ClientResponsiveContent from '@/components/client/ClientResponsiveContent';
7
+ import { useMarketStore } from '@/store/market';
7
8
 
8
9
  import AgentCard from '../features/AgentCard';
9
- import Index from '../index';
10
+ import AgentSearchBar from '../features/AgentSearchBar';
10
11
 
11
- const Desktop = memo(() => (
12
- <>
13
- <Index />
14
- <AgentCard CardRender={SpotlightCard as FC<SpotlightCardProps>} />
15
- </>
16
- ));
12
+ const Desktop = memo(() => {
13
+ useEffect(() => {
14
+ // refs: https://github.com/pmndrs/zustand/blob/main/docs/integrations/persisting-store-data.md#hashydrated
15
+ useMarketStore.persist.rehydrate();
16
+ }, []);
17
+
18
+ return (
19
+ <>
20
+ <AgentSearchBar />
21
+ <AgentCard CardRender={SpotlightCard as FC<SpotlightCardProps>} />
22
+ </>
23
+ );
24
+ });
17
25
 
18
26
  export default ClientResponsiveContent({ Desktop, Mobile: () => import('../(mobile)') });
@@ -1,21 +1,30 @@
1
1
  'use client';
2
2
 
3
3
  import dynamic from 'next/dynamic';
4
- import { memo } from 'react';
4
+ import { memo, useEffect } from 'react';
5
5
  import { Flexbox } from 'react-layout-kit';
6
6
 
7
+ import { useMarketStore } from '@/store/market';
8
+
7
9
  import AgentCard from '../features/AgentCard';
8
- import Index from '../index';
10
+ import AgentSearchBar from '../features/AgentSearchBar';
9
11
  import CardRender from './features/AgentCard';
10
12
 
11
13
  const DetailModal = dynamic(() => import('./features/AgentDetail'), { ssr: false });
12
14
 
13
- export default memo(() => (
14
- <>
15
- <Flexbox flex={1} gap={16} style={{ padding: 16 }}>
16
- <Index />
17
- <AgentCard CardRender={CardRender} mobile />{' '}
18
- </Flexbox>
19
- <DetailModal />
20
- </>
21
- ));
15
+ export default memo(() => {
16
+ useEffect(() => {
17
+ // refs: https://github.com/pmndrs/zustand/blob/main/docs/integrations/persisting-store-data.md#hashydrated
18
+ useMarketStore.persist.rehydrate();
19
+ }, []);
20
+
21
+ return (
22
+ <>
23
+ <Flexbox flex={1} gap={16} style={{ padding: 16 }}>
24
+ <AgentSearchBar mobile />
25
+ <AgentCard CardRender={CardRender} mobile />{' '}
26
+ </Flexbox>
27
+ <DetailModal />
28
+ </>
29
+ );
30
+ });
@@ -34,7 +34,7 @@ const Desktop = memo<PropsWithChildren>(({ children }) => {
34
34
  <Flexbox flex={1} height={'100%'} id={'lobe-market-container'} style={{ position: 'relative' }}>
35
35
  <Header />
36
36
  <Flexbox flex={1} height={'calc(100% - 64px)'} horizontal>
37
- <Flexbox align={'center'} flex={1} style={{ overflow: 'scroll', padding: 16 }}>
37
+ <Flexbox align={'center'} flex={1} style={{ overflowY: 'scroll', padding: 16 }}>
38
38
  <SafeSpacing />
39
39
 
40
40
  <Flexbox gap={16} style={{ maxWidth: MAX_WIDTH, position: 'relative', width: '100%' }}>
@@ -1,15 +1,16 @@
1
1
  import { SearchBar } from '@lobehub/ui';
2
- import { useResponsive } from 'antd-style';
3
2
  import { memo, useCallback, useState } from 'react';
4
3
  import { useTranslation } from 'react-i18next';
5
4
 
5
+ import { useIsMobile } from '@/hooks/useIsMobile';
6
6
  import { useMarketStore } from '@/store/market';
7
7
 
8
- const AgentSearchBar = memo(() => {
8
+ const AgentSearchBar = memo<{ mobile?: boolean }>(({ mobile: controlledMobile }) => {
9
9
  const { t } = useTranslation('market');
10
10
  const [keywords, setKeywords] = useMarketStore((s) => [s.searchKeywords, s.setSearchKeywords]);
11
11
  const [value, setValue] = useState(keywords);
12
- const { mobile } = useResponsive();
12
+ const isMobile = useIsMobile();
13
+ const mobile = controlledMobile ?? isMobile;
13
14
 
14
15
  const handleSearch = useCallback(() => {
15
16
  setKeywords(value);
@@ -0,0 +1,13 @@
1
+ 'use client';
2
+
3
+ import { memo } from 'react';
4
+ import { useTranslation } from 'react-i18next';
5
+
6
+ import PageTitle from '@/components/PageTitle';
7
+
8
+ const Title = memo(() => {
9
+ const { t } = useTranslation('common');
10
+
11
+ return <PageTitle title={t('tab.market')} />;
12
+ });
13
+ export default Title;
@@ -5,13 +5,19 @@ import { isMobileDevice } from '@/utils/responsive';
5
5
 
6
6
  import DesktopPage from './(desktop)';
7
7
  import MobilePage from './(mobile)';
8
+ import PageTitle from './features/PageTitle';
8
9
 
9
10
  export default () => {
10
11
  const mobile = isMobileDevice();
11
12
 
12
13
  const Page = mobile ? MobilePage : DesktopPage;
13
14
 
14
- return <Page />;
15
+ return (
16
+ <>
17
+ <PageTitle />
18
+ <Page />
19
+ </>
20
+ );
15
21
  };
16
22
 
17
23
  export const metadata: Metadata = {
@@ -60,6 +60,7 @@ const Theme = memo(() => {
60
60
  value: 'auto',
61
61
  },
62
62
  ]}
63
+ unoptimized={false}
63
64
  width={100}
64
65
  />
65
66
  ),
package/src/const/meta.ts CHANGED
@@ -6,4 +6,4 @@ export const DEFAULT_BACKGROUND_COLOR = 'rgba(0,0,0,0)';
6
6
  export const DEFAULT_AGENT_META: MetaData = {};
7
7
  export const DEFAULT_INBOX_AVATAR = '🤯';
8
8
  export const DEFAULT_USER_AVATAR_URL =
9
- 'https://registry.npmmirror.com/@lobehub/assets-logo/1.1.0/files/assets/logo-3d.webp';
9
+ 'https://registry.npmmirror.com/@lobehub/assets-logo/1.2.0/files/assets/logo-3d.webp';
@@ -58,6 +58,7 @@ const AgentConfig = memo(() => {
58
58
  value: 'docs',
59
59
  },
60
60
  ]}
61
+ unoptimized={false}
61
62
  value={displayMode}
62
63
  width={144}
63
64
  />
@@ -1,9 +1,9 @@
1
1
  import { Upload } from 'antd';
2
2
  import { createStyles } from 'antd-style';
3
- import Avatar from 'next/image';
3
+ import NextImage from 'next/image';
4
4
  import { CSSProperties, memo, useCallback } from 'react';
5
5
 
6
- import { imageUrl } from '@/const/url';
6
+ import { DEFAULT_USER_AVATAR_URL } from '@/const/meta';
7
7
  import { useGlobalStore } from '@/store/global';
8
8
  import { commonSelectors } from '@/store/global/selectors';
9
9
  import { imageToBase64 } from '@/utils/imageToBase64';
@@ -58,10 +58,11 @@ const AvatarWithUpload = memo<AvatarWithUploadProps>(
58
58
  return (
59
59
  <div className={styles} id={id} style={{ maxHeight: size, maxWidth: size, ...style }}>
60
60
  <Upload beforeUpload={handleUploadAvatar} itemRender={() => void 0} maxCount={1}>
61
- <Avatar
61
+ <NextImage
62
62
  alt={avatar ? 'userAvatar' : 'LobeChat'}
63
63
  height={size}
64
- src={!!avatar ? avatar : imageUrl('logo.png')}
64
+ src={!!avatar ? avatar : DEFAULT_USER_AVATAR_URL}
65
+ unoptimized
65
66
  width={size}
66
67
  />
67
68
  </Upload>
@@ -76,7 +76,7 @@ const AppTheme = memo<AppThemeProps>(
76
76
  themeMode={themeMode}
77
77
  >
78
78
  <GlobalStyle />
79
- <ConfigProvider config={{ imgAs: Image } as any}>
79
+ <ConfigProvider config={{ imgAs: Image, imgUnoptimized: true }}>
80
80
  <Container>{children}</Container>
81
81
  </ConfigProvider>
82
82
  </ThemeProvider>
@@ -28,6 +28,10 @@ export const normalizeLocale = (locale?: string) => {
28
28
  return 'zh-CN';
29
29
  }
30
30
 
31
+ case 'de': {
32
+ return 'de-DE';
33
+ }
34
+
31
35
  case 'en': {
32
36
  return 'en-US';
33
37
  }
@@ -1,27 +0,0 @@
1
- 'use client';
2
-
3
- import { memo, useEffect } from 'react';
4
- import { useTranslation } from 'react-i18next';
5
-
6
- import PageTitle from '@/components/PageTitle';
7
- import { useMarketStore } from '@/store/market';
8
-
9
- import AgentSearchBar from './features/AgentSearchBar';
10
-
11
- const Market = memo(() => {
12
- const { t } = useTranslation('common');
13
-
14
- useEffect(() => {
15
- // refs: https://github.com/pmndrs/zustand/blob/main/docs/integrations/persisting-store-data.md#hashydrated
16
- useMarketStore.persist.rehydrate();
17
- }, []);
18
-
19
- return (
20
- <>
21
- <PageTitle title={t('tab.market')} />
22
- <AgentSearchBar />
23
- </>
24
- );
25
- });
26
-
27
- export default Market;