mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
fix(ai): preserve provider thinking level in frames
This commit is contained in:
parent
8b5899dce2
commit
0fdec07ba3
2 changed files with 11 additions and 0 deletions
|
|
@ -83,6 +83,7 @@ function cloneStartMessage(message: AssistantMessage): AssistantMessage {
|
|||
model: message.model,
|
||||
...(message.responseModel === undefined ? {} : { responseModel: message.responseModel }),
|
||||
...(message.responseId === undefined ? {} : { responseId: message.responseId }),
|
||||
...(message.providerThinkingLevel === undefined ? {} : { providerThinkingLevel: message.providerThinkingLevel }),
|
||||
...(message.diagnostics === undefined ? {} : { diagnostics: structuredClone(message.diagnostics) }),
|
||||
usage: structuredClone(message.usage),
|
||||
stopReason: "pending",
|
||||
|
|
|
|||
|
|
@ -61,6 +61,16 @@ describe("assistant message frames", () => {
|
|||
]);
|
||||
});
|
||||
|
||||
it("preserves provider thinking level from the stream start", () => {
|
||||
const partial = seed();
|
||||
partial.providerThinkingLevel = "high";
|
||||
const encoder = new AssistantMessageFrameEncoder();
|
||||
const start = frame(encoder, { type: "start", partial });
|
||||
|
||||
expect(start).toMatchObject({ type: "start", partial: { providerThinkingLevel: "high" } });
|
||||
expect(reduceAssistantMessageFrames([start])?.providerThinkingLevel).toBe("high");
|
||||
});
|
||||
|
||||
it("preserves initial and final thinking metadata, including redaction", () => {
|
||||
const partial = seed();
|
||||
const encoder = new AssistantMessageFrameEncoder();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue