Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(bots): 跟进邀请改为一行轻提示,并修复重复出现两张

zqchrisff812dc777c0
diff --git a/apps/desktop/scripts/fixtures/bot-follow-up/ui-page.mjs b/apps/desktop/scripts/fixtures/bot-follow-up/ui-page.mjs
index b3a0c7d4f6..c35cfc5e69 100644
--- a/apps/desktop/scripts/fixtures/bot-follow-up/ui-page.mjs
+++ b/apps/desktop/scripts/fixtures/bot-follow-up/ui-page.mjs
@@ -11,7 +11,7 @@ export default {
cases: {
'before-chat': { about: 'Opening alone never invites; an accepted message reveals the invitation' },
'remote': { about: 'Remote chat uses the same invitation with the host-owned scope and choice' },
- 'default': { about: 'Invite after an accepted user message, with explicit scope and model allowance' },
+ 'default': { about: 'One-line invitation after an accepted user message; scope and model allowance sit in the Start tooltip' },
'settings-off': { about: 'Off by default; explain scope before enabling' },
'settings-on': { about: 'An explicit choice is preserved; disabling is immediate' },
},
diff --git a/apps/desktop/src/renderer/features/bots/BotFollowUpInvitation.tsx b/apps/desktop/src/renderer/features/bots/BotFollowUpInvitation.tsx
index 4e1020862d..3b1fa29b51 100644
--- a/apps/desktop/src/renderer/features/bots/BotFollowUpInvitation.tsx
+++ b/apps/desktop/src/renderer/features/bots/BotFollowUpInvitation.tsx
@@ -2,6 +2,7 @@ import { useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { Button } from '@/components/ui/button';
+import { Tip } from '@/components/ui/tooltip';
import { getDataOwnerGeneration, isDataOwnerGenerationCurrent } from '@/contexts/dataOwnerGeneration';
import { toast } from '@/lib/toast';
import { setBotSchedulerBotId, useBotAutonomySettings } from './botStore';
@@ -37,14 +38,18 @@ export function BotFollowUpInvitationCard({ pending, onChoose, consent }: {
pending: boolean; onChoose(enable: boolean): void | Promise<void>; consent?: string;
}) {
const { t } = useTranslation();
+ // 一行轻提示:读什么、花额度的说明放在「开始跟进」的悬停提示里,同时作为它的可访问描述。
+ const scope = consent ?? t('bots.autonomy.consent');
return (
- <section className="w-full rounded-xl border border-[var(--border-default)] p-4" aria-label={t('bots.autonomy.invitation.title')}>
- <p className="text-13 font-medium leading-5 text-[var(--text-primary)]">{t('bots.autonomy.invitation.title')}</p>
- <p className="mt-2 text-12 leading-5 text-[var(--text-secondary)]">{consent ?? t('bots.autonomy.consent')}</p>
- <div className="mt-3 flex flex-wrap gap-2">
- <Button variant="cta" size="md" disabled={pending} onClick={() => void onChoose(true)}>{t('bots.autonomy.invitation.start')}</Button>
- <Button variant="secondary" tone="quiet" size="md" disabled={pending} onClick={() => void onChoose(false)}>{t('bots.autonomy.invitation.notNow')}</Button>
- </div>
+ <section
+ className="flex w-full items-center gap-2 rounded-xl border border-[var(--border-default)] py-1.5 pl-3 pr-1.5"
+ aria-label={t('bots.autonomy.invitation.title')}
+ >
+ <p className="min-w-0 flex-1 text-13 leading-5 text-[var(--text-primary)]">{t('bots.autonomy.invitation.title')}</p>
+ <Tip text={scope}>
+ <Button variant="cta" size="sm" aria-description={scope} disabled={pending} onClick={() => void onChoose(true)}>{t('bots.autonomy.invitation.start')}</Button>
+ </Tip>
+ <Button variant="secondary" tone="quiet" size="sm" disabled={pending} onClick={() => void onChoose(false)}>{t('bots.autonomy.invitation.notNow')}</Button>
</section>
);
}
diff --git a/apps/desktop/src/renderer/features/bots/__tests__/botAutonomySettings.test.tsx b/apps/desktop/src/renderer/features/bots/__tests__/botAutonomySettings.test.tsx
index 5f3a58d5d2..e6019d8256 100644
--- a/apps/desktop/src/renderer/features/bots/__tests__/botAutonomySettings.test.tsx
+++ b/apps/desktop/src/renderer/features/bots/__tests__/botAutonomySettings.test.tsx
@@ -187,7 +187,9 @@ it.each([true, false])('remote invitation uses the host-bound choice, enable=%s'
const invoke = vi.fn(async (_device, channel) => channel.endsWith(':get') ? resource : { effects: [] });
Object.assign(window.electronAPI, { deviceLink: { invoke } });
render(<RemoteBotFollowUpInvitation deviceId="host-computer" botId="cindy-default" />);
- await screen.findByText(resource.blocks[0].fallbackMarkdown);
+ // The host-owned scope (not this computer's copy) describes the Start button.
+ const start = await screen.findByRole('button', { name: 'bots.autonomy.invitation.start' });
+ expect(start.getAttribute('aria-description')).toBe(resource.blocks[0].fallbackMarkdown);
expect(invoke).toHaveBeenCalledTimes(1);
fireEvent.click(screen.getByText(enable ? 'bots.autonomy.invitation.start' : 'bots.autonomy.invitation.notNow'));
await waitFor(() => expect(screen.queryByRole('region')).toBeNull());
diff --git a/apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx b/apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx
index 39a15a5ad2..c69cf5e2e9 100644
--- a/apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx
@@ -5737,9 +5737,11 @@ function CCAgentSessionContent({
&& !pendingPlanReview && !pendingPermission && !pendingAskUser && !pendingPluginSetup
&& !pendingIssueConfirm && !pendingRenameSessionsConfirm && !pendingGhostGrantConfirm
&& !pendingRemoteDesktopConfirmation && !pendingInputHandoff && followUpInvitationSession === sessionId && (
+ // Keys are namespaced: the voice panel below is a sibling keyed by the bare sessionId,
+ // and sharing it made React leave a stale copy of this card each time it reappeared.
remoteDeviceId
- ? <RemoteBotFollowUpInvitation key={`${remoteDeviceId}:${sessionId}`} deviceId={remoteDeviceId} botId={botChatIdentity.id} />
- : <BotFollowUpInvitation key={sessionId} botId={botChatIdentity.id} engaged />
+ ? <RemoteBotFollowUpInvitation key={`follow-up:${remoteDeviceId}:${sessionId}`} deviceId={remoteDeviceId} botId={botChatIdentity.id} />
+ : <BotFollowUpInvitation key={`follow-up:${sessionId}`} botId={botChatIdentity.id} engaged />
)}
<InteractionPromptHost
hasInteraction={
diff --git a/docs/dev-rules/protocol-compatibility.md b/docs/dev-rules/protocol-compatibility.md
index 666f9f620f..4b571b1587 100644
--- a/docs/dev-rules/protocol-compatibility.md
+++ b/docs/dev-rules/protocol-compatibility.md
@@ -2924,5 +2924,7 @@ namespace + id 下同一插件的有界 JSON 请求;`deviceSync: true` 是独
读资源不启用跟进;点击开启或暂不开启才保存。票据绑定账号、控制端、伙伴及当前设置 revision;
旧票、隐藏伙伴与账号切换沿用既有拒绝规则,不新增 invoke channel 或共享访客权限。
新 Host 对旧查看端仍执行默认关闭;旧端忽略新增入口/字段,已有聊天不变。新查看端连接旧 Host
-时不显示邀请,不能声称旧 Host 已执行新默认。Desktop 本机、远程 Desktop 和 Mobile 均显示范围及用量,
-Mobile iOS/Android 复用现有设置表单与按钮;没有原生配置、依赖、指纹或数据库迁移变化。
+时不显示邀请,不能声称旧 Host 已执行新默认。Desktop 本机与远程 Desktop 的对话内邀请是一行轻提示,
+范围及用量(远程时取 Host 下发的文字)放在「开始跟进」的悬停提示与可访问描述里(2026-10-22 Chris 确认);
+设置页开关开启前的确认框仍完整显示。Mobile iOS/Android 复用现有设置表单与按钮并显示范围及用量;
+没有原生配置、依赖、指纹或数据库迁移变化。