Update cron, dashboard, root +3 more (+1 ~11)
This commit is contained in:
@@ -15,7 +15,7 @@ from src.claude_session import (
|
||||
PROJECT_ROOT,
|
||||
VALID_MODELS,
|
||||
)
|
||||
from src.fast_commands import dispatch as fast_dispatch
|
||||
from src.fast_commands import dispatch as fast_dispatch, split_text_chunks, extract_url_text
|
||||
from src.router import (
|
||||
route_message,
|
||||
_ralph_propose,
|
||||
@@ -916,6 +916,37 @@ def create_bot(config: Config) -> discord.Client:
|
||||
rezumat: bool = False,
|
||||
) -> None:
|
||||
await interaction.response.defer()
|
||||
voice = voce or "M2"
|
||||
|
||||
# URL fără rezumat → fetch + split în chunks + trimite pe rând
|
||||
if text_sau_url and text_sau_url.startswith("http") and not rezumat:
|
||||
text = await asyncio.to_thread(extract_url_text, text_sau_url)
|
||||
if not text:
|
||||
await interaction.followup.send("Nu am putut extrage text din URL.")
|
||||
return
|
||||
chunks = split_text_chunks(text, max_chars=1500)
|
||||
total = len(chunks)
|
||||
for i, chunk in enumerate(chunks, 1):
|
||||
result = await asyncio.to_thread(fast_dispatch, "audio", [voice, chunk])
|
||||
if result and result.startswith("__AUDIO__:"):
|
||||
wav_path = result[len("__AUDIO__:"):]
|
||||
try:
|
||||
filename = f"echo-audio-{i}din{total}.wav" if total > 1 else "echo-audio.wav"
|
||||
await interaction.followup.send(
|
||||
content=f"Bucata {i}/{total}" if total > 1 else None,
|
||||
file=discord.File(wav_path, filename=filename),
|
||||
)
|
||||
finally:
|
||||
try:
|
||||
os.unlink(wav_path)
|
||||
except OSError:
|
||||
pass
|
||||
else:
|
||||
await interaction.followup.send(result or f"Eroare TTS la bucata {i}.")
|
||||
return
|
||||
return
|
||||
|
||||
# Comportament existent: text direct, gol, sau rezumat URL
|
||||
args: list[str] = []
|
||||
if voce:
|
||||
args.append(voce)
|
||||
|
||||
Reference in New Issue
Block a user