feat: 添加gemini协议适配 (#125)

* feat: 添加gemini协议适配

* Remove unrelated local files from Gemini PR
This commit is contained in:
SaltedFish555
2026-04-06 09:55:20 +08:00
committed by GitHub
parent 27825293bb
commit 0da5ec09e8
24 changed files with 2257 additions and 38 deletions

View File

@@ -474,3 +474,10 @@ describe("formatZodError", () => {
}
});
});
describe("gemini settings", () => {
test("accepts gemini modelType", () => {
const result = SettingsSchema().safeParse({ modelType: "gemini" });
expect(result.success).toBe(true);
});
});

View File

@@ -373,11 +373,11 @@ export const SettingsSchema = lazySchema(() =>
.optional()
.describe('Tool usage permissions configuration'),
modelType: z
.enum(['anthropic', 'openai'])
.enum(['anthropic', 'openai', 'gemini'])
.optional()
.describe(
'API provider type. "anthropic" uses the Anthropic API (default), "openai" uses the OpenAI Chat Completions API (/v1/chat/completions). ' +
'When set to "openai", configure OPENAI_API_KEY, OPENAI_BASE_URL, and OPENAI_MODEL in env.',
'API provider type. "anthropic" uses the Anthropic API (default), "openai" uses the OpenAI Chat Completions API (/v1/chat/completions), and "gemini" uses the Gemini Generate Content API. ' +
'When set to "openai", configure OPENAI_API_KEY, OPENAI_BASE_URL, and OPENAI_MODEL in env. When set to "gemini", configure GEMINI_API_KEY, optional GEMINI_BASE_URL, and either GEMINI_MODEL or ANTHROPIC_DEFAULT_*_MODEL family env vars.',
),
model: z
.string()
@@ -1153,3 +1153,4 @@ export type PluginConfig = {
[serverName: string]: UserConfigValues
}
}