From 82639c66f8c77512e10f40f9d688e97ca5b4c1e4 Mon Sep 17 00:00:00 2001 From: HeavyGee <133152184+heavygee@users.noreply.github.com> Date: Mon, 3 Aug 2026 11:01:17 +0100 Subject: [PATCH] fix(web): show full voice platform rules in settings preview (#1345) Settings truncated read-only fixtures to 800 chars so scrolling never revealed the rest. Default preview is now the full document; explicit caps remain for tests. Closes #1341 Co-authored-by: Cursor --- shared/src/voicePersonality.test.ts | 8 +++++++- shared/src/voicePromptLayers.ts | 12 +++++++++--- .../components/settings/VoiceAdvancedControls.tsx | 2 +- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/shared/src/voicePersonality.test.ts b/shared/src/voicePersonality.test.ts index f66a22d1..e1077bfe 100644 --- a/shared/src/voicePersonality.test.ts +++ b/shared/src/voicePersonality.test.ts @@ -11,7 +11,7 @@ import { truncateUtf8ByteLength, utf8ByteLength } from './voicePersonality' -import { VOICE_PLATFORM_FIXTURES } from './voicePromptLayers' +import { VOICE_PLATFORM_FIXTURES, getVoicePlatformFixturesPreview } from './voicePromptLayers' describe('voicePersonality', () => { test('parseVoicePersonalityPreferences returns defaults for invalid input', () => { @@ -78,4 +78,10 @@ describe('voicePersonality', () => { const huge = truncateUtf8ByteLength('a'.repeat(50_000), 100) expect(utf8ByteLength(huge)).toBeLessThanOrEqual(100) }) + + test('settings fixtures preview returns full platform rules by default', () => { + expect(getVoicePlatformFixturesPreview()).toBe(VOICE_PLATFORM_FIXTURES) + expect(getVoicePlatformFixturesPreview(40)).toContain('[…]') + expect(getVoicePlatformFixturesPreview(40).length).toBeLessThan(VOICE_PLATFORM_FIXTURES.length) + }) }) diff --git a/shared/src/voicePromptLayers.ts b/shared/src/voicePromptLayers.ts index a21b9435..a338ef90 100644 --- a/shared/src/voicePromptLayers.ts +++ b/shared/src/voicePromptLayers.ts @@ -205,9 +205,15 @@ export function composeVoiceAgentPrompt( return prompt } -/** Short preview for Settings (fixtures are read-only). */ -export function getVoicePlatformFixturesPreview(maxChars = 600): string { +/** + * Read-only fixtures text for Settings. + * Pass a finite maxChars only when deliberately truncating (e.g. tests); + * Settings shows the full document in a scrollable panel. + */ +export function getVoicePlatformFixturesPreview(maxChars?: number): string { const text = VOICE_PLATFORM_FIXTURES - if (text.length <= maxChars) return text + if (maxChars == null || !Number.isFinite(maxChars) || maxChars <= 0 || text.length <= maxChars) { + return text + } return `${text.slice(0, maxChars)}\n\n[…]` } diff --git a/web/src/components/settings/VoiceAdvancedControls.tsx b/web/src/components/settings/VoiceAdvancedControls.tsx index 66d227f0..b3c4f8cd 100644 --- a/web/src/components/settings/VoiceAdvancedControls.tsx +++ b/web/src/components/settings/VoiceAdvancedControls.tsx @@ -307,7 +307,7 @@ export function VoiceDiagnosticsControls(props: { const backend = props.voiceBackend ?? 'elevenlabs' const wireHint = getVoiceWireBudgetHint(backend) - const fixturesPreview = useMemo(() => getVoicePlatformFixturesPreview(800), []) + const fixturesPreview = useMemo(() => getVoicePlatformFixturesPreview(), []) const composed = useMemo( () => resolveComposedVoiceSystemPrompt(prefs, { backend }), [prefs, backend]