| | |
| | | from core.handle.sendAudioHandle import sendAudioMessage, send_tts_message |
| | | from core.utils.util import remove_punctuation_and_length, opus_datas_to_wav_bytes |
| | | from core.providers.tools.device_mcp import MCPClient, send_mcp_initialize_message |
| | | from core.websocket_handshake import merge_hello_audio_params |
| | | |
| | | TAG = __name__ |
| | | |
| | |
| | | format = audio_params.get("format") |
| | | conn.logger.bind(tag=TAG).debug(f"客户端音频格式: {format}") |
| | | conn.audio_format = format |
| | | conn.welcome_msg["audio_params"] = audio_params |
| | | conn.welcome_msg["audio_params"] = merge_hello_audio_params( |
| | | conn.welcome_msg.get("audio_params"), audio_params |
| | | ) |
| | | output_rate = (conn.welcome_msg.get("audio_params") or {}).get("sample_rate") |
| | | if output_rate: |
| | | conn.sample_rate = output_rate |
| | | features = msg_json.get("features") |
| | | if features: |
| | | conn.logger.bind(tag=TAG).debug(f"客户端特性: {features}") |