@lobehub/lobehub 2.0.0-next.273 → 2.0.0-next.274
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 +34 -0
- package/changelog/v1.json +9 -0
- package/locales/ar/chat.json +7 -0
- package/locales/ar/models.json +2 -3
- package/locales/ar/plugin.json +22 -1
- package/locales/bg-BG/chat.json +7 -0
- package/locales/bg-BG/models.json +3 -3
- package/locales/bg-BG/plugin.json +22 -1
- package/locales/de-DE/chat.json +7 -0
- package/locales/de-DE/models.json +3 -4
- package/locales/de-DE/plugin.json +22 -1
- package/locales/en-US/chat.json +7 -0
- package/locales/en-US/models.json +5 -5
- package/locales/en-US/plugin.json +22 -1
- package/locales/es-ES/chat.json +7 -0
- package/locales/es-ES/models.json +3 -4
- package/locales/es-ES/plugin.json +22 -1
- package/locales/fa-IR/chat.json +7 -0
- package/locales/fa-IR/models.json +3 -4
- package/locales/fa-IR/plugin.json +22 -1
- package/locales/fr-FR/chat.json +7 -0
- package/locales/fr-FR/models.json +50 -3
- package/locales/fr-FR/plugin.json +22 -1
- package/locales/it-IT/chat.json +7 -0
- package/locales/it-IT/models.json +3 -3
- package/locales/it-IT/plugin.json +22 -1
- package/locales/ja-JP/chat.json +7 -0
- package/locales/ja-JP/models.json +43 -4
- package/locales/ja-JP/plugin.json +22 -1
- package/locales/ko-KR/chat.json +7 -0
- package/locales/ko-KR/models.json +3 -4
- package/locales/ko-KR/plugin.json +22 -1
- package/locales/nl-NL/chat.json +7 -0
- package/locales/nl-NL/models.json +51 -3
- package/locales/nl-NL/plugin.json +22 -1
- package/locales/pl-PL/chat.json +7 -0
- package/locales/pl-PL/models.json +3 -3
- package/locales/pl-PL/plugin.json +22 -1
- package/locales/pt-BR/chat.json +7 -0
- package/locales/pt-BR/models.json +3 -4
- package/locales/pt-BR/plugin.json +22 -1
- package/locales/ru-RU/chat.json +7 -0
- package/locales/ru-RU/models.json +3 -4
- package/locales/ru-RU/plugin.json +22 -1
- package/locales/tr-TR/chat.json +7 -0
- package/locales/tr-TR/models.json +3 -4
- package/locales/tr-TR/plugin.json +22 -1
- package/locales/vi-VN/chat.json +7 -0
- package/locales/vi-VN/models.json +3 -3
- package/locales/vi-VN/plugin.json +22 -1
- package/locales/zh-CN/chat.json +7 -0
- package/locales/zh-CN/models.json +54 -4
- package/locales/zh-CN/plugin.json +22 -1
- package/locales/zh-TW/chat.json +7 -0
- package/locales/zh-TW/models.json +43 -4
- package/locales/zh-TW/plugin.json +22 -1
- package/package.json +1 -1
- package/packages/builtin-tool-agent-builder/package.json +1 -0
- package/packages/builtin-tool-agent-builder/src/client/Inspector/GetAvailableModels/index.tsx +66 -0
- package/packages/builtin-tool-agent-builder/src/client/Inspector/InstallPlugin/index.tsx +63 -0
- package/packages/builtin-tool-agent-builder/src/client/Inspector/SearchMarketTools/index.tsx +64 -0
- package/packages/builtin-tool-agent-builder/src/client/Inspector/UpdateConfig/index.tsx +94 -0
- package/packages/builtin-tool-agent-builder/src/client/Inspector/UpdatePrompt/index.tsx +96 -0
- package/packages/builtin-tool-agent-builder/src/client/Inspector/index.ts +29 -0
- package/packages/builtin-tool-agent-builder/src/client/index.ts +13 -0
- package/packages/builtin-tool-agent-builder/src/executor.ts +132 -0
- package/packages/builtin-tool-cloud-sandbox/src/client/Inspector/ExecuteCode/index.tsx +5 -14
- package/packages/builtin-tool-cloud-sandbox/src/client/Inspector/RunCommand/index.tsx +5 -13
- package/packages/builtin-tool-group-agent-builder/package.json +7 -1
- package/packages/builtin-tool-group-agent-builder/src/ExecutionRuntime/index.ts +331 -87
- package/packages/builtin-tool-group-agent-builder/src/client/Inspector/BatchCreateAgents/index.tsx +110 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Inspector/CreateAgent/index.tsx +72 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Inspector/InviteAgent/index.tsx +57 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Inspector/RemoveAgent/index.tsx +57 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Inspector/SearchAgent/index.tsx +66 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Inspector/UpdateAgentPrompt/index.tsx +120 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Inspector/UpdateGroup/index.tsx +87 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Inspector/UpdateGroupPrompt/index.tsx +99 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Inspector/index.ts +52 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Render/BatchCreateAgents.tsx +103 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Render/UpdateAgentPrompt/index.tsx +36 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Render/UpdateGroupPrompt/index.tsx +36 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Render/index.ts +16 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Streaming/BatchCreateAgents/index.tsx +88 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Streaming/UpdateAgentPrompt/index.tsx +37 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Streaming/UpdateGroupPrompt/index.tsx +35 -0
- package/packages/builtin-tool-group-agent-builder/src/client/Streaming/index.ts +22 -0
- package/packages/builtin-tool-group-agent-builder/src/client/index.ts +26 -0
- package/packages/builtin-tool-group-agent-builder/src/executor.ts +284 -0
- package/packages/builtin-tool-group-agent-builder/src/index.ts +1 -14
- package/packages/builtin-tool-group-agent-builder/src/manifest.ts +160 -15
- package/packages/builtin-tool-group-agent-builder/src/systemRole.ts +232 -46
- package/packages/builtin-tool-group-agent-builder/src/types.ts +191 -41
- package/packages/builtin-tool-group-management/src/client/Inspector/Broadcast/index.tsx +2 -2
- package/packages/builtin-tool-group-management/src/manifest.ts +1 -1
- package/packages/builtin-tool-gtd/src/client/Inspector/ClearTodos/index.tsx +5 -11
- package/packages/builtin-tool-gtd/src/client/Inspector/CompleteTodos/index.tsx +3 -9
- package/packages/builtin-tool-gtd/src/client/Inspector/CreatePlan/index.tsx +6 -15
- package/packages/builtin-tool-gtd/src/client/Inspector/CreateTodos/index.tsx +3 -9
- package/packages/builtin-tool-gtd/src/client/Inspector/ExecTask/index.tsx +6 -17
- package/packages/builtin-tool-gtd/src/client/Inspector/RemoveTodos/index.tsx +3 -9
- package/packages/builtin-tool-gtd/src/client/Inspector/UpdatePlan/index.tsx +3 -9
- package/packages/builtin-tool-gtd/src/client/Inspector/UpdateTodos/index.tsx +3 -9
- package/packages/builtin-tool-knowledge-base/src/client/Inspector/ReadKnowledge/index.tsx +4 -16
- package/packages/builtin-tool-knowledge-base/src/client/Inspector/SearchKnowledgeBase/index.tsx +5 -16
- package/packages/builtin-tool-local-system/src/client/Inspector/EditLocalFile/index.tsx +4 -12
- package/packages/builtin-tool-local-system/src/client/Inspector/GlobLocalFiles/index.tsx +5 -13
- package/packages/builtin-tool-local-system/src/client/Inspector/GrepContent/index.tsx +5 -16
- package/packages/builtin-tool-local-system/src/client/Inspector/ListLocalFiles/index.tsx +5 -16
- package/packages/builtin-tool-local-system/src/client/Inspector/ReadLocalFile/index.tsx +5 -16
- package/packages/builtin-tool-local-system/src/client/Inspector/RenameLocalFile/index.tsx +5 -11
- package/packages/builtin-tool-local-system/src/client/Inspector/RunCommand/index.tsx +5 -13
- package/packages/builtin-tool-local-system/src/client/Inspector/SearchLocalFiles/index.tsx +5 -16
- package/packages/builtin-tool-local-system/src/client/Inspector/WriteLocalFile/index.tsx +6 -15
- package/packages/builtin-tool-notebook/src/client/Inspector/CreateDocument/index.tsx +7 -15
- package/packages/builtin-tool-page-agent/src/client/Inspector/EditTitle/index.tsx +5 -14
- package/packages/builtin-tool-page-agent/src/client/Inspector/GetPageContent/index.tsx +7 -8
- package/packages/builtin-tool-page-agent/src/client/Inspector/InitPage/index.tsx +4 -10
- package/packages/builtin-tool-page-agent/src/client/Inspector/ModifyNodes/index.tsx +3 -9
- package/packages/builtin-tool-page-agent/src/client/Inspector/ReplaceText/index.tsx +5 -11
- package/packages/builtin-tool-web-browsing/src/client/Inspector/CrawlMultiPages/index.tsx +6 -15
- package/packages/builtin-tool-web-browsing/src/client/Inspector/CrawlSinglePage/index.tsx +6 -15
- package/packages/builtin-tool-web-browsing/src/client/Inspector/Search/index.tsx +4 -15
- package/packages/database/src/models/chatGroup.ts +1 -1
- package/packages/model-bank/src/aiModels/aihubmix.ts +2 -1
- package/packages/model-bank/src/aiModels/google.ts +2 -1
- package/packages/model-bank/src/aiModels/infiniai.ts +9 -6
- package/packages/model-bank/src/aiModels/minimax.ts +9 -5
- package/packages/model-bank/src/aiModels/ollamacloud.ts +4 -2
- package/packages/model-bank/src/aiModels/vertexai.ts +2 -1
- package/packages/types/src/agentGroup/index.ts +8 -0
- package/patches/@upstash__qstash.patch +13 -1
- package/src/app/[variants]/(main)/agent/_layout/Sidebar/Header/Nav.tsx +1 -1
- package/src/app/[variants]/(main)/agent/cron/[cronId]/index.tsx +4 -3
- package/src/app/[variants]/(main)/agent/profile/features/ProfileEditor/index.tsx +1 -1
- package/src/app/[variants]/(main)/agent/profile/features/store/action.ts +18 -21
- package/src/app/[variants]/(main)/group/_layout/GroupIdSync.tsx +6 -1
- package/src/app/[variants]/(main)/group/_layout/Sidebar/GroupConfig/AgentProfilePopup.tsx +29 -21
- package/src/app/[variants]/(main)/group/_layout/Sidebar/GroupConfig/GroupMember.tsx +1 -0
- package/src/app/[variants]/(main)/group/_layout/Sidebar/GroupConfig/GroupMemberItem.tsx +35 -18
- package/src/app/[variants]/(main)/group/_layout/Sidebar/Header/AddTopicButon.tsx +2 -10
- package/src/app/[variants]/(main)/group/_layout/Sidebar/Header/Nav.tsx +10 -2
- package/src/app/[variants]/(main)/group/_layout/Sidebar/Header/index.tsx +1 -2
- package/src/app/[variants]/(main)/group/profile/features/AgentBuilder/AgentBuilderProvider.tsx +1 -0
- package/src/app/[variants]/(main)/group/profile/features/AgentBuilder/TopicSelector.tsx +15 -9
- package/src/app/[variants]/(main)/group/profile/features/AgentBuilder/index.tsx +12 -6
- package/src/app/[variants]/(main)/group/profile/features/{ProfileEditor/AgentHeader.tsx → GroupProfile/GroupHeader.tsx} +22 -29
- package/src/app/[variants]/(main)/group/profile/features/GroupProfile/index.tsx +96 -0
- package/src/app/[variants]/(main)/group/profile/features/Header/AgentBuilderToggle.tsx +3 -4
- package/src/app/[variants]/(main)/group/profile/features/Header/AutoSaveHint.tsx +11 -7
- package/src/app/[variants]/(main)/group/profile/features/Header/ChromeTabs/index.tsx +147 -0
- package/src/app/[variants]/(main)/group/profile/features/Header/index.tsx +104 -13
- package/src/app/[variants]/(main)/group/profile/features/MemberProfile/AgentHeader.tsx +222 -0
- package/src/app/[variants]/(main)/group/profile/features/MemberProfile/index.tsx +155 -0
- package/src/app/[variants]/(main)/group/profile/features/ProfileHydration.tsx +63 -5
- package/src/app/[variants]/(main)/group/profile/index.tsx +34 -37
- package/src/app/[variants]/(mobile)/(home)/_layout/SessionHydration.tsx +1 -1
- package/src/app/[variants]/(mobile)/(home)/features/SessionListContent/List/Item/index.tsx +1 -1
- package/src/features/AgentBuilder/index.tsx +16 -1
- package/src/features/Conversation/Messages/AssistantGroup/Tool/Inspector/StatusIndicator.tsx +3 -2
- package/src/features/EditorCanvas/EditorCanvas.test.tsx +206 -0
- package/src/features/EditorCanvas/EditorDataMode.tsx +53 -19
- package/src/features/EditorModal/index.tsx +2 -2
- package/src/features/NavPanel/components/SessionHydration.tsx +1 -1
- package/src/features/ShareModal/ShareImage/ChatList/index.tsx +1 -1
- package/src/features/ShareModal/SharePdf/index.tsx +1 -1
- package/src/hooks/useBidirectionalQuerySync.ts +112 -0
- package/src/locales/default/chat.ts +10 -0
- package/src/locales/default/plugin.ts +22 -1
- package/src/server/modules/AgentRuntime/RuntimeExecutors.ts +45 -45
- package/src/server/modules/KeyVaultsEncrypt/index.ts +6 -6
- package/src/server/modules/S3/index.ts +1 -1
- package/src/server/routers/lambda/agent.ts +24 -0
- package/src/server/routers/lambda/agentGroup.ts +39 -0
- package/src/services/agent.ts +22 -0
- package/src/services/chatGroup/index.ts +14 -0
- package/src/store/agent/selectors/selectors.ts +3 -0
- package/src/store/agentGroup/initialState.ts +6 -0
- package/src/store/agentGroup/selectors/byId.ts +3 -1
- package/src/store/agentGroup/selectors/current.ts +2 -2
- package/src/store/agentGroup/slices/lifecycle.ts +18 -0
- package/src/store/chat/agents/__tests__/createAgentExecutors/fixtures/mockStore.ts +1 -1
- package/src/store/chat/slices/aiAgent/actions/__tests__/agentGroup.test.ts +4 -1
- package/src/store/chat/slices/aiAgent/actions/agentGroup.ts +1 -1
- package/src/store/chat/slices/aiChat/actions/__tests__/conversationLifecycle.test.ts +65 -0
- package/src/store/chat/slices/aiChat/actions/conversationLifecycle.ts +2 -1
- package/src/store/chat/slices/builtinTool/actions/__tests__/search.test.ts +1 -1
- package/src/store/chat/slices/builtinTool/actions/index.ts +1 -6
- package/src/store/chat/slices/message/action.test.ts +5 -5
- package/src/store/chat/slices/message/actions/publicApi.ts +5 -5
- package/src/store/chat/slices/message/initialState.ts +0 -5
- package/src/store/chat/slices/message/selectors/displayMessage.test.ts +4 -4
- package/src/store/chat/slices/plugin/action.test.ts +54 -19
- package/src/store/chat/slices/plugin/actions/pluginTypes.ts +15 -21
- package/src/store/chat/slices/topic/action.test.ts +74 -24
- package/src/store/chat/slices/topic/action.ts +21 -13
- package/src/store/chat/slices/topic/selectors.test.ts +1 -1
- package/src/store/global/initialState.ts +10 -0
- package/src/store/global/selectors/systemStatus.ts +5 -0
- package/src/store/groupProfile/action.ts +168 -0
- package/src/store/groupProfile/index.ts +16 -0
- package/src/{app/[variants]/(main)/group/profile/features/store → store/groupProfile}/initialState.ts +17 -0
- package/src/store/groupProfile/selectors.ts +13 -0
- package/src/store/tool/slices/builtin/executors/index.ts +4 -0
- package/src/styles/text.ts +16 -0
- package/src/tools/inspectors.ts +13 -0
- package/src/tools/renders.ts +3 -0
- package/src/tools/streamings.ts +8 -0
- package/src/app/[variants]/(main)/group/profile/features/EditorCanvas/TypoBar.tsx +0 -129
- package/src/app/[variants]/(main)/group/profile/features/EditorCanvas/index.tsx +0 -138
- package/src/app/[variants]/(main)/group/profile/features/EditorCanvas/useSlashItems.tsx +0 -139
- package/src/app/[variants]/(main)/group/profile/features/ProfileEditor/index.tsx +0 -82
- package/src/app/[variants]/(main)/group/profile/features/ProfileProvider.tsx +0 -20
- package/src/app/[variants]/(main)/group/profile/features/StoreUpdater.tsx +0 -24
- package/src/app/[variants]/(main)/group/profile/features/store/action.ts +0 -163
- package/src/app/[variants]/(main)/group/profile/features/store/index.ts +0 -23
- package/src/app/[variants]/(main)/group/profile/features/store/selectors.ts +0 -7
- package/src/features/EditorModal/EditorCanvas.tsx +0 -84
- package/src/features/EditorModal/Typobar.tsx +0 -139
- package/src/store/chat/slices/builtinTool/actions/agentBuilder.ts +0 -192
- package/src/store/chat/slices/builtinTool/actions/groupAgentBuilder.ts +0 -242
- package/src/tools/executionRuntimes.ts +0 -14
- /package/src/app/[variants]/(main)/group/profile/features/{ProfileEditor → MemberProfile}/AgentTool.tsx +0 -0
- /package/src/app/[variants]/(main)/group/profile/features/{ProfileEditor → MemberProfile}/MentionList/MentionDropdown.tsx +0 -0
- /package/src/app/[variants]/(main)/group/profile/features/{ProfileEditor → MemberProfile}/MentionList/index.tsx +0 -0
- /package/src/app/[variants]/(main)/group/profile/features/{ProfileEditor → MemberProfile}/MentionList/types.ts +0 -0
- /package/src/app/[variants]/(main)/group/profile/features/{ProfileEditor → MemberProfile}/MentionList/useMentionItems.tsx +0 -0
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import type { AgentItem } from '@lobechat/types';
|
|
4
|
-
import { Avatar, Center, Flexbox, Popover, Text, Tooltip } from '@lobehub/ui';
|
|
4
|
+
import { ActionIcon, Avatar, Center, Flexbox, Popover, Text, Tooltip } from '@lobehub/ui';
|
|
5
5
|
import { createStaticStyles, cssVar } from 'antd-style';
|
|
6
|
+
import { Settings } from 'lucide-react';
|
|
6
7
|
import { type PropsWithChildren, memo, useState } from 'react';
|
|
7
8
|
import { useTranslation } from 'react-i18next';
|
|
9
|
+
import { useNavigate } from 'react-router-dom';
|
|
8
10
|
|
|
9
11
|
import { DEFAULT_AVATAR } from '@/const/meta';
|
|
10
12
|
import ModelSelect from '@/features/ModelSelect';
|
|
@@ -73,6 +75,7 @@ interface AgentProfilePopupProps extends PropsWithChildren {
|
|
|
73
75
|
|
|
74
76
|
const AgentProfilePopup = memo<AgentProfilePopupProps>(({ agent, groupId, children }) => {
|
|
75
77
|
const { t } = useTranslation('chat');
|
|
78
|
+
const navigate = useNavigate();
|
|
76
79
|
const [open, setOpen] = useState(false);
|
|
77
80
|
const [loading, setLoading] = useState(false);
|
|
78
81
|
|
|
@@ -90,10 +93,10 @@ const AgentProfilePopup = memo<AgentProfilePopupProps>(({ agent, groupId, childr
|
|
|
90
93
|
}
|
|
91
94
|
};
|
|
92
95
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
const handleSettings = () => {
|
|
97
|
+
setOpen(false);
|
|
98
|
+
navigate(`/group/${groupId}/profile?tab=${agent.id}`);
|
|
99
|
+
};
|
|
97
100
|
|
|
98
101
|
const content = (
|
|
99
102
|
<Flexbox className={styles.container}>
|
|
@@ -127,9 +130,26 @@ const AgentProfilePopup = memo<AgentProfilePopupProps>(({ agent, groupId, childr
|
|
|
127
130
|
}}
|
|
128
131
|
/>
|
|
129
132
|
<Flexbox gap={2}>
|
|
130
|
-
<
|
|
131
|
-
{
|
|
132
|
-
|
|
133
|
+
<Flexbox align={'center'} horizontal justify={'space-between'}>
|
|
134
|
+
<Text className={styles.name} ellipsis>
|
|
135
|
+
{agent.title || t('defaultSession', { ns: 'common' })}
|
|
136
|
+
</Text>
|
|
137
|
+
|
|
138
|
+
{/* Settings Button */}
|
|
139
|
+
<Flexbox
|
|
140
|
+
align="center"
|
|
141
|
+
horizontal
|
|
142
|
+
justify="flex-end"
|
|
143
|
+
style={{ paddingBlockStart: 0 }}
|
|
144
|
+
>
|
|
145
|
+
<ActionIcon
|
|
146
|
+
icon={Settings}
|
|
147
|
+
onClick={handleSettings}
|
|
148
|
+
size="small"
|
|
149
|
+
title={t('groupSidebar.agentProfile.settings')}
|
|
150
|
+
/>
|
|
151
|
+
</Flexbox>
|
|
152
|
+
</Flexbox>
|
|
133
153
|
{agent.description && (
|
|
134
154
|
<Tooltip title={agent.description}>
|
|
135
155
|
<Text className={styles.description} ellipsis={{ rows: 2 }}>
|
|
@@ -149,18 +169,6 @@ const AgentProfilePopup = memo<AgentProfilePopupProps>(({ agent, groupId, childr
|
|
|
149
169
|
value={{ model: agent.model!, provider: agent.provider! }}
|
|
150
170
|
/>
|
|
151
171
|
</Flexbox>
|
|
152
|
-
|
|
153
|
-
{/* Actions */}
|
|
154
|
-
{/*<Flexbox className={styles.section} style={{ paddingBlockStart: 0 }}>*/}
|
|
155
|
-
{/* <Button*/}
|
|
156
|
-
{/* className={styles.chatButton}*/}
|
|
157
|
-
{/* icon={<MessageSquare size={14} />}*/}
|
|
158
|
-
{/* onClick={handleChat}*/}
|
|
159
|
-
{/* type="primary"*/}
|
|
160
|
-
{/* >*/}
|
|
161
|
-
{/* {t('groupSidebar.agentProfile.chat')}*/}
|
|
162
|
-
{/* </Button>*/}
|
|
163
|
-
{/*</Flexbox>*/}
|
|
164
172
|
</Flexbox>
|
|
165
173
|
);
|
|
166
174
|
|
|
@@ -171,7 +179,7 @@ const AgentProfilePopup = memo<AgentProfilePopupProps>(({ agent, groupId, childr
|
|
|
171
179
|
open={open}
|
|
172
180
|
placement="right"
|
|
173
181
|
styles={{
|
|
174
|
-
content: { overflow: 'hidden', padding: 0 },
|
|
182
|
+
content: { borderRadius: 12, overflow: 'hidden', padding: 0 },
|
|
175
183
|
}}
|
|
176
184
|
trigger="click"
|
|
177
185
|
>
|
|
@@ -109,6 +109,7 @@ const GroupMember = memo<GroupMemberProps>(({ addModalOpen, onAddModalOpenChange
|
|
|
109
109
|
}
|
|
110
110
|
avatar={item.avatar || DEFAULT_AVATAR}
|
|
111
111
|
background={item.backgroundColor ?? undefined}
|
|
112
|
+
isExternal={!item.virtual}
|
|
112
113
|
title={item.title || t('defaultSession', { ns: 'common' })}
|
|
113
114
|
/>
|
|
114
115
|
</div>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { Avatar } from '@lobehub/ui';
|
|
3
|
+
import { Avatar, Flexbox, Tag } from '@lobehub/ui';
|
|
4
4
|
import { type ReactNode, memo } from 'react';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
5
6
|
|
|
6
7
|
import { DEFAULT_AVATAR } from '@/const/meta';
|
|
7
8
|
import NavItem from '@/features/NavPanel/components/NavItem';
|
|
@@ -10,26 +11,42 @@ interface GroupMemberItemProps {
|
|
|
10
11
|
actions?: ReactNode;
|
|
11
12
|
avatar?: string;
|
|
12
13
|
background?: string;
|
|
14
|
+
isExternal?: boolean;
|
|
13
15
|
onClick?: () => void;
|
|
14
16
|
title: string;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
|
-
const GroupMemberItem = memo<GroupMemberItemProps>(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
19
|
+
const GroupMemberItem = memo<GroupMemberItemProps>(
|
|
20
|
+
({ title, avatar, background, actions, isExternal }) => {
|
|
21
|
+
const { t } = useTranslation('chat');
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<NavItem
|
|
25
|
+
actions={actions}
|
|
26
|
+
icon={
|
|
27
|
+
<Avatar
|
|
28
|
+
avatar={avatar || DEFAULT_AVATAR}
|
|
29
|
+
background={background}
|
|
30
|
+
emojiScaleWithBackground
|
|
31
|
+
size={24}
|
|
32
|
+
style={{ flex: 'none' }}
|
|
33
|
+
/>
|
|
34
|
+
}
|
|
35
|
+
title={
|
|
36
|
+
<Flexbox align="center" gap={4} horizontal>
|
|
37
|
+
<span style={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>
|
|
38
|
+
{title}
|
|
39
|
+
</span>
|
|
40
|
+
{isExternal && (
|
|
41
|
+
<Tag size="small" style={{ flexShrink: 0 }}>
|
|
42
|
+
{t('group.profile.external')}
|
|
43
|
+
</Tag>
|
|
44
|
+
)}
|
|
45
|
+
</Flexbox>
|
|
46
|
+
}
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
49
|
+
},
|
|
50
|
+
);
|
|
34
51
|
|
|
35
52
|
export default GroupMemberItem;
|
|
@@ -4,12 +4,9 @@ import { ActionIcon } from '@lobehub/ui';
|
|
|
4
4
|
import { MessageSquarePlusIcon } from 'lucide-react';
|
|
5
5
|
import { memo } from 'react';
|
|
6
6
|
import { useTranslation } from 'react-i18next';
|
|
7
|
-
import urlJoin from 'url-join';
|
|
8
7
|
|
|
9
8
|
import { DESKTOP_HEADER_ICON_SIZE } from '@/const/layoutTokens';
|
|
10
|
-
import { useQueryRoute } from '@/hooks/useQueryRoute';
|
|
11
9
|
import { useAgentGroupStore } from '@/store/agentGroup';
|
|
12
|
-
import { useChatStore } from '@/store/chat';
|
|
13
10
|
import { useUserStore } from '@/store/user';
|
|
14
11
|
import { settingsSelectors } from '@/store/user/selectors';
|
|
15
12
|
import { HotkeyEnum } from '@/types/hotkey';
|
|
@@ -17,17 +14,12 @@ import { HotkeyEnum } from '@/types/hotkey';
|
|
|
17
14
|
const AddTopicButon = memo(() => {
|
|
18
15
|
const { t } = useTranslation('topic');
|
|
19
16
|
const hotkey = useUserStore(settingsSelectors.getHotkeyById(HotkeyEnum.SaveTopic));
|
|
20
|
-
const
|
|
21
|
-
const router = useQueryRoute();
|
|
17
|
+
const switchToNewTopic = useAgentGroupStore((s) => s.switchToNewTopic);
|
|
22
18
|
|
|
23
19
|
return (
|
|
24
20
|
<ActionIcon
|
|
25
21
|
icon={MessageSquarePlusIcon}
|
|
26
|
-
onClick={
|
|
27
|
-
if (!activeGroupId) return;
|
|
28
|
-
useChatStore.setState({ activeTopicId: undefined });
|
|
29
|
-
router.push(urlJoin('/group', activeGroupId), { query: { thread: null, topic: null } });
|
|
30
|
-
}}
|
|
22
|
+
onClick={switchToNewTopic}
|
|
31
23
|
size={DESKTOP_HEADER_ICON_SIZE}
|
|
32
24
|
title={t('actions.addNewTopic')}
|
|
33
25
|
tooltipProps={{
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { Flexbox } from '@lobehub/ui';
|
|
4
4
|
import { BotPromptIcon } from '@lobehub/ui/icons';
|
|
5
|
-
import { SearchIcon } from 'lucide-react';
|
|
5
|
+
import { MessageSquarePlusIcon, SearchIcon } from 'lucide-react';
|
|
6
6
|
import { usePathname } from 'next/navigation';
|
|
7
7
|
import { memo } from 'react';
|
|
8
8
|
import { useTranslation } from 'react-i18next';
|
|
@@ -11,12 +11,14 @@ import urlJoin from 'url-join';
|
|
|
11
11
|
|
|
12
12
|
import NavItem from '@/features/NavPanel/components/NavItem';
|
|
13
13
|
import { useQueryRoute } from '@/hooks/useQueryRoute';
|
|
14
|
+
import { useAgentGroupStore } from '@/store/agentGroup';
|
|
14
15
|
import { useChatStore } from '@/store/chat';
|
|
15
16
|
import { useGlobalStore } from '@/store/global';
|
|
16
17
|
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
|
|
17
18
|
|
|
18
19
|
const Nav = memo(() => {
|
|
19
20
|
const { t } = useTranslation('chat');
|
|
21
|
+
const { t: tTopic } = useTranslation('topic');
|
|
20
22
|
const params = useParams();
|
|
21
23
|
const groupId = params.gid;
|
|
22
24
|
const pathname = usePathname();
|
|
@@ -25,15 +27,21 @@ const Nav = memo(() => {
|
|
|
25
27
|
const { isAgentEditable } = useServerConfigStore(featureFlagsSelectors);
|
|
26
28
|
const toggleCommandMenu = useGlobalStore((s) => s.toggleCommandMenu);
|
|
27
29
|
const switchTopic = useChatStore((s) => s.switchTopic);
|
|
30
|
+
const switchToNewTopic = useAgentGroupStore((s) => s.switchToNewTopic);
|
|
28
31
|
|
|
29
32
|
return (
|
|
30
33
|
<Flexbox gap={1} paddingInline={4}>
|
|
34
|
+
<NavItem
|
|
35
|
+
icon={MessageSquarePlusIcon}
|
|
36
|
+
onClick={switchToNewTopic}
|
|
37
|
+
title={tTopic('actions.addNewTopic')}
|
|
38
|
+
/>
|
|
31
39
|
{isAgentEditable && (
|
|
32
40
|
<NavItem
|
|
33
41
|
active={isProfileActive}
|
|
34
42
|
icon={BotPromptIcon}
|
|
35
43
|
onClick={() => {
|
|
36
|
-
switchTopic(
|
|
44
|
+
switchTopic(null, { skipRefreshMessage: true });
|
|
37
45
|
router.push(urlJoin('/group', groupId!, 'profile'));
|
|
38
46
|
}}
|
|
39
47
|
title={t('tab.groupProfile')}
|
|
@@ -4,14 +4,13 @@ import { type PropsWithChildren, memo } from 'react';
|
|
|
4
4
|
|
|
5
5
|
import SideBarHeaderLayout from '@/features/NavPanel/SideBarHeaderLayout';
|
|
6
6
|
|
|
7
|
-
import AddTopicButon from './AddTopicButon';
|
|
8
7
|
import Agent from './Agent';
|
|
9
8
|
import Nav from './Nav';
|
|
10
9
|
|
|
11
10
|
const HeaderInfo = memo<PropsWithChildren>(() => {
|
|
12
11
|
return (
|
|
13
12
|
<>
|
|
14
|
-
<SideBarHeaderLayout left={<Agent />}
|
|
13
|
+
<SideBarHeaderLayout left={<Agent />} />
|
|
15
14
|
<Nav />
|
|
16
15
|
</>
|
|
17
16
|
);
|
package/src/app/[variants]/(main)/group/profile/features/AgentBuilder/AgentBuilderProvider.tsx
CHANGED
|
@@ -16,6 +16,7 @@ interface AgentBuilderProviderProps {
|
|
|
16
16
|
* Uses 'group_agent_builder' scope with groupId to isolate messages per group
|
|
17
17
|
*/
|
|
18
18
|
const AgentBuilderProvider = memo<AgentBuilderProviderProps>(({ agentId, children }) => {
|
|
19
|
+
// Use activeTopicId from chatStore (synced with URL query 'bt' via ProfileHydration)
|
|
19
20
|
const activeTopicId = useChatStore((s) => s.activeTopicId);
|
|
20
21
|
|
|
21
22
|
// Build conversation context for group agent builder
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ActionIcon, DropdownMenu, type DropdownMenuCheckboxItem, Tag } from '@lobehub/ui';
|
|
2
2
|
import { Clock3Icon, PlusIcon } from 'lucide-react';
|
|
3
|
-
import { memo, useMemo } from 'react';
|
|
3
|
+
import { memo, useCallback, useMemo } from 'react';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
|
|
6
6
|
import { DESKTOP_HEADER_ICON_SIZE } from '@/const/layoutTokens';
|
|
@@ -18,11 +18,17 @@ const TopicSelector = memo<TopicSelectorProps>(({ agentId }) => {
|
|
|
18
18
|
// Fetch topics for the group agent builder
|
|
19
19
|
useChatStore((s) => s.useFetchTopics)(true, { agentId });
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
// Use activeTopicId from chatStore (synced with URL query 'bt' via ProfileHydration)
|
|
22
|
+
const [activeTopicId, switchTopic] = useChatStore((s) => [s.activeTopicId, s.switchTopic]);
|
|
23
|
+
const topics = useChatStore((s) => topicSelectors.getTopicsByAgentId(agentId)(s));
|
|
24
|
+
|
|
25
|
+
// Switch topic - ProfileHydration handles URL sync automatically
|
|
26
|
+
const handleSwitchTopic = useCallback(
|
|
27
|
+
(topicId?: string) => {
|
|
28
|
+
switchTopic(topicId);
|
|
29
|
+
},
|
|
30
|
+
[switchTopic],
|
|
31
|
+
);
|
|
26
32
|
|
|
27
33
|
// Find active topic from the agent's topics list directly
|
|
28
34
|
const activeTopic = useMemo(
|
|
@@ -39,12 +45,12 @@ const TopicSelector = memo<TopicSelectorProps>(({ agentId }) => {
|
|
|
39
45
|
label: topic.title,
|
|
40
46
|
onCheckedChange: (checked) => {
|
|
41
47
|
if (checked) {
|
|
42
|
-
|
|
48
|
+
handleSwitchTopic(topic.id);
|
|
43
49
|
}
|
|
44
50
|
},
|
|
45
51
|
type: 'checkbox',
|
|
46
52
|
})),
|
|
47
|
-
[topics,
|
|
53
|
+
[topics, handleSwitchTopic, activeTopicId],
|
|
48
54
|
);
|
|
49
55
|
const isEmpty = !topics || topics.length === 0;
|
|
50
56
|
|
|
@@ -55,7 +61,7 @@ const TopicSelector = memo<TopicSelectorProps>(({ agentId }) => {
|
|
|
55
61
|
<>
|
|
56
62
|
<ActionIcon
|
|
57
63
|
icon={PlusIcon}
|
|
58
|
-
onClick={() =>
|
|
64
|
+
onClick={() => handleSwitchTopic(undefined)}
|
|
59
65
|
size={DESKTOP_HEADER_ICON_SIZE}
|
|
60
66
|
title={t('actions.addNewTopic')}
|
|
61
67
|
/>
|
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
import { BUILTIN_AGENT_SLUGS } from '@lobechat/builtin-agents';
|
|
2
2
|
import { DraggablePanel } from '@lobehub/ui';
|
|
3
3
|
import { cssVar } from 'antd-style';
|
|
4
|
-
import { memo
|
|
4
|
+
import { memo } from 'react';
|
|
5
5
|
|
|
6
6
|
import Loading from '@/components/Loading/BrandTextLoading';
|
|
7
7
|
import { useAgentStore } from '@/store/agent';
|
|
8
8
|
import { builtinAgentSelectors } from '@/store/agent/selectors';
|
|
9
|
+
import { useGlobalStore } from '@/store/global';
|
|
10
|
+
import { systemStatusSelectors } from '@/store/global/selectors';
|
|
11
|
+
import { useGroupProfileStore } from '@/store/groupProfile';
|
|
9
12
|
|
|
10
|
-
import { useProfileStore } from '../store';
|
|
11
13
|
import AgentBuilderConversation from './AgentBuilderConversation';
|
|
12
14
|
import AgentBuilderProvider from './AgentBuilderProvider';
|
|
13
15
|
|
|
14
16
|
const AgentBuilder = memo(() => {
|
|
15
|
-
const chatPanelExpanded =
|
|
16
|
-
const setChatPanelExpanded =
|
|
17
|
+
const chatPanelExpanded = useGroupProfileStore((s) => s.chatPanelExpanded);
|
|
18
|
+
const setChatPanelExpanded = useGroupProfileStore((s) => s.setChatPanelExpanded);
|
|
17
19
|
const groupAgentBuilderId = useAgentStore(builtinAgentSelectors.groupAgentBuilderId);
|
|
18
20
|
|
|
19
|
-
const [width,
|
|
21
|
+
const [width, updateSystemStatus] = useGlobalStore((s) => [
|
|
22
|
+
systemStatusSelectors.groupAgentBuilderPanelWidth(s),
|
|
23
|
+
s.updateSystemStatus,
|
|
24
|
+
]);
|
|
20
25
|
|
|
21
26
|
const useInitBuiltinAgent = useAgentStore((s) => s.useInitBuiltinAgent);
|
|
22
27
|
useInitBuiltinAgent(BUILTIN_AGENT_SLUGS.groupAgentBuilder);
|
|
@@ -31,7 +36,8 @@ const AgentBuilder = memo(() => {
|
|
|
31
36
|
onExpandChange={setChatPanelExpanded}
|
|
32
37
|
onSizeChange={(_, size) => {
|
|
33
38
|
if (size?.width) {
|
|
34
|
-
|
|
39
|
+
const w = typeof size.width === 'string' ? Number.parseInt(size.width) : size.width;
|
|
40
|
+
if (!!w) updateSystemStatus({ groupAgentBuilderPanelWidth: w });
|
|
35
41
|
}
|
|
36
42
|
}}
|
|
37
43
|
placement="right"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { EDITOR_DEBOUNCE_TIME } from '@lobechat/const';
|
|
4
4
|
import { Block, Flexbox, Icon, Input, Skeleton, Tooltip } from '@lobehub/ui';
|
|
5
5
|
import { useDebounceFn } from 'ahooks';
|
|
6
6
|
import { message } from 'antd';
|
|
@@ -9,11 +9,9 @@ import { PaletteIcon } from 'lucide-react';
|
|
|
9
9
|
import { Suspense, memo, useCallback, useEffect, useState } from 'react';
|
|
10
10
|
import { useTranslation } from 'react-i18next';
|
|
11
11
|
|
|
12
|
-
import
|
|
12
|
+
import GroupAvatar from '@/app/[variants]/(main)/group/features/GroupAvatar';
|
|
13
13
|
import EmojiPicker from '@/components/EmojiPicker';
|
|
14
14
|
import BackgroundSwatches from '@/features/AgentSetting/AgentMeta/BackgroundSwatches';
|
|
15
|
-
import { useAgentStore } from '@/store/agent';
|
|
16
|
-
import { agentSelectors } from '@/store/agent/selectors';
|
|
17
15
|
import { useAgentGroupStore } from '@/store/agentGroup';
|
|
18
16
|
import { agentGroupSelectors } from '@/store/agentGroup/selectors';
|
|
19
17
|
import { useFileStore } from '@/store/file';
|
|
@@ -22,23 +20,19 @@ import { globalGeneralSelectors } from '@/store/global/selectors';
|
|
|
22
20
|
|
|
23
21
|
const MAX_AVATAR_SIZE = 1024 * 1024; // 1MB limit for server actions
|
|
24
22
|
|
|
25
|
-
const
|
|
23
|
+
const GroupHeader = memo(() => {
|
|
26
24
|
const { t } = useTranslation(['setting', 'common']);
|
|
27
25
|
const locale = useGlobalStore(globalGeneralSelectors.currentLanguage);
|
|
28
26
|
|
|
29
|
-
// Get
|
|
27
|
+
// Get group meta from agentGroup store
|
|
30
28
|
const groupMeta = useAgentGroupStore(agentGroupSelectors.currentGroupMeta, isEqual);
|
|
31
29
|
const updateGroupMeta = useAgentGroupStore((s) => s.updateGroupMeta);
|
|
32
30
|
|
|
33
|
-
// Get avatar/backgroundColor from supervisor agent (useAgentStore)
|
|
34
|
-
const agentMeta = useAgentStore(agentSelectors.currentAgentMeta, isEqual);
|
|
35
|
-
const updateAgentMeta = useAgentStore((s) => s.updateAgentMeta);
|
|
36
|
-
|
|
37
31
|
// File upload
|
|
38
32
|
const uploadWithProgress = useFileStore((s) => s.uploadWithProgress);
|
|
39
33
|
const [uploading, setUploading] = useState(false);
|
|
40
34
|
|
|
41
|
-
// Local state for inputs
|
|
35
|
+
// Local state for inputs
|
|
42
36
|
const [localTitle, setLocalTitle] = useState(groupMeta.title || '');
|
|
43
37
|
|
|
44
38
|
// Sync local state when meta changes from external source
|
|
@@ -46,7 +40,7 @@ const AgentHeader = memo(() => {
|
|
|
46
40
|
setLocalTitle(groupMeta.title || '');
|
|
47
41
|
}, [groupMeta.title]);
|
|
48
42
|
|
|
49
|
-
// Debounced save for title
|
|
43
|
+
// Debounced save for title
|
|
50
44
|
const { run: debouncedSaveTitle } = useDebounceFn(
|
|
51
45
|
(value: string) => {
|
|
52
46
|
updateGroupMeta({ title: value });
|
|
@@ -54,9 +48,9 @@ const AgentHeader = memo(() => {
|
|
|
54
48
|
{ wait: EDITOR_DEBOUNCE_TIME },
|
|
55
49
|
);
|
|
56
50
|
|
|
57
|
-
// Handle avatar change (immediate save)
|
|
51
|
+
// Handle avatar change (immediate save)
|
|
58
52
|
const handleAvatarChange = (emoji: string) => {
|
|
59
|
-
|
|
53
|
+
updateGroupMeta({ avatar: emoji });
|
|
60
54
|
};
|
|
61
55
|
|
|
62
56
|
// Handle avatar upload
|
|
@@ -70,26 +64,25 @@ const AgentHeader = memo(() => {
|
|
|
70
64
|
setUploading(true);
|
|
71
65
|
try {
|
|
72
66
|
const result = await uploadWithProgress({ file });
|
|
73
|
-
console.log('result', result);
|
|
74
67
|
if (result?.url) {
|
|
75
|
-
|
|
68
|
+
updateGroupMeta({ avatar: result.url });
|
|
76
69
|
}
|
|
77
70
|
} finally {
|
|
78
71
|
setUploading(false);
|
|
79
72
|
}
|
|
80
73
|
},
|
|
81
|
-
[uploadWithProgress,
|
|
74
|
+
[uploadWithProgress, updateGroupMeta, t],
|
|
82
75
|
);
|
|
83
76
|
|
|
84
77
|
// Handle avatar delete
|
|
85
78
|
const handleAvatarDelete = useCallback(() => {
|
|
86
|
-
|
|
87
|
-
}, [
|
|
79
|
+
updateGroupMeta({ avatar: undefined });
|
|
80
|
+
}, [updateGroupMeta]);
|
|
88
81
|
|
|
89
|
-
// Handle background color change
|
|
82
|
+
// Handle background color change
|
|
90
83
|
const handleBackgroundColorChange = (color?: string) => {
|
|
91
84
|
if (color !== undefined) {
|
|
92
|
-
|
|
85
|
+
updateGroupMeta({ backgroundColor: color });
|
|
93
86
|
}
|
|
94
87
|
};
|
|
95
88
|
|
|
@@ -106,20 +99,20 @@ const AgentHeader = memo(() => {
|
|
|
106
99
|
}}
|
|
107
100
|
>
|
|
108
101
|
<EmojiPicker
|
|
109
|
-
allowDelete={!!
|
|
102
|
+
allowDelete={!!groupMeta.avatar}
|
|
110
103
|
allowUpload
|
|
111
104
|
background={
|
|
112
|
-
|
|
113
|
-
?
|
|
105
|
+
groupMeta.backgroundColor && groupMeta.backgroundColor !== 'rgba(0,0,0,0)'
|
|
106
|
+
? groupMeta.backgroundColor
|
|
114
107
|
: undefined
|
|
115
108
|
}
|
|
116
109
|
customRender={
|
|
117
|
-
|
|
110
|
+
groupMeta.avatar
|
|
118
111
|
? undefined
|
|
119
112
|
: () => {
|
|
120
113
|
return (
|
|
121
114
|
<Block clickable height={72} width={72}>
|
|
122
|
-
<
|
|
115
|
+
<GroupAvatar size={72} />
|
|
123
116
|
</Block>
|
|
124
117
|
);
|
|
125
118
|
}
|
|
@@ -146,7 +139,7 @@ const AgentHeader = memo(() => {
|
|
|
146
139
|
onChange={handleBackgroundColorChange}
|
|
147
140
|
shape={'square'}
|
|
148
141
|
size={38}
|
|
149
|
-
value={
|
|
142
|
+
value={groupMeta.backgroundColor}
|
|
150
143
|
/>
|
|
151
144
|
</Suspense>
|
|
152
145
|
</Flexbox>
|
|
@@ -164,7 +157,7 @@ const AgentHeader = memo(() => {
|
|
|
164
157
|
}}
|
|
165
158
|
shape={'square'}
|
|
166
159
|
size={72}
|
|
167
|
-
value={
|
|
160
|
+
value={groupMeta.avatar}
|
|
168
161
|
/>
|
|
169
162
|
<Input
|
|
170
163
|
onChange={(e) => {
|
|
@@ -185,4 +178,4 @@ const AgentHeader = memo(() => {
|
|
|
185
178
|
);
|
|
186
179
|
});
|
|
187
180
|
|
|
188
|
-
export default
|
|
181
|
+
export default GroupHeader;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Button, Flexbox } from '@lobehub/ui';
|
|
4
|
+
import { Divider } from 'antd';
|
|
5
|
+
import { PlayIcon } from 'lucide-react';
|
|
6
|
+
import { memo, useCallback } from 'react';
|
|
7
|
+
import { useTranslation } from 'react-i18next';
|
|
8
|
+
import urlJoin from 'url-join';
|
|
9
|
+
|
|
10
|
+
import { EditorCanvas } from '@/features/EditorCanvas';
|
|
11
|
+
import { useQueryRoute } from '@/hooks/useQueryRoute';
|
|
12
|
+
import { useAgentGroupStore } from '@/store/agentGroup';
|
|
13
|
+
import { agentGroupSelectors } from '@/store/agentGroup/selectors';
|
|
14
|
+
import { useGroupProfileStore } from '@/store/groupProfile';
|
|
15
|
+
|
|
16
|
+
import AutoSaveHint from '../Header/AutoSaveHint';
|
|
17
|
+
import GroupHeader from './GroupHeader';
|
|
18
|
+
|
|
19
|
+
const GroupProfile = memo(() => {
|
|
20
|
+
const { t } = useTranslation(['setting', 'chat']);
|
|
21
|
+
const groupId = useAgentGroupStore(agentGroupSelectors.activeGroupId);
|
|
22
|
+
const currentGroup = useAgentGroupStore(agentGroupSelectors.currentGroup);
|
|
23
|
+
const updateGroup = useAgentGroupStore((s) => s.updateGroup);
|
|
24
|
+
const router = useQueryRoute();
|
|
25
|
+
|
|
26
|
+
const editor = useGroupProfileStore((s) => s.editor);
|
|
27
|
+
const handleContentChange = useGroupProfileStore((s) => s.handleContentChange);
|
|
28
|
+
|
|
29
|
+
// Create save callback that captures latest groupId
|
|
30
|
+
const saveContent = useCallback(
|
|
31
|
+
async (payload: { content: string; editorData: Record<string, any> }) => {
|
|
32
|
+
if (!groupId) return;
|
|
33
|
+
await updateGroup(groupId, {
|
|
34
|
+
content: payload.content,
|
|
35
|
+
editorData: payload.editorData,
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
[updateGroup, groupId],
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const onContentChange = useCallback(() => {
|
|
42
|
+
handleContentChange(saveContent);
|
|
43
|
+
}, [handleContentChange, saveContent]);
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<>
|
|
47
|
+
<Flexbox
|
|
48
|
+
onClick={(e) => {
|
|
49
|
+
e.stopPropagation();
|
|
50
|
+
}}
|
|
51
|
+
style={{ cursor: 'default', marginBottom: 12 }}
|
|
52
|
+
>
|
|
53
|
+
<Flexbox height={66} width={'100%'}>
|
|
54
|
+
<Flexbox paddingBlock={12}>
|
|
55
|
+
<AutoSaveHint />
|
|
56
|
+
</Flexbox>
|
|
57
|
+
</Flexbox>
|
|
58
|
+
{/* Header: Group Avatar + Title */}
|
|
59
|
+
<GroupHeader />
|
|
60
|
+
{/* Start Conversation Button */}
|
|
61
|
+
<Flexbox
|
|
62
|
+
align={'center'}
|
|
63
|
+
gap={8}
|
|
64
|
+
horizontal
|
|
65
|
+
justify={'flex-start'}
|
|
66
|
+
style={{ marginTop: 16 }}
|
|
67
|
+
>
|
|
68
|
+
<Button
|
|
69
|
+
icon={PlayIcon}
|
|
70
|
+
onClick={() => {
|
|
71
|
+
if (!groupId) return;
|
|
72
|
+
router.push(urlJoin('/group', groupId));
|
|
73
|
+
}}
|
|
74
|
+
type={'primary'}
|
|
75
|
+
>
|
|
76
|
+
{t('startConversation')}
|
|
77
|
+
</Button>
|
|
78
|
+
</Flexbox>
|
|
79
|
+
</Flexbox>
|
|
80
|
+
<Divider />
|
|
81
|
+
{/* Group Content Editor */}
|
|
82
|
+
<EditorCanvas
|
|
83
|
+
editor={editor}
|
|
84
|
+
editorData={{
|
|
85
|
+
content: currentGroup?.content ?? undefined,
|
|
86
|
+
editorData: currentGroup?.editorData,
|
|
87
|
+
}}
|
|
88
|
+
key={groupId}
|
|
89
|
+
onContentChange={onContentChange}
|
|
90
|
+
placeholder={t('group.profile.contentPlaceholder', { ns: 'chat' })}
|
|
91
|
+
/>
|
|
92
|
+
</>
|
|
93
|
+
);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
export default GroupProfile;
|
|
@@ -3,12 +3,11 @@ import { BotMessageSquareIcon } from 'lucide-react';
|
|
|
3
3
|
import { memo } from 'react';
|
|
4
4
|
|
|
5
5
|
import { DESKTOP_HEADER_ICON_SIZE } from '@/const/layoutTokens';
|
|
6
|
-
|
|
7
|
-
import { useProfileStore } from '../store';
|
|
6
|
+
import { useGroupProfileStore } from '@/store/groupProfile';
|
|
8
7
|
|
|
9
8
|
const AgentBuilderToggle = memo(() => {
|
|
10
|
-
const chatPanelExpanded =
|
|
11
|
-
const setChatPanelExpanded =
|
|
9
|
+
const chatPanelExpanded = useGroupProfileStore((s) => s.chatPanelExpanded);
|
|
10
|
+
const setChatPanelExpanded = useGroupProfileStore((s) => s.setChatPanelExpanded);
|
|
12
11
|
|
|
13
12
|
return (
|
|
14
13
|
<ActionIcon
|
|
@@ -3,15 +3,19 @@
|
|
|
3
3
|
import { memo } from 'react';
|
|
4
4
|
|
|
5
5
|
import AutoSaveHintBase from '@/components/Editor/AutoSaveHint';
|
|
6
|
+
import { useGroupProfileStore } from '@/store/groupProfile';
|
|
7
|
+
import { selectors } from '@/store/groupProfile/selectors';
|
|
6
8
|
|
|
7
|
-
/**
|
|
8
|
-
* AutoSaveHint - Save status indicator for group settings
|
|
9
|
-
* TODO: Add saveStatus and lastUpdatedTime to agentGroupStore when needed
|
|
10
|
-
*/
|
|
11
9
|
const AutoSaveHint = memo(() => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
const activeTabId = useGroupProfileStore((s) => s.activeTabId);
|
|
11
|
+
const saveState = useGroupProfileStore(selectors.getSaveState(activeTabId));
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<AutoSaveHintBase
|
|
15
|
+
lastUpdatedTime={saveState.lastUpdatedTime}
|
|
16
|
+
saveStatus={saveState.saveStatus}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
15
19
|
});
|
|
16
20
|
|
|
17
21
|
export default AutoSaveHint;
|