mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 12:50:42 +00:00
perf: avoid heavy imports in hot tests
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { resolveAuthProfileOrder } from "./auth-profiles/order.js";
|
||||
import type { AuthProfileStore } from "./auth-profiles/types.js";
|
||||
import { isProfileInCooldown } from "./auth-profiles/usage.js";
|
||||
import { isProfileInCooldown } from "./auth-profiles/usage-state.js";
|
||||
|
||||
/**
|
||||
* Integration tests for cooldown auto-expiry through resolveAuthProfileOrder.
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { resolveProviderEndpoint } from "../agents/provider-attribution.js";
|
||||
|
||||
export const DEFAULT_GOOGLE_API_BASE_URL = "https://generativelanguage.googleapis.com/v1beta";
|
||||
const GOOGLE_GENERATIVE_LANGUAGE_HOST = "generativelanguage.googleapis.com";
|
||||
|
||||
function trimTrailingSlashes(value: string): string {
|
||||
return value.replace(/\/+$/, "");
|
||||
@@ -17,7 +16,7 @@ export function normalizeGoogleApiBaseUrl(baseUrl?: string): string {
|
||||
url.hash = "";
|
||||
url.search = "";
|
||||
if (
|
||||
resolveProviderEndpoint(url.toString()).endpointClass === "google-generative-ai" &&
|
||||
url.hostname.toLowerCase() === GOOGLE_GENERATIVE_LANGUAGE_HOST &&
|
||||
trimTrailingSlashes(url.pathname || "") === ""
|
||||
) {
|
||||
url.pathname = "/v1beta";
|
||||
|
||||
Reference in New Issue
Block a user