mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-03 03:03:24 -04:00
refactor(agents): drop pi subscribe fallback changes from this pr
This commit is contained in:
@@ -165,10 +165,9 @@ export function handleMessageUpdate(
|
||||
}
|
||||
}
|
||||
|
||||
const streamedReasoning = extractThinkingFromTaggedStream(ctx.state.deltaBuffer);
|
||||
if (ctx.state.streamReasoning) {
|
||||
// Handle partial <think> tags: stream whatever reasoning is visible so far.
|
||||
ctx.emitReasoningStream(streamedReasoning);
|
||||
ctx.emitReasoningStream(extractThinkingFromTaggedStream(ctx.state.deltaBuffer));
|
||||
}
|
||||
|
||||
const next = ctx
|
||||
@@ -277,9 +276,7 @@ export function handleMessageEnd(
|
||||
});
|
||||
const rawThinking =
|
||||
ctx.state.includeReasoning || ctx.state.streamReasoning
|
||||
? extractAssistantThinking(assistantMessage) ||
|
||||
extractThinkingFromTaggedStream(ctx.state.deltaBuffer) ||
|
||||
extractThinkingFromTaggedText(rawText)
|
||||
? extractAssistantThinking(assistantMessage) || extractThinkingFromTaggedText(rawText)
|
||||
: "";
|
||||
const formattedReasoning = rawThinking ? formatReasoningMessage(rawThinking) : "";
|
||||
const trimmedText = text.trim();
|
||||
|
||||
@@ -68,36 +68,4 @@ describe("subscribeEmbeddedPiSession", () => {
|
||||
]);
|
||||
},
|
||||
);
|
||||
|
||||
it.each(THINKING_TAG_CASES)(
|
||||
"falls back to streamed <%s> reasoning when message_end has no thinking block",
|
||||
({ open, close }) => {
|
||||
const { emit, onBlockReply } = createReasoningBlockReplyHarness();
|
||||
|
||||
emit({ type: "message_start", message: { role: "assistant" } });
|
||||
emit({
|
||||
type: "message_update",
|
||||
message: { role: "assistant" },
|
||||
assistantMessageEvent: { type: "text_delta", delta: `${open}Because` },
|
||||
});
|
||||
emit({
|
||||
type: "message_update",
|
||||
message: { role: "assistant" },
|
||||
assistantMessageEvent: {
|
||||
type: "text_delta",
|
||||
delta: ` it helps${close}\n\nFinal answer`,
|
||||
},
|
||||
});
|
||||
|
||||
emit({
|
||||
type: "message_end",
|
||||
message: {
|
||||
role: "assistant",
|
||||
content: [{ type: "text", text: "Final answer" }],
|
||||
} as AssistantMessage,
|
||||
});
|
||||
|
||||
expectReasoningAndAnswerCalls(onBlockReply);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user