primocode 11.2.0 → 11.3.1
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/README.md +2 -2
- package/lib/agentes-pessoais.js +5 -2
- package/lib/app-server/cli.js +6 -0
- package/lib/app-server/enderecos.js +43 -0
- package/lib/app-server/servidor.js +174 -31
- package/lib/avisos.js +1 -0
- package/lib/cli/sessao.js +174 -16
- package/lib/config/config.js +16 -1
- package/lib/diff.js +12 -2
- package/lib/motor/fala-viva.js +77 -0
- package/lib/motor/processo-vivo.js +66 -0
- package/lib/motor/transcricao.js +81 -0
- package/lib/plugin/entregaveis/nucleo.js +2 -2
- package/lib/plugin/estudio/gosto.js +3 -0
- package/lib/plugin/estudio/kits/tela.html +3 -1
- package/lib/projetos-meta.js +20 -3
- package/lib/session/runner/act.js +23 -4
- package/lib/tool/tools.js +1 -0
- package/lib/tui/entrada.js +143 -18
- package/lib/tui/tela.js +312 -49
- package/lib/tui/ui.js +77 -3
- package/package.json +6 -2
- package/studio/voz_kokoro_vivo.py +46 -0
- package/voz/primo_voz/transcrever.py +37 -0
|
@@ -200,6 +200,43 @@ def main() -> int:
|
|
|
200
200
|
return 1
|
|
201
201
|
print(json.dumps({"ok": True, "palavras": ws}, ensure_ascii=False))
|
|
202
202
|
return 0
|
|
203
|
+
if acao == "servir":
|
|
204
|
+
# `... servir [idioma]`: processo vivo do app (modo voz ao vivo). O modelo carrega UMA vez; cada linha de entrada é
|
|
205
|
+
# {"id":N,"arquivo":"x.wav"} e cada linha de saída é {"id":N,"ok":true,"texto":"..."}. Primeira linha: {"pronto":true}.
|
|
206
|
+
if not disponivel():
|
|
207
|
+
print(json.dumps({"ok": False, "error": "o faster-whisper não está instalado"}), flush=True)
|
|
208
|
+
return 1
|
|
209
|
+
idioma = sys.argv[2] if len(sys.argv) > 2 else "pt"
|
|
210
|
+
try:
|
|
211
|
+
carregar()
|
|
212
|
+
except Exception as e:
|
|
213
|
+
print(json.dumps({"ok": False, "error": str(e)}), flush=True)
|
|
214
|
+
return 1
|
|
215
|
+
print(json.dumps({"pronto": True, "modelo": MODELO}), flush=True)
|
|
216
|
+
for linha in sys.stdin:
|
|
217
|
+
linha = linha.strip()
|
|
218
|
+
if not linha:
|
|
219
|
+
continue
|
|
220
|
+
pedido = {}
|
|
221
|
+
try:
|
|
222
|
+
pedido = json.loads(linha)
|
|
223
|
+
texto = transcrever(Path(pedido["arquivo"]), idioma)
|
|
224
|
+
print(json.dumps({"id": pedido.get("id"), "ok": True, "texto": texto}, ensure_ascii=False), flush=True)
|
|
225
|
+
except Exception as e:
|
|
226
|
+
print(json.dumps({"id": pedido.get("id"), "ok": False, "error": str(e)}), flush=True)
|
|
227
|
+
return 0
|
|
228
|
+
if acao == "arquivo":
|
|
229
|
+
# `... arquivo <wav> [idioma]`: a fala de um arquivo vira texto (o app desktop grava no microfone e manda para cá).
|
|
230
|
+
if not disponivel():
|
|
231
|
+
print(json.dumps({"ok": False, "error": "o faster-whisper não está instalado"}))
|
|
232
|
+
return 1
|
|
233
|
+
try:
|
|
234
|
+
texto = transcrever(Path(sys.argv[2]), sys.argv[3] if len(sys.argv) > 3 else "pt")
|
|
235
|
+
except Exception as e:
|
|
236
|
+
print(json.dumps({"ok": False, "error": str(e)}))
|
|
237
|
+
return 1
|
|
238
|
+
print(json.dumps({"ok": True, "texto": texto}, ensure_ascii=False))
|
|
239
|
+
return 0
|
|
203
240
|
if acao != "baixar":
|
|
204
241
|
print(json.dumps({"ok": False, "error": f"ação desconhecida: {acao}"}))
|
|
205
242
|
return 2
|