refactor: simplify Telegram preview streaming to single boolean (#22012)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: a4017d3b94
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Reviewed-by: @obviyus
This commit is contained in:
Ayaan Zaidi
2026-02-21 15:19:13 +05:30
committed by GitHub
parent e1cb73cdeb
commit 677384c519
13 changed files with 116 additions and 137 deletions

View File

@@ -154,11 +154,18 @@ export function buildTypingThreadParams(messageThreadId?: number) {
}
export function resolveTelegramStreamMode(telegramCfg?: {
streaming?: boolean;
streamMode?: TelegramStreamMode;
}): TelegramStreamMode {
if (typeof telegramCfg?.streaming === "boolean") {
return telegramCfg.streaming ? "partial" : "off";
}
const raw = telegramCfg?.streamMode?.trim().toLowerCase();
if (raw === "off" || raw === "partial" || raw === "block") {
return raw;
if (raw === "off") {
return "off";
}
if (raw === "partial" || raw === "block") {
return "partial";
}
return "partial";
}