|
@@ -115,16 +115,16 @@ class STTSink(Sink):
|
|
|
except Exception as e:
|
|
except Exception as e:
|
|
|
logger.warning(f"[STT][{user_id}] WS fermé : {e}")
|
|
logger.warning(f"[STT][{user_id}] WS fermé : {e}")
|
|
|
|
|
|
|
|
- # ⚠️ SIGNATURE OBLIGATOIRE
|
|
|
|
|
def write(self, pcm_bytes: bytes, user_id: int):
|
|
def write(self, pcm_bytes: bytes, user_id: int):
|
|
|
if not pcm_bytes:
|
|
if not pcm_bytes:
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
audio_16k_float32 = discord_pcm_to_whisper_float32(pcm_bytes)
|
|
audio_16k_float32 = discord_pcm_to_whisper_float32(pcm_bytes)
|
|
|
|
|
+
|
|
|
if not audio_16k_float32:
|
|
if not audio_16k_float32:
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
- asyncio.create_task(self._send_audio(user_id, audio_16k_float32))
|
|
|
|
|
|
|
+ asyncio.run_coroutine_threadsafe(self._send_audio(user_id, audio_16k_float32), MAIN_LOOP)
|
|
|
|
|
|
|
|
logger.debug(
|
|
logger.debug(
|
|
|
f"[STT] audio reçu user={user_id} "
|
|
f"[STT] audio reçu user={user_id} "
|
|
@@ -309,6 +309,8 @@ except ValueError:
|
|
|
# Initialiser le client Discord avec les intents modifiés
|
|
# Initialiser le client Discord avec les intents modifiés
|
|
|
client_discord = discord.Bot(intents=intents)
|
|
client_discord = discord.Bot(intents=intents)
|
|
|
|
|
|
|
|
|
|
+MAIN_LOOP = asyncio.get_event_loop()
|
|
|
|
|
+
|
|
|
# Appeler la fonction pour charger l'historique au démarrage
|
|
# Appeler la fonction pour charger l'historique au démarrage
|
|
|
load_conversation_history()
|
|
load_conversation_history()
|
|
|
|
|
|