fix(telegram): handle empty reply array in notifyEmptyResponse

Previous fix only checked skippedEmpty > 0, but when model returns
content: [] no payloads are created at all. Now also checks
replies.length === 0 to catch this case.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
kiranjd 2026-01-27 21:43:49 +05:30 committed by Ayaan Zaidi
parent a2d06e75b0
commit 0761652701

View File

@ -274,7 +274,8 @@ export async function deliverReplies(params: {
}
// If all replies were empty and notifyEmptyResponse is enabled, send a fallback message
if (!hasReplied && skippedEmpty > 0 && params.notifyEmptyResponse) {
// Check both: (1) replies with no content (skippedEmpty), (2) no replies at all (empty array)
if (!hasReplied && (skippedEmpty > 0 || replies.length === 0) && params.notifyEmptyResponse) {
const fallbackText = "No response generated. Please try again.";
await sendTelegramText(bot, chatId, fallbackText, runtime, {
messageThreadId,