Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(model-providers): 修正 Gemini 3.8 Flash 思考档位 (#4852)

Dashc5ce78fa8bac
diff --git a/packages/model-providers/catalog/provider-models.json b/packages/model-providers/catalog/provider-models.json
index 028a2c155a..80495101f3 100644
--- a/packages/model-providers/catalog/provider-models.json
+++ b/packages/model-providers/catalog/provider-models.json
@@ -12806,7 +12806,6 @@
"supportsImageInput": true,
"reasoning": true,
"efforts": [
- "minimal",
"low",
"medium",
"high"
@@ -12831,6 +12830,9 @@
"supportsStore": false,
"supportsDeveloperRole": false,
"supportsReasoningEffort": false
+ },
+ "thinkingLevelMap": {
+ "minimal": null
}
}
}
@@ -14416,7 +14418,6 @@
"supportsImageInput": true,
"reasoning": true,
"efforts": [
- "minimal",
"low",
"medium",
"high"
@@ -14432,7 +14433,8 @@
"pi": {
"api": "google-generative-ai",
"thinkingLevelMap": {
- "off": null
+ "off": null,
+ "minimal": null
}
}
}
@@ -15041,7 +15043,6 @@
"supportsImageInput": true,
"reasoning": true,
"efforts": [
- "minimal",
"low",
"medium",
"high"
@@ -15057,7 +15058,8 @@
"pi": {
"api": "google-vertex",
"thinkingLevelMap": {
- "off": null
+ "off": null,
+ "minimal": null
}
}
}
@@ -24608,7 +24610,6 @@
"supportsImageInput": true,
"reasoning": true,
"efforts": [
- "minimal",
"low",
"medium",
"high"
@@ -24624,7 +24625,8 @@
"pi": {
"api": "google-generative-ai",
"thinkingLevelMap": {
- "off": null
+ "off": null,
+ "minimal": null
}
}
}
@@ -49057,7 +49059,6 @@
"supportsImageInput": true,
"reasoning": true,
"efforts": [
- "minimal",
"low",
"medium",
"high"
@@ -49071,7 +49072,10 @@
},
"execution": {
"pi": {
- "api": "anthropic-messages"
+ "api": "anthropic-messages",
+ "thinkingLevelMap": {
+ "minimal": null
+ }
}
}
},
diff --git a/packages/model-providers/src/__tests__/gemini38Catalog.test.ts b/packages/model-providers/src/__tests__/gemini38Catalog.test.ts
new file mode 100644
index 0000000000..ce760ae5fb
--- /dev/null
+++ b/packages/model-providers/src/__tests__/gemini38Catalog.test.ts
@@ -0,0 +1,72 @@
+import { describe, expect, it } from "vitest";
+import { providerCatalogForPi } from "../providerModelCatalog.js";
+import { toCindyProviderModel } from "../../../../tools/pi/catalog-format.mjs";
+const piCatalog = providerCatalogForPi();
+
+describe("Gemini 3.8 Flash catalog correction", () => {
+ it.each([
+ "google",
+ "google-vertex",
+ "opencode",
+ "github-copilot",
+ "vercel-ai-gateway",
+ ])(
+ "keeps %s imports and the bundled Pi projection free of minimal",
+ (provider) => {
+ const id =
+ provider === "vercel-ai-gateway"
+ ? "google/gemini-3.8-flash"
+ : "gemini-3.8-flash";
+ const source = piCatalog.providers[provider].find(
+ (row) => row.id === id,
+ )!;
+ const bundled = { ...source, cost: { ...source.cost } };
+ expect(bundled.thinkingLevelMap).toMatchObject({ minimal: null });
+ const stale = {
+ ...bundled,
+ defaultEffort: "minimal",
+ thinkingLevelMap: { off: null, minimal: "minimal" },
+ };
+ const converted = toCindyProviderModel(stale);
+ expect(converted.efforts).toEqual(["low", "medium", "high"]);
+ expect(converted.defaultEffort).toBe("medium");
+ expect(converted.execution.pi.thinkingLevelMap).toEqual({
+ off: null,
+ minimal: null,
+ });
+ expect(
+ toCindyProviderModel({ ...stale, thinkingLevelMap: undefined }).efforts,
+ ).toEqual(["low", "medium", "high"]);
+ expect(toCindyProviderModel(bundled).efforts).toEqual([
+ "low",
+ "medium",
+ "high",
+ ]);
+ expect(stale.thinkingLevelMap.minimal).toBe("minimal");
+ for (const unrelated of [
+ { ...stale, id: "gemini-3-flash-preview" },
+ { ...stale, provider: "custom-proxy" },
+ ])
+ expect(toCindyProviderModel(unrelated).efforts).toContain("minimal");
+ },
+ );
+ it("preserves the existing OpenRouter standard and batch mappings", () => {
+ for (const id of [
+ "google/gemini-3.8-flash",
+ "google/gemini-3.8-flash:batch",
+ ]) {
+ const source = piCatalog.providers.openrouter.find(
+ (row) => row.id === id,
+ )!;
+ const model = { ...source, cost: { ...source.cost } };
+ expect(toCindyProviderModel(model).efforts).toEqual([
+ "low",
+ "medium",
+ "high",
+ ]);
+ expect(toCindyProviderModel(model).execution.pi.thinkingLevelMap).toEqual(
+ model.thinkingLevelMap,
+ );
+ }
+ });
+});
diff --git a/tools/pi/catalog-format.mjs b/tools/pi/catalog-format.mjs
index 553df82dfa..795a6f0ccc 100644
--- a/tools/pi/catalog-format.mjs
+++ b/tools/pi/catalog-format.mjs
@@ -3,6 +3,25 @@ import { piSupportedEfforts } from "../../packages/model-providers/src/piThinkin
/** Pi is an import source. Persist Cindy's public field names, with transport-specific data
* confined to execution.pi. Never copy credentials or arbitrary headers into a public catalog. */
export function toCindyProviderModel(row) {
+ // Exact known routes only: Gemini 3.8 Flash rejects minimal. Keep the correction
+ // in the import path so both online refreshes and bundle imports retain it.
+ // https://ai.google.dev/gemini-api/docs/models/gemini-3.8-flash
+ const gemini38Ids = {
+ google: "gemini-3.8-flash",
+ "google-vertex": "gemini-3.8-flash",
+ opencode: "gemini-3.8-flash",
+ "github-copilot": "gemini-3.8-flash",
+ "vercel-ai-gateway": "google/gemini-3.8-flash",
+ };
+ if (
+ Object.hasOwn(gemini38Ids, row.provider) &&
+ gemini38Ids[row.provider] === row.id
+ ) {
+ row = {
+ ...row,
+ thinkingLevelMap: { ...row.thinkingLevelMap, minimal: null },
+ };
+ }
const efforts = piSupportedEfforts(row);
const { id, provider, baseUrl, api } = row;
if (