mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
refactor(fireworks): flatten Kimi stream wrapper
This commit is contained in:
@@ -37,7 +37,7 @@ function capturePayload(params: {
|
||||
return captured;
|
||||
}
|
||||
|
||||
describe("createFireworksKimiThinkingDisabledWrapper", () => {
|
||||
describe("wrapFireworksProviderStream", () => {
|
||||
it("forces thinking disabled for Fireworks Kimi models", () => {
|
||||
expect(
|
||||
capturePayload({
|
||||
|
||||
@@ -10,17 +10,6 @@ function isFireworksProviderId(providerId: string): boolean {
|
||||
return normalized === "fireworks" || normalized === "fireworks-ai";
|
||||
}
|
||||
|
||||
function createFireworksKimiThinkingDisabledWrapper(baseStreamFn: StreamFn | undefined): StreamFn {
|
||||
return createPayloadPatchStreamWrapper(baseStreamFn, ({ payload }) => {
|
||||
// Fireworks Kimi can emit chain-of-thought in visible `content` unless
|
||||
// the Anthropic-style thinking toggle is explicitly disabled.
|
||||
payload.thinking = { type: "disabled" };
|
||||
delete payload.reasoning;
|
||||
delete payload.reasoning_effort;
|
||||
delete payload.reasoningEffort;
|
||||
});
|
||||
}
|
||||
|
||||
export function wrapFireworksProviderStream(
|
||||
ctx: ProviderWrapStreamFnContext,
|
||||
): StreamFn | undefined {
|
||||
@@ -31,5 +20,12 @@ export function wrapFireworksProviderStream(
|
||||
) {
|
||||
return undefined;
|
||||
}
|
||||
return createFireworksKimiThinkingDisabledWrapper(ctx.streamFn);
|
||||
return createPayloadPatchStreamWrapper(ctx.streamFn, ({ payload }) => {
|
||||
// Fireworks Kimi can emit chain-of-thought in visible `content` unless
|
||||
// the Anthropic-style thinking toggle is explicitly disabled.
|
||||
payload.thinking = { type: "disabled" };
|
||||
delete payload.reasoning;
|
||||
delete payload.reasoning_effort;
|
||||
delete payload.reasoningEffort;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user