@lobehub/chat 0.96.2 → 0.96.3
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 +25 -0
- package/package.json +1 -1
- package/src/app/chat/features/SessionListContent/CollapseGroup/index.tsx +7 -3
- package/src/app/chat/features/SessionListContent/Inbox/index.tsx +5 -25
- package/src/app/chat/features/SessionListContent/List/Item/index.tsx +17 -52
- package/src/app/chat/features/SessionListContent/ListItem/index.tsx +61 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
### [Version 0.96.3](https://github.com/lobehub/lobe-chat/compare/v0.96.2...v0.96.3)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2023-10-28**</sup>
|
|
8
|
+
|
|
9
|
+
#### 💄 Styles
|
|
10
|
+
|
|
11
|
+
- **misc**: Fix SessionList on mobile.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### Styles
|
|
19
|
+
|
|
20
|
+
- **misc**: Fix SessionList on mobile ([e7e7b80](https://github.com/lobehub/lobe-chat/commit/e7e7b80))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
5
30
|
### [Version 0.96.2](https://github.com/lobehub/lobe-chat/compare/v0.96.1...v0.96.2)
|
|
6
31
|
|
|
7
32
|
<sup>Released on **2023-10-28**</sup>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/chat",
|
|
3
|
-
"version": "0.96.
|
|
3
|
+
"version": "0.96.3",
|
|
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",
|
|
@@ -4,12 +4,16 @@ import { createStyles } from 'antd-style';
|
|
|
4
4
|
import { ChevronDown } from 'lucide-react';
|
|
5
5
|
import { memo } from 'react';
|
|
6
6
|
|
|
7
|
-
const useStyles = createStyles(({ css, prefixCls, token }) => ({
|
|
7
|
+
const useStyles = createStyles(({ css, prefixCls, token, responsive }) => ({
|
|
8
8
|
container: css`
|
|
9
9
|
.${prefixCls}-collapse-header {
|
|
10
|
-
padding-inline: 16px !important;
|
|
10
|
+
padding-inline: 16px 10px !important;
|
|
11
11
|
color: ${token.colorTextDescription} !important;
|
|
12
|
-
border-radius:
|
|
12
|
+
border-radius: ${token.borderRadius}px !important;
|
|
13
|
+
|
|
14
|
+
${responsive.mobile} {
|
|
15
|
+
border-radius: 0 !important;
|
|
16
|
+
}
|
|
13
17
|
|
|
14
18
|
&:hover {
|
|
15
19
|
color: ${token.colorText} !important;
|
|
@@ -1,22 +1,16 @@
|
|
|
1
|
-
import { Avatar, List } from '@lobehub/ui';
|
|
2
|
-
import { useHover } from 'ahooks';
|
|
3
1
|
import { useResponsive } from 'antd-style';
|
|
4
2
|
import Link from 'next/link';
|
|
5
|
-
import { memo
|
|
3
|
+
import { memo } from 'react';
|
|
6
4
|
import { useTranslation } from 'react-i18next';
|
|
7
5
|
|
|
8
|
-
import { useStyles } from '@/app/chat/features/SessionListContent/List/Item';
|
|
9
6
|
import { DEFAULT_INBOX_AVATAR } from '@/const/meta';
|
|
10
7
|
import { INBOX_SESSION_ID } from '@/const/session';
|
|
11
8
|
import { SESSION_CHAT_URL } from '@/const/url';
|
|
12
9
|
import { useSessionStore } from '@/store/session';
|
|
13
10
|
|
|
14
|
-
|
|
11
|
+
import ListItem from '../ListItem';
|
|
15
12
|
|
|
16
13
|
const Inbox = memo(() => {
|
|
17
|
-
const ref = useRef(null);
|
|
18
|
-
const { styles } = useStyles();
|
|
19
|
-
const isHovering = useHover(ref);
|
|
20
14
|
const { t } = useTranslation('chat');
|
|
21
15
|
const { mobile } = useResponsive();
|
|
22
16
|
const [activeId, activeSession, switchSession] = useSessionStore((s) => [
|
|
@@ -25,18 +19,6 @@ const Inbox = memo(() => {
|
|
|
25
19
|
s.switchSession,
|
|
26
20
|
]);
|
|
27
21
|
|
|
28
|
-
const avatarRender = useMemo(
|
|
29
|
-
() => (
|
|
30
|
-
<Avatar
|
|
31
|
-
animation={isHovering}
|
|
32
|
-
avatar={DEFAULT_INBOX_AVATAR}
|
|
33
|
-
size={46}
|
|
34
|
-
style={{ padding: 3 }}
|
|
35
|
-
/>
|
|
36
|
-
),
|
|
37
|
-
[isHovering],
|
|
38
|
-
);
|
|
39
|
-
|
|
40
22
|
return (
|
|
41
23
|
<Link
|
|
42
24
|
aria-label={t('inbox.title')}
|
|
@@ -47,11 +29,9 @@ const Inbox = memo(() => {
|
|
|
47
29
|
else activeSession(INBOX_SESSION_ID);
|
|
48
30
|
}}
|
|
49
31
|
>
|
|
50
|
-
<
|
|
51
|
-
active={
|
|
52
|
-
avatar={
|
|
53
|
-
className={styles.container}
|
|
54
|
-
ref={ref}
|
|
32
|
+
<ListItem
|
|
33
|
+
active={activeId === INBOX_SESSION_ID}
|
|
34
|
+
avatar={DEFAULT_INBOX_AVATAR}
|
|
55
35
|
title={t('inbox.title')}
|
|
56
36
|
/>
|
|
57
37
|
</Link>
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { SiOpenai } from '@icons-pack/react-simple-icons';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { createStyles, useResponsive } from 'antd-style';
|
|
5
|
-
import { memo, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { Tag } from '@lobehub/ui';
|
|
3
|
+
import { memo, useMemo, useState } from 'react';
|
|
6
4
|
import { Flexbox } from 'react-layout-kit';
|
|
7
5
|
import { shallow } from 'zustand/shallow';
|
|
8
6
|
|
|
@@ -10,32 +8,16 @@ import { settingsSelectors, useGlobalStore } from '@/store/global';
|
|
|
10
8
|
import { useSessionStore } from '@/store/session';
|
|
11
9
|
import { agentSelectors, sessionSelectors } from '@/store/session/selectors';
|
|
12
10
|
|
|
11
|
+
import ListItem from '../../ListItem';
|
|
13
12
|
import Actions from './Actions';
|
|
14
13
|
|
|
15
|
-
const { Item } = List;
|
|
16
|
-
|
|
17
|
-
export const useStyles = createStyles(({ css, token, responsive }) => {
|
|
18
|
-
return {
|
|
19
|
-
container: css`
|
|
20
|
-
position: relative;
|
|
21
|
-
border-radius: ${token.borderRadius}px;
|
|
22
|
-
${responsive.mobile} {
|
|
23
|
-
border-radius: 0;
|
|
24
|
-
}
|
|
25
|
-
`,
|
|
26
|
-
};
|
|
27
|
-
});
|
|
28
|
-
|
|
29
14
|
interface SessionItemProps {
|
|
30
15
|
id: string;
|
|
31
16
|
}
|
|
32
17
|
|
|
33
18
|
const SessionItem = memo<SessionItemProps>(({ id }) => {
|
|
34
19
|
const [open, setOpen] = useState(false);
|
|
35
|
-
|
|
36
|
-
const isHovering = useHover(ref);
|
|
37
|
-
const { mobile } = useResponsive();
|
|
38
|
-
const { styles } = useStyles();
|
|
20
|
+
|
|
39
21
|
const [defaultModel] = useGlobalStore((s) => [settingsSelectors.defaultAgentConfig(s).model]);
|
|
40
22
|
|
|
41
23
|
const [
|
|
@@ -72,19 +54,6 @@ const SessionItem = memo<SessionItemProps>(({ id }) => {
|
|
|
72
54
|
|
|
73
55
|
const actions = useMemo(() => <Actions id={id} setOpen={setOpen} />, [id]);
|
|
74
56
|
|
|
75
|
-
const avatarRender = useMemo(
|
|
76
|
-
() => (
|
|
77
|
-
<Avatar
|
|
78
|
-
animation={isHovering}
|
|
79
|
-
avatar={avatar}
|
|
80
|
-
background={avatarBackground}
|
|
81
|
-
shape="circle"
|
|
82
|
-
size={46}
|
|
83
|
-
/>
|
|
84
|
-
),
|
|
85
|
-
[isHovering, avatar, avatarBackground],
|
|
86
|
-
);
|
|
87
|
-
|
|
88
57
|
const addon = useMemo(
|
|
89
58
|
() =>
|
|
90
59
|
!showModel ? undefined : (
|
|
@@ -96,23 +65,19 @@ const SessionItem = memo<SessionItemProps>(({ id }) => {
|
|
|
96
65
|
);
|
|
97
66
|
|
|
98
67
|
return (
|
|
99
|
-
<
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
showAction={open || isHovering}
|
|
113
|
-
title={title}
|
|
114
|
-
/>
|
|
115
|
-
</Flexbox>
|
|
68
|
+
<ListItem
|
|
69
|
+
actions={actions}
|
|
70
|
+
active={active}
|
|
71
|
+
addon={addon}
|
|
72
|
+
avatar={avatar}
|
|
73
|
+
avatarBackground={avatarBackground}
|
|
74
|
+
date={updateAt}
|
|
75
|
+
description={description || systemRole}
|
|
76
|
+
loading={loading}
|
|
77
|
+
pin={pin}
|
|
78
|
+
showAction={open}
|
|
79
|
+
title={title}
|
|
80
|
+
/>
|
|
116
81
|
);
|
|
117
82
|
}, shallow);
|
|
118
83
|
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Avatar, List, ListItemProps } from '@lobehub/ui';
|
|
2
|
+
import { useHover } from 'ahooks';
|
|
3
|
+
import { createStyles, useResponsive } from 'antd-style';
|
|
4
|
+
import { memo, useMemo, useRef } from 'react';
|
|
5
|
+
|
|
6
|
+
const { Item } = List;
|
|
7
|
+
|
|
8
|
+
const useStyles = createStyles(({ css, token, responsive }) => {
|
|
9
|
+
return {
|
|
10
|
+
container: css`
|
|
11
|
+
position: relative;
|
|
12
|
+
|
|
13
|
+
margin-block: 2px;
|
|
14
|
+
padding-right: 16px;
|
|
15
|
+
padding-left: 8px;
|
|
16
|
+
|
|
17
|
+
border-radius: ${token.borderRadius}px;
|
|
18
|
+
${responsive.mobile} {
|
|
19
|
+
margin-block: 0;
|
|
20
|
+
padding-left: 12px;
|
|
21
|
+
border-radius: 0;
|
|
22
|
+
}
|
|
23
|
+
`,
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const ListItem = memo<ListItemProps & { avatar: string; avatarBackground?: string }>(
|
|
28
|
+
({ avatar, avatarBackground, active, showAction, actions, ...props }) => {
|
|
29
|
+
const ref = useRef(null);
|
|
30
|
+
const isHovering = useHover(ref);
|
|
31
|
+
const { mobile } = useResponsive();
|
|
32
|
+
const { styles } = useStyles();
|
|
33
|
+
|
|
34
|
+
const avatarRender = useMemo(
|
|
35
|
+
() => (
|
|
36
|
+
<Avatar
|
|
37
|
+
animation={isHovering}
|
|
38
|
+
avatar={avatar}
|
|
39
|
+
background={avatarBackground}
|
|
40
|
+
shape="circle"
|
|
41
|
+
size={46}
|
|
42
|
+
/>
|
|
43
|
+
),
|
|
44
|
+
[isHovering, avatar, avatarBackground],
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<Item
|
|
49
|
+
actions={actions}
|
|
50
|
+
active={mobile ? false : active}
|
|
51
|
+
avatar={avatarRender}
|
|
52
|
+
className={styles.container}
|
|
53
|
+
ref={ref}
|
|
54
|
+
showAction={actions && (isHovering || showAction)}
|
|
55
|
+
{...(props as any)}
|
|
56
|
+
/>
|
|
57
|
+
);
|
|
58
|
+
},
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
export default ListItem;
|