style: italicize reasoning output
This commit is contained in:
@@ -164,7 +164,7 @@ describe("subscribeEmbeddedPiSession", () => {
|
||||
|
||||
expect(onBlockReply).toHaveBeenCalledTimes(2);
|
||||
expect(onBlockReply.mock.calls[0][0].text).toBe(
|
||||
"Reasoning:\nBecause it helps",
|
||||
"Reasoning:\n_Because it helps_",
|
||||
);
|
||||
expect(onBlockReply.mock.calls[1][0].text).toBe("Final answer");
|
||||
});
|
||||
@@ -209,7 +209,7 @@ describe("subscribeEmbeddedPiSession", () => {
|
||||
|
||||
expect(onBlockReply).toHaveBeenCalledTimes(2);
|
||||
expect(onBlockReply.mock.calls[0][0].text).toBe(
|
||||
"Reasoning:\nBecause it helps",
|
||||
"Reasoning:\n_Because it helps_",
|
||||
);
|
||||
expect(onBlockReply.mock.calls[1][0].text).toBe("Final answer");
|
||||
|
||||
@@ -283,7 +283,7 @@ describe("subscribeEmbeddedPiSession", () => {
|
||||
const streamTexts = onReasoningStream.mock.calls
|
||||
.map((call) => call[0]?.text)
|
||||
.filter((value): value is string => typeof value === "string");
|
||||
expect(streamTexts.at(-1)).toBe("Reasoning:\nBecause it helps");
|
||||
expect(streamTexts.at(-1)).toBe("Reasoning:\n_Because it helps_");
|
||||
|
||||
expect(assistantMessage.content).toEqual([
|
||||
{ type: "thinking", thinking: "Because it helps" },
|
||||
|
||||
@@ -37,7 +37,9 @@ export function extractAssistantThinking(msg: AssistantMessage): string {
|
||||
export function formatReasoningMessage(text: string): string {
|
||||
const trimmed = text.trim();
|
||||
if (!trimmed) return "";
|
||||
return `Reasoning:\n${trimmed}`;
|
||||
// Show reasoning in italics (cursive) for markdown-friendly surfaces (Discord, etc.).
|
||||
// Keep the plain "Reasoning:" prefix so existing parsing/detection keeps working.
|
||||
return `Reasoning:\n_${trimmed}_`;
|
||||
}
|
||||
|
||||
type ThinkTaggedSplitBlock =
|
||||
|
||||
@@ -206,7 +206,7 @@ describe("runReplyAgent typing (heartbeat)", () => {
|
||||
text?: string;
|
||||
}) => Promise<void> | void;
|
||||
}) => {
|
||||
await params.onReasoningStream?.({ text: "Reasoning:\nstep" });
|
||||
await params.onReasoningStream?.({ text: "Reasoning:\n_step_" });
|
||||
await params.onPartialReply?.({ text: "hi" });
|
||||
return { payloads: [{ text: "final" }], meta: {} };
|
||||
},
|
||||
|
||||
@@ -286,7 +286,7 @@ describe("runHeartbeatOnce", () => {
|
||||
};
|
||||
|
||||
replySpy.mockResolvedValue([
|
||||
{ text: "Reasoning:\nBecause it helps" },
|
||||
{ text: "Reasoning:\n_Because it helps_" },
|
||||
{ text: "Final alert" },
|
||||
]);
|
||||
const sendWhatsApp = vi.fn().mockResolvedValue({
|
||||
@@ -309,7 +309,7 @@ describe("runHeartbeatOnce", () => {
|
||||
expect(sendWhatsApp).toHaveBeenNthCalledWith(
|
||||
1,
|
||||
"+1555",
|
||||
"Reasoning:\nBecause it helps",
|
||||
"Reasoning:\n_Because it helps_",
|
||||
expect.any(Object),
|
||||
);
|
||||
expect(sendWhatsApp).toHaveBeenNthCalledWith(
|
||||
@@ -361,7 +361,7 @@ describe("runHeartbeatOnce", () => {
|
||||
};
|
||||
|
||||
replySpy.mockResolvedValue([
|
||||
{ text: "Reasoning:\nBecause it helps" },
|
||||
{ text: "Reasoning:\n_Because it helps_" },
|
||||
{ text: "HEARTBEAT_OK" },
|
||||
]);
|
||||
const sendWhatsApp = vi.fn().mockResolvedValue({
|
||||
@@ -384,7 +384,7 @@ describe("runHeartbeatOnce", () => {
|
||||
expect(sendWhatsApp).toHaveBeenNthCalledWith(
|
||||
1,
|
||||
"+1555",
|
||||
"Reasoning:\nBecause it helps",
|
||||
"Reasoning:\n_Because it helps_",
|
||||
expect.any(Object),
|
||||
);
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user