@@ -161,97 +161,6 @@ def main():
161161 else :
162162 log .warning ("OAK-D unavailable — no depth perception" )
163163
164- # ── Voice pipeline init ──────────────────────────────────────────────────
165- from config import ASR_ENABLED
166- if ASR_ENABLED :
167- from voice import init_voice , start_voice_pipeline
168-
169- if init_voice ():
170- log .info ("Voice: models loaded — starting pipeline..." )
171-
172- def _on_utterance (text : str , is_wake : bool ):
173- """
174- Route transcribed utterances to mission system.
175- is_wake=True → first activation (wake word heard)
176- is_wake=False → active session utterance
177- """
178- if is_wake :
179- log .info (f"Voice: wake word activated — { text !r} " )
180- try :
181- from config import TELEGRAM_ENABLED
182- if TELEGRAM_ENABLED :
183- from telegram_handler import notify
184- notify ("👂 Voice session activated" )
185- except Exception :
186- pass
187- return
188- # Pass utterance to mission as if typed in GUI
189- # During active mission: treat as character response
190- # Outside mission: treat as new mission briefing command
191- try :
192- # Check email commands first
193- from config import EMAIL_ENABLED
194- if EMAIL_ENABLED :
195- from email_handler import handle_voice_email_command
196- email_response = handle_voice_email_command (text )
197- if email_response :
198- from tts import speak
199- speak (email_response )
200- return
201-
202- from mission import get_mission_active , handle_character_response , start_mission
203- if get_mission_active ():
204- log .info (f"Voice: routing to character comms → { text !r} " )
205- handle_character_response ("Operator" , text )
206- else :
207- log .info (f"Voice: routing as mission command → { text !r} " )
208- start_mission (text )
209- except Exception as e :
210- log .error (f"Voice: utterance routing error — { e } " )
211-
212- def _on_state_change (state : str ):
213- log .debug (f"Voice state: { state } " )
214- # Forward to GUI status if available
215- try :
216- from gui import set_voice_state
217- set_voice_state (state )
218- except Exception :
219- pass
220-
221- start_voice_pipeline (
222- on_utterance = _on_utterance ,
223- on_state_change = _on_state_change ,
224- )
225- else :
226- log .warning ("Voice: init failed — voice input unavailable" )
227-
228- # ── Telegram bot init ────────────────────────────────────────────────────
229- from config import TELEGRAM_ENABLED
230- if TELEGRAM_ENABLED :
231- from telegram_handler import init_telegram , start_telegram_bot , notify
232- if init_telegram ():
233- start_telegram_bot ()
234- log .info ("Telegram: bot started — owner notifications active" )
235- # Notify owner Eric is online
236- import threading
237- threading .Timer (3.0 , lambda : notify (
238- "🤖 * ERIC online .*
239- Edge Robotics Innovation by Cosmos .
240- Ready for missions ."
241- )).start ()
242- else :
243- log .warning ("Telegram: init failed — check TELEGRAM_BOT_TOKEN in .env" )
244-
245- # ── Email handler init ───────────────────────────────────────────────────
246- from config import EMAIL_ENABLED
247- if EMAIL_ENABLED :
248- from email_handler import init_email , start_email_timer
249- if init_email ():
250- start_email_timer ()
251- log .info ("Email: handler ready — checking every 30 min" )
252- else :
253- log .warning ("Email: init failed — check ERIC_EMAIL_PASSWORD in .env" )
254-
255164 # ── Cosmos connectivity test ──────────────────────────────────────────────
256165 from cosmos import ask_cosmos
257166 test = ask_cosmos ("Say exactly: ERIC online and ready." , max_tokens = 20 )
0 commit comments