




















@@ -1,44 +1,6 @@
1-import { beforeAll, describe, expect, it, vi } from "vitest";
2-import type { PluginWebSearchProviderEntry } from "../plugins/types.js";
1+import { beforeAll, describe, expect, it } from "vitest";
32import { asConfig, setupSecretsRuntimeSnapshotTestHooks } from "./runtime.test-support.ts";
435-const { resolvePluginWebSearchProvidersMock } = vi.hoisted(() => ({
6-resolvePluginWebSearchProvidersMock: vi.fn<() => PluginWebSearchProviderEntry[]>(() => [
7-{
8-pluginId: "google",
9-id: "gemini",
10-label: "gemini",
11-hint: "gemini test provider",
12-envVars: ["GEMINI_API_KEY"],
13-placeholder: "gemini-...",
14-signupUrl: "https://example.com/gemini",
15-autoDetectOrder: 20,
16-credentialPath: "plugins.entries.google.config.webSearch.apiKey",
17-inactiveSecretPaths: ["plugins.entries.google.config.webSearch.apiKey"],
18-getCredentialValue: (searchConfig) => searchConfig?.apiKey,
19-setCredentialValue: (searchConfigTarget, value) => {
20-searchConfigTarget.apiKey = value;
21-},
22-getConfiguredCredentialValue: (config) =>
23-(config?.plugins?.entries?.google?.config as { webSearch?: { apiKey?: unknown } })
24-?.webSearch?.apiKey,
25-setConfiguredCredentialValue: (configTarget, value) => {
26-const plugins = (configTarget.plugins ??= {}) as { entries?: Record<string, unknown> };
27-const entries = (plugins.entries ??= {});
28-const entry = (entries.google ??= {}) as { config?: Record<string, unknown> };
29-const config = (entry.config ??= {});
30-const webSearch = (config.webSearch ??= {}) as { apiKey?: unknown };
31-webSearch.apiKey = value;
32-},
33-createTool: () => null,
34-},
35-]),
36-}));
37-38-vi.mock("../plugins/web-search-providers.runtime.js", () => ({
39-resolvePluginWebSearchProviders: resolvePluginWebSearchProvidersMock,
40-}));
41-424let activateSecretsRuntimeSnapshot: typeof import("./runtime.js").activateSecretsRuntimeSnapshot;
435let getActiveRuntimeWebToolsMetadata: typeof import("./runtime.js").getActiveRuntimeWebToolsMetadata;
446const { prepareSecretsRuntimeSnapshot } = setupSecretsRuntimeSnapshotTestHooks();
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。