mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 12:20:26 +00:00
refactor(providers): share kilocode stream family
This commit is contained in:
@@ -105,6 +105,27 @@ describe("buildProviderStreamFamilyHooks", () => {
|
||||
);
|
||||
expect(capturedModelId).toBe("MiniMax-M2.7-highspeed");
|
||||
|
||||
const kilocodeHooks = buildProviderStreamFamilyHooks("kilocode-thinking");
|
||||
kilocodeHooks.wrapStreamFn?.({
|
||||
streamFn: baseStreamFn,
|
||||
thinkingLevel: "high",
|
||||
modelId: "openai/gpt-5.4",
|
||||
} as never)({ provider: "kilocode", id: "openai/gpt-5.4" } as never, {} as never, {});
|
||||
expect(capturedPayload).toMatchObject({
|
||||
config: { thinkingConfig: { thinkingBudget: -1 } },
|
||||
reasoning: { effort: "high" },
|
||||
});
|
||||
|
||||
kilocodeHooks.wrapStreamFn?.({
|
||||
streamFn: baseStreamFn,
|
||||
thinkingLevel: "high",
|
||||
modelId: "kilo/auto",
|
||||
} as never)({ provider: "kilocode", id: "kilo/auto" } as never, {} as never, {});
|
||||
expect(capturedPayload).toMatchObject({
|
||||
config: { thinkingConfig: { thinkingBudget: -1 } },
|
||||
});
|
||||
expect(capturedPayload).not.toHaveProperty("reasoning");
|
||||
|
||||
const moonshotHooks = buildProviderStreamFamilyHooks("moonshot-thinking");
|
||||
void requireStreamFn(
|
||||
requireWrapStreamFn(moonshotHooks.wrapStreamFn)({
|
||||
|
||||
@@ -48,6 +48,7 @@ export function composeProviderStreamWrappers(
|
||||
|
||||
export type ProviderStreamFamily =
|
||||
| "google-thinking"
|
||||
| "kilocode-thinking"
|
||||
| "moonshot-thinking"
|
||||
| "minimax-fast-mode"
|
||||
| "openai-responses-defaults"
|
||||
@@ -75,6 +76,16 @@ export function buildProviderStreamFamilyHooks(
|
||||
return createMoonshotThinkingWrapper(ctx.streamFn, thinkingType);
|
||||
},
|
||||
};
|
||||
case "kilocode-thinking":
|
||||
return {
|
||||
wrapStreamFn: (ctx: ProviderWrapStreamFnContext) => {
|
||||
const thinkingLevel =
|
||||
ctx.modelId === "kilo/auto" || isProxyReasoningUnsupported(ctx.modelId)
|
||||
? undefined
|
||||
: ctx.thinkingLevel;
|
||||
return createKilocodeWrapper(ctx.streamFn, thinkingLevel);
|
||||
},
|
||||
};
|
||||
case "minimax-fast-mode":
|
||||
return {
|
||||
wrapStreamFn: (ctx: ProviderWrapStreamFnContext) =>
|
||||
|
||||
Reference in New Issue
Block a user