@lobehub/chat 0.8.1 → 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 +51 -0
- package/package.json +1 -1
- package/src/locales/default/common.ts +1 -0
- package/src/pages/_document.page.tsx +1 -0
- package/src/pages/chat/SessionList/List/SessionItem.tsx +14 -9
- package/src/pages/chat/[id]/Conversation/MessageExtra.tsx +14 -14
- 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,57 @@
|
|
|
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
|
+
|
|
30
|
+
### [Version 0.8.2](https://github.com/lobehub/lobe-chat/compare/v0.8.1...v0.8.2)
|
|
31
|
+
|
|
32
|
+
<sup>Released on **2023-07-22**</sup>
|
|
33
|
+
|
|
34
|
+
#### 🐛 Bug Fixes
|
|
35
|
+
|
|
36
|
+
- **misc**: Fix miss manifest.json link, 优化 model tag 展示逻辑.
|
|
37
|
+
|
|
38
|
+
<br/>
|
|
39
|
+
|
|
40
|
+
<details>
|
|
41
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
42
|
+
|
|
43
|
+
#### What's fixed
|
|
44
|
+
|
|
45
|
+
- **misc**: Fix miss manifest.json link ([ac4b2f3](https://github.com/lobehub/lobe-chat/commit/ac4b2f3))
|
|
46
|
+
- **misc**: 优化 model tag 展示逻辑 ([3463ede](https://github.com/lobehub/lobe-chat/commit/3463ede))
|
|
47
|
+
|
|
48
|
+
</details>
|
|
49
|
+
|
|
50
|
+
<div align="right">
|
|
51
|
+
|
|
52
|
+
[](#readme-top)
|
|
53
|
+
|
|
54
|
+
</div>
|
|
55
|
+
|
|
5
56
|
### [Version 0.8.1](https://github.com/lobehub/lobe-chat/compare/v0.8.0...v0.8.1)
|
|
6
57
|
|
|
7
58
|
<sup>Released on **2023-07-22**</sup>
|
package/package.json
CHANGED
|
@@ -57,6 +57,7 @@ class MyDocument extends Document {
|
|
|
57
57
|
<meta content="LobeHub" name="application-name" />
|
|
58
58
|
<meta content="#000000" name="msapplication-TileColor" />
|
|
59
59
|
<meta content="#000000" name="theme-color" />
|
|
60
|
+
<link href="/manifest.json" rel="manifest" />
|
|
60
61
|
</Head>
|
|
61
62
|
<body>
|
|
62
63
|
<Main />
|
|
@@ -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}
|
|
@@ -18,20 +18,20 @@ const MessageExtra = ({ role, extra }: ChatMessage): ReactNode => {
|
|
|
18
18
|
|
|
19
19
|
const [model] = useSessionStore((s) => [agentSelectors.currentAgentModel(s)], shallow);
|
|
20
20
|
|
|
21
|
-
// 只有 ai 的 message
|
|
22
|
-
|
|
23
|
-
//
|
|
24
|
-
if (extra?.fromModel && model
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
21
|
+
// 1. 只有 ai 的 message
|
|
22
|
+
// 2. 且存在 fromModel
|
|
23
|
+
// 3. 且当前的 model 和 fromModel 不一致时
|
|
24
|
+
if (role === 'assistant' && extra?.fromModel && model !== extra?.fromModel)
|
|
25
|
+
// 才需要展示 model tag
|
|
26
|
+
return (
|
|
27
|
+
<Flexbox className={styles.container}>
|
|
28
|
+
<div>
|
|
29
|
+
<Tag bordered={false} style={{ borderRadius: 6 }}>
|
|
30
|
+
{extra?.fromModel}
|
|
31
|
+
</Tag>
|
|
32
|
+
</div>
|
|
33
|
+
</Flexbox>
|
|
34
|
+
);
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
export default MessageExtra;
|
|
@@ -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;
|