Skip to content

Commit efe7922

Browse files
committed
Address Xiaomi PR review feedback
1 parent ba12325 commit efe7922

2 files changed

Lines changed: 38 additions & 36 deletions

File tree

extensions/xiaomi/index.test.ts

Lines changed: 38 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -59,49 +59,52 @@ function runWrappedXiaomiStream(params: {
5959
}
6060

6161
describe("xiaomi provider plugin", () => {
62-
it("normalizes reasoning-only final assistant messages into text for MiMo reasoning models", async () => {
63-
const stream = runWrappedXiaomiStream({
64-
modelId: "mimo-v2-pro",
65-
events: [
62+
it.each(["mimo-v2-pro", "mimo-v2-omni"])(
63+
"normalizes reasoning-only final assistant messages into text for %s",
64+
async (modelId) => {
65+
const stream = runWrappedXiaomiStream({
66+
modelId,
67+
events: [
68+
{
69+
type: "done",
70+
reason: "stop",
71+
message: {
72+
role: "assistant",
73+
content: [{ type: "thinking", thinking: "MiMo final answer" }],
74+
stopReason: "stop",
75+
},
76+
},
77+
],
78+
resultMessage: {
79+
role: "assistant",
80+
content: [{ type: "thinking", thinking: "MiMo final answer" }],
81+
stopReason: "stop",
82+
},
83+
});
84+
85+
const events: unknown[] = [];
86+
for await (const event of stream) {
87+
events.push(event);
88+
}
89+
90+
await expect(stream.result()).resolves.toEqual({
91+
role: "assistant",
92+
content: [{ type: "text", text: "MiMo final answer" }],
93+
stopReason: "stop",
94+
});
95+
expect(events).toEqual([
6696
{
6797
type: "done",
6898
reason: "stop",
6999
message: {
70100
role: "assistant",
71-
content: [{ type: "thinking", thinking: "MiMo final answer" }],
101+
content: [{ type: "text", text: "MiMo final answer" }],
72102
stopReason: "stop",
73103
},
74104
},
75-
],
76-
resultMessage: {
77-
role: "assistant",
78-
content: [{ type: "thinking", thinking: "MiMo final answer" }],
79-
stopReason: "stop",
80-
},
81-
});
82-
83-
const events: unknown[] = [];
84-
for await (const event of stream) {
85-
events.push(event);
86-
}
87-
88-
await expect(stream.result()).resolves.toEqual({
89-
role: "assistant",
90-
content: [{ type: "text", text: "MiMo final answer" }],
91-
stopReason: "stop",
92-
});
93-
expect(events).toEqual([
94-
{
95-
type: "done",
96-
reason: "stop",
97-
message: {
98-
role: "assistant",
99-
content: [{ type: "text", text: "MiMo final answer" }],
100-
stopReason: "stop",
101-
},
102-
},
103-
]);
104-
});
105+
]);
106+
},
107+
);
105108

106109
it("leaves non-target Xiaomi models unchanged", async () => {
107110
const stream = runWrappedXiaomiStream({

extensions/xiaomi/stream.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ function rewriteXiaomiReasoningContentAsTextInMessage(message: unknown): void {
6161
typedBlock.text.trim()
6262
) {
6363
hasRenderableText = true;
64-
break;
6564
}
6665
if (typedBlock.type === "toolCall") {
6766
hasToolCalls = true;

0 commit comments

Comments
 (0)