fix: avoid duplicate block-stream payloads
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
- Config: expose schema + UI hints for generic config forms (Web UI + future clients).
|
- Config: expose schema + UI hints for generic config forms (Web UI + future clients).
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
|
- Auto-reply: drop final payloads when block streaming to avoid duplicate Discord sends.
|
||||||
- Telegram: chunk block-stream replies to avoid “message is too long” errors (#124) — thanks @mukhtharcm.
|
- Telegram: chunk block-stream replies to avoid “message is too long” errors (#124) — thanks @mukhtharcm.
|
||||||
- Block streaming: default to text_end and suppress duplicate block sends while in-flight.
|
- Block streaming: default to text_end and suppress duplicate block sends while in-flight.
|
||||||
- Block streaming: drop final payloads after soft chunking to keep Discord order intact.
|
- Block streaming: drop final payloads after soft chunking to keep Discord order intact.
|
||||||
|
|||||||
@@ -2240,13 +2240,13 @@ export async function getReplyFromConfig(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pendingStreamedPayloadKeys.add(payloadKey);
|
pendingStreamedPayloadKeys.add(payloadKey);
|
||||||
didStreamBlockReply = true;
|
|
||||||
const task = (async () => {
|
const task = (async () => {
|
||||||
await startTypingOnText(cleaned);
|
await startTypingOnText(cleaned);
|
||||||
await opts.onBlockReply?.(blockPayload);
|
await opts.onBlockReply?.(blockPayload);
|
||||||
})()
|
})()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
streamedPayloadKeys.add(payloadKey);
|
streamedPayloadKeys.add(payloadKey);
|
||||||
|
didStreamBlockReply = true;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
logVerbose(`block reply delivery failed: ${String(err)}`);
|
logVerbose(`block reply delivery failed: ${String(err)}`);
|
||||||
@@ -2348,7 +2348,7 @@ export async function getReplyFromConfig(
|
|||||||
);
|
);
|
||||||
|
|
||||||
const shouldDropFinalPayloads =
|
const shouldDropFinalPayloads =
|
||||||
blockStreamingEnabled && blockReplyChunking && didStreamBlockReply;
|
blockStreamingEnabled && didStreamBlockReply;
|
||||||
const filteredPayloads = shouldDropFinalPayloads
|
const filteredPayloads = shouldDropFinalPayloads
|
||||||
? []
|
? []
|
||||||
: blockStreamingEnabled
|
: blockStreamingEnabled
|
||||||
|
|||||||
Reference in New Issue
Block a user