@lobehub/chat 0.99.1 → 0.100.1

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,51 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 0.100.1](https://github.com/lobehub/lobe-chat/compare/v0.100.0...v0.100.1)
6
+
7
+ <sup>Released on **2023-11-09**</sup>
8
+
9
+ <br/>
10
+
11
+ <details>
12
+ <summary><kbd>Improvements and Fixes</kbd></summary>
13
+
14
+ </details>
15
+
16
+ <div align="right">
17
+
18
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
19
+
20
+ </div>
21
+
22
+ ## [Version 0.100.0](https://github.com/lobehub/lobe-chat/compare/v0.99.1...v0.100.0)
23
+
24
+ <sup>Released on **2023-11-09**</sup>
25
+
26
+ #### ✨ Features
27
+
28
+ - **hotkeys**: Compatible with SSR, display platform specific key.
29
+ - **misc**: Platform check utils.
30
+
31
+ <br/>
32
+
33
+ <details>
34
+ <summary><kbd>Improvements and Fixes</kbd></summary>
35
+
36
+ #### What's improved
37
+
38
+ - **hotkeys**: Compatible with SSR ([99fa4f8](https://github.com/lobehub/lobe-chat/commit/99fa4f8))
39
+ - **hotkeys**: Display platform specific key ([ee332a4](https://github.com/lobehub/lobe-chat/commit/ee332a4))
40
+ - **misc**: Platform check utils ([08a3cb9](https://github.com/lobehub/lobe-chat/commit/08a3cb9))
41
+
42
+ </details>
43
+
44
+ <div align="right">
45
+
46
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
47
+
48
+ </div>
49
+
5
50
  ### [Version 0.99.1](https://github.com/lobehub/lobe-chat/compare/v0.99.0...v0.99.1)
6
51
 
7
52
  <sup>Released on **2023-11-08**</sup>
package/next.config.mjs CHANGED
@@ -1,5 +1,5 @@
1
+ import nextPWA from '@ducanh2912/next-pwa';
1
2
  import analyzer from '@next/bundle-analyzer';
2
- import nextPWA from 'next-pwa';
3
3
 
4
4
  const isProd = process.env.NODE_ENV === 'production';
5
5
  const buildWithDocker = process.env.DOCKER === 'true';
@@ -11,55 +11,64 @@ const withBundleAnalyzer = analyzer({
11
11
  const withPWA = nextPWA({
12
12
  dest: 'public',
13
13
  register: true,
14
- skipWaiting: true,
14
+ workboxOptions: {
15
+ skipWaiting: true,
16
+ },
15
17
  });
16
18
 
17
19
  /** @type {import('next').NextConfig} */
18
20
  const nextConfig = {
19
21
  compress: isProd,
20
- reactStrictMode: true,
22
+ env: {
23
+ AGENTS_INDEX_URL: process.env.AGENTS_INDEX_URL ?? '',
24
+ PLUGINS_INDEX_URL: process.env.PLUGINS_INDEX_URL ?? '',
25
+ },
26
+ experimental: {
27
+ forceSwcTransforms: true,
28
+ optimizePackageImports: [
29
+ 'modern-screenshot',
30
+ 'emoji-mart',
31
+ '@emoji-mart/react',
32
+ '@emoji-mart/data',
33
+ '@icons-pack/react-simple-icons',
34
+ 'gpt-tokenizer',
35
+ 'chroma-js',
36
+ ],
37
+ webVitalsAttribution: ['CLS', 'LCP'],
38
+ },
21
39
  images: {
22
- unoptimized: !isProd,
23
40
  remotePatterns: [
24
41
  {
25
- protocol: 'https',
26
42
  hostname: 'registry.npmmirror.com',
27
- port: '',
28
43
  pathname: '/@lobehub/assets-emoji/1.3.0/files/assets/**',
44
+ port: '',
45
+ protocol: 'https',
29
46
  },
30
47
  {
31
- protocol: 'https',
32
48
  hostname: 'registry.npmmirror.com',
33
- port: '',
34
49
  pathname: '/@lobehub/assets-emoji-anim/1.0.0/files/assets/**',
50
+ port: '',
51
+ protocol: 'https',
35
52
  },
36
53
  {
37
- protocol: 'https',
38
54
  hostname: 'registry.npmmirror.com',
39
- port: '',
40
55
  pathname: '/@lobehub/assets-logo/1.1.0/files/assets/**',
56
+ port: '',
57
+ protocol: 'https',
41
58
  },
42
59
  {
43
- protocol: 'https',
44
60
  hostname: 'registry.npmmirror.com',
45
- port: '',
46
61
  pathname: '/@lobehub/assets-favicons/latest/files/assets/**',
62
+ port: '',
63
+ protocol: 'https',
47
64
  },
48
65
  ],
66
+ unoptimized: !isProd,
49
67
  },
50
- experimental: {
51
- webVitalsAttribution: ['CLS', 'LCP'],
52
- forceSwcTransforms: true,
53
- optimizePackageImports: [
54
- 'modern-screenshot',
55
- 'emoji-mart',
56
- '@emoji-mart/react',
57
- '@emoji-mart/data',
58
- '@icons-pack/react-simple-icons',
59
- 'gpt-tokenizer',
60
- 'chroma-js',
61
- ],
62
- },
68
+ output: buildWithDocker ? 'standalone' : undefined,
69
+
70
+ reactStrictMode: true,
71
+
63
72
  transpilePackages: ['@lobehub/ui', 'antd-style', 'lodash-es'],
64
73
 
65
74
  webpack(config) {
@@ -68,15 +77,10 @@ const nextConfig = {
68
77
  layers: true,
69
78
  };
70
79
 
71
- return config;
72
- },
80
+ config.resolve.alias['@ant-design/cssinjs'] = '@ant-design/cssinjs/lib';
73
81
 
74
- env: {
75
- AGENTS_INDEX_URL: process.env.AGENTS_INDEX_URL,
76
- PLUGINS_INDEX_URL: process.env.PLUGINS_INDEX_URL,
82
+ return config;
77
83
  },
78
-
79
- output: buildWithDocker ? 'standalone' : undefined,
80
84
  };
81
85
 
82
86
  export default isProd ? withBundleAnalyzer(withPWA(nextConfig)) : nextConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.99.1",
3
+ "version": "0.100.1",
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",
@@ -92,7 +92,7 @@
92
92
  "lucide-react": "latest",
93
93
  "modern-screenshot": "^4",
94
94
  "nanoid": "^5",
95
- "next": "^13.5.3",
95
+ "next": "^14.0.1",
96
96
  "openai": "~4.15.0",
97
97
  "polished": "^4",
98
98
  "posthog-js": "^1",
@@ -121,10 +121,11 @@
121
121
  },
122
122
  "devDependencies": {
123
123
  "@commitlint/cli": "^18",
124
+ "@ducanh2912/next-pwa": "^9.7.2",
124
125
  "@lobehub/i18n-cli": "latest",
125
126
  "@lobehub/lint": "latest",
126
- "@next/bundle-analyzer": "^13",
127
- "@next/eslint-plugin-next": "^13",
127
+ "@next/bundle-analyzer": "^14.0.1",
128
+ "@next/eslint-plugin-next": "^14.0.1",
128
129
  "@testing-library/jest-dom": "^6",
129
130
  "@testing-library/react": "^14",
130
131
  "@types/chroma-js": "^2",
@@ -148,7 +149,6 @@
148
149
  "lint-staged": "^15",
149
150
  "lodash": "^4",
150
151
  "markdown-table": "^3",
151
- "next-pwa": "^5",
152
152
  "node-fetch": "^3",
153
153
  "prettier": "^3",
154
154
  "remark-cli": "^11",
@@ -21,7 +21,7 @@ const RootLayout = ({ children }: PropsWithChildren) => {
21
21
  const lang = cookieStore.get(LOBE_LOCALE_COOKIE);
22
22
 
23
23
  return (
24
- <html lang={lang?.value || DEFAULT_LANG}>
24
+ <html lang={lang?.value || DEFAULT_LANG} suppressHydrationWarning>
25
25
  <body>
26
26
  <StyleRegistry>
27
27
  <Layout
@@ -1,7 +1,12 @@
1
+ 'use client';
2
+
1
3
  import { createStyles } from 'antd-style';
2
- import { Fragment, memo } from 'react';
4
+ import { Fragment, memo, useEffect, useState } from 'react';
3
5
  import { Flexbox } from 'react-layout-kit';
4
6
 
7
+ import { CLEAN_MESSAGE_KEY, PREFIX_KEY } from '@/const/hotkeys';
8
+ import { isApplePlatform } from '@/utils/platform';
9
+
5
10
  const useStyles = createStyles(
6
11
  ({ css, token }) => css`
7
12
  font-size: 12px;
@@ -33,12 +38,28 @@ export interface HotKeysProps {
33
38
 
34
39
  const HotKeys = memo<HotKeysProps>(({ keys, desc }) => {
35
40
  const { styles } = useStyles();
36
- const keysGroup = keys.split('+').filter(Boolean);
41
+ const [keysGroup, setKeysGroup] = useState(keys.split('+'));
42
+ const visibility = typeof window === 'undefined' ? 'hidden' : 'visible';
43
+
44
+ useEffect(() => {
45
+ const mapping: Record<string, string> = {
46
+ [CLEAN_MESSAGE_KEY]: isApplePlatform() ? '⌫' : 'backspace',
47
+ [PREFIX_KEY]: isApplePlatform() ? '⌥' : 'alt',
48
+ };
49
+ const newValue = keys
50
+ .split('+')
51
+ .filter(Boolean)
52
+ .map((k) => mapping[k] ?? k);
53
+ setKeysGroup(newValue);
54
+ }, [keys]);
55
+
37
56
  const content = (
38
57
  <Flexbox align={'center'} className={styles} gap={2} horizontal>
39
58
  {keysGroup.map((key, index) => (
40
59
  <Fragment key={index}>
41
- <kbd>{key.toUpperCase()}</kbd>
60
+ <kbd>
61
+ <span style={{ visibility }}>{key.toUpperCase()}</span>
62
+ </kbd>
42
63
  {index + 1 < keysGroup.length && <span>+</span>}
43
64
  </Fragment>
44
65
  ))}
@@ -0,0 +1,11 @@
1
+ import UAParser from 'ua-parser-js';
2
+
3
+ export const getPlatform = () => {
4
+ let ua = navigator.userAgent;
5
+ return new UAParser(ua).getOS();
6
+ };
7
+
8
+ export const isApplePlatform = () => {
9
+ const platform = getPlatform().name;
10
+ return platform && ['Mac OS', 'iOS'].includes(platform);
11
+ };