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

Function saveAnalyticsToDB

lib/edge-runtime/dataAnalysis.ts:48–68  ·  view source on GitHub ↗
(
  instructionMessage: string,
  llmResponse: string,
  orgId: number,
  dbData: { conversationId: number; index: number },
)

Source from the content-addressed store, hash-verified

46type NonUserMessage = FunctionMessage | AssistantMessage;
47
48async function saveAnalyticsToDB(
49 instructionMessage: string,
50 llmResponse: string,
51 orgId: number,
52 dbData: { conversationId: number; index: number },
53) {
54 const insertRes = await supabase.from("analytics_code_snippets").insert({
55 // The user message contents
56 instruction_message: instructionMessage,
57 output: llmResponse,
58 org_id: orgId,
59 conversation_id: dbData.conversationId,
60 conversation_index: dbData.index,
61 });
62 if (insertRes.error) {
63 console.error(
64 "Failed to insert analytics code snippet to DB:",
65 insertRes.error,
66 );
67 }
68}
69
70export async function runDataAnalysis(
71 instruction: string,

Callers 1

runDataAnalysisFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected