mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-11 07:00:48 +08:00
重构主控编排与运行时预热链路,统一工作区提示词/专家调度协议并补齐 wiki 记忆注入与写回闭环。
同时收敛启动与运维脚本默认行为(含 wiki worker)、更新 Admin 可观测性与相关测试,降低首轮时延并提高运行稳定性。 Made-with: Cursor
This commit is contained in:
parent
4a23b715a2
commit
dbbe3add6a
14438 changed files with 2693620 additions and 2546 deletions
116
openclaw/extensions/google/thinking.test.ts
Normal file
116
openclaw/extensions/google/thinking.test.ts
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
resolveGoogleGemini3ThinkingLevel,
|
||||
sanitizeGoogleThinkingPayload,
|
||||
} from "./thinking-api.js";
|
||||
|
||||
describe("google thinking policy", () => {
|
||||
it.each([
|
||||
["off", "LOW"],
|
||||
["minimal", "LOW"],
|
||||
["low", "LOW"],
|
||||
["medium", "HIGH"],
|
||||
["adaptive", "HIGH"],
|
||||
["high", "HIGH"],
|
||||
["xhigh", "HIGH"],
|
||||
] as const)("maps Gemini 3 Pro thinking level %s to %s", (thinkingLevel, expected) => {
|
||||
expect(
|
||||
resolveGoogleGemini3ThinkingLevel({
|
||||
modelId: "gemini-3.1-pro-preview",
|
||||
thinkingLevel,
|
||||
}),
|
||||
).toBe(expected);
|
||||
});
|
||||
|
||||
it.each([
|
||||
[0, "LOW"],
|
||||
[2048, "LOW"],
|
||||
[2049, "HIGH"],
|
||||
] as const)("maps Gemini 3 Pro budget %s to %s", (thinkingBudget, expected) => {
|
||||
expect(
|
||||
resolveGoogleGemini3ThinkingLevel({
|
||||
modelId: "gemini-pro-latest",
|
||||
thinkingBudget,
|
||||
}),
|
||||
).toBe(expected);
|
||||
});
|
||||
|
||||
it.each([
|
||||
["off", "MINIMAL"],
|
||||
["minimal", "MINIMAL"],
|
||||
["low", "LOW"],
|
||||
["medium", "MEDIUM"],
|
||||
["adaptive", "MEDIUM"],
|
||||
["high", "HIGH"],
|
||||
["xhigh", "HIGH"],
|
||||
] as const)("maps Gemini 3 Flash thinking level %s to %s", (thinkingLevel, expected) => {
|
||||
expect(
|
||||
resolveGoogleGemini3ThinkingLevel({
|
||||
modelId: "gemini-flash-latest",
|
||||
thinkingLevel,
|
||||
}),
|
||||
).toBe(expected);
|
||||
});
|
||||
|
||||
it.each([
|
||||
[-1, "MINIMAL"],
|
||||
[0, "MINIMAL"],
|
||||
[2048, "LOW"],
|
||||
[8192, "MEDIUM"],
|
||||
[8193, "HIGH"],
|
||||
] as const)("maps Gemini 3 Flash budget %s to %s", (thinkingBudget, expected) => {
|
||||
expect(
|
||||
resolveGoogleGemini3ThinkingLevel({
|
||||
modelId: "gemini-3.1-flash-lite-preview",
|
||||
thinkingBudget,
|
||||
}),
|
||||
).toBe(expected);
|
||||
});
|
||||
|
||||
it("removes thinkingBudget=0 for Gemini 2.5 Pro", () => {
|
||||
const payload = {
|
||||
config: {
|
||||
thinkingConfig: { thinkingBudget: 0 },
|
||||
},
|
||||
};
|
||||
|
||||
sanitizeGoogleThinkingPayload({ payload, modelId: "google/gemini-2.5-pro-preview" });
|
||||
|
||||
expect(payload.config).not.toHaveProperty("thinkingConfig");
|
||||
});
|
||||
|
||||
it("rewrites Gemini 3 thinking budgets to thinkingLevel", () => {
|
||||
const payload = {
|
||||
generationConfig: {
|
||||
thinkingConfig: { thinkingBudget: 8193, includeThoughts: true },
|
||||
},
|
||||
};
|
||||
|
||||
sanitizeGoogleThinkingPayload({
|
||||
payload,
|
||||
modelId: "gemini-3-flash-preview",
|
||||
thinkingLevel: "medium",
|
||||
});
|
||||
|
||||
expect(payload.generationConfig.thinkingConfig).toEqual({
|
||||
includeThoughts: true,
|
||||
thinkingLevel: "MEDIUM",
|
||||
});
|
||||
});
|
||||
|
||||
it("maps Gemma 4 thinking mode without sending thinkingBudget", () => {
|
||||
const payload = {
|
||||
config: {
|
||||
thinkingConfig: { thinkingBudget: 4096 },
|
||||
},
|
||||
};
|
||||
|
||||
sanitizeGoogleThinkingPayload({
|
||||
payload,
|
||||
modelId: "gemma-4-26b-a4b-it",
|
||||
thinkingLevel: "high",
|
||||
});
|
||||
|
||||
expect(payload.config.thinkingConfig).toEqual({ thinkingLevel: "HIGH" });
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue