Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix: fix supervisor group prompt (#11543)

Arvin Xu3a6efbcbade4
diff --git a/locales/en-US/agentGroup.json b/locales/en-US/agentGroup.json
new file mode 100644
index 00000000000..26c10f92947
--- /dev/null
+++ b/locales/en-US/agentGroup.json
@@ -0,0 +1,5 @@
+{
+ "avatar.sizeExceeded": "Avatar size exceeds limit",
+ "backgroundColor.title": "Background Color",
+ "name.placeholder": "Enter group name"
+}
diff --git a/locales/en-US/chat.json b/locales/en-US/chat.json
index cec87739831..fd60b6a517f 100644
--- a/locales/en-US/chat.json
+++ b/locales/en-US/chat.json
@@ -288,7 +288,7 @@
"shareModal.pdfReady": "PDF is ready",
"shareModal.popover.moreOptions": "More share options",
"shareModal.popover.privacyWarning.confirm": "I understand, continue",
- "shareModal.popover.privacyWarning.content": "Please ensure the conversation does not contain any private or sensitive information before sharing. LobeHub is not responsible for any security issues that may arise from sharing.",
+ "shareModal.popover.privacyWarning.content": "Please make sure your conversation doesn't contain any personal or sensitive information. You are responsible for any content you choose to share and its consequences.",
"shareModal.popover.privacyWarning.title": "Privacy Notice",
"shareModal.popover.title": "Share Topic",
"shareModal.popover.visibility": "Visibility",
diff --git a/locales/zh-CN/agentGroup.json b/locales/zh-CN/agentGroup.json
new file mode 100644
index 00000000000..a8783f4fda1
--- /dev/null
+++ b/locales/zh-CN/agentGroup.json
@@ -0,0 +1,5 @@
+{
+ "avatar.sizeExceeded": "头像大小超过限制",
+ "backgroundColor.title": "背景颜色",
+ "name.placeholder": "请输入群组名称"
+}
diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.json
index 523bfd2d2ca..28284965545 100644
--- a/locales/zh-CN/chat.json
+++ b/locales/zh-CN/chat.json
@@ -288,7 +288,7 @@
"shareModal.pdfReady": "PDF 已准备就绪",
"shareModal.popover.moreOptions": "更多分享方式",
"shareModal.popover.privacyWarning.confirm": "我已了解,继续",
- "shareModal.popover.privacyWarning.content": "分享前请确保对话中不包含任何隐私或敏感信息。因分享而可能产生的任何安全问题,LobeHub 概不负责。",
+ "shareModal.popover.privacyWarning.content": "请确保对话中不含个人隐私或敏感信息,LobeHub 不对任何分享的内容及其产生的后果负责。",
"shareModal.popover.privacyWarning.title": "隐私提醒",
"shareModal.popover.title": "分享话题",
"shareModal.popover.visibility": "可见性",
diff --git a/packages/builtin-agents/src/agents/group-supervisor/index.ts b/packages/builtin-agents/src/agents/group-supervisor/index.ts
index 817bd68add8..42cf5dc4df6 100644
--- a/packages/builtin-agents/src/agents/group-supervisor/index.ts
+++ b/packages/builtin-agents/src/agents/group-supervisor/index.ts
@@ -11,7 +11,9 @@ import type { GroupSupervisorContext } from './type';
* Replace template variables in system role
*/
const resolveSystemRole = (ctx: GroupSupervisorContext): string => {
- return supervisorSystemRole.replace('{{GROUP_TITLE}}', ctx.groupTitle);
+ return supervisorSystemRole
+ .replace('{{GROUP_TITLE}}', ctx.groupTitle)
+ .replace('{{SYSTEM_PROMPT}}', ctx.systemPrompt || '');
};
/**
diff --git a/packages/builtin-agents/src/agents/group-supervisor/systemRole.ts b/packages/builtin-agents/src/agents/group-supervisor/systemRole.ts
index 5c23d1fc4d9..b6dae7de18f 100644
--- a/packages/builtin-agents/src/agents/group-supervisor/systemRole.ts
+++ b/packages/builtin-agents/src/agents/group-supervisor/systemRole.ts
@@ -15,6 +15,7 @@ export const supervisorSystemRole = `You are LobeAI, an intelligent team coordin
- Current date: {{date}}
</system_context>
+{{SYSTEM_PROMPT}}
<core_responsibilities>
1. **Proactive Group Participation (PRIMARY FOCUS)**
diff --git a/src/app/[variants]/(main)/group/profile/features/GroupProfile/GroupHeader.tsx b/src/app/[variants]/(main)/group/profile/features/GroupProfile/GroupHeader.tsx
index 88341e7f4e6..5524ef187eb 100644
--- a/src/app/[variants]/(main)/group/profile/features/GroupProfile/GroupHeader.tsx
+++ b/src/app/[variants]/(main)/group/profile/features/GroupProfile/GroupHeader.tsx
@@ -21,7 +21,7 @@ import { globalGeneralSelectors } from '@/store/global/selectors';
const MAX_AVATAR_SIZE = 1024 * 1024; // 1MB limit for server actions
const GroupHeader = memo(() => {
- const { t } = useTranslation(['setting', 'common']);
+ const { t } = useTranslation('agentGroup');
const locale = useGlobalStore(globalGeneralSelectors.currentLanguage);
// Get group meta from agentGroup store
@@ -57,7 +57,7 @@ const GroupHeader = memo(() => {
const handleAvatarUpload = useCallback(
async (file: File) => {
if (file.size > MAX_AVATAR_SIZE) {
- message.error(t('settingAgent.avatar.sizeExceeded', { ns: 'setting' }));
+ message.error(t('avatar.sizeExceeded'));
return;
}
@@ -120,7 +120,7 @@ const GroupHeader = memo(() => {
customTabs={[
{
label: (
- <Tooltip title={t('settingAgent.backgroundColor.title', { ns: 'setting' })}>
+ <Tooltip title={t('backgroundColor.title')}>
<Icon icon={PaletteIcon} size={{ size: 20, strokeWidth: 2.5 }} />
</Tooltip>
),
@@ -164,7 +164,7 @@ const GroupHeader = memo(() => {
setLocalTitle(e.target.value);
debouncedSaveTitle(e.target.value);
}}
- placeholder={t('settingAgent.name.placeholder', { ns: 'setting' })}
+ placeholder={t('name.placeholder')}
style={{
fontSize: 36,
fontWeight: 600,
diff --git a/src/app/[variants]/(main)/page/_layout/Body/List/Item/index.tsx b/src/app/[variants]/(main)/page/_layout/Body/List/Item/index.tsx
index b23deda3743..fc1c918043f 100644
--- a/src/app/[variants]/(main)/page/_layout/Body/List/Item/index.tsx
+++ b/src/app/[variants]/(main)/page/_layout/Body/List/Item/index.tsx
@@ -1,6 +1,6 @@
-import { Avatar } from '@lobehub/ui';
+import { Avatar, Icon } from '@lobehub/ui';
import { FileTextIcon } from 'lucide-react';
-import { memo, useCallback, useMemo } from 'react';
+import { type MouseEvent, memo, useCallback, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import NavItem from '@/features/NavPanel/components/NavItem';
@@ -36,25 +36,26 @@ const PageListItem = memo<DocumentItemProps>(({ pageId, className }) => {
[pageId, setRenamingPageId],
);
- const handleClick = useCallback(() => {
- if (!editing) {
- selectPage(pageId);
- }
- }, [editing, selectPage, pageId]);
+ const handleClick = useCallback(
+ (e: MouseEvent) => {
+ // Skip navigation in current tab when opening in new tab
+ if (e.metaKey || e.ctrlKey) return;
+ if (!editing) {
+ selectPage(pageId);
+ }
+ },
+ [editing, selectPage, pageId],
+ );
// Icon with emoji support
const icon = useMemo(() => {
if (emoji) {
return <Avatar avatar={emoji} size={28} />;
}
- return FileTextIcon;
+ return <Icon icon={FileTextIcon} size={{ size: 18, strokeWidth: 1.5 }} />;
}, [emoji]);
- const dropdownMenu = useDropdownMenu({
- documentContent: document?.content || undefined,
- pageId,
- toggleEditing,
- });
+ const dropdownMenu = useDropdownMenu({ pageId, toggleEditing });
return (
<>
@@ -64,6 +65,7 @@ const PageListItem = memo<DocumentItemProps>(({ pageId, className }) => {
className={className}
contextMenuItems={dropdownMenu}
disabled={editing}
+ href={`/page/${pageId}`}
icon={icon}
key={pageId}
onClick={handleClick}
diff --git a/src/app/[variants]/(main)/page/_layout/Body/List/Item/useDropdownMenu.tsx b/src/app/[variants]/(main)/page/_layout/Body/List/Item/useDropdownMenu.tsx
index c13b7b1ef04..fa5ff776dc8 100644
--- a/src/app/[variants]/(main)/page/_layout/Body/List/Item/useDropdownMenu.tsx
+++ b/src/app/[variants]/(main)/page/_layout/Body/List/Item/useDropdownMenu.tsx
@@ -1,19 +1,17 @@
import { Icon, type MenuProps } from '@lobehub/ui';
import { App } from 'antd';
-import { Copy, CopyPlus, Pencil, Trash2 } from 'lucide-react';
+import { CopyPlus, Pencil, Trash2 } from 'lucide-react';
import { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { usePageStore } from '@/store/page';
interface ActionProps {
- documentContent?: string;
pageId: string;
toggleEditing: (visible?: boolean) => void;
}
export const useDropdownMenu = ({
- documentContent,
pageId,
toggleEditing,
}: ActionProps): (() => MenuProps['items']) => {
@@ -41,16 +39,6 @@ export const useDropdownMenu = ({
});
};
- const handleCopy = async () => {
- if (documentContent) {
- try {
- await navigator.clipboard.writeText(documentContent);
- } catch (error) {
- console.error('Failed to copy page:', error);
- }
- }
- };
-
const handleDuplicate = async () => {
try {
await duplicatePage(pageId);
@@ -68,12 +56,12 @@ export const useDropdownMenu = ({
label: t('rename'),
onClick: () => toggleEditing(true),
},
- {
- icon: <Icon icon={Copy} />,
- key: 'copy',
- label: t('pageList.copyContent', { ns: 'file' }),
- onClick: handleCopy,
- },
+ // {
+ // icon: <Icon icon={Copy} />,
+ // key: 'copy',
+ // label: t('pageList.copyContent', { ns: 'file' }),
+ // onClick: handleCopy,
+ // },
{
icon: <Icon icon={CopyPlus} />,
key: 'duplicate',
@@ -89,6 +77,6 @@ export const useDropdownMenu = ({
onClick: handleDelete,
},
].filter(Boolean) as MenuProps['items'],
- [t, toggleEditing, handleCopy, handleDuplicate, handleDelete],
+ [t, toggleEditing, handleDuplicate, handleDelete],
);
};
diff --git a/src/features/PageEditor/PageEditor.tsx b/src/features/PageEditor/PageEditor.tsx
index 6c2846f59cc..47853baa6bf 100644
--- a/src/features/PageEditor/PageEditor.tsx
+++ b/src/features/PageEditor/PageEditor.tsx
@@ -130,7 +130,6 @@ export const PageEditor: FC<PageEditorProps> = ({
<EditorProvider>
<PageEditorProvider
emoji={emoji}
- key={pageId}
knowledgeBaseId={knowledgeBaseId}
onBack={onBack}
onDelete={() => deletePage(pageId || '')}
diff --git a/src/features/PageExplorer/index.tsx b/src/features/PageExplorer/index.tsx
index e4f3a7aebcf..b0fce5620d5 100644
--- a/src/features/PageExplorer/index.tsx
+++ b/src/features/PageExplorer/index.tsx
@@ -40,6 +40,7 @@ const PageExplorer = memo<PageExplorerProps>(({ pageId }) => {
return (
<PageEditor
emoji={emoji}
+ key={pageId}
onEmojiChange={handleEmojiChange}
onTitleChange={handleTitleChange}
pageId={pageId}
diff --git a/src/locales/default/agentGroup.ts b/src/locales/default/agentGroup.ts
new file mode 100644
index 00000000000..4c80b2b6f04
--- /dev/null
+++ b/src/locales/default/agentGroup.ts
@@ -0,0 +1,5 @@
+export default {
+ 'avatar.sizeExceeded': 'Avatar size exceeds limit',
+ 'backgroundColor.title': 'Background Color',
+ 'name.placeholder': 'Enter group name',
+};
diff --git a/src/locales/default/chat.ts b/src/locales/default/chat.ts
index 73eabcbde2a..bfdb5a54a99 100644
--- a/src/locales/default/chat.ts
+++ b/src/locales/default/chat.ts
@@ -319,7 +319,7 @@ export default {
'shareModal.popover.moreOptions': 'More share options',
'shareModal.popover.privacyWarning.confirm': 'I understand, continue',
'shareModal.popover.privacyWarning.content':
- 'Please ensure the conversation does not contain any private or sensitive information before sharing. LobeHub is not responsible for any security issues that may arise from sharing.',
+ "Please make sure your conversation doesn't contain any personal or sensitive information. You are responsible for any content you choose to share and its consequences.",
'shareModal.popover.privacyWarning.title': 'Privacy Notice',
'shareModal.popover.title': 'Share Topic',
'shareModal.popover.visibility': 'Visibility',
diff --git a/src/locales/default/index.ts b/src/locales/default/index.ts
index 009c72d2cd8..e74b205b0a6 100644
--- a/src/locales/default/index.ts
+++ b/src/locales/default/index.ts
@@ -1,5 +1,6 @@
import { businessLocales } from '@/business/locales/index';
+import agentGroup from './agentGroup';
import auth from './auth';
import authError from './authError';
import changelog from './changelog';
@@ -41,6 +42,7 @@ import ui from './ui';
import welcome from './welcome';
const resources = {
+ agentGroup,
auth,
authError,
changelog,
diff --git a/src/services/chat/mecha/agentConfigResolver.test.ts b/src/services/chat/mecha/agentConfigResolver.test.ts
index 0081305b3c8..79839ad2716 100644
--- a/src/services/chat/mecha/agentConfigResolver.test.ts
+++ b/src/services/chat/mecha/agentConfigResolver.test.ts
@@ -730,7 +730,7 @@ describe('resolveAgentConfig', () => {
],
groupId: 'group-123',
groupTitle: 'Test Group',
- systemPrompt: 'Custom group system prompt',
+ systemPrompt: 'You are a helpful assistant',
},
}),
);
diff --git a/src/services/chat/mecha/agentConfigResolver.ts b/src/services/chat/mecha/agentConfigResolver.ts
index f3addfd6c2d..3e802991db8 100644
--- a/src/services/chat/mecha/agentConfigResolver.ts
+++ b/src/services/chat/mecha/agentConfigResolver.ts
@@ -193,7 +193,7 @@ export const resolveAgentConfig = (ctx: AgentConfigResolverContext): ResolvedAge
availableAgents: groupMembers.map((agent) => ({ id: agent.id, title: agent.title })),
groupId: group.id,
groupTitle: group.title || 'Group Chat',
- systemPrompt: group.config?.systemPrompt,
+ systemPrompt: agentConfig.systemRole,
};
}
}