@lobehub/chat 0.99.0 → 0.100.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,59 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
## [Version 0.100.0](https://github.com/lobehub/lobe-chat/compare/v0.99.1...v0.100.0)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2023-11-09**</sup>
|
|
8
|
+
|
|
9
|
+
#### ✨ Features
|
|
10
|
+
|
|
11
|
+
- **hotkeys**: Compatible with SSR, display platform specific key.
|
|
12
|
+
- **misc**: Platform check utils.
|
|
13
|
+
|
|
14
|
+
<br/>
|
|
15
|
+
|
|
16
|
+
<details>
|
|
17
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
18
|
+
|
|
19
|
+
#### What's improved
|
|
20
|
+
|
|
21
|
+
- **hotkeys**: Compatible with SSR ([99fa4f8](https://github.com/lobehub/lobe-chat/commit/99fa4f8))
|
|
22
|
+
- **hotkeys**: Display platform specific key ([ee332a4](https://github.com/lobehub/lobe-chat/commit/ee332a4))
|
|
23
|
+
- **misc**: Platform check utils ([08a3cb9](https://github.com/lobehub/lobe-chat/commit/08a3cb9))
|
|
24
|
+
|
|
25
|
+
</details>
|
|
26
|
+
|
|
27
|
+
<div align="right">
|
|
28
|
+
|
|
29
|
+
[](#readme-top)
|
|
30
|
+
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
### [Version 0.99.1](https://github.com/lobehub/lobe-chat/compare/v0.99.0...v0.99.1)
|
|
34
|
+
|
|
35
|
+
<sup>Released on **2023-11-08**</sup>
|
|
36
|
+
|
|
37
|
+
#### 💄 Styles
|
|
38
|
+
|
|
39
|
+
- **misc**: Add max height to model menu in chat input area.
|
|
40
|
+
|
|
41
|
+
<br/>
|
|
42
|
+
|
|
43
|
+
<details>
|
|
44
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
45
|
+
|
|
46
|
+
#### Styles
|
|
47
|
+
|
|
48
|
+
- **misc**: Add max height to model menu in chat input area, closes [#430](https://github.com/lobehub/lobe-chat/issues/430) ([c9a86f3](https://github.com/lobehub/lobe-chat/commit/c9a86f3))
|
|
49
|
+
|
|
50
|
+
</details>
|
|
51
|
+
|
|
52
|
+
<div align="right">
|
|
53
|
+
|
|
54
|
+
[](#readme-top)
|
|
55
|
+
|
|
56
|
+
</div>
|
|
57
|
+
|
|
5
58
|
## [Version 0.99.0](https://github.com/lobehub/lobe-chat/compare/v0.98.3...v0.99.0)
|
|
6
59
|
|
|
7
60
|
<sup>Released on **2023-11-08**</sup>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/chat",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.100.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",
|
|
@@ -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('+')
|
|
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>
|
|
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
|
+
};
|