@lobehub/chat 0.8.2 → 0.9.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 +25 -0
- package/package.json +1 -1
- package/src/locales/default/common.ts +1 -0
- package/src/pages/chat/SessionList/List/SessionItem.tsx +14 -9
- package/src/pages/chat/[id]/Header.tsx +12 -3
- package/src/pages/chat/[id]/index.page.tsx +10 -8
- package/src/store/session/slices/agentConfig/initialState.ts +1 -1
- package/src/types/chatMessage.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
## [Version 0.9.0](https://github.com/lobehub/lobe-chat/compare/v0.8.2...v0.9.0)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2023-07-22**</sup>
|
|
8
|
+
|
|
9
|
+
#### ✨ Features
|
|
10
|
+
|
|
11
|
+
- **misc**: 展示模型类型.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### What's improved
|
|
19
|
+
|
|
20
|
+
- **misc**: 展示模型类型 ([58ea93c](https://github.com/lobehub/lobe-chat/commit/58ea93c))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
5
30
|
### [Version 0.8.2](https://github.com/lobehub/lobe-chat/compare/v0.8.1...v0.8.2)
|
|
6
31
|
|
|
7
32
|
<sup>Released on **2023-07-22**</sup>
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ActionIcon, Avatar, List } from '@lobehub/ui';
|
|
2
|
-
import { Popconfirm } from 'antd';
|
|
2
|
+
import { Popconfirm, Tag } from 'antd';
|
|
3
3
|
import { X } from 'lucide-react';
|
|
4
|
-
import { useTranslation } from 'react-i18next';
|
|
5
4
|
import { FC, memo } from 'react';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
6
|
import { Flexbox } from 'react-layout-kit';
|
|
7
7
|
import { shallow } from 'zustand/shallow';
|
|
8
8
|
|
|
@@ -22,7 +22,7 @@ interface SessionItemProps {
|
|
|
22
22
|
const SessionItem: FC<SessionItemProps> = memo(({ id, active = true, loading }) => {
|
|
23
23
|
const { t } = useTranslation('common');
|
|
24
24
|
const { styles, theme, cx } = useStyles();
|
|
25
|
-
const [title, description, systemRole, avatar, avatarBackground, updateAt, removeSession] =
|
|
25
|
+
const [title, description, systemRole, avatar, avatarBackground, updateAt, model, removeSession] =
|
|
26
26
|
useSessionStore((s) => {
|
|
27
27
|
const session = sessionSelectors.getSessionById(id)(s);
|
|
28
28
|
const meta = session.meta;
|
|
@@ -34,6 +34,7 @@ const SessionItem: FC<SessionItemProps> = memo(({ id, active = true, loading })
|
|
|
34
34
|
sessionSelectors.getAgentAvatar(meta),
|
|
35
35
|
meta.backgroundColor,
|
|
36
36
|
session?.updateAt,
|
|
37
|
+
session.config.model,
|
|
37
38
|
s.removeSession,
|
|
38
39
|
];
|
|
39
40
|
}, shallow);
|
|
@@ -53,13 +54,17 @@ const SessionItem: FC<SessionItemProps> = memo(({ id, active = true, loading })
|
|
|
53
54
|
}
|
|
54
55
|
classNames={{ time: cx('session-time', styles.time) }}
|
|
55
56
|
date={updateAt}
|
|
56
|
-
description={
|
|
57
|
+
description={
|
|
58
|
+
<Flexbox gap={4}>
|
|
59
|
+
<Flexbox>{description || systemRole}</Flexbox>
|
|
60
|
+
<Flexbox horizontal>
|
|
61
|
+
<Tag bordered={false}>{model}</Tag>
|
|
62
|
+
</Flexbox>
|
|
63
|
+
</Flexbox>
|
|
64
|
+
}
|
|
57
65
|
loading={loading}
|
|
58
|
-
style={{
|
|
59
|
-
|
|
60
|
-
color: theme.colorText,
|
|
61
|
-
}}
|
|
62
|
-
title={title || DEFAULT_TITLE}
|
|
66
|
+
style={{ color: theme.colorText }}
|
|
67
|
+
title={title || t(DEFAULT_TITLE)}
|
|
63
68
|
/>
|
|
64
69
|
<Popconfirm
|
|
65
70
|
arrow={false}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ActionIcon, Avatar, ChatHeader } from '@lobehub/ui';
|
|
2
|
+
import { Tag } from 'antd';
|
|
2
3
|
import { createStyles } from 'antd-style';
|
|
3
4
|
import { ArchiveIcon, MoreVerticalIcon, Share2 } from 'lucide-react';
|
|
4
5
|
import { memo } from 'react';
|
|
@@ -6,7 +7,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
6
7
|
import { Flexbox } from 'react-layout-kit';
|
|
7
8
|
import { shallow } from 'zustand/shallow';
|
|
8
9
|
|
|
9
|
-
import { sessionSelectors, useSessionStore } from '@/store/session';
|
|
10
|
+
import { agentSelectors, sessionSelectors, useSessionStore } from '@/store/session';
|
|
10
11
|
|
|
11
12
|
const useStyles = createStyles(({ css, token }) => ({
|
|
12
13
|
desc: css`
|
|
@@ -18,8 +19,13 @@ const useStyles = createStyles(({ css, token }) => ({
|
|
|
18
19
|
color: ${token.colorText};
|
|
19
20
|
`,
|
|
20
21
|
}));
|
|
22
|
+
|
|
21
23
|
const Header = memo(() => {
|
|
22
24
|
const { t } = useTranslation('common');
|
|
25
|
+
const [avatar, model] = useSessionStore(
|
|
26
|
+
(s) => [agentSelectors.currentAgentAvatar(s), agentSelectors.currentAgentModel(s)],
|
|
27
|
+
shallow,
|
|
28
|
+
);
|
|
23
29
|
const [meta, id] = useSessionStore((s) => {
|
|
24
30
|
const chat = sessionSelectors.currentSession(s);
|
|
25
31
|
return [chat?.meta, s.activeId];
|
|
@@ -42,9 +48,12 @@ const Header = memo(() => {
|
|
|
42
48
|
<ChatHeader
|
|
43
49
|
left={
|
|
44
50
|
<>
|
|
45
|
-
<Avatar avatar={
|
|
51
|
+
<Avatar avatar={avatar} size={40} title={meta?.title} />
|
|
46
52
|
<Flexbox>
|
|
47
|
-
<Flexbox className={styles.title}
|
|
53
|
+
<Flexbox align={'center'} className={styles.title} gap={8} horizontal>
|
|
54
|
+
{meta?.title || t('defaultAgent')}
|
|
55
|
+
<Tag bordered={false}>{model}</Tag>
|
|
56
|
+
</Flexbox>
|
|
48
57
|
<Flexbox className={styles.desc}>{meta?.description || t('noDescription')}</Flexbox>
|
|
49
58
|
</Flexbox>
|
|
50
59
|
</>
|
|
@@ -19,18 +19,20 @@ const Chat = memo(() => {
|
|
|
19
19
|
const pageTitle = title ? `${title} - LobeChat` : 'LobeChat';
|
|
20
20
|
|
|
21
21
|
return (
|
|
22
|
-
|
|
22
|
+
<>
|
|
23
23
|
<Head>
|
|
24
24
|
<title>{pageTitle}</title>
|
|
25
25
|
</Head>
|
|
26
|
-
<
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
<
|
|
30
|
-
|
|
26
|
+
<Layout>
|
|
27
|
+
<Flexbox id={'lobe-conversion-container'} style={{ height: '100vh' }}>
|
|
28
|
+
<Header />
|
|
29
|
+
<Flexbox flex={1} height={'calc(100vh - 64px)'} horizontal>
|
|
30
|
+
<Conversation />
|
|
31
|
+
<Config />
|
|
32
|
+
</Flexbox>
|
|
31
33
|
</Flexbox>
|
|
32
|
-
</
|
|
33
|
-
|
|
34
|
+
</Layout>
|
|
35
|
+
</>
|
|
34
36
|
);
|
|
35
37
|
});
|
|
36
38
|
export default Chat;
|
|
@@ -18,7 +18,7 @@ export const initialLobeAgentConfig: LobeAgentConfig = {
|
|
|
18
18
|
|
|
19
19
|
export const DEFAULT_AVATAR = 'https://npm.elemecdn.com/@lobehub/assets-logo/assets/logo-3d.webp';
|
|
20
20
|
|
|
21
|
-
export const DEFAULT_TITLE = '
|
|
21
|
+
export const DEFAULT_TITLE = 'DefaultSession';
|
|
22
22
|
|
|
23
23
|
export const initialAgentConfigState: AgentConfigState = {
|
|
24
24
|
// // loading 中间态
|
package/src/types/chatMessage.ts
CHANGED
|
@@ -25,12 +25,12 @@ export interface ChatMessage extends BaseDataModel {
|
|
|
25
25
|
|
|
26
26
|
// 扩展字段
|
|
27
27
|
extra?: {
|
|
28
|
+
fromModel?: string;
|
|
28
29
|
// 翻译
|
|
29
|
-
translate
|
|
30
|
+
translate?: {
|
|
30
31
|
target: string;
|
|
31
32
|
to: string;
|
|
32
33
|
};
|
|
33
|
-
// 语音
|
|
34
34
|
} & Record<string, any>;
|
|
35
35
|
|
|
36
36
|
parentId?: string;
|