Raiff1982 commited on
Commit
0006108
·
verified ·
1 Parent(s): 9cc1fbb

Update AICoreAGIX_with_TB.py

Browse files
Files changed (1) hide show
  1. AICoreAGIX_with_TB.py +9 -1
AICoreAGIX_with_TB.py CHANGED
@@ -271,7 +271,15 @@ def _identity_hash(self):
271
  self.database.log_interaction(user_id, query, final_response)
272
  self._log_to_blockchain(user_id, query, final_response)
273
  self._speak_response(final_response)
274
-
 
 
 
 
 
 
 
 
275
  return {
276
  "response": final_response,
277
  "real_time_data": self.federated_ai.get_latest_data(),
 
271
  self.database.log_interaction(user_id, query, final_response)
272
  self._log_to_blockchain(user_id, query, final_response)
273
  self._speak_response(final_response)
274
+ def _speak_response(self, response: str):
275
+ if not self.ethics_core.evaluate_action(f"speak: {response}"):
276
+ logger.warning("[Codriao]: Speech output blocked by ethical filter.")
277
+ return
278
+ try:
279
+ self.speech_engine.say(response)
280
+ self.speech_engine.runAndWait()
281
+ except Exception as e:
282
+ logger.error(f"Speech synthesis failed: {e}")
283
  return {
284
  "response": final_response,
285
  "real_time_data": self.federated_ai.get_latest_data(),