Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion app/bot/responder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ export async function handleBotAiResponse(ctx: Context): Promise<void> {
};

const sendOrEdit = (accumulated: string): void => {
clearInterval(typingInterval);
streamedAccumulated = accumulated;
if (isCancelled()) return;
const slice = accumulated.length > MAX_MESSAGE_TEXT_LENGTH
Expand Down Expand Up @@ -372,7 +373,19 @@ export async function handleBotAiResponse(ctx: Context): Promise<void> {

interruptedReplyCallback = sendInterruptedReply;

await sendOrEditOnce("…", "…");
// Start with rotating typing indicator instead of static "…"
const typingFrames = ["\\", "/", "-", "|"];
let typingIndex = 0;

await sendOrEditOnce(typingFrames[typingIndex], typingFrames[typingIndex]);

const typingInterval = setInterval(() => {
if (sentMessageId === null) return;
typingIndex = (typingIndex + 1) % typingFrames.length;
ctx.api
.editMessageText(chatId, sentMessageId, typingFrames[typingIndex])
.catch(() => {});
}, 300);
result = await transmitStream(
{ input: text, userId, context, mode, threadContext, instructions: TELEGRAM_BOT_LENGTH_INSTRUCTION },
sendOrEdit,
Expand Down
Loading