diff --git a/locales/en-US/agentGroup.json b/locales/en-US/agentGroup.json new file mode 100644 index 0000000000..26c10f9294 --- /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 cec8773983..fd60b6a517 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 0000000000..a8783f4fda --- /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 523bfd2d2c..2828496554 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 817bd68add..42cf5dc4df 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 5c23d1fc4d..b6dae7de18 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_PROMPT}} 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 88341e7f4e..5524ef187e 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: ( - + ), @@ -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 b23deda374..fc1c918043 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(({ 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 ; } - return FileTextIcon; + return ; }, [emoji]); - const dropdownMenu = useDropdownMenu({ - documentContent: document?.content || undefined, - pageId, - toggleEditing, - }); + const dropdownMenu = useDropdownMenu({ pageId, toggleEditing }); return ( <> @@ -64,6 +65,7 @@ const PageListItem = memo(({ 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 c13b7b1ef0..fa5ff776dc 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: , - key: 'copy', - label: t('pageList.copyContent', { ns: 'file' }), - onClick: handleCopy, - }, + // { + // icon: , + // key: 'copy', + // label: t('pageList.copyContent', { ns: 'file' }), + // onClick: handleCopy, + // }, { icon: , 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 6c2846f59c..47853baa6b 100644 --- a/src/features/PageEditor/PageEditor.tsx +++ b/src/features/PageEditor/PageEditor.tsx @@ -130,7 +130,6 @@ export const PageEditor: FC = ({ deletePage(pageId || '')} diff --git a/src/features/PageExplorer/index.tsx b/src/features/PageExplorer/index.tsx index e4f3a7aebc..b0fce5620d 100644 --- a/src/features/PageExplorer/index.tsx +++ b/src/features/PageExplorer/index.tsx @@ -40,6 +40,7 @@ const PageExplorer = memo(({ pageId }) => { return ( { ], 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 f3addfd6c2..3e802991db 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, }; } }