MCPcopy Create free account
hub / github.com/ConnectAI-E/TalkBase / handler

Function handler

pages/api/table.ts:11–27  ·  view source on GitHub ↗
(
    req: NextApiRequest,
    res: NextApiResponse,
)

Source from the content-addressed store, hash-verified

9const model = createLanguageModel(process.env);
10
11export default async function handler(
12 req: NextApiRequest,
13 res: NextApiResponse,
14) {
15 const { input, schema, table } = JSON.parse(req.body) as Prop;
16 // console.log(schema);
17 // console.log(table);
18 const translator = createJsonTranslator(model, schema, table);
19 const response = await translator.translate(input);
20 console.log(response);
21 if (!response.success) {
22 console.log(response.message);
23 res.status(500).send({ error: response.message })
24 return;
25 }
26 res.status(200).send({ res: response.data });
27}
28
29
30

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected