MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / normalizeGeminiBaseUrl

Function normalizeGeminiBaseUrl

ai/ai.ts:1796–1812  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

1794
1795const normalizeGeminiBaseUrl = (url: string): string => {
1796 try {
1797 const u = new URL(url);
1798 u.pathname = u.pathname.replace(/\/+$/, "");
1799 if (u.pathname === "" || u.pathname === "/") {
1800 u.pathname = "/v1beta";
1801 }
1802 if (!u.pathname.startsWith("/v1beta")) {
1803 u.pathname = "/v1beta";
1804 }
1805 u.search = "";
1806 u.hash = "";
1807 return u.toString();
1808 } catch {
1809 return url;
1810 }
1811};
1812
1813const parseOpenAIChatResponse = (
1814 data: any,
1815): { text: string; images: AIImage[] } => {

Callers 2

resolveBaseUrlFunction · 0.85
generateGeminiVideoMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected