mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-20 14:30:57 +00:00
47 lines
1.7 KiB
TypeScript
47 lines
1.7 KiB
TypeScript
import {
|
|
createPluginBackedWebSearchProvider,
|
|
getScopedCredentialValue,
|
|
setScopedCredentialValue,
|
|
} from "../../src/agents/tools/web-search-plugin-factory.js";
|
|
import { emptyPluginConfigSchema } from "../../src/plugins/config-schema.js";
|
|
import type { OpenClawPluginApi } from "../../src/plugins/types.js";
|
|
import { registerGoogleGeminiCliProvider } from "./gemini-cli-provider.js";
|
|
import { isModernGoogleModel, resolveGoogle31ForwardCompatModel } from "./provider-models.js";
|
|
|
|
const googlePlugin = {
|
|
id: "google",
|
|
name: "Google Plugin",
|
|
description: "Bundled Google plugin",
|
|
configSchema: emptyPluginConfigSchema(),
|
|
register(api: OpenClawPluginApi) {
|
|
api.registerProvider({
|
|
id: "google",
|
|
label: "Google AI Studio",
|
|
docsPath: "/providers/models",
|
|
envVars: ["GEMINI_API_KEY", "GOOGLE_API_KEY"],
|
|
auth: [],
|
|
resolveDynamicModel: (ctx) =>
|
|
resolveGoogle31ForwardCompatModel({ providerId: "google", ctx }),
|
|
isModernModelRef: ({ modelId }) => isModernGoogleModel(modelId),
|
|
});
|
|
registerGoogleGeminiCliProvider(api);
|
|
api.registerWebSearchProvider(
|
|
createPluginBackedWebSearchProvider({
|
|
id: "gemini",
|
|
label: "Gemini (Google Search)",
|
|
hint: "Google Search grounding · AI-synthesized",
|
|
envVars: ["GEMINI_API_KEY"],
|
|
placeholder: "AIza...",
|
|
signupUrl: "https://aistudio.google.com/apikey",
|
|
docsUrl: "https://docs.openclaw.ai/tools/web",
|
|
autoDetectOrder: 20,
|
|
getCredentialValue: (searchConfig) => getScopedCredentialValue(searchConfig, "gemini"),
|
|
setCredentialValue: (searchConfigTarget, value) =>
|
|
setScopedCredentialValue(searchConfigTarget, "gemini", value),
|
|
}),
|
|
);
|
|
},
|
|
};
|
|
|
|
export default googlePlugin;
|