@lobehub/chat 0.10.1 → 0.10.2

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,31 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 0.10.2](https://github.com/lobehub/lobe-chat/compare/v0.10.1...v0.10.2)
6
+
7
+ <sup>Released on **2023-07-23**</sup>
8
+
9
+ #### 💄 Styles
10
+
11
+ - **misc**: 优化模型在 list 中的展示逻辑.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Styles
19
+
20
+ - **misc**: 优化模型在 list 中的展示逻辑 ([4bdf3c5](https://github.com/lobehub/lobe-chat/commit/4bdf3c5))
21
+
22
+ </details>
23
+
24
+ <div align="right">
25
+
26
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
27
+
28
+ </div>
29
+
5
30
  ### [Version 0.10.1](https://github.com/lobehub/lobe-chat/compare/v0.10.0...v0.10.1)
6
31
 
7
32
  <sup>Released on **2023-07-22**</sup>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.10.1",
3
+ "version": "0.10.2",
4
4
  "description": "Lobe Chat is an open-source chatbot client using LangChain, Typescript and Next.js",
5
5
  "keywords": [
6
6
  "chatbot",
@@ -6,8 +6,9 @@ import { useTranslation } from 'react-i18next';
6
6
  import { Flexbox } from 'react-layout-kit';
7
7
  import { shallow } from 'zustand/shallow';
8
8
 
9
- import { sessionSelectors, useSessionStore } from '@/store/session';
9
+ import { chatSelectors, sessionSelectors, useSessionStore } from '@/store/session';
10
10
  import { DEFAULT_TITLE } from '@/store/session/slices/agentConfig';
11
+ import { useSettings } from '@/store/settings';
11
12
 
12
13
  import { useStyles } from './style';
13
14
 
@@ -22,22 +23,37 @@ interface SessionItemProps {
22
23
  const SessionItem: FC<SessionItemProps> = memo(({ id, active = true, loading }) => {
23
24
  const { t } = useTranslation('common');
24
25
  const { styles, theme, cx } = useStyles();
25
- const [title, description, systemRole, avatar, avatarBackground, updateAt, model, removeSession] =
26
- useSessionStore((s) => {
27
- const session = sessionSelectors.getSessionById(id)(s);
28
- const meta = session.meta;
29
- const systemRole = session.config.systemRole;
30
- return [
31
- meta.title,
32
- meta.description,
33
- systemRole,
34
- sessionSelectors.getAgentAvatar(meta),
35
- meta.backgroundColor,
36
- session?.updateAt,
37
- session.config.model,
38
- s.removeSession,
39
- ];
40
- }, shallow);
26
+ const [defaultModel] = useSettings((s) => [s.settings.model], shallow);
27
+
28
+ const [
29
+ title,
30
+ description,
31
+ systemRole,
32
+ avatar,
33
+ avatarBackground,
34
+ updateAt,
35
+ model,
36
+ chatLength,
37
+ removeSession,
38
+ ] = useSessionStore((s) => {
39
+ const session = sessionSelectors.getSessionById(id)(s);
40
+ const meta = session.meta;
41
+ const systemRole = session.config.systemRole;
42
+ return [
43
+ meta.title,
44
+ meta.description,
45
+ systemRole,
46
+ sessionSelectors.getAgentAvatar(meta),
47
+ meta.backgroundColor,
48
+ session?.updateAt,
49
+ session.config.model,
50
+ chatSelectors.currentChats(s).length,
51
+ s.removeSession,
52
+ ];
53
+ }, shallow);
54
+
55
+ const showModel = model !== defaultModel;
56
+ const showChatLength = chatLength > 0;
41
57
 
42
58
  return (
43
59
  <Flexbox className={styles.container} style={{ position: 'relative' }}>
@@ -57,9 +73,25 @@ const SessionItem: FC<SessionItemProps> = memo(({ id, active = true, loading })
57
73
  description={
58
74
  <Flexbox gap={4}>
59
75
  <Flexbox>{description || systemRole}</Flexbox>
60
- <Flexbox horizontal>
61
- <Tag bordered={false}>{model}</Tag>
62
- </Flexbox>
76
+
77
+ {!(showModel || showChatLength) ? undefined : (
78
+ <Flexbox horizontal>
79
+ {showModel && (
80
+ <Tag bordered={false} style={{ color: theme.colorTextSecondary }}>
81
+ {model}
82
+ </Tag>
83
+ )}
84
+ {/*{showChatLength && (*/}
85
+ {/* <Tag*/}
86
+ {/* bordered={false}*/}
87
+ {/* style={{ color: theme.colorTextSecondary, display: 'flex', gap: 4 }}*/}
88
+ {/* >*/}
89
+ {/* <Icon icon={LucideMessageCircle} />*/}
90
+ {/* {chatLength}*/}
91
+ {/* </Tag>*/}
92
+ {/*)}*/}
93
+ </Flexbox>
94
+ )}
63
95
  </Flexbox>
64
96
  }
65
97
  loading={loading}