Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
feat(bots): 简化私聊建群并统一群聊邀请弹窗
nanaf49648223252
diff --git a/apps/desktop/scripts/fixtures/group-invite/fixture.tsx b/apps/desktop/scripts/fixtures/group-invite/fixture.tsxnew file mode 100644index 0000000000..6edd26794c--- /dev/null+++ b/apps/desktop/scripts/fixtures/group-invite/fixture.tsx@@ -0,0 +1,39 @@+import { useEffect } from 'react';+import { mountPage, forbid } from '../../ui-page/harness';+import { ChatInviteDialog } from '../../../src/renderer/features/bots/ChatInviteDialog';+import { BotGroupCreateDialog } from '../../../src/renderer/features/bots/BotGroupCreateDialog';+import accountAvatar from '../../../src/renderer/assets/cindy-avatar-account.png';++const members = [+ { botId: 'preview-bot', name: 'Cindy', avatar: 'cindy://avatar/preset/cindy', avatarColor: 'violet', status: 'active' as const },+ { botId: 'preview-user', name: 'Alex', avatar: '', avatarUrl: 'https://example.invalid/avatar/alex.png', avatarColor: 'graphite', status: 'active' as const, isSelf: true },+];++// The isolated HTTP fixture has no secure-context randomUUID.+if (!crypto.randomUUID) Object.defineProperty(crypto, 'randomUUID', { value: () => '00000000-0000-4000-8000-000000000001' });++function CreatePreview({ invalid }: { invalid: boolean }) {+ useEffect(() => {+ if (!invalid) return;+ const frame = requestAnimationFrame(() => document.querySelector<HTMLFormElement>('[role="dialog"] form')?.requestSubmit());+ return () => cancelAnimationFrame(frame);+ }, [invalid]);+ return <BotGroupCreateDialog privateChatBotId="preview-bot" onOpenChange={() => {}} onCreated={() => {}} />;+}++mountPage({+ host: ctx => ({ maker: {+ resolveCompanionAvatar: async () => accountAvatar,+ createBotGroup: forbid('maker.createBotGroup'),+ chatServer: {+ status: async () => ({ enabled: true }),+ createInvite: async () => ctx.case === 'loading' ? new Promise(() => {})+ : ctx.case === 'failed' ? { ok: false, errorCode: 'REQUEST_FAILED' }+ : { ok: true, link: 'https://example.invalid/invite/preview', expiresAt: null, reusable: true },+ revokeInvite: forbid('chatServer.revokeInvite'),+ },+ } }),+ render: ctx => ctx.case === 'create' || ctx.case === 'name-error'+ ? <CreatePreview invalid={ctx.case === 'name-error'} />+ : <ChatInviteDialog groupId="preview-group" created={ctx.case === 'default'} members={members} onClose={() => {}} />,+});diff --git a/apps/desktop/scripts/fixtures/group-invite/ui-page.mjs b/apps/desktop/scripts/fixtures/group-invite/ui-page.mjsnew file mode 100644index 0000000000..cd4bfd2602--- /dev/null+++ b/apps/desktop/scripts/fixtures/group-invite/ui-page.mjs@@ -0,0 +1,33 @@+import assert from 'node:assert/strict';++export default {+ name: 'group-invite',+ entry: './fixture.tsx',+ viewport: { width: 720, height: 560 },+ real: 'BotGroupCreateDialog, ChatInviteDialog, BotAvatar and shared input/button/dialog components',+ notCovered: 'Real accounts, group creation, invitation service, clipboard and route transitions; host replies use example data',+ cases: {+ default: { about: 'New group success, creator avatar, invitation slot and copy action' },+ manual: { about: 'Group invitation with close, revoke and copy actions in the footer' },+ loading: { about: 'Automatic invitation generation pending' },+ failed: { about: 'Invitation generation failure with retry' },+ create: { about: 'Private-chat group creation with a focused name and no member picker' },+ 'name-error': { about: 'Required group name and its unclipped error ring' },+ },+ async ready(page) {+ await page.getByRole('dialog').waitFor();+ },+ async check(page, ui) {+ if (ui.case === 'create' || ui.case === 'name-error') {+ assert.equal(await page.getByRole('checkbox').count(), 0);+ if (ui.case === 'name-error') await page.getByText(await ui.t('bots.groupChat.create.nameRequired'), { exact: true }).waitFor();+ return;+ }+ if (ui.case === 'loading') await page.getByRole('status').waitFor();+ else if (ui.case === 'failed') await page.getByRole('alert').waitFor();+ else {+ await page.getByRole('button', { name: await ui.t('bots.groupChat.server.copyLink'), exact: true }).waitFor();+ assert.equal(await page.getByRole('button').count(), ui.case === 'manual' ? 3 : 2);+ }+ },+};diff --git a/apps/desktop/src/renderer/features/bots/BotAddToGroupMenu.tsx b/apps/desktop/src/renderer/features/bots/BotAddToGroupMenu.tsxindex aa8d646831..5ad392094c 100644--- a/apps/desktop/src/renderer/features/bots/BotAddToGroupMenu.tsx+++ b/apps/desktop/src/renderer/features/bots/BotAddToGroupMenu.tsx@@ -1,10 +1,4 @@-/**- * The private chat's way into group chat: start a new group with this teammate- * already picked, or bring them into a group you are in. It reuses the group- * creation dialog and the same member invitation the group settings use, so the- * server's membership rules stay the only authority. The private chat itself is- * untouched — group lanes never carry its history.- */+/** Create a group with the current teammate or add it to an existing group. */import { useRef, useState } from 'react';import { MessagesSquare, UserPlus, Users } from 'lucide-react';import { useNavigate } from 'react-router-dom';@@ -124,9 +118,9 @@ export function BotAddToGroupMenu({ botId }: { botId: string }) {</DropdownMenu>{creating ? (<BotGroupCreateDialog- initialBotIds={[botId]}+ privateChatBotId={botId}onOpenChange={open => { if (!open) { setCreating(false); trigger.current?.focus(); } }}- onCreated={id => { setCreating(false); navigate(groupRoute(id)); }}+ onCreated={id => { setCreating(false); navigate(groupRoute(id), { state: { createdGroupInvite: id } }); }}/>) : null}</>diff --git a/apps/desktop/src/renderer/features/bots/BotGroupChatView.tsx b/apps/desktop/src/renderer/features/bots/BotGroupChatView.tsxindex 3dc42691b1..57531dbd63 100644--- a/apps/desktop/src/renderer/features/bots/BotGroupChatView.tsx+++ b/apps/desktop/src/renderer/features/bots/BotGroupChatView.tsx@@ -1,4 +1,5 @@import { RemoveChatFromListButton } from './RemoveChatFromListButton';+import { ChatInviteDialog } from './ChatInviteDialog';import { useThreadPanelResize } from './useThreadPanelResize';import { cn } from '@/lib/utils';/**@@ -191,9 +192,25 @@ function isAttachmentDrag(event: DragEvent): boolean {export function BotGroupChatView() {const { groupId } = useParams();- const { search } = useLocation();- const direct = new URLSearchParams(search).get('conversationKind') === 'direct';- return <BotGroupChatContent key={`${groupId}:${direct}`} groupId={groupId ?? ''} direct={direct} />;+ const location = useLocation();+ const navigate = useNavigate();+ const [createdInvite, setCreatedInvite] = useState<{ groupId: string; owner: ReturnType<typeof getDataOwnerGeneration> } | null>(null);+ const createdGroup = useBotGroupSummary(createdInvite?.groupId ?? null);+ const direct = new URLSearchParams(location.search).get('conversationKind') === 'direct';+ useEffect(() => {+ if (!groupId || direct || location.state?.createdGroupInvite !== groupId) {+ setCreatedInvite(current => current?.groupId !== groupId || direct ? null : current);+ return;+ }+ setCreatedInvite({ groupId, owner: getDataOwnerGeneration() });+ // Consume the one-off intent so Back, Forward or a refresh cannot create another link.+ navigate(location.pathname + location.search, { replace: true, state: { ...location.state, createdGroupInvite: null } });+ }, [groupId, direct, location.state, location.pathname, location.search, navigate]);+ return <>+ <BotGroupChatContent key={`${groupId}:${direct}`} groupId={groupId ?? ''} direct={direct} />+ {createdInvite !== null && createdInvite.groupId === groupId && !direct && isDataOwnerGenerationCurrent(createdInvite.owner)+ ? <ChatInviteDialog key={groupId} groupId={groupId} created members={createdGroup?.members} onClose={() => setCreatedInvite(null)} /> : null}+ </>;}function BotGroupChatContent({ groupId, direct }: { groupId: string; direct: boolean }) {@@ -743,7 +760,7 @@ function BotGroupChatContent({ groupId, direct }: { groupId: string; direct: boo</span></button><div className="ml-auto flex shrink-0 items-center">- {headerGroup.serverBacked && headerGroup.canInvite && <ChatInviteButton groupId={headerGroup.id} />}+ {headerGroup.serverBacked && headerGroup.canInvite && <ChatInviteButton key={headerGroup.id} groupId={headerGroup.id} members={members} />}{!direct && <Tip text={settingsLabel}><buttontype="button"diff --git a/apps/desktop/src/renderer/features/bots/BotGroupCreateDialog.tsx b/apps/desktop/src/renderer/features/bots/BotGroupCreateDialog.tsxindex c0d9d0c460..6eb1a228a1 100644--- a/apps/desktop/src/renderer/features/bots/BotGroupCreateDialog.tsx+++ b/apps/desktop/src/renderer/features/bots/BotGroupCreateDialog.tsx@@ -1,10 +1,4 @@-/**- * 新建群聊:填群名称,选 2–6 位本机伙伴。- *- * 表单弹窗遵循 DESIGN.md §4 Dialog & Modal:无右上角 ×,点遮罩不关闭(误触不能丢掉- * 填了一半的表单),Esc 与底部「取消」关闭,打开时聚焦群名称。成员数与群名长度由- * main 最终校验,这里先挡住明显不成立的提交并把焦点送到第一个出错的字段。- */+/** Create a group with a fixed private-chat teammate or a selectable roster. */import { useEffect, useMemo, useRef, useState, type FormEvent } from 'react';import * as Dialog from '@radix-ui/react-dialog';import { Check } from 'lucide-react';@@ -21,25 +15,22 @@ import { botGroupApi, refreshBotGroups } from './botGroupStore';import { BOT_GROUP_MAX_MEMBERS, BOT_GROUP_MIN_MEMBERS, botGroupErrorKey } from './botGroupPresentation';import { useBotProfiles, type BotProfile } from './botStore';-/** Local Bots that may appear in the picker; archived and deleting ones never do. */function pickableBots(bots: readonly BotProfile[]): BotProfile[] {return bots.filter((bot) => bot.status !== 'archived' && bot.status !== 'deleting').sort((a, b) => a.createdAt - b.createdAt || a.id.localeCompare(b.id));}-/** Whether a teammate can join a group right now (shared with entry points outside this dialog). */export function isSelectable(bot: BotProfile): boolean {return (bot.status ?? 'active') === 'active' && bot.enabled !== false;}export function BotGroupCreateDialog({- initialBotIds = [],+ privateChatBotId,onOpenChange,onCreated,}: {- /** Preselected teammates, e.g. the one whose private chat started this group. */- initialBotIds?: readonly string[];+ privateChatBotId?: string;onOpenChange: (open: boolean) => void;onCreated: (groupId: string) => void;}) {@@ -49,13 +40,14 @@ export function BotGroupCreateDialog({const selectableCount = candidates.filter(isSelectable).length;const [serverBacked, setServerBacked] = useState(false);useEffect(() => {+ if (privateChatBotId) return;let disposed = false;void botGroupApi()?.chatServer?.status().then(s => { if (!disposed) setServerBacked(s.enabled); }).catch(() => undefined);return () => { disposed = true; };- }, []);- const minMembers = serverBacked ? 0 : BOT_GROUP_MIN_MEMBERS;+ }, [privateChatBotId]);+ const minMembers = privateChatBotId ? 1 : serverBacked ? 0 : BOT_GROUP_MIN_MEMBERS;const [name, setName] = useState('');- const [selectedIds, setSelectedIds] = useState<string[]>(() => initialBotIds.slice(0, BOT_GROUP_MAX_MEMBERS));+ const [selectedIds, setSelectedIds] = useState<string[]>([]);const [nameError, setNameError] = useState(false);const [membersError, setMembersError] = useState(false);const [submitError, setSubmitError] = useState<string | null>(null);@@ -65,7 +57,7 @@ export function BotGroupCreateDialog({const firstMemberRef = useRef<HTMLButtonElement>(null);// Speaking order follows the picker's order, not the click order.- const orderedSelection = candidates+ const orderedSelection = privateChatBotId ? [privateChatBotId] : candidates.filter((bot) => selectedIds.includes(bot.id)).map((bot) => bot.id);const atLimit = orderedSelection.length >= BOT_GROUP_MAX_MEMBERS;@@ -105,6 +97,15 @@ export function BotGroupCreateDialog({const owner = getDataOwnerGeneration();try {if (!api) throw new Error('Bot group IPC is unavailable');+ // This flow must create a shared group: a local-only group cannot invite people.+ if (privateChatBotId) {+ const status = await api.chatServer?.status();+ if (!isDataOwnerGenerationCurrent(owner)) return;+ if (!status?.enabled) {+ setSubmitError(t('bots.groupChat.errors.chatUnavailable'));+ return;+ }+ }const result = await api.createBotGroup({ name: trimmed, botIds: orderedSelection });if (!isDataOwnerGenerationCurrent(owner)) return;if (!result.ok) {@@ -146,11 +147,12 @@ export function BotGroupCreateDialog({<Dialog.Title className="text-18 font-medium text-[var(--confirm-title)]">{t('bots.groupChat.create.title')}</Dialog.Title>- <Dialog.Description className="mt-1 text-13 leading-normal text-[var(--confirm-desc)]">- {t(serverBacked ? 'bots.groupChat.server.createDescription' : 'bots.groupChat.create.description')}+ <Dialog.Description className={privateChatBotId ? 'sr-only' : 'mt-1 text-13 leading-normal text-[var(--confirm-desc)]'}>+ {t(privateChatBotId || serverBacked ? 'bots.groupChat.server.createDescription' : 'bots.groupChat.create.description')}</Dialog.Description>- <div className="mt-4 flex min-h-0 flex-col gap-4 overflow-y-auto">+ {/* Leave room for outer input rings inside the scroll container. */}+ <div className="mt-4 -mx-1 -mb-1 flex min-h-0 flex-col gap-4 overflow-y-auto px-1 pb-1"><FormFieldlabel={t('bots.groupChat.nameLabel')}error={nameError ? t('bots.groupChat.create.nameRequired') : undefined}@@ -179,7 +181,7 @@ export function BotGroupCreateDialog({)}</FormField>- <div className="flex min-w-0 flex-col gap-2">+ {!privateChatBotId && <div className="flex min-w-0 flex-col gap-2"><div className="flex items-center justify-between gap-2"><spanid="bot-group-create-members-label"@@ -256,7 +258,7 @@ export function BotGroupCreateDialog({: null}</p></div>- </div>+ </div>}</div>{submitError ? (diff --git a/apps/desktop/src/renderer/features/bots/ChatInviteDialog.tsx b/apps/desktop/src/renderer/features/bots/ChatInviteDialog.tsxindex e2c24fdf2c..f13736f601 100644--- a/apps/desktop/src/renderer/features/bots/ChatInviteDialog.tsx+++ b/apps/desktop/src/renderer/features/bots/ChatInviteDialog.tsx@@ -1,25 +1,25 @@import { useEffect, useRef, useState } from 'react';import * as Dialog from '@radix-ui/react-dialog';import { useTranslation } from 'react-i18next';+import { Plus } from 'lucide-react';import { Button } from '@/components/ui/button';import { Input } from '@/components/ui/input';import { ConfirmDialog } from '@/components/ui/confirm-dialog';import { getDataOwnerGeneration, isDataOwnerGenerationCurrent } from '@/contexts/dataOwnerGeneration';import { toast } from '@/lib/toast';-import type { ChatInvitePreview } from '../../../shared/botGroupChat';+import { cn } from '@/lib/utils';+import type { BotGroupMemberView, ChatInvitePreview } from '../../../shared/botGroupChat';+import { BotAvatar } from './BotAvatar';import { refreshBotGroups } from './botGroupStore';import { chatErrorKey } from './chatError';const key = (name: string) => `bots.groupChat.server.${name}`;const api = () => window.electronAPI.maker.chatServer;-/**- * Without `groupId` this joins a group: either from a clicked invitation- * (`initialLink`, previewed immediately, no paste field) or from a pasted link.- * `malformedLink` reports a clicked link whose token could not be read.- */-export function ChatInviteDialog({ groupId, initialLink = '', malformedLink = false, onClose, onJoined }: {- groupId?: string; initialLink?: string; malformedLink?: boolean; onClose: () => void; onJoined?: (id: string) => void;+/** Share a group's invitation or preview a received link before joining. */+export function ChatInviteDialog({ groupId, initialLink = '', malformedLink = false, created = false, members = [], onClose, onJoined }: {+ groupId?: string; initialLink?: string; malformedLink?: boolean; created?: boolean; onClose: () => void; onJoined?: (id: string) => void;+ members?: readonly BotGroupMemberView[];}) {const { t, i18n } = useTranslation();const fromLink = !groupId && (Boolean(initialLink) || malformedLink);@@ -34,15 +34,20 @@ export function ChatInviteDialog({ groupId, initialLink = '', malformedLink = faconst [error, setError] = useState(() => malformedLink ? t(key('malformedInvite')) : '');// The server said this invitation cannot be used; asking it again will not help.const [unusable, setUnusable] = useState(malformedLink);- const [busy, setBusy] = useState(fromLink && !malformedLink);+ const [busy, setBusy] = useState(!!groupId || (fromLink && !malformedLink));+ const [copied, setCopied] = useState(false);const busyRef = useRef(false);const mounted = useRef(true);const operation = useRef(crypto.randomUUID());const revokeOperation = useRef(crypto.randomUUID());+ const contentRef = useRef<HTMLDivElement>(null);+ const copyButtonRef = useRef<HTMLButtonElement>(null);useEffect(() => { mounted.current = true; return () => { mounted.current = false; }; }, []);- // A clicked link already expresses the intent to look (once, on open); joining still- // needs the explicit accept.- useEffect(() => { if (fromLink && !malformedLink) void run(); }, []);+ useEffect(() => {+ if (groupId && link && document.activeElement === contentRef.current) copyButtonRef.current?.focus();+ }, [groupId, link]);+ // Generate outgoing links on open; received invitations still require acceptance.+ useEffect(() => { if ((fromLink && !malformedLink) || groupId) void run(); }, []);const expiry = groupId ? expiresAt : preview?.expiresAt;const expired = typeof expiry === 'string' && Date.parse(expiry) <= now;useEffect(() => {@@ -56,7 +61,7 @@ export function ChatInviteDialog({ groupId, initialLink = '', malformedLink = fareturn () => clearTimeout(timer);}, [expiry, now]);const validity = revoked ? t(key('revokedLink'))- : expiry === null && (groupId ? reusable : preview?.reusable) === true ? t(key('reusableLink'))+ : !groupId && expiry === null && preview?.reusable === true ? t(key('reusableLink')): expired ? t(key('expiredLink')): typeof expiry === 'string' && Number.isFinite(Date.parse(expiry))? t(key('singleUseUntil'), { date: new Date(expiry).toLocaleString(i18n.language) }) : '';@@ -66,14 +71,13 @@ export function ChatInviteDialog({ groupId, initialLink = '', malformedLink = fabusyRef.current = true; setBusy(true); setError('');const owner = getDataOwnerGeneration();const current = () => mounted.current && isDataOwnerGenerationCurrent(owner);- // Reading an invitation is side-effect free; a result discarded for an older owner- // generation is simply read again for the current one instead of leaving the dialog loading.+ // Only read-only previews may retry after an owner-generation update.const reading = action === 'main' && !groupId && !preview;try {if (action === 'copy') {if (expired || (typeof expiry === 'string' && Date.parse(expiry) <= Date.now()) || revoked || !link) return;await navigator.clipboard.writeText(link);- if (current()) toast.success(t(key('copied')));+ if (current()) setCopied(true);} else if (action === 'revoke') {if (!groupId || !link || revoked || !canRevoke) return;const result = await api().revokeInvite({ groupId, link, clientId: revokeOperation.current });@@ -87,6 +91,7 @@ export function ChatInviteDialog({ groupId, initialLink = '', malformedLink = fasetRevoked(true); operation.current = crypto.randomUUID();toast.success(t(key('revokedLink')));} else if (groupId) {+ setCopied(false);const result = await api().createInvite({ groupId, clientId: operation.current });if (!current()) return;if (!result.ok) { setError(t(chatErrorKey(result.errorCode))); return; }@@ -118,8 +123,7 @@ export function ChatInviteDialog({ groupId, initialLink = '', malformedLink = fa}finally {busyRef.current = false;- // Request results belong to their owner generation; transient UI cleanup- // belongs to the mounted dialog, which can survive a same-owner update.+ // Clear transient UI even when the request's owner generation changed.if (mounted.current) {setBusy(false);if (action === 'revoke') setRevokeConfirm(false);@@ -127,18 +131,41 @@ export function ChatInviteDialog({ groupId, initialLink = '', malformedLink = fa}}}- const title = t(key(groupId ? 'invite' : 'join'));- // Reading a clicked invitation changes nothing, so it never traps the user; accepting,- // creating and revoking still hold the dialog until their result is known.- const locked = () => busyRef.current && !(fromLink && !preview);+ const title = t(key(groupId ? created ? 'groupCreated' : 'invite' : 'join'));+ const creator = members.find(member => member.isSelf);+ // Allow dismissal during link generation, but not acceptance or revocation.+ const locked = () => busyRef.current && (revokeConfirm || (!groupId && !(fromLink && !preview)));return <Dialog.Root open onOpenChange={open => !open && !locked() && onClose()}><Dialog.Portal><Dialog.Overlay className="modal-scrim fixed inset-0 z-[70]" />- <Dialog.Content onPointerDownOutside={e => e.preventDefault()}+ <Dialog.Content ref={contentRef} onPointerDownOutside={e => e.preventDefault()}+ onOpenAutoFocus={e => { if (groupId) { e.preventDefault(); contentRef.current?.focus(); } }}onEscapeKeyDown={e => { if (e.isComposing || e.keyCode === 229 || locked()) e.preventDefault(); }}- className="modal-panel fixed inset-0 z-[71] m-auto flex h-fit max-h-[85vh] w-[min(460px,calc(100vw-32px))] flex-col gap-4 p-5 outline-none">- <Dialog.Title className="text-18 font-medium text-[var(--confirm-title)]">{title}</Dialog.Title>- <Dialog.Description className="text-13 leading-normal text-[var(--confirm-desc)]">{t(key(groupId ? 'inviteDescription' : fromLink ? 'linkDescription' : 'joinDescription'))}</Dialog.Description>+ className={cn('modal-panel fixed inset-0 z-[71] m-auto flex h-fit max-h-[85vh] flex-col outline-none',+ groupId && created ? 'w-[min(420px,calc(100vw-32px))]' : 'w-[min(460px,calc(100vw-32px))]',+ groupId ? 'gap-5 p-6' : 'gap-4 p-5')}>+ {groupId ? <div className="flex flex-col items-center gap-3 pt-1 text-center">+ <div aria-hidden className="flex items-center">+ {creator && <span className="flex rounded-full border-2 border-[var(--confirm-bg)]">+ <BotAvatar bot={creator} size="md" />+ </span>}+ {/* Opaque backing beneath the theme's translucent chip fill. */}+ <span className={cn('relative flex h-11 w-11 rounded-full border-2 border-[var(--confirm-bg)] bg-[var(--confirm-bg)] text-[var(--text-secondary)]', creator && '-ml-3')}>+ <span className="flex h-full w-full items-center justify-center rounded-full border border-dashed border-[var(--text-tertiary)] bg-[var(--surface-chip)]">+ <Plus size={20} strokeWidth={1.6} />+ </span>+ </span>+ </div>+ <div className="flex flex-col gap-2">+ <Dialog.Title className="text-20 font-medium text-[var(--confirm-title)]">{title}</Dialog.Title>+ <Dialog.Description className="text-13 leading-normal text-[var(--text-secondary)]">{t(key('inviteFriends'))}</Dialog.Description>+ </div>+ </div> : <>+ <Dialog.Title className="text-18 font-medium text-[var(--confirm-title)]">{title}</Dialog.Title>+ <Dialog.Description className="text-13 leading-normal text-[var(--confirm-desc)]">{t(key(fromLink ? 'linkDescription' : 'joinDescription'))}</Dialog.Description>+ </>}+ {groupId && busy && !link && <p role="status" className="text-13 text-[var(--text-secondary)]">{t(key('generatingLink'))}</p>}{!fromLink && (!groupId || link) && <Input aria-label={t(key('inviteLink'))} value={link} readOnly={!!groupId} disabled={busy || revoked}+ size={groupId ? 'md' : 'lg'} inputClassName={groupId ? 'text-12 text-[var(--text-secondary)]' : undefined}placeholder={t(key('pasteLink'))} onChange={value => { setLink(value); setPreview(null); setError(''); operation.current = crypto.randomUUID(); }} />}{fromLink && !preview && !error && <p role="status" className="text-13 leading-normal text-[var(--text-secondary)]">{t(key('loadingInvite'))}</p>}{preview && <div className="space-y-1 rounded-lg bg-[var(--surface-elevated)] p-3">@@ -146,13 +173,13 @@ export function ChatInviteDialog({ groupId, initialLink = '', malformedLink = fa<p className="text-13 text-[var(--text-secondary)]">{t(key('invitedBy'), { name: preview.inviterName })}</p></div>}{validity && <p role="status" className="text-13 leading-normal text-[var(--text-secondary)]">{validity}</p>}- {groupId && link && !revoked && !expired && !canRevoke && <p className="text-13 leading-normal text-[var(--text-secondary)]">{t(key('revokeUnsupported'))}</p>}+ {!created && groupId && link && !revoked && !expired && !canRevoke && <p className="text-13 leading-normal text-[var(--text-secondary)]">{t(key('revokeUnsupported'))}</p>}{error && <p role="alert" className="text-13 text-[var(--error-fg)]">{error}</p>}- <div className="flex flex-wrap justify-end gap-2">- <Button variant="secondary" palette="confirmation" size="lg" disabled={busy && !(fromLink && !preview)} onClick={onClose}>{t('bots.close')}</Button>- {groupId && link && !revoked && !expired && <Button variant="secondary" palette="confirmation" size="lg" disabled={busy || !canRevoke} onClick={() => setRevokeConfirm(true)}>{t(key('revokeLink'))}</Button>}+ <div className={cn('flex flex-wrap justify-end gap-2', groupId && 'pt-1')}>+ <Button variant="secondary" palette="confirmation" size="lg" compact={!!groupId && !created} disabled={locked()} onClick={onClose}>{t('bots.close')}</Button>+ {!created && groupId && link && !revoked && !expired && <Button variant="secondary" palette="confirmation" size="lg" compact disabled={busy || !canRevoke} onClick={() => setRevokeConfirm(true)}>{t(key('revokeLink'))}</Button>}{groupId && link && !expired && !revoked- ? <Button variant="cta" palette="confirmation" size="lg" loading={busy} onClick={() => void run('copy')}>{t(key('copyLink'))}</Button>+ ? <Button ref={copyButtonRef} variant="cta" palette="confirmation" size="lg" compact={!created} loading={busy} onClick={() => void run('copy')}>{t(key(copied ? 'copied' : 'copyLink'))}</Button>: (!fromLink || preview || (error && !unusable)) && <Button variant="cta" palette="confirmation" size="lg" loading={busy} disabled={!groupId && (!link.trim() || expired)} onClick={() => void run()}>{t(key(groupId ? 'createLink' : preview ? 'accept' : fromLink ? 'retryInvite' : 'previewInvite'))}</Button>}diff --git a/apps/desktop/src/renderer/features/bots/ChatServerControls.tsx b/apps/desktop/src/renderer/features/bots/ChatServerControls.tsxindex 3e9c4eab4a..f5c17ba847 100644--- a/apps/desktop/src/renderer/features/bots/ChatServerControls.tsx+++ b/apps/desktop/src/renderer/features/bots/ChatServerControls.tsx@@ -131,12 +131,12 @@ export function ChatMessageActions(props: ChatMessageActionProps) {}/** Group owners and admins create or revoke invitation links from the group header. */-export function ChatInviteButton({ groupId }: { groupId: string }) {+export function ChatInviteButton({ groupId, members }: { groupId: string; members?: readonly BotGroupMemberView[] }) {const { t } = useTranslation();const [open, setOpen] = useState(false);const title = t(key('invite'));return <><Tip text={title}><button type="button" className={iconClass} style={WINDOW_NO_DRAG_STYLE} aria-label={title} onClick={() => setOpen(true)}><UserPlus size={16} /></button></Tip>- {open && <ChatInviteDialog groupId={groupId} onClose={() => setOpen(false)} />}+ {open && <ChatInviteDialog groupId={groupId} members={members} onClose={() => setOpen(false)} />}</>;}diff --git a/apps/desktop/src/renderer/features/bots/__tests__/BotAddToGroupMenu.test.tsx b/apps/desktop/src/renderer/features/bots/__tests__/BotAddToGroupMenu.test.tsxindex 40ae3de564..ac383bb54e 100644--- a/apps/desktop/src/renderer/features/bots/__tests__/BotAddToGroupMenu.test.tsx+++ b/apps/desktop/src/renderer/features/bots/__tests__/BotAddToGroupMenu.test.tsx@@ -14,8 +14,8 @@ vi.mock('../botGroupStore', () => ({ useBotGroupList: () => ({ groups: mocks.grovi.mock('@/lib/toast', () => ({ toast: { success: mocks.success, error: mocks.error } }));vi.mock('../BotGroupCreateDialog', async importOriginal => ({...await importOriginal<typeof import('../BotGroupCreateDialog')>(),- BotGroupCreateDialog: (props: { initialBotIds?: string[]; onCreated: (id: string) => void }) => {- mocks.createDialog(props.initialBotIds);+ BotGroupCreateDialog: (props: { privateChatBotId?: string; onCreated: (id: string) => void }) => {+ mocks.createDialog(props.privateChatBotId);return <div role="dialog"><button type="button" onClick={() => props.onCreated('new-room')}>create</button></div>;},}));@@ -59,14 +59,14 @@ it('offers no entry for a teammate that is not on this computer', () => {expect(screen.queryByRole('button', { name: /triggerFor/ })).toBeNull();});-it('starts a new group with this teammate preselected and opens it', () => {+it('starts a new group with this teammate fixed and opens it', () => {render(<BotAddToGroupMenu botId="bot-1" />);openMenu();expect(mocks.refresh).toHaveBeenCalled();fireEvent.click(screen.getByRole('menuitem', { name: k('newGroup') }));- expect(mocks.createDialog).toHaveBeenCalledWith(['bot-1']);+ expect(mocks.createDialog).toHaveBeenCalledWith('bot-1');fireEvent.click(screen.getByRole('button', { name: 'create' }));- expect(mocks.navigate).toHaveBeenCalledWith('/bots/groups/new-room');+ expect(mocks.navigate).toHaveBeenCalledWith('/bots/groups/new-room', { state: { createdGroupInvite: 'new-room' } });expect(mocks.manage).not.toHaveBeenCalled();});diff --git a/apps/desktop/src/renderer/features/bots/__tests__/BotGroupChatView.test.tsx b/apps/desktop/src/renderer/features/bots/__tests__/BotGroupChatView.test.tsxindex 1adc49cfa8..7e5128dc43 100644--- a/apps/desktop/src/renderer/features/bots/__tests__/BotGroupChatView.test.tsx+++ b/apps/desktop/src/renderer/features/bots/__tests__/BotGroupChatView.test.tsx@@ -31,6 +31,8 @@ const mocks = vi.hoisted(() => ({options && 'name' in options ? `${key}:${String(options.name)}`: key === 'bots.groupChat.memberCount' ? `${key}:${String(options?.count)}` : key,groupId: 'g1',+ locationState: null as { createdGroupInvite?: string | null } | null,+ createInvite: vi.fn(),navigate: vi.fn(),getBotGroup: vi.fn(),cachedGroup: null as BotGroupDetail | null,@@ -72,7 +74,7 @@ vi.mock('react-i18next', async (original) => ({}),}));vi.mock('react-router-dom', () => ({- useLocation: () => ({ pathname: '/bots/groups/g1', search: '' }),+ useLocation: () => ({ pathname: `/bots/groups/${mocks.groupId}`, search: '', state: mocks.locationState }),useNavigate: () => mocks.navigate,useParams: () => ({ groupId: mocks.groupId }),}));@@ -284,6 +286,8 @@ beforeEach(() => {resetBotReadStateForTests();resetBotGroupOutboxForTests();mocks.groupId = 'g1';+ mocks.locationState = null;+ mocks.createInvite.mockReset().mockResolvedValue({ ok: true, link: 'cindy://chat-invite/preview', expiresAt: null, reusable: true });__resetControlledBannerForTests();mocks.controlledPush = null;mocks.getControlledState.mockReset().mockResolvedValue({ controlledBy: [] });@@ -332,7 +336,7 @@ beforeEach(() => {cleanupCachedImages: vi.fn(async () => undefined),getFileThumbnail: vi.fn(async () => null),maker: {- chatServer: { thread: mocks.thread, reply: mocks.reply, shareToMain: mocks.shareToMain, reactors: vi.fn(async () => ({ ok: true, reactors: [] })) },+ chatServer: { createInvite: mocks.createInvite, thread: mocks.thread, reply: mocks.reply, shareToMain: mocks.shareToMain, reactors: vi.fn(async () => ({ ok: true, reactors: [] })) },listBotGroups: vi.fn(async () => ({ ok: true, groups: [] })),getBotGroup: (...args: unknown[]) => (args[1] as { cacheOnly?: boolean } | undefined)?.cacheOnly? Promise.resolve(mocks.cachedGroup ? { ok: true, group: mocks.cachedGroup } : { ok: false, errorCode: 'NOT_FOUND' })@@ -359,6 +363,25 @@ beforeEach(() => {afterEach(() => { cleanup(); vi.unstubAllGlobals(); });describe('BotGroupChatView', () => {+ // Regression: returning to a group must not replay its consumed creation intent.+ it('does not reopen a created invitation or regenerate its link after leaving and returning', async () => {+ mocks.locationState = { createdGroupInvite: 'g1' };+ const tree = () => <Tooltip.Provider><FeatureSidebarSlotProvider isCollapsed={false}>+ <HeaderSlot /><BotGroupChatView />+ </FeatureSidebarSlotProvider></Tooltip.Provider>;+ const view = render(tree());+ await screen.findByRole('button', { name: 'bots.groupChat.server.copyLink' });+ expect(mocks.createInvite).toHaveBeenCalledTimes(1);+ mocks.locationState = { createdGroupInvite: null };+ mocks.groupId = 'g2';+ view.rerender(tree());+ expect(screen.queryByRole('dialog')).toBeNull();+ mocks.groupId = 'g1';+ view.rerender(tree());+ expect(screen.queryByRole('dialog')).toBeNull();+ expect(mocks.createInvite).toHaveBeenCalledTimes(1);+ });+it('clears the selected route when an authoritative personal hide unmounts settings', async () => {renderView();await screen.findByRole('textbox');diff --git a/apps/desktop/src/renderer/features/bots/__tests__/BotGroupCreateDialog.test.tsx b/apps/desktop/src/renderer/features/bots/__tests__/BotGroupCreateDialog.test.tsxindex b17a9415f6..78b81c39e7 100644--- a/apps/desktop/src/renderer/features/bots/__tests__/BotGroupCreateDialog.test.tsx+++ b/apps/desktop/src/renderer/features/bots/__tests__/BotGroupCreateDialog.test.tsx@@ -63,6 +63,27 @@ beforeEach(() => {afterEach(cleanup);describe('BotGroupCreateDialog', () => {+ it('creates from a private chat with only its teammate and no member picker', async () => {+ mocks.status.mockResolvedValue({ enabled: true });+ const onCreated = vi.fn();+ render(<BotGroupCreateDialog privateChatBotId="c" onOpenChange={vi.fn()} onCreated={onCreated} />);+ expect(screen.queryAllByRole('checkbox')).toHaveLength(0);+ expect(document.activeElement).toBe(screen.getByRole('textbox'));+ fireEvent.change(screen.getByRole('textbox'), { target: { value: ' 项目讨论 ' } });+ fireEvent.click(screen.getByRole('button', { name: 'bots.groupChat.create.submit' }));+ await waitFor(() => expect(onCreated).toHaveBeenCalledWith('g-new'));+ expect(mocks.createBotGroup).toHaveBeenCalledExactlyOnceWith({ name: '项目讨论', botIds: ['c'] });+ });++ it('does not silently create a local-only group from a private chat', async () => {+ render(<BotGroupCreateDialog privateChatBotId="c" onOpenChange={vi.fn()} onCreated={vi.fn()} />);+ fireEvent.change(screen.getByRole('textbox'), { target: { value: '项目讨论' } });+ fireEvent.click(screen.getByRole('button', { name: 'bots.groupChat.create.submit' }));+ expect(await screen.findByRole('alert')).toHaveProperty('textContent', 'bots.groupChat.errors.chatUnavailable');+ expect(screen.getByRole('textbox')).toHaveProperty('value', '项目讨论');+ expect(mocks.createBotGroup).not.toHaveBeenCalled();+ });+it('focuses the name, lists local teammates and blocks paused or archived ones', () => {renderDialog();expect(document.activeElement).toBe(screen.getByRole('textbox'));@@ -112,18 +133,6 @@ describe('BotGroupCreateDialog', () => {expect(onCreated).not.toHaveBeenCalled();});- it('starts with the private-chat teammate already picked and still lets the user change it', async () => {- const onCreated = vi.fn();- render(<BotGroupCreateDialog initialBotIds={['c']} onOpenChange={vi.fn()} onCreated={onCreated} />);- expect(checkbox('Bot c').getAttribute('aria-checked')).toBe('true');- expect(checkbox('Bot a').getAttribute('aria-checked')).toBe('false');- fireEvent.change(screen.getByRole('textbox'), { target: { value: '新项目' } });- fireEvent.click(checkbox('Bot a'));- fireEvent.click(screen.getByRole('button', { name: 'bots.groupChat.create.submit' }));- await waitFor(() => expect(onCreated).toHaveBeenCalledWith('g-new'));- expect(mocks.createBotGroup).toHaveBeenCalledWith({ name: '新项目', botIds: ['a', 'c'] });- });-it('closes from Cancel', () => {const { onOpenChange } = renderDialog();fireEvent.click(screen.getByRole('button', { name: 'bots.cancel' }));diff --git a/apps/desktop/src/renderer/features/bots/__tests__/ChatInviteDialog.test.tsx b/apps/desktop/src/renderer/features/bots/__tests__/ChatInviteDialog.test.tsxindex 74c5baf817..fb6bbed738 100644--- a/apps/desktop/src/renderer/features/bots/__tests__/ChatInviteDialog.test.tsx+++ b/apps/desktop/src/renderer/features/bots/__tests__/ChatInviteDialog.test.tsx@@ -20,15 +20,39 @@ beforeEach(() => {});afterEach(() => { cleanup(); vi.useRealTimers(); });async function create() {- render(<ChatInviteDialog groupId="room" onClose={vi.fn()} />);- await act(async () => fireEvent.click(screen.getByRole('button', { name: k('createLink') })));+ await act(async () => { render(<ChatInviteDialog groupId="room" onClose={vi.fn()} />); });}describe('invitation validity', () => {- it('shows null as reusable and copies the same link repeatedly without generating more', async () => {+ it('automatically generates a link after creation with just close and copy actions', async () => {+ render(<ChatInviteDialog groupId="new-room" created onClose={vi.fn()} />);+ expect(screen.getByRole('heading').textContent).toBe(k('groupCreated'));+ const copy = await screen.findByRole('button', { name: k('copyLink') });+ expect(mocks.createInvite).toHaveBeenCalledExactlyOnceWith({ groupId: 'new-room', clientId: expect.any(String) });+ expect(screen.queryByRole('button', { name: k('revokeLink') })).toBeNull();+ expect(screen.getByText(k('inviteFriends'))).toBeTruthy();+ expect(screen.queryByText(k('reusableLink'))).toBeNull();+ expect(screen.getAllByRole('button')).toHaveLength(2);+ await act(async () => fireEvent.click(copy));+ expect(mocks.copy).toHaveBeenCalledWith(link);+ expect(screen.getByRole('button', { name: k('copied') })).toBeTruthy();+ expect(mocks.success).not.toHaveBeenCalled();+ });++ it.each([false, true])('retries only the invitation with the same operation after automatic generation fails (created=%s)', async created => {+ mocks.createInvite.mockResolvedValueOnce({ ok: false, errorCode: 'REQUEST_TIMEOUT' });+ render(<ChatInviteDialog groupId="new-room" created={created} onClose={vi.fn()} />);+ await screen.findByRole('alert');+ await act(async () => fireEvent.click(screen.getByRole('button', { name: k('createLink') })));+ await screen.findByRole('button', { name: k('copyLink') });+ expect(mocks.createInvite).toHaveBeenCalledTimes(2);+ expect(mocks.createInvite.mock.calls[0][0]).toEqual(mocks.createInvite.mock.calls[1][0]);+ });++ it('copies the same reusable link repeatedly without generating more or showing extra validity text', async () => {await create();- expect(screen.getByRole('status').textContent).toBe(k('reusableLink'));- await act(async () => fireEvent.click(screen.getByRole('button', { name: k('copyLink') })));+ expect(screen.queryByText(k('reusableLink'))).toBeNull();await act(async () => fireEvent.click(screen.getByRole('button', { name: k('copyLink') })));+ await act(async () => fireEvent.click(screen.getByRole('button', { name: k('copied') })));expect(mocks.copy.mock.calls).toEqual([[link], [link]]);expect(mocks.createInvite).toHaveBeenCalledOnce();});@@ -78,7 +102,7 @@ describe('invitation validity', () => {await act(async () => fireEvent.click(screen.getByRole('button', { name: k('createLink') })));expect((screen.getByRole('textbox') as HTMLInputElement).value).toBe(newLink);expect(mocks.createInvite.mock.calls[0][0].clientId).not.toBe(mocks.createInvite.mock.calls[1][0].clientId);- expect(screen.getByRole('status').textContent).toBe(k('reusableLink'));+ expect(screen.queryByText(k('reusableLink'))).toBeNull();});it.each(['ROLE_REQUIRED', 'INVITATION_NOT_FOUND', 'REQUEST_TIMEOUT', 'INVITE_REVOKE_UNSUPPORTED'])('retains state when revoke fails with %s', async errorCode => {mocks.revokeInvite.mockResolvedValue({ ok: false, errorCode });@@ -86,7 +110,7 @@ describe('invitation validity', () => {fireEvent.click(screen.getByRole('button', { name: k('revokeLink') }));await act(async () => fireEvent.click(screen.getAllByRole('button', { name: k('revokeLink') }).at(-1)!));expect(screen.getByRole('alert')).toBeTruthy();- expect(screen.getByRole('status').textContent).toBe(k('reusableLink'));+ expect(screen.queryByText(k('reusableLink'))).toBeNull();expect((screen.getByRole('textbox') as HTMLInputElement).value).toBe(link);expect(screen.getByRole('button', { name: k('copyLink') })).toBeTruthy();expect(mocks.success).not.toHaveBeenCalled();@@ -140,7 +164,7 @@ describe('invitation validity', () => {mocks.revokeInvite.mockReturnValue(new Promise((resolve, fail) => { finish = resolve; reject = fail; }));const onClose = vi.fn();render(<ChatInviteDialog groupId="room" onClose={onClose} />);- await act(async () => fireEvent.click(screen.getByRole('button', { name: k('createLink') })));+ await screen.findByRole('button', { name: k('copyLink') });fireEvent.click(screen.getByRole('button', { name: k('revokeLink') }));fireEvent.click(screen.getByRole('button', { name: k('revokeLink') }));expect((screen.getByRole('button', { name: 'commonUi.confirmDialog.cancel' }) as HTMLButtonElement).disabled).toBe(true);@@ -151,7 +175,7 @@ describe('invitation validity', () => {});expect(screen.queryByRole('alertdialog')).toBeNull();expect(screen.queryByRole('alert')).toBeNull();- expect(screen.getByRole('status').textContent).toBe(k('reusableLink'));+ expect(screen.queryByText(k('reusableLink'))).toBeNull();expect(mocks.success).not.toHaveBeenCalled();const close = screen.getByRole('button', { name: 'bots.close' }) as HTMLButtonElement;expect(close.disabled).toBe(false);diff --git a/apps/desktop/src/renderer/features/bots/__tests__/ChatServerControls.test.tsx b/apps/desktop/src/renderer/features/bots/__tests__/ChatServerControls.test.tsxindex eb2a562b8a..b3801b4610 100644--- a/apps/desktop/src/renderer/features/bots/__tests__/ChatServerControls.test.tsx+++ b/apps/desktop/src/renderer/features/bots/__tests__/ChatServerControls.test.tsx@@ -24,7 +24,7 @@ vi.mock('react-i18next', async (original) => ({useTranslation: () => ({ t: (key: string) => key, i18n: { language: 'en' } }),}));vi.mock('@/components/chat/MarkdownRenderer', () => ({ MarkdownRenderer: ({ content }: { content: string }) => <div>{content}</div> }));-vi.mock('../BotAvatar', () => ({ BotAvatar: () => null }));+vi.mock('../BotAvatar', () => ({ BotAvatar: ({ bot }: { bot: { avatar?: string } }) => <span>{bot.avatar}</span> }));vi.mock('../botGroupStore', () => ({ refreshBotGroups: mocks.refresh }));vi.mock('@/lib/toast', () => ({ toast: { error: vi.fn(), success: vi.fn() } }));vi.mock('@/contexts/dataOwnerGeneration', () => ({@@ -580,10 +580,16 @@ describe('chat interaction controls', () => {});it('creates and displays a copyable link in Strict Mode', async () => {- render(<StrictMode><ChatInviteButton groupId="room" /></StrictMode>);+ render(<StrictMode><ChatInviteButton groupId="room" members={[+ { botId: 'self', name: 'Alex', avatar: '👤', avatarColor: 'graphite', status: 'active', isSelf: true },+ { botId: 'bot', name: 'Cindy', avatar: '🤖', avatarColor: 'violet', status: 'active' },+ ]} /></StrictMode>);fireEvent.click(screen.getByRole('button', { name: k('invite') }));- fireEvent.click(screen.getByRole('button', { name: k('createLink') }));expect((await screen.findByRole('textbox', { name: k('inviteLink') }) as HTMLInputElement).value).toBe('cindy://chat-invite/test');+ expect(mocks.createInvite).toHaveBeenCalledExactlyOnceWith({ groupId: 'room', clientId: expect.any(String) });+ expect(screen.queryByRole('button', { name: k('createLink') })).toBeNull();+ expect(screen.getByText('👤')).toBeTruthy();+ expect(screen.queryByText('🤖')).toBeNull();});it.each([{ members: [] }, { members: [{ botId: 'namesake', name: 'Ann', status: 'active' as const }] }])('keeps a refused directed thread reply after the roster changes to %j', async ({ members }) => {diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.jsonindex 20e794740b..fcbfc2b588 100644--- a/apps/desktop/src/renderer/i18n/locales/en/common.json+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json@@ -10514,8 +10514,10 @@"reactorsUnavailable_one": "Name unavailable for {{count}} more member","reactorsUnavailable_other": "Names unavailable for {{count}} more members","invite": "Invite to group",+ "groupCreated": "Group Chat Created",+ "inviteFriends": "Invite friends to join and work with your teammate.",+ "generatingLink": "Generating invitation link…","join": "Join group",- "inviteDescription": "People who accept the invitation join the group and can read its chat history.","revokeLink": "Revoke this link","revokeDescription": "This link will stop accepting new members. Other invitation links and existing members are unaffected.","revokedLink": "This invitation link has been revoked.",diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.jsonindex c9d64370c3..64c883aa25 100644--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json@@ -10479,8 +10479,10 @@"reactorsUnavailable_one": "ほか {{count}} 人のメンバー情報は表示できません","reactorsUnavailable_other": "ほか {{count}} 人のメンバー情報は表示できません","invite": "グループに招待",+ "groupCreated": "グループチャットを作成しました",+ "inviteFriends": "友達を招待して、一緒にパートナーを使いましょう",+ "generatingLink": "招待リンクを作成中…","join": "グループに参加",- "inviteDescription": "招待を承諾するとメンバーになり、チャット履歴を閲覧できます。","revokeLink": "このリンクを無効にする","revokeDescription": "このリンクからはグループに参加できなくなります。他の招待リンクや既存のメンバーには影響しません。","revokedLink": "この招待リンクは無効化されました。",diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.jsonindex b5c597adfe..abc69ff36a 100644--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json@@ -10479,8 +10479,10 @@"reactorsUnavailable_one": "외 {{count}}명의 멤버 정보를 표시할 수 없습니다","reactorsUnavailable_other": "외 {{count}}명의 멤버 정보를 표시할 수 없습니다","invite": "그룹에 초대",+ "groupCreated": "그룹 채팅이 생성되었습니다",+ "inviteFriends": "친구를 초대해 함께 파트너를 사용해 보세요",+ "generatingLink": "초대 링크 생성 중…","join": "그룹 참여",- "inviteDescription": "초대를 수락하면 그룹 구성원이 되어 대화 기록을 볼 수 있습니다.","revokeLink": "이 링크 취소","revokeDescription": "이 링크로는 더 이상 그룹에 참여할 수 없습니다. 다른 초대 링크와 기존 구성원은 영향을 받지 않습니다.","revokedLink": "이 초대 링크는 취소되었습니다.",diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.jsonindex 3d5d09cb94..575aa7b8da 100644--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json@@ -10479,8 +10479,10 @@"reactorsUnavailable_one": "另有 {{count}} 位成员的信息暂不可用","reactorsUnavailable_other": "另有 {{count}} 位成员的信息暂不可用","invite": "邀请加入群聊",+ "groupCreated": "群聊已创建",+ "inviteFriends": "邀请朋友加入,一起使用伙伴",+ "generatingLink": "正在生成邀请链接…","join": "加入群聊",- "inviteDescription": "对方接受邀请后会成为群成员,可阅读群聊记录。","revokeLink": "撤销此链接","revokeDescription": "此链接将无法再用于加入群聊。其他邀请链接和已加入的成员不受影响。","revokedLink": "此邀请链接已撤销。",diff --git a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.jsonindex cb08e66e30..0c1bf23326 100644--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json@@ -10479,8 +10479,10 @@"reactorsUnavailable_one": "另有 {{count}} 位成員的資訊暫不可用","reactorsUnavailable_other": "另有 {{count}} 位成員的資訊暫不可用","invite": "邀請加入群聊",+ "groupCreated": "群聊已建立",+ "inviteFriends": "邀請朋友加入,一起使用夥伴",+ "generatingLink": "正在產生邀請連結…","join": "加入群聊",- "inviteDescription": "對方接受邀請後會成為群組成員,可閱讀群聊記錄。","revokeLink": "撤銷此連結","revokeDescription": "此連結將無法再用於加入群組。其他邀請連結和已加入的成員不受影響。","revokedLink": "此邀請連結已撤銷。",diff --git a/docs/product-rules/bot-group-chat.md b/docs/product-rules/bot-group-chat.mdindex 289a35ac58..40db82449d 100644--- a/docs/product-rules/bot-group-chat.md+++ b/docs/product-rules/bot-group-chat.md@@ -41,7 +41,9 @@修改群资料不算活动。空群按创建时间排序,但不增加创建提示消息。顶部统一用一个加号提供「新建伙伴」和「新建群聊」两个创建入口,分隔线下另有「输入邀请链接…」作为手动加群的后备;不再常驻单独的加群按钮。搜索同时覆盖伙伴与群聊。-- **私聊右上角可以把伙伴带进群**:本机可用伙伴的私聊头部有「添加到群聊」:「发起群聊…」打开新建群聊并预选该伙伴;+- **私聊右上角可以把伙伴带进群**:本机可用伙伴的私聊头部有「添加到群聊」:「发起群聊…」只填写群名称,自动带入当前伙伴,不显示伙伴选择列表;+ 创建服务器群后进入新群,自动打开「群聊已创建」邀请弹窗并生成邀请链接。复制在原位反馈,关闭后留在群里;+ 链接生成失败只重试邀请,不重复建群。群聊服务不可用时保留输入并提示,不降级为不能邀请人的本地群。「添加到已有群聊」只列出你已加入、未归档、该伙伴尚未在内的服务端群,沿用群设置「邀请我的伙伴」的成员邀请,权限以服务端为准(已加入成员可带入自己的伙伴),失败如实提示。子菜单先写明「将 某伙伴 添加到」,每行是目标群名;添加进行中菜单不能再次打开,成功提示带「打开群聊」,切换账号后旧提示不再导航。原私聊保持不变,私聊记录不会带进群。@@ -743,8 +745,13 @@ Desktop 群聊只对 `TOKEN_EXPIRED`、`INVALID_TOKEN`、`AUTH_REQUIRED` 的 401### Desktop 群邀请链接的有效期与撤销-邀请弹窗按服务端真实响应显示规则:只有 `expiresAt=null` 且 `reusable=true` 才标为长期有效、-可供多人重复使用。旧服务端返回的到期时间及省略的 `reusable` 仍按单次链接显示实际到期时间;+群内手动邀请和建群后的邀请复用 `ChatInviteDialog`:打开即生成链接,不再先点「生成邀请链接」。+两者共用当前用户头像、带不透明底色与虚线描边的「+」空位、邀请朋友说明和原位复制反馈;+只有建群后的标题写「群聊已创建」。手动邀请的「撤销此链接」与「关闭」「复制邀请链接」同放底部操作行。+离开新建群时清空自动邀请状态,返回该群不重复弹窗或请求链接。++邀请按服务端真实响应判断规则:只有 `expiresAt=null` 且 `reusable=true` 才视为长期有效、+可供多人重复使用;发送方不展示常规有效期说明。旧服务端返回的到期时间及省略的 `reusable` 仍按单次链接显示实际到期时间;不把缺失字段当作永久链接。到期后停止复制和接受,已加入成员仍可打开群聊。「撤销此链接」需确认,只作废弹窗中当前这一条链接,不影响同群其他链接或已加入成员。