Peter Michael Gits Claude commited on
Commit Β·
e985487
1
Parent(s): 22227a1
fix: Add PyTorch dependencies and fix base64 imports v0.5.7
Browse files- Add missing PyTorch, TorchAudio, and Transformers dependencies to requirements.txt
- Fix missing base64 import statements in WebSocket handler
- Add better HTTP 503 error handling for cold starts
- Update to version 0.5.7 with comprehensive fixes
π€ Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- requirements.txt +5 -0
- version.py +2 -2
- webrtc/server/websocket_handler.py +7 -1
requirements.txt
CHANGED
|
@@ -38,6 +38,11 @@ webrtcvad==2.0.10
|
|
| 38 |
# Audio processing (compatible with existing numpy/librosa)
|
| 39 |
librosa>=0.10.1
|
| 40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
# ASGI server for FastAPI integration
|
| 42 |
uvicorn>=0.24.0
|
| 43 |
numpy>=1.21.0
|
|
|
|
| 38 |
# Audio processing (compatible with existing numpy/librosa)
|
| 39 |
librosa>=0.10.1
|
| 40 |
|
| 41 |
+
# ML/AI dependencies for audio processing
|
| 42 |
+
torch>=2.0.0
|
| 43 |
+
torchaudio>=2.0.0
|
| 44 |
+
transformers>=4.30.0
|
| 45 |
+
|
| 46 |
# ASGI server for FastAPI integration
|
| 47 |
uvicorn>=0.24.0
|
| 48 |
numpy>=1.21.0
|
version.py
CHANGED
|
@@ -2,8 +2,8 @@
|
|
| 2 |
Version information for ChatCal Voice-Enabled AI Assistant
|
| 3 |
"""
|
| 4 |
|
| 5 |
-
__version__ = "0.5.
|
| 6 |
-
__build_date__ = "2025-08-
|
| 7 |
__description__ = "VoiceCal - Voice-Enabled AI Scheduling Assistant with WebSocket services"
|
| 8 |
|
| 9 |
def get_version_info():
|
|
|
|
| 2 |
Version information for ChatCal Voice-Enabled AI Assistant
|
| 3 |
"""
|
| 4 |
|
| 5 |
+
__version__ = "0.5.7"
|
| 6 |
+
__build_date__ = "2025-08-21T00:30:00"
|
| 7 |
__description__ = "VoiceCal - Voice-Enabled AI Scheduling Assistant with WebSocket services"
|
| 8 |
|
| 9 |
def get_version_info():
|
webrtc/server/websocket_handler.py
CHANGED
|
@@ -148,7 +148,11 @@ class WebRTCHandler:
|
|
| 148 |
logger.error(f"β STT service connection timeout for {client_id} - service may be cold starting or WebSocket endpoints not available")
|
| 149 |
return False
|
| 150 |
except websockets.exceptions.WebSocketException as e:
|
| 151 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 152 |
logger.info(f"π Debug: Attempted connection to {self.stt_websocket_url}")
|
| 153 |
return False
|
| 154 |
except Exception as e:
|
|
@@ -290,6 +294,7 @@ class WebRTCHandler:
|
|
| 290 |
|
| 291 |
if response_data.get("type") == "tts_audio_response":
|
| 292 |
# Decode base64 audio data
|
|
|
|
| 293 |
audio_b64 = response_data.get("audio_data", "")
|
| 294 |
audio_bytes = base64.b64decode(audio_b64)
|
| 295 |
logger.info(f"π TTS audio received: {len(audio_bytes)} bytes")
|
|
@@ -323,6 +328,7 @@ class WebRTCHandler:
|
|
| 323 |
|
| 324 |
if audio_data:
|
| 325 |
# Convert audio to base64 for WebSocket transmission
|
|
|
|
| 326 |
audio_b64 = base64.b64encode(audio_data).decode('utf-8')
|
| 327 |
|
| 328 |
# Send audio playback message to client
|
|
|
|
| 148 |
logger.error(f"β STT service connection timeout for {client_id} - service may be cold starting or WebSocket endpoints not available")
|
| 149 |
return False
|
| 150 |
except websockets.exceptions.WebSocketException as e:
|
| 151 |
+
if "503" in str(e):
|
| 152 |
+
logger.error(f"β STT service unavailable (HTTP 503) for {client_id} - service may be cold starting")
|
| 153 |
+
logger.info(f"π Try again in a few moments - Hugging Face services need time to start")
|
| 154 |
+
else:
|
| 155 |
+
logger.error(f"β STT WebSocket error for {client_id}: {e}")
|
| 156 |
logger.info(f"π Debug: Attempted connection to {self.stt_websocket_url}")
|
| 157 |
return False
|
| 158 |
except Exception as e:
|
|
|
|
| 294 |
|
| 295 |
if response_data.get("type") == "tts_audio_response":
|
| 296 |
# Decode base64 audio data
|
| 297 |
+
import base64
|
| 298 |
audio_b64 = response_data.get("audio_data", "")
|
| 299 |
audio_bytes = base64.b64decode(audio_b64)
|
| 300 |
logger.info(f"π TTS audio received: {len(audio_bytes)} bytes")
|
|
|
|
| 328 |
|
| 329 |
if audio_data:
|
| 330 |
# Convert audio to base64 for WebSocket transmission
|
| 331 |
+
import base64
|
| 332 |
audio_b64 = base64.b64encode(audio_data).decode('utf-8')
|
| 333 |
|
| 334 |
# Send audio playback message to client
|