MCPcopy Create free account
hub / github.com/CommandCodeAI/BaseAI / handleRun

Function handleRun

packages/baseai/src/dev/routes/beta/pipes/run.ts:115–136  ·  view source on GitHub ↗
(c: any)

Source from the content-addressed store, hash-verified

113
114// Main endpoint handler
115const handleRun = async (c: any) => {
116 try {
117 const body = await c.req.json();
118
119 const llmKey = (body.llmApiKey as string) || '';
120 const hiddenChars = new Array(45).fill('*').join('');
121 const redactedKey = llmKey.length
122 ? llmKey.slice(0, 8) + hiddenChars
123 : '';
124
125 const logData = { ...body, llmApiKey: redactedKey };
126 logger('pipe.request', logData, 'Pipe Request Body');
127
128 const validatedBody = validateRequestBody(body);
129
130 const rawLlmResponse = await callLLM(validatedBody);
131
132 return processLlmResponse(c, validatedBody, rawLlmResponse);
133 } catch (error: unknown) {
134 return handleGenerateError(c, error);
135 }
136};
137
138// Register the endpoint
139export const registerBetaPipesRun = (app: Hono) => {

Callers

nothing calls this directly

Calls 5

loggerFunction · 0.90
callLLMFunction · 0.90
validateRequestBodyFunction · 0.70
processLlmResponseFunction · 0.70
handleGenerateErrorFunction · 0.70

Tested by

no test coverage detected