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。

Merge upstream/main and fix localized queued group work status

Chris98b80cbcbf5f
diff --cc apps/mobile/src/__tests__/BotGroupSpeakerRow.test.tsx
index 1c657770b1,37f585eb3a..4eda1784d8
--- a/apps/mobile/src/__tests__/BotGroupSpeakerRow.test.tsx
+++ b/apps/mobile/src/__tests__/BotGroupSpeakerRow.test.tsx
@@@ -21,7 -21,7 +21,6 @@@ vi.mock('react-native', () => (
}));
vi.mock('@/components/MobilePrimitives', () => ({ MainWindowActionButton: ({ action }: any) => el('button', { onClick: action.onPress }, action.label) }));
vi.mock('expo-router', () => ({ useRouter: () => ({ push: h.push }), useFocusEffect: (effect: () => void) => useEffect(effect, [effect]) }));
--vi.mock('react-i18next', () => ({ useTranslation: () => ({ t: (key: string, options?: { name?: string }) => options?.name ? `${key}:${options.name}` : key }) }));
vi.mock('lucide-react-native', () => ({ CircleAlert: () => null, Sparkles: () => null }));
vi.mock('@/theme', () => ({ useThemedStyles: () => ({}), useTheme: () => ({ colors: {} }) }));
vi.mock('@/components/AppText', () => ({ Text: ({ children }: any) => el('span', null, children) }));
@@@ -45,6 -45,6 +44,7 @@@ vi.mock('@/hooks/useReduceMotion', () =
vi.mock('@/session/CompanionPresenceRing', () => ({ CompanionPresenceRing: () => null }));
vi.mock('@/session/ThinkingDots', () => ({ ThinkingDots: () => null }));
import { BotGroupSpeakerRow } from '@/session/BotGroupSpeakerRow';
++import i18n from '@/i18n';
Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true });
let root: Root;
@@@ -53,7 -53,7 +53,8 @@@ const identity = { botId: 'abu', name:
async function render(props: Record<string, unknown>) {
await act(async () => root.render(el(BotGroupSpeakerRow, { deviceId: 'mac', identity, online: true, onError: vi.fn(), sessionId: 's1', activity: 'reply', ...props } as any)));
}
--beforeEach(() => {
++beforeEach(async () => {
++ await i18n.changeLanguage('zh-CN');
vi.clearAllMocks(); h.pending = {}; h.live = {}; h.panel = null;
h.invoke.mockResolvedValue([{ request: { requestId: 'r1' } }]);
node = document.createElement('div'); root = createRoot(node);
@@@ -77,10 -77,10 +78,10 @@@ it('uses the live phase, and plain cop
await render({});
expect(node.textContent).toContain('copy:reading-file');
await render({ activity: 'planning', sessionId: null });
-- expect(node.textContent).toContain('groupChat.speaking.planning');
++ expect(node.textContent).toContain(i18n.t('groupChat.speaking.planning'));
expect(h.copy).toHaveBeenLastCalledWith(expect.objectContaining({ active: false }));
await render({ activity: 'step', sessionId: 's2' });
-- expect(node.textContent).toContain('groupChat.speaking.step');
++ expect(node.textContent).toContain(i18n.t('groupChat.speaking.step'));
});
it('shows the teammate’s pending prompt inline instead of the working line', async () => {
@@@ -94,7 -94,7 +95,7 @@@
it('says it is waiting when the host reports a prompt the phone cannot show yet', async () => {
h.live.s1 = { sessionId: 's1', phase: 'needs-interaction', compactDetail: '' };
await render({});
-- expect(node.querySelector('[data-testid="botGroup.speaking.waiting"]')?.textContent).toBe('groupChat.waitingConfirm:阿布');
++ expect(node.querySelector('[data-testid="botGroup.speaking.waiting"]')?.textContent).toBe(i18n.t('groupChat.waitingConfirm', { name: identity.name }));
expect(h.panel).toBeNull();
});
@@@ -113,3 -113,3 +114,18 @@@ it('opens the ordinary task with no com
expect(h.push).toHaveBeenCalledWith({ pathname: '/sessions/[sessionId]', params: { sessionId: 'group-lane', deviceId: 'studio' } });
expect(h.invoke).not.toHaveBeenCalled();
});
++
++// Unit regression for PR #7233 / discussion_r4384096621: render a queued execution
++// through the real i18n hook/catalog. The previous key-only mock hid missing keys;
++// this minimal queued row must show localized copy instead of a resource path.
++it.each([
++ ['en', 'Getting started'],
++ ['zh-CN', '正在开始'],
++ ['zh-TW', '正在開始'],
++ ['ja', '開始しています'],
++ ['ko', '시작하는 중'],
++])('localizes queued work with the real %s catalog', async (locale, expected) => {
++ await i18n.changeLanguage(locale);
++ await render({ executionStatus: 'queued' });
++ expect(node.querySelector('[data-testid="status"]')?.textContent).toBe(expected);
++});
diff --cc apps/mobile/src/session/BotGroupSpeakerRow.tsx
index e157f7d98c,d076e582fb..e81749d7af
--- a/apps/mobile/src/session/BotGroupSpeakerRow.tsx
+++ b/apps/mobile/src/session/BotGroupSpeakerRow.tsx
@@@ -69,11 -67,9 +69,11 @@@ export function BotGroupSpeakerRow({ de
active: !waiting && activity !== 'planning' && (activity === 'reply' || livePhase !== null),
turnId: lane,
});
- const label = activity === 'planning'
+ const label = stopping || executionStatus === 'stopping' ? t('groupChat.speaking.stopping')
- : executionStatus === 'queued' ? t('devices.companions.queued')
++ : executionStatus === 'queued' ? t('devices.companions.status.queued')
+ : activity === 'planning'
? t('groupChat.speaking.planning')
- : copy ?? (activity === 'step' ? t('groupChat.speaking.step') : t('devices.companions.working.thinking'));
+ : copy ?? (activity === 'step' ? t('groupChat.speaking.step') : t('devices.companions.working.processing'));
// G4: the same working vocabulary as the 1:1 chat — breathing portrait, three dots, paced copy.
return <View style={styles.row} testID="botGroup.speaking" accessibilityLabel={`${identity.name}, ${waiting ? t('groupChat.waitingConfirm', { name: identity.name }) : label}`}>
<View style={styles.avatar}>