@lobehub/chat 1.81.1 → 1.81.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 +25 -0
- package/changelog/v1.json +9 -0
- package/package.json +1 -1
- package/src/app/[variants]/(main)/chat/(workspace)/@topic/features/SystemRole/SystemRoleContent.tsx +26 -7
- package/src/app/[variants]/(main)/chat/(workspace)/@topic/features/SystemRole/style.ts +5 -0
- package/src/components/SidebarHeader/index.tsx +3 -1
- package/src/store/global/actions/workspacePane.ts +16 -0
- package/src/store/global/initialState.ts +2 -0
- package/src/store/global/selectors/systemStatus.ts +8 -0
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,31 @@
|
|
2
2
|
|
3
3
|
# Changelog
|
4
4
|
|
5
|
+
### [Version 1.81.2](https://github.com/lobehub/lobe-chat/compare/v1.81.1...v1.81.2)
|
6
|
+
|
7
|
+
<sup>Released on **2025-04-18**</sup>
|
8
|
+
|
9
|
+
#### 💄 Styles
|
10
|
+
|
11
|
+
- **misc**: Allow folding SystemRole box.
|
12
|
+
|
13
|
+
<br/>
|
14
|
+
|
15
|
+
<details>
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
17
|
+
|
18
|
+
#### Styles
|
19
|
+
|
20
|
+
- **misc**: Allow folding SystemRole box, closes [#7421](https://github.com/lobehub/lobe-chat/issues/7421) ([c147df7](https://github.com/lobehub/lobe-chat/commit/c147df7))
|
21
|
+
|
22
|
+
</details>
|
23
|
+
|
24
|
+
<div align="right">
|
25
|
+
|
26
|
+
[](#readme-top)
|
27
|
+
|
28
|
+
</div>
|
29
|
+
|
5
30
|
### [Version 1.81.1](https://github.com/lobehub/lobe-chat/compare/v1.81.0...v1.81.1)
|
6
31
|
|
7
32
|
<sup>Released on **2025-04-18**</sup>
|
package/changelog/v1.json
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lobehub/chat",
|
3
|
-
"version": "1.81.
|
3
|
+
"version": "1.81.2",
|
4
4
|
"description": "Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
|
5
5
|
"keywords": [
|
6
6
|
"framework",
|
package/src/app/[variants]/(main)/chat/(workspace)/@topic/features/SystemRole/SystemRoleContent.tsx
CHANGED
@@ -4,7 +4,7 @@ import { ActionIcon } from '@lobehub/ui';
|
|
4
4
|
import { EditableMessage } from '@lobehub/ui/chat';
|
5
5
|
import { Skeleton } from 'antd';
|
6
6
|
import { Edit } from 'lucide-react';
|
7
|
-
import { memo, useState } from 'react';
|
7
|
+
import { MouseEvent, memo, useState } from 'react';
|
8
8
|
import { useTranslation } from 'react-i18next';
|
9
9
|
import { Flexbox } from 'react-layout-kit';
|
10
10
|
import useMergeState from 'use-merge-value';
|
@@ -24,11 +24,12 @@ import { useStyles } from './style';
|
|
24
24
|
|
25
25
|
const SystemRole = memo(() => {
|
26
26
|
const [editing, setEditing] = useState(false);
|
27
|
-
const { styles } = useStyles();
|
27
|
+
const { styles, cx } = useStyles();
|
28
28
|
const openChatSettings = useOpenChatSettings(ChatSettingsTabs.Prompt);
|
29
|
-
const [init, meta] = useSessionStore((s) => [
|
29
|
+
const [init, meta, sessionId] = useSessionStore((s) => [
|
30
30
|
sessionSelectors.isSomeSessionActive(s),
|
31
31
|
sessionMetaSelectors.currentAgentMeta(s),
|
32
|
+
s.activeId,
|
32
33
|
]);
|
33
34
|
|
34
35
|
const [isAgentConfigLoading, systemRole, updateAgentConfig] = useAgentStore((s) => [
|
@@ -52,8 +53,10 @@ const SystemRole = memo(() => {
|
|
52
53
|
|
53
54
|
const isLoading = !init || isAgentConfigLoading;
|
54
55
|
|
55
|
-
const handleOpenWithEdit = () => {
|
56
|
+
const handleOpenWithEdit = (e: MouseEvent) => {
|
56
57
|
if (isLoading) return;
|
58
|
+
|
59
|
+
e.stopPropagation();
|
57
60
|
setEditing(true);
|
58
61
|
setOpen(true);
|
59
62
|
};
|
@@ -64,20 +67,36 @@ const SystemRole = memo(() => {
|
|
64
67
|
setOpen(true);
|
65
68
|
};
|
66
69
|
|
70
|
+
const [expanded, toggleAgentSystemRoleExpand] = useGlobalStore((s) => [
|
71
|
+
systemStatusSelectors.getAgentSystemRoleExpanded(sessionId)(s),
|
72
|
+
s.toggleAgentSystemRoleExpand,
|
73
|
+
]);
|
74
|
+
|
75
|
+
const toggleExpanded = () => {
|
76
|
+
toggleAgentSystemRoleExpand(sessionId);
|
77
|
+
};
|
78
|
+
|
67
79
|
return (
|
68
80
|
<Flexbox height={'fit-content'}>
|
69
81
|
<SidebarHeader
|
70
82
|
actions={
|
71
83
|
<ActionIcon icon={Edit} onClick={handleOpenWithEdit} size={'small'} title={t('edit')} />
|
72
84
|
}
|
85
|
+
onClick={toggleExpanded}
|
86
|
+
style={{ cursor: 'pointer' }}
|
73
87
|
title={t('settingAgent.prompt.title', { ns: 'setting' })}
|
74
88
|
/>
|
75
89
|
<Flexbox
|
76
|
-
className={styles.promptBox}
|
77
|
-
height={200}
|
90
|
+
className={cx(styles.promptBox, styles.animatedContainer)}
|
91
|
+
height={expanded ? 200 : 0}
|
78
92
|
onClick={handleOpen}
|
79
93
|
onDoubleClick={(e) => {
|
80
|
-
if (e.altKey) handleOpenWithEdit();
|
94
|
+
if (e.altKey) handleOpenWithEdit(e);
|
95
|
+
}}
|
96
|
+
style={{
|
97
|
+
opacity: expanded ? 1 : 0,
|
98
|
+
overflow: 'hidden',
|
99
|
+
transition: 'height 0.3s ease',
|
81
100
|
}}
|
82
101
|
>
|
83
102
|
{isLoading ? (
|
@@ -10,11 +10,12 @@ const useStyles = createStyles(({ css }) => ({
|
|
10
10
|
|
11
11
|
interface SidebarHeaderProps {
|
12
12
|
actions?: ReactNode;
|
13
|
+
onClick?: () => void;
|
13
14
|
style?: CSSProperties;
|
14
15
|
title: ReactNode;
|
15
16
|
}
|
16
17
|
|
17
|
-
const SidebarHeader = memo<SidebarHeaderProps>(({ title, style, actions }) => {
|
18
|
+
const SidebarHeader = memo<SidebarHeaderProps>(({ title, style, actions, onClick }) => {
|
18
19
|
const { styles } = useStyles();
|
19
20
|
|
20
21
|
return (
|
@@ -23,6 +24,7 @@ const SidebarHeader = memo<SidebarHeaderProps>(({ title, style, actions }) => {
|
|
23
24
|
className={styles.header}
|
24
25
|
distribution={'space-between'}
|
25
26
|
horizontal
|
27
|
+
onClick={onClick}
|
26
28
|
padding={14}
|
27
29
|
paddingInline={16}
|
28
30
|
style={style}
|
@@ -10,6 +10,7 @@ const n = setNamespace('w');
|
|
10
10
|
|
11
11
|
export interface GlobalWorkspacePaneAction {
|
12
12
|
switchBackToChat: (sessionId?: string) => void;
|
13
|
+
toggleAgentSystemRoleExpand: (agentId: string, expanded?: boolean) => void;
|
13
14
|
toggleChatSideBar: (visible?: boolean) => void;
|
14
15
|
toggleExpandSessionGroup: (id: string, expand: boolean) => void;
|
15
16
|
toggleMobilePortal: (visible?: boolean) => void;
|
@@ -28,6 +29,21 @@ export const globalWorkspaceSlice: StateCreator<
|
|
28
29
|
get().router?.push(SESSION_CHAT_URL(sessionId || INBOX_SESSION_ID, get().isMobile));
|
29
30
|
},
|
30
31
|
|
32
|
+
toggleAgentSystemRoleExpand: (agentId, expanded) => {
|
33
|
+
const { status } = get();
|
34
|
+
const systemRoleExpandedMap = status.systemRoleExpandedMap || {};
|
35
|
+
const nextExpanded = typeof expanded === 'boolean' ? expanded : !systemRoleExpandedMap[agentId];
|
36
|
+
|
37
|
+
get().updateSystemStatus(
|
38
|
+
{
|
39
|
+
systemRoleExpandedMap: {
|
40
|
+
...systemRoleExpandedMap,
|
41
|
+
[agentId]: nextExpanded,
|
42
|
+
},
|
43
|
+
},
|
44
|
+
n('toggleAgentSystemRoleExpand', { agentId, expanded: nextExpanded }),
|
45
|
+
);
|
46
|
+
},
|
31
47
|
toggleChatSideBar: (newValue) => {
|
32
48
|
const showChatSideBar =
|
33
49
|
typeof newValue === 'boolean' ? newValue : !get().status.showChatSideBar;
|
@@ -66,6 +66,7 @@ export interface SystemStatus {
|
|
66
66
|
showHotkeyHelper?: boolean;
|
67
67
|
showSessionPanel?: boolean;
|
68
68
|
showSystemRole?: boolean;
|
69
|
+
systemRoleExpandedMap: Record<string, boolean>;
|
69
70
|
/**
|
70
71
|
* theme mode
|
71
72
|
*/
|
@@ -111,6 +112,7 @@ export const INITIAL_STATUS = {
|
|
111
112
|
showHotkeyHelper: false,
|
112
113
|
showSessionPanel: true,
|
113
114
|
showSystemRole: false,
|
115
|
+
systemRoleExpandedMap: {},
|
114
116
|
themeMode: 'auto',
|
115
117
|
threadInputHeight: 200,
|
116
118
|
zenMode: false,
|
@@ -50,8 +50,16 @@ const isPgliteInited = (s: GlobalState): boolean =>
|
|
50
50
|
// 这个变量控制 clientdb 是否完成初始化,正常来说,只有 pgliteDB 模式下,才会存在变化,其他时候都是 true
|
51
51
|
const isDBInited = (s: GlobalState): boolean => (isUsePgliteDB ? isPgliteInited(s) : true);
|
52
52
|
|
53
|
+
const getAgentSystemRoleExpanded =
|
54
|
+
(agentId: string) =>
|
55
|
+
(s: GlobalState): boolean => {
|
56
|
+
const map = s.status.systemRoleExpandedMap || {};
|
57
|
+
return map[agentId] !== false; // 角色设定默认为展开状态
|
58
|
+
};
|
59
|
+
|
53
60
|
export const systemStatusSelectors = {
|
54
61
|
filePanelWidth,
|
62
|
+
getAgentSystemRoleExpanded,
|
55
63
|
hidePWAInstaller,
|
56
64
|
inZenMode,
|
57
65
|
inputHeight,
|