Skip to content

Commit 2fa6b29

Browse files
committed
chore: removed redundant logs
1 parent 792004d commit 2fa6b29

File tree

4 files changed

+5
-43
lines changed

4 files changed

+5
-43
lines changed

src/client/app/chat/page.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,6 @@ export default function ChatPage() {
868868

869869
const handleVoiceEvent = useCallback(
870870
(event) => {
871-
console.log("[ChatPage] Received voice event:", event)
872871
if (event.type === "stt_result" && event.text) {
873872
setDisplayedMessages((prev) => [
874873
...prev,

src/client/lib/webrtc-client.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,7 @@ export class WebRTCClient {
135135
console.log("[WebRTCClient] Data channel created.")
136136
this.dataChannel.addEventListener("message", (event) => {
137137
try {
138-
const message = JSON.parse(event.data)
139-
console.log(
140-
"[WebRTCClient] Received data channel message:",
141-
message
142-
)
143-
this.options.onEvent?.(message)
138+
this.options.onEvent?.(JSON.parse(event.data))
144139
} catch (error) {
145140
console.error("Error parsing data channel message:", error)
146141
}

src/server/main/chat/utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,6 @@ def agent_worker():
474474
if last_message.get('role') == 'assistant' and last_message.get('function_call'):
475475
tool_name = last_message['function_call']['name']
476476
asyncio.run_coroutine_threadsafe(send_status_update({"type": "status", "message": f"using_tool_{tool_name}"}), loop)
477-
print(final_run_response)
478477
return final_run_response
479478
except Exception as e:
480479
logger.error(f"Error in voice agent_worker thread: {e}", exc_info=True)

src/server/main/voice/routes.py

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,12 @@ async def initiate_voice_session(
6565
rtc_token = str(uuid.uuid4())
6666
expires_at = now + TOKEN_EXPIRATION_SECONDS
6767
rtc_token_cache[rtc_token] = {"user_id": user_id, "expires_at": expires_at}
68-
logger.info(f"Generated RTC token {rtc_token} for user {user_id}, expires at {datetime.fromtimestamp(expires_at).isoformat()}")
69-
68+
logger.info(f"Generated RTC token {rtc_token} for user {user_id}, expires at {datetime.fromtimestamp(expires_at).isoformat()}. Mode: {ENVIRONMENT}")
69+
7070
if ENVIRONMENT in ["dev-local", "selfhost"]:
71-
logger.info(f"Initiated voice session for user {user_id} in dev-local mode with token {rtc_token}")
72-
return {"rtc_token": rtc_token, "ice_servers": []} # No TURN server in dev-local mode
73-
71+
return {"rtc_token": rtc_token, "ice_servers": []}
7472
else:
75-
logger.info(f"Initiated voice session for user {user_id} with token {rtc_token} using TURN server")
76-
# Get TURN credentials to send to the client
7773
ice_servers_config = await get_credentials()
78-
79-
logger.info(f"Initiated voice session for user {user_id} with token {rtc_token}")
8074
return {"rtc_token": rtc_token, "ice_servers": ice_servers_config}
8175

8276

@@ -144,30 +138,10 @@ async def process_audio_chunk(self, audio: tuple[int, np.ndarray]):
144138
await self.send_message(json.dumps({"type": "status", "message": "transcribing"}))
145139
sample_rate, audio_array = audio
146140

147-
# --- DEBUG: Save audio to file before STT ---
148-
try:
149-
debug_dir = "audio_debug_logs"
150-
# Create the directory relative to the current file's location
151-
server_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))
152-
full_debug_path = os.path.join(server_root, debug_dir)
153-
os.makedirs(full_debug_path, exist_ok=True)
154-
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S_%f")
155-
filename = os.path.join(full_debug_path, f"stt_input_{timestamp}.wav")
156-
157-
with wave.open(filename, 'wb') as wf:
158-
wf.setnchannels(1) # Mono
159-
wf.setsampwidth(audio_array.dtype.itemsize) # Should be 2 for int16
160-
wf.setframerate(sample_rate)
161-
wf.writeframes(audio_array.tobytes())
162-
logger.info(f"[Handler:{self.handler_id}] DEBUG: Saved pre-STT audio to {filename}")
163-
except Exception as e:
164-
logger.error(f"[Handler:{self.handler_id}] DEBUG: Failed to save debug audio: {e}")
165-
# --- END DEBUG ---
166-
167141
if audio_array.dtype != np.int16:
168142
audio_array = (audio_array * 32767).astype(np.int16)
169143

170-
logger.debug(f"[Handler:{self.handler_id}] Transcribing audio for user {user_id}...")
144+
logger.info(f"[Handler:{self.handler_id}] Transcribing audio for user {user_id}...")
171145
transcription, detected_language = await stt_model_instance.transcribe(audio_array.tobytes(), sample_rate=sample_rate)
172146

173147
if not transcription or not transcription.strip():
@@ -180,7 +154,6 @@ async def process_audio_chunk(self, audio: tuple[int, np.ndarray]):
180154

181155
async def send_status_update(status_update: Dict[str, Any]):
182156
"""Sends a status update message to the client."""
183-
logger.info(f"[Handler:{self.handler_id}] Sending status update to client: {status_update}")
184157
await self.send_message(json.dumps(status_update))
185158

186159
# 2. Process command, which may return a background task for Stage 2
@@ -227,13 +200,9 @@ async def send_status_update(status_update: Dict[str, Any]):
227200
sentences = [s.strip() for s in sentences if s.strip()]
228201
for i, sentence in enumerate(sentences):
229202
if not sentence: continue
230-
logger.info(f"[Handler:{self.handler_id}] Generating TTS for sentence {i+1}/{len(sentences)}: '{sentence}'")
231203
audio_stream = tts_model_instance.stream_tts(sentence, language=detected_language)
232-
chunk_count = 0
233204
async for audio_chunk in audio_stream:
234205
yield self._format_audio_chunk(audio_chunk)
235-
chunk_count += 1
236-
logger.info(f"[Handler:{self.handler_id}] Streamed {chunk_count} TTS chunks for sentence.")
237206
except Exception as e:
238207
logger.error(f"[Handler:{self.handler_id}] Error in voice_chat for user {user_id}: {e}", exc_info=True)
239208
await self.send_message(json.dumps({"type": "error", "message": str(e)}))

0 commit comments

Comments
 (0)