Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(voice): 会话页停止期间保持录音胶囊外观
Dash55465cb819b0
diff --git a/apps/mobile/app/sessions/[sessionId].tsx b/apps/mobile/app/sessions/[sessionId].tsxindex bcadb842c3..4311f9a698 100644--- a/apps/mobile/app/sessions/[sessionId].tsx+++ b/apps/mobile/app/sessions/[sessionId].tsx@@ -6708,8 +6708,9 @@ export default function SessionScreen() {active={composerLayout.voice.active}busy={voiceIsProcessing}disabled={composerLayout.voice.disabled || (!canUseComposer && !voiceIsBusy)}- // 停止后的短暂收尾期仍禁止操作,但保持录音胶囊原样、不置灰。- disabledStyle={voiceProcessingIndicator.stopping && !composerLayout.voice.disabled ? null : undefined}+ // 停止后的短暂收尾期仍禁止操作,但保持录音胶囊原样、不置灰。voice.disabled 在+ // 语音处理中恒为 true,不能拿它判断;只有与语音无关的禁用原因(发送中)才置灰。+ disabledStyle={voiceProcessingIndicator.stopping && !sending ? null : undefined}delayLongPress={320}hitSlop={COMPOSER_CONTROL_HIT_SLOP}onPressIn={handleVoiceButtonPressIn}diff --git a/apps/mobile/src/__tests__/newSession.test.ts b/apps/mobile/src/__tests__/newSession.test.tsindex fa326f4582..54b07f97f2 100644--- a/apps/mobile/src/__tests__/newSession.test.ts+++ b/apps/mobile/src/__tests__/newSession.test.ts@@ -2045,6 +2045,8 @@ describe('new session composer surface', () => {expect(newSource).toContain('localVoiceInputHistory: () => localVoiceInputHistory,');// 停止后 150ms 内保持录音胶囊,超过才显示处理转圈。expect(newSource).toContain('expanded: voiceIsListening || voiceStartPending || voiceProcessingIndicator.stopping,');+ // 停止期保持胶囊外观,只有与语音无关的禁用原因(创建中)才置灰。+ expect(newSource).toContain('(creating || (voiceIsProcessing && !voiceProcessingIndicator.stopping)) && styles.disabled,');expect(newSource).not.toContain('MobileVoiceServiceMode');expect(newSource).not.toContain('LiteLlm');expect(newSource).toContain('?? createMobileCindyVoiceCredential(selectedDeviceId);');diff --git a/apps/mobile/src/__tests__/sessionComposerDesktopFirst.test.ts b/apps/mobile/src/__tests__/sessionComposerDesktopFirst.test.tsindex 8a18c6ac83..e7468953be 100644--- a/apps/mobile/src/__tests__/sessionComposerDesktopFirst.test.ts+++ b/apps/mobile/src/__tests__/sessionComposerDesktopFirst.test.ts@@ -1,6 +1,7 @@import { readFileSync } from 'node:fs';import { resolve } from 'node:path';import { describe, expect, it } from 'vitest';+import { buildSessionComposerLayout } from '@/session/sessionComposerLayout';// Windows checkout(core.autocrlf)下源码是 CRLF;统一归一成 LF,含 \n 的多行片段断言才跨平台成立。const readTextLf = (...args: Parameters<typeof readFileSync>): string =>@@ -772,6 +773,20 @@ describe('mobile session composer desktop-first surface', () => {// 停止后 150ms 内仍保持胶囊(stopping),超过才换处理转圈(对齐桌面)。expect(source).toContain('expanded: voiceIsListening || voiceStartPending || voiceProcessingIndicator.stopping,');expect(source).toContain('{voiceProcessingIndicator.showProcessing ? (');+ // 停止期不置灰:共享布局在语音处理中恒把 voice.disabled 设为 true,不能拿它判断,+ // 只有与语音无关的禁用原因(发送中)才置灰(新建任务页对应 creating)。+ expect(buildSessionComposerLayout({+ attachmentBusy: false,+ attachmentCount: 0,+ attachmentPickerOpen: false,+ canStop: false,+ draftText: '',+ queueBusy: false,+ sending: false,+ voiceState: 'submitting',+ }).voice.disabled).toBe(true);+ expect(source).toContain('disabledStyle={voiceProcessingIndicator.stopping && !sending ? null : undefined}');+ expect(source).not.toContain('voiceProcessingIndicator.stopping && !composerLayout.voice.disabled');expect(source).toContain('counting: voiceIsListening,');expect(source).toContain('const voiceStartedOnPressInRef = useRef(false);');// pending 世代守卫:切会话后旧启动收尾不得塌掉新录音的乐观胶囊(review P1)。