MCPcopy
hub / github.com/ChatGPTNextWeb/NextChat / adapter

Function adapter

app/utils.ts:363–375  ·  view source on GitHub ↗
(config: Record<string, unknown>)

Source from the content-addressed store, hash-verified

361}
362
363export function adapter(config: Record<string, unknown>) {
364 const { baseURL, url, params, data: body, ...rest } = config;
365 const path = baseURL ? `${baseURL}${url}` : url;
366 const fetchUrl = params
367 ? `${path}?${new URLSearchParams(params as any).toString()}`
368 : path;
369 return fetch(fetchUrl as string, { ...rest, body }).then((res) => {
370 const { status, headers, statusText } = res;
371 return res
372 .text()
373 .then((data: string) => ({ status, statusText, headers, data }));
374 });
375}
376
377export function safeLocalStorage(): {
378 getItem: (key: string) => string | null;

Callers

nothing calls this directly

Calls 1

fetchFunction · 0.90

Tested by

no test coverage detected