mirror of https://github.com/openclaw/openclaw.git
fix(telegram): split preview per assistant block
This commit is contained in:
parent
36a0df423d
commit
7e632b9674
|
|
@ -445,7 +445,7 @@ describe("dispatchTelegramMessage draft streaming", () => {
|
|||
);
|
||||
});
|
||||
|
||||
it("does not force new message for legacy block stream mode", async () => {
|
||||
it("forces new message for next assistant block in legacy block stream mode", async () => {
|
||||
const draftStream = createDraftStream(999);
|
||||
createTelegramDraftStream.mockReturnValue(draftStream);
|
||||
dispatchReplyWithBufferedBlockDispatcher.mockImplementation(
|
||||
|
|
@ -464,10 +464,10 @@ describe("dispatchTelegramMessage draft streaming", () => {
|
|||
|
||||
await dispatchWithContext({ context: createContext(), streamMode: "block" });
|
||||
|
||||
expect(draftStream.forceNewMessage).not.toHaveBeenCalled();
|
||||
expect(draftStream.forceNewMessage).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("does not force new message in partial mode when assistant message restarts", async () => {
|
||||
it("forces new message in partial mode when assistant message restarts", async () => {
|
||||
const draftStream = createDraftStream(999);
|
||||
createTelegramDraftStream.mockReturnValue(draftStream);
|
||||
dispatchReplyWithBufferedBlockDispatcher.mockImplementation(
|
||||
|
|
@ -483,7 +483,7 @@ describe("dispatchTelegramMessage draft streaming", () => {
|
|||
|
||||
await dispatchWithContext({ context: createContext(), streamMode: "partial" });
|
||||
|
||||
expect(draftStream.forceNewMessage).not.toHaveBeenCalled();
|
||||
expect(draftStream.forceNewMessage).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("does not force new message on first assistant message start", async () => {
|
||||
|
|
|
|||
|
|
@ -630,6 +630,9 @@ export const dispatchTelegramMessage = async ({
|
|||
onAssistantMessageStart: answerLane.stream
|
||||
? () => {
|
||||
reasoningStepState.resetForNextStep();
|
||||
if (answerLane.hasStreamedMessage) {
|
||||
answerLane.stream?.forceNewMessage();
|
||||
}
|
||||
resetDraftLaneState(answerLane);
|
||||
}
|
||||
: undefined,
|
||||
|
|
|
|||
Loading…
Reference in New Issue