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

Function saveAnalyticsToDB

lib/v2/edge-runtime/dataAnalysis.ts:44–67  ·  view source on GitHub ↗
(
  instructionMessage: string,
  llmResponse: string,
  orgId: number,
  dbData: { conversationId: number; index: number },
  bertie?: boolean,
  chosenActions?: string[],
)

Source from the content-addressed store, hash-verified

42};
43
44async function saveAnalyticsToDB(
45 instructionMessage: string,
46 llmResponse: string,
47 orgId: number,
48 dbData: { conversationId: number; index: number },
49 bertie?: boolean,
50 chosenActions?: string[],
51): Promise<void> {
52 const insertRes = await supabase.from("analytics_code_snippets").insert({
53 instruction_message: instructionMessage, // The user message contents
54 output: llmResponse,
55 org_id: orgId,
56 conversation_id: dbData.conversationId,
57 conversation_index: dbData.index,
58 is_bertie: bertie ?? false,
59 chosen_actions: chosenActions ?? [],
60 });
61 if (insertRes.error) {
62 console.error(
63 "Failed to insert analytics code snippet to DB:",
64 insertRes.error,
65 );
66 }
67}
68
69const madeAMistake = {
70 role: "loading",

Callers 1

runDataAnalysisFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected