perf: avoid heavy imports in hot tests · openclaw/openclaw@c27b82d
steipete
·
2026-04-28
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | | -import { resolveProviderEndpoint } from "../agents/provider-attribution.js"; |
2 | | - |
3 | 1 | export const DEFAULT_GOOGLE_API_BASE_URL = "https://generativelanguage.googleapis.com/v1beta"; |
| 2 | +const GOOGLE_GENERATIVE_LANGUAGE_HOST = "generativelanguage.googleapis.com"; |
4 | 3 | |
5 | 4 | function trimTrailingSlashes(value: string): string { |
6 | 5 | return value.replace(/\/+$/, ""); |
@@ -17,7 +16,7 @@ export function normalizeGoogleApiBaseUrl(baseUrl?: string): string {
|
17 | 16 | url.hash = ""; |
18 | 17 | url.search = ""; |
19 | 18 | if ( |
20 | | -resolveProviderEndpoint(url.toString()).endpointClass === "google-generative-ai" && |
| 19 | +url.hostname.toLowerCase() === GOOGLE_GENERATIVE_LANGUAGE_HOST && |
21 | 20 | trimTrailingSlashes(url.pathname || "") === "" |
22 | 21 | ) { |
23 | 22 | url.pathname = "/v1beta"; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。