@danhachuel/thunderbolt 0.3.80 → 0.3.82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danhachuel/thunderbolt",
3
- "version": "0.3.80",
3
+ "version": "0.3.82",
4
4
  "description": "Thunderbolt — interface local para operação de canais faceless e motor MoneyPrinterTurbo",
5
5
  "license": "MIT",
6
6
  "main": "scripts/cli.mjs",
@@ -116,10 +116,11 @@ def chunk_character_limit(rate: float) -> int:
116
116
  def _build_ssml(text: str, voice: str, rate: float) -> str:
117
117
  parts = voice.split("-", 2)
118
118
  locale = "-".join(parts[:2]) if len(parts) >= 2 else "en-US"
119
+ escaped_voice = escape(voice, {'"': """})
119
120
  return (
120
121
  '<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" '
121
122
  f'xml:lang="{escape(locale)}">'
122
- f'<voice name="{escape(voice, {"\"": "&quot;"})}">'
123
+ f'<voice name="{escaped_voice}">'
123
124
  f'<prosody rate="{_normalise_rate(rate):g}">{escape(text)}</prosody>'
124
125
  "</voice></speak>"
125
126
  )
@@ -148,7 +149,9 @@ def _synthesise_chunk(
148
149
  try:
149
150
  result = synthesizer.speak_ssml_async(_build_ssml(text, voice, rate)).get()
150
151
  finally:
151
- synthesizer.close()
152
+ close = getattr(synthesizer, "close", None)
153
+ if callable(close):
154
+ close()
152
155
  if result.reason != speechsdk.ResultReason.SynthesizingAudioCompleted:
153
156
  details = getattr(
154
157
  getattr(result, "cancellation_details", None), "error_details", ""