feat(desktop): add a group-chat entry point on the Agents page

Adds a "Group chat" button next to "Create Agent" (shown when at least two
Agents exist) that navigates to the chat page with ?team=1, which pops the
group-chat picker over the conversation. The flag is cleared once consumed so
back/refresh doesn't reopen it.

Co-authored-by: cowagent <cow@cowagent.ai>
This commit is contained in:
zhayujieandcowagent committed 2026-09-13 21:22:15 +08:00
1 parent 8b3d5f530e
commit 0b2b001d21
3 files changed
+41 -7

No files matched your search

+2
View File
@@ -21,6 +21,7 @@ const translations: Record<string, Record<string, string>> = {
agents_loading: '加载团队中...',
agents_empty: '从左侧选择一个智能体',
agents_create: '新建智能体',
agents_new_team_chat: '群聊会话',
agents_create_failed: '创建失败',
agents_name_required: '请填写名称',
agents_field_name: '名称',
@@ -758,6 +759,7 @@ const translations: Record<string, Record<string, string>> = {
agents_loading: 'Loading team...',
agents_empty: 'Select an agent on the left',
agents_create: 'New Agent',
agents_new_team_chat: 'Group chat',
agents_create_failed: 'Failed to create',
agents_name_required: 'A name is required',
agents_field_name: 'Name',
+17 -6
View File
@@ -28,6 +28,7 @@ type DetailTab = 'profile' | 'skills' | 'files'
* otherwise), so it can assume a real roster.
*/
const AgentsPage: React.FC<AgentsPageProps> = ({ baseUrl }) => {
const navigate = useNavigate()
const agents = useAgentStore((s) => s.agents)
const defaultAgentId = useAgentStore((s) => s.defaultAgentId)
const loaded = useAgentStore((s) => s.loaded)
@@ -68,12 +69,22 @@ const AgentsPage: React.FC<AgentsPageProps> = ({ baseUrl }) => {
<h2 className="text-xl font-bold text-content">{t('agents_title')}</h2>
<p className="text-xs text-content-tertiary mt-1">{t('agents_desc')}</p>
</div>
<Btn variant="primary" onClick={() => setCreateOpen(true)}>
<span className="flex items-center gap-1.5">
<Plus size={15} />
{t('agents_create')}
</span>
</Btn>
<div className="flex items-center gap-2">
{agents.length >= 2 && (
<Btn onClick={() => navigate('/?team=1')}>
<span className="flex items-center gap-1.5">
<Users size={15} />
{t('agents_new_team_chat')}
</span>
</Btn>
)}
<Btn variant="primary" onClick={() => setCreateOpen(true)}>
<span className="flex items-center gap-1.5">
<Plus size={15} />
{t('agents_create')}
</span>
</Btn>
</div>
</div>
<div className="flex-1 overflow-hidden border-t border-default flex min-h-0">
+22 -1
View File
@@ -10,9 +10,10 @@ import {
Terminal,
type LucideIcon,
} from 'lucide-react'
import { useNavigate } from 'react-router-dom'
import { useNavigate, useSearchParams } from 'react-router-dom'
import MessageBubble from '../components/MessageBubble'
import ChatInput, { type ChatInputHandle } from '../components/ChatInput'
import { TeamChatModal } from '../components/NewChatMenu'
import { product } from '@product'
import { t } from '../i18n'
import apiClient from '../api/client'
@@ -69,6 +70,20 @@ const ChatPage: React.FC<ChatPageProps> = ({ baseUrl }) => {
const bottomRef = useRef<HTMLDivElement>(null)
const inputResetRef = useRef<ChatInputHandle>(null)
const navigate = useNavigate()
const [searchParams, setSearchParams] = useSearchParams()
// The Agents page can hand the user straight into a group chat: it navigates
// here with ?team=1 to pop the group-chat picker over the conversation. Clear
// the flag once consumed so a back/refresh doesn't reopen it.
const [teamOpen, setTeamOpen] = useState(false)
useEffect(() => {
if (searchParams.get('team') === '1') {
setTeamOpen(true)
searchParams.delete('team')
setSearchParams(searchParams, { replace: true })
}
}, [searchParams, setSearchParams])
// "Config" action on the context pie: jump to settings and flag the budget
// field to scroll/highlight (read in BasicSettings on mount).
const handleAdjustContext = useCallback(() => {
@@ -360,6 +375,12 @@ const ChatPage: React.FC<ChatPageProps> = ({ baseUrl }) => {
onAdjustContext={handleAdjustContext}
ref={inputResetRef}
/>
<TeamChatModal
open={teamOpen}
onClose={() => setTeamOpen(false)}
onStarted={() => setTeamOpen(false)}
/>
</div>
)
}