feat(telegram): fix short transcriptions summary publications in telegram
-pull/3/head
parent
cb7bc6c97b
commit
ab719cc60d
|
|
@ -167,9 +167,13 @@ async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
||||||
# Zapisz pełne streszczenie do bazy danych
|
# Zapisz pełne streszczenie do bazy danych
|
||||||
saved = await save_video_summary(url, title, transcript, combined_summary)
|
saved = await save_video_summary(url, title, transcript, combined_summary)
|
||||||
|
|
||||||
# Wyślij końcowe streszczenie, jeśli były więcej niż 3 fragmenty
|
# Wyślij końcowe streszczenie niezależnie od ilości fragmentów
|
||||||
if len(chunks) > 3:
|
if len(chunks) > 3:
|
||||||
final_text = f"*Ostateczne streszczenie filmu:*\n*{title}*\n\n{combined_summary}"
|
final_text = f"*Ostateczne streszczenie filmu:*\n*{title}*\n\n{combined_summary}"
|
||||||
|
else:
|
||||||
|
# Dla krótszych filmów po prostu wyślij streszczenie
|
||||||
|
final_text = f"*Streszczenie filmu:*\n*{title}*\n\n{combined_summary}"
|
||||||
|
|
||||||
await send_long_message(
|
await send_long_message(
|
||||||
context.bot,
|
context.bot,
|
||||||
chat_id=chat_id,
|
chat_id=chat_id,
|
||||||
|
|
@ -181,13 +185,7 @@ async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
||||||
# Podsumowanie procesu
|
# Podsumowanie procesu
|
||||||
if saved:
|
if saved:
|
||||||
logger.info(f"Pomyślnie przetworzono i zapisano film: {title} ({url})")
|
logger.info(f"Pomyślnie przetworzono i zapisano film: {title} ({url})")
|
||||||
if len(chunks) <= 3: # Nie wysyłaj podsumowania ponownie dla dłuższych filmów
|
# Nie wysyłamy dodatkowej wiadomości, bo już wysłaliśmy streszczenie
|
||||||
await safe_send_message(
|
|
||||||
context.bot,
|
|
||||||
chat_id=chat_id,
|
|
||||||
text=f"Pomyślnie zapisano streszczenie filmu w bazie danych: {title}",
|
|
||||||
disable_web_page_preview=True
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
logger.error(f"Nie udało się zapisać danych do bazy dla filmu: {title} ({url})")
|
logger.error(f"Nie udało się zapisać danych do bazy dla filmu: {title} ({url})")
|
||||||
await safe_send_message(
|
await safe_send_message(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue