@lobehub/chat 0.88.0 → 0.89.0

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.89.0](https://github.com/lobehub/lobe-chat/compare/v0.88.0...v0.89.0)
6
+
7
+ <sup>Released on **2023-10-12**</sup>
8
+
9
+ #### ✨ Features
10
+
11
+ - **agent-card**: Add and modify features for agent card.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's improved
19
+
20
+ - **agent-card**: Add and modify features for agent card ([3e3090a](https://github.com/lobehub/lobe-chat/commit/3e3090a))
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.88.0](https://github.com/lobehub/lobe-chat/compare/v0.87.0...v0.88.0)
6
31
 
7
32
  <sup>Released on **2023-10-11**</sup>
package/next.config.mjs CHANGED
@@ -16,8 +16,9 @@ const withPWA = nextPWA({
16
16
 
17
17
  /** @type {import('next').NextConfig} */
18
18
  const nextConfig = {
19
+ compress: isProd,
20
+ productionBrowserSourceMaps: true,
19
21
  reactStrictMode: true,
20
- swcMinify: true,
21
22
  images: {
22
23
  unoptimized: !isProd,
23
24
  remotePatterns: [
@@ -39,12 +40,20 @@ const nextConfig = {
39
40
  port: '',
40
41
  pathname: '/@lobehub/assets-logo/1.1.0/files/assets/**',
41
42
  },
43
+ {
44
+ protocol: 'https',
45
+ hostname: 'registry.npmmirror.com',
46
+ port: '',
47
+ pathname: '/@lobehub/assets-favicons/latest/files/assets/**',
48
+ },
42
49
  ],
43
50
  },
44
51
  experimental: {
52
+ webVitalsAttribution: ['CLS', 'LCP'],
45
53
  forceSwcTransforms: true,
54
+ optimizePackageImports: ['modern-screenshot','emoji-mart','@emoji-mart/react','@emoji-mart/data','@icons-pack/react-simple-icons','gpt-tokenizer','chroma-js'],
46
55
  },
47
- transpilePackages: ['@lobehub/ui', 'antd-style'],
56
+ transpilePackages: ['@lobehub/ui', 'antd-style', 'lodash-es'],
48
57
 
49
58
  webpack(config) {
50
59
  config.experiments = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.88.0",
3
+ "version": "0.89.0",
4
4
  "description": "An open-source, extensible (Function Calling), high-performance chatbot framework. It supports one-click free deployment of your private ChatGPT/LLM web application",
5
5
  "keywords": [
6
6
  "chatbot",
@@ -66,7 +66,6 @@
66
66
  },
67
67
  "dependencies": {
68
68
  "@ant-design/colors": "^7",
69
- "@ant-design/icons": "^5",
70
69
  "@emoji-mart/data": "^1",
71
70
  "@emoji-mart/react": "^1",
72
71
  "@icons-pack/react-simple-icons": "^9",
@@ -3,11 +3,11 @@ import { createStyles } from 'antd-style';
3
3
  import { memo } from 'react';
4
4
  import { Flexbox } from 'react-layout-kit';
5
5
 
6
- const useStyles = createStyles(({ css, token }) => ({
6
+ const useStyles = createStyles(({ css, token, isDarkMode }) => ({
7
7
  container: css`
8
8
  overflow: hidden;
9
9
  background: ${token.colorBgContainer};
10
- border: 1px solid ${token.colorFillTertiary};
10
+ border: 1px solid ${isDarkMode ? token.colorFillTertiary : token.colorFillSecondary};
11
11
  border-radius: ${token.borderRadiusLG}px;
12
12
  `,
13
13
  }));
@@ -5,7 +5,7 @@ import { Flexbox } from 'react-layout-kit';
5
5
 
6
6
  import { MetaData } from '@/types/meta';
7
7
 
8
- export const useStyles = createStyles(({ css, token }, maskColor: string) => ({
8
+ export const useStyles = createStyles(({ css, token }) => ({
9
9
  banner: css`
10
10
  position: relative;
11
11
 
@@ -14,20 +14,14 @@ export const useStyles = createStyles(({ css, token }, maskColor: string) => ({
14
14
  height: 64px;
15
15
  margin-bottom: -56px;
16
16
 
17
- background: ${token.colorFill};
17
+ background: ${token.colorFillSecondary};
18
+
19
+ mask-image: linear-gradient(to bottom, #fff, transparent);
18
20
  `,
19
21
  bannerImg: css`
20
- filter: blur(6px) saturate(1.6);
21
- `,
22
- bannerMask: css`
23
22
  position: absolute;
24
- bottom: 0;
25
- left: 0;
26
-
27
- width: 100%;
28
- height: 100%;
29
-
30
- background: linear-gradient(to bottom, transparent, ${maskColor || token.colorBgLayout});
23
+ top: -50%;
24
+ filter: blur(50px) saturate(2);
31
25
  `,
32
26
  }));
33
27
 
@@ -39,8 +33,8 @@ interface AgentCardBannerProps extends DivProps {
39
33
  }
40
34
 
41
35
  const AgentCardBanner = memo<AgentCardBannerProps>(
42
- ({ meta, className, mask, size = 8, maskColor, children, ...props }) => {
43
- const { styles, theme, cx } = useStyles(maskColor);
36
+ ({ meta, className, size = 200, children, ...props }) => {
37
+ const { styles, cx } = useStyles();
44
38
 
45
39
  return (
46
40
  <Flexbox
@@ -49,14 +43,7 @@ const AgentCardBanner = memo<AgentCardBannerProps>(
49
43
  justify={'center'}
50
44
  {...props}
51
45
  >
52
- <Avatar
53
- alt={'banner'}
54
- avatar={meta.avatar}
55
- background={meta.backgroundColor || theme.colorBgContainer}
56
- className={styles.bannerImg}
57
- style={{ transform: `scale(${size})` }}
58
- />
59
- {mask && <div className={styles.bannerMask} />}
46
+ <Avatar alt={'banner'} avatar={meta.avatar} className={styles.bannerImg} size={size} />
60
47
  {children}
61
48
  </Flexbox>
62
49
  );
@@ -22,12 +22,7 @@ const AgentCardItem = memo<AgentsMarketIndexItem>(({ meta, identifier }) => {
22
22
  const { isDarkMode } = useThemeMode();
23
23
  return (
24
24
  <Flexbox className={styles.container} onClick={() => onAgentCardClick(identifier)}>
25
- <AgentCardBanner
26
- mask
27
- maskColor={theme.colorBgContainer}
28
- meta={meta}
29
- style={{ opacity: isDarkMode ? 0.9 : 0.4 }}
30
- />
25
+ <AgentCardBanner meta={meta} style={{ opacity: isDarkMode ? 0.9 : 0.4 }} />
31
26
  <Flexbox className={styles.inner} gap={8} ref={ref}>
32
27
  <Avatar
33
28
  animation={isHovering}
@@ -1,5 +1,4 @@
1
1
  import { Markdown, TabsNav } 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
  import { Flexbox } from 'react-layout-kit';
@@ -23,8 +22,8 @@ const AgentModalInner = memo(() => {
23
22
  s.useFetchAgent,
24
23
  s.currentIdentifier,
25
24
  ]);
26
- const { styles, theme } = useStyles();
27
- const { mobile } = useResponsive();
25
+ const { styles } = useStyles();
26
+
28
27
  const { data, isLoading } = useFetchAgent(currentIdentifier);
29
28
  const { t } = useTranslation('market');
30
29
  const [tab, setTab] = useState<string>(InfoTabs.prompt);
@@ -36,13 +35,7 @@ const AgentModalInner = memo(() => {
36
35
 
37
36
  return (
38
37
  <>
39
- <AgentCardBanner
40
- mask
41
- maskColor={mobile ? theme.colorBgContainer : undefined}
42
- meta={meta}
43
- size={10}
44
- style={{ height: 120, marginBottom: -60 }}
45
- />
38
+ <AgentCardBanner meta={meta} size={400} style={{ height: 120, marginBottom: -60 }} />
46
39
  <Header />
47
40
  <Flexbox align={'center'}>
48
41
  <TabsNav
@@ -9,9 +9,9 @@ const { description, homepage } = pkg;
9
9
  const metadata: Metadata = {
10
10
  appleWebApp: {
11
11
  statusBarStyle: 'black-translucent',
12
- title: title,
12
+ title,
13
13
  },
14
- description: description,
14
+ description,
15
15
  icons: {
16
16
  apple:
17
17
  'https://registry.npmmirror.com/@lobehub/assets-favicons/latest/files/assets/apple-touch-icon.png',
@@ -26,13 +26,13 @@ const metadata: Metadata = {
26
26
  {
27
27
  alt: title,
28
28
  height: 360,
29
- url: 'https://registry.npmmirror.com/@lobehub/assets-favicons/1.4.0/files/assets/og-480x270.png',
29
+ url: 'https://registry.npmmirror.com/@lobehub/assets-favicons/latest/files/assets/og-480x270.png',
30
30
  width: 480,
31
31
  },
32
32
  {
33
33
  alt: title,
34
34
  height: 720,
35
- url: 'https://registry.npmmirror.com/@lobehub/assets-favicons/1.4.0/files/assets/og-960x540.png',
35
+ url: 'https://registry.npmmirror.com/@lobehub/assets-favicons/latest/files/assets/og-960x540.png',
36
36
  width: 960,
37
37
  },
38
38
  ],
@@ -50,6 +50,15 @@ const metadata: Metadata = {
50
50
  default: title,
51
51
  template: '%s · LobeChat',
52
52
  },
53
+ twitter: {
54
+ card: 'summary_large_image',
55
+ creator: '@lobehub',
56
+ description,
57
+ images: [
58
+ 'https://registry.npmmirror.com/@lobehub/assets-favicons/latest/files/assets/og-960x540.png',
59
+ ],
60
+ title,
61
+ },
53
62
  viewport: {
54
63
  initialScale: 1,
55
64
  maximumScale: 1,
@@ -6,7 +6,7 @@ import { Flexbox } from 'react-layout-kit';
6
6
 
7
7
  import { DEFAULT_USER_AVATAR_URL } from '@/const/meta';
8
8
 
9
- export const useStyles = createStyles(({ css, token }, maskColor: string) => ({
9
+ export const useStyles = createStyles(({ css, token }) => ({
10
10
  banner: css`
11
11
  position: relative;
12
12
 
@@ -15,36 +15,32 @@ export const useStyles = createStyles(({ css, token }, maskColor: string) => ({
15
15
  height: 172px;
16
16
  min-height: 172px;
17
17
  max-height: 172px;
18
+ `,
19
+ bannerBox: css`
20
+ position: relative;
21
+
22
+ width: 100%;
23
+ height: 100%;
18
24
 
19
25
  background: ${token.colorBgLayout};
26
+
27
+ mask-image: linear-gradient(to bottom, #fff, transparent);
20
28
  `,
21
29
  bannerImg: css`
22
30
  position: absolute;
23
31
  top: -50%;
24
32
  filter: blur(100px) saturate(2);
25
33
  `,
26
- bannerMask: css`
27
- position: absolute;
28
- bottom: 0;
29
- left: 0;
30
-
31
- width: 100%;
32
- height: 100%;
33
-
34
- background: linear-gradient(to bottom, transparent, ${maskColor || token.colorBgLayout});
35
- `,
36
34
  }));
37
35
 
38
36
  interface AgentCardBannerProps extends DivProps {
39
37
  avatar: string;
40
- mask?: boolean;
41
- maskColor?: string;
42
38
  size?: number;
43
39
  }
44
40
 
45
41
  const AvatarBanner = memo<AgentCardBannerProps>(
46
- ({ avatar, className, mask, size = 200, maskColor, children, ...props }) => {
47
- const { styles, cx } = useStyles(maskColor);
42
+ ({ avatar, className, size = 200, children, ...props }) => {
43
+ const { styles, cx } = useStyles();
48
44
 
49
45
  return (
50
46
  <Flexbox
@@ -53,14 +49,15 @@ const AvatarBanner = memo<AgentCardBannerProps>(
53
49
  justify={'center'}
54
50
  {...props}
55
51
  >
56
- <Image
57
- alt={'banner'}
58
- className={styles.bannerImg}
59
- height={size}
60
- src={avatar || DEFAULT_USER_AVATAR_URL}
61
- width={size}
62
- />
63
- {mask && <div className={styles.bannerMask} />}
52
+ <Flexbox align={'center'} className={styles.bannerBox} justify={'center'}>
53
+ <Image
54
+ alt={'banner'}
55
+ className={styles.bannerImg}
56
+ height={size}
57
+ src={avatar || DEFAULT_USER_AVATAR_URL}
58
+ width={size}
59
+ />
60
+ </Flexbox>
64
61
  {children}
65
62
  </Flexbox>
66
63
  );
@@ -33,7 +33,7 @@ const Setting = memo(() => {
33
33
 
34
34
  return (
35
35
  <Layout>
36
- <AvatarBanner avatar={avatar} mask>
36
+ <AvatarBanner avatar={avatar}>
37
37
  <Center style={{ position: 'absolute', zIndex: 2 }}>
38
38
  <AvatarWithUpload size={88} />
39
39
  </Center>
@@ -24,7 +24,7 @@ const Hero = memo<{ mobile?: boolean; width: number }>(({ width, mobile }) => {
24
24
  <>
25
25
  <LogoThree size={size.logo} style={{ marginTop: -size.logo / 5 }} />
26
26
  <div className={styles.title} style={{ fontSize: size.title }}>
27
- <span style={mobile ? { fontSize: '1.2em' } : {}}>LobeChat</span>
27
+ <strong style={mobile ? { fontSize: '1.2em' } : {}}>LobeChat</strong>
28
28
  {mobile ? <br /> : ' '}
29
29
  {t('slogan.title')}
30
30
  </div>
@@ -1,11 +1,10 @@
1
1
  'use client';
2
2
 
3
3
  import { Icon } from '@lobehub/ui';
4
- import { useSize } from 'ahooks';
5
4
  import { Button, Upload } from 'antd';
6
5
  import { SendHorizonal } from 'lucide-react';
7
6
  import dynamic from 'next/dynamic';
8
- import { memo, useCallback, useRef } from 'react';
7
+ import { memo, useCallback } from 'react';
9
8
  import { useTranslation } from 'react-i18next';
10
9
  import { Flexbox } from 'react-layout-kit';
11
10
 
@@ -18,9 +17,6 @@ const Hero = dynamic(() => import('./Hero'));
18
17
 
19
18
  const Banner = memo<{ mobile?: boolean }>(({ mobile }) => {
20
19
  const { importConfig } = useImportConfig();
21
- const ref = useRef(null);
22
- const domSize = useSize(ref);
23
- const width = domSize?.width || 1024;
24
20
  const { t } = useTranslation('welcome');
25
21
  const { styles } = useStyles();
26
22
  const [switchSession, switchBackToChat, router, isMobile] = useSessionStore((s) => [
@@ -36,8 +32,8 @@ const Banner = memo<{ mobile?: boolean }>(({ mobile }) => {
36
32
 
37
33
  return (
38
34
  <>
39
- <div className={styles.container} ref={ref}>
40
- <Hero mobile={mobile} width={width} />
35
+ <div className={styles.container}>
36
+ <Hero mobile={mobile} width={mobile ? 640 : 1024} />
41
37
  </div>
42
38
  <Flexbox
43
39
  className={styles.buttonGroup}
@@ -2,9 +2,9 @@ import type { FormProps } from '@lobehub/ui';
2
2
 
3
3
  export const HEADER_HEIGHT = 64;
4
4
  export const MOBILE_NABBAR_HEIGHT = 44;
5
- export const MOBILE_TABBAR_HEIGHT = 60;
5
+ export const MOBILE_TABBAR_HEIGHT = 48;
6
6
  export const CHAT_TEXTAREA_HEIGHT = 200;
7
- export const CHAT_TEXTAREA_HEIGHT_MOBILE = 120;
7
+ export const CHAT_TEXTAREA_HEIGHT_MOBILE = 108;
8
8
  export const CHAT_SIDEBAR_WIDTH = 280;
9
9
  export const MARKET_SIDEBAR_WIDTH = 400;
10
10
  export const FOLDER_WIDTH = 256;