MCPcopy Create free account
hub / github.com/Superflows-AI/superflows / getParam

Function getParam

lib/edge-runtime/utils.ts:162–181  ·  view source on GitHub ↗
(
  parameters: Record<string, any>,
  key: string,
  allowObjects: boolean = false,
)

Source from the content-addressed store, hash-verified

160}
161
162export function getParam(
163 parameters: Record<string, any>,
164 key: string,
165 allowObjects: boolean = false,
166): any {
167 let out: any = undefined;
168 if (key in parameters) out = parameters[key];
169 if (!out) {
170 // Sometimes (rarely) the AI replaces hyphens with underscores. This is a hacky fix
171 const found = Object.keys(parameters).find(
172 (k) => k.replaceAll("-", "_") === key.replaceAll("-", "_"),
173 );
174 if (found) out = parameters[found];
175 }
176 if (out === undefined) return undefined;
177 if (allowObjects && typeof out === "object") {
178 return JSON.stringify(out);
179 }
180 return out;
181}
182
183export function deduplicateChunks(
184 chunks: SimilaritySearchResult[],

Callers 3

constructHttpRequestFunction · 0.90
buildBodyFunction · 0.90
utils.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected