SIGN IN SIGN UP

fix: make audio_interface optional for text-only chat mode (#749)

* fix: make audio_interface optional for text-only chat mode

When using chat-only (text_only) mode, requiring an AudioInterface is
unnecessary. This makes audio_interface default to None in both
Conversation and AsyncConversation, with None-guards around all audio
operations (start, stop, output, interrupt).

Fixes #632

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: auto-set text_only in config when audio_interface is omitted

When audio_interface is None (text-only chat mode), automatically set
text_only: True in conversation_config_override so the server skips
audio generation. Uses setdefault to preserve explicit user overrides.

Applied to both Conversation and AsyncConversation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: avoid mutating shared config dict when setting text_only

Replace setdefault (which mutates the caller's dict in-place) with a
new dict spread. Prevents a reused ConversationInitiationData from
inheriting text_only: True when creating a second Conversation with
an audio_interface.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* test: add text-only mode tests for Conversation

Verifies that:
- text_only is auto-set when audio_interface is None
- explicit text_only=False override is preserved
- original config dict is not mutated (dict spread fix)

* refactor: move text_only auto-set to BaseConversation, deep-copy config

Move the text_only auto-set logic from both Conversation and
AsyncConversation into BaseConversation to eliminate duplication.
Deep-copy the ConversationInitiationData so the caller's original
object is never mutated.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
M
Matt Van Horn committed
ba601c17372753910ce662cbd5bb9c0031096cf3
Parent: 54f25ea
Committed by GitHub <noreply@github.com> on 3/26/2026, 2:00:03 PM