mirror of
https://github.com/supabase/supabase.git
synced 2026-06-22 21:16:29 +08:00
* First * Fix the parsing of SQL. * Get thread data action * Remove old page * Wait for data to complete * SSR everywhere * Remove unused * Add monaco settings * update loaders * Add sorting * supress hydration warnings * Fix profile layout * more server action action * fixes * Update page.tsx * Update actions.ts * Update AssistantChatForm.tsx * init * add polling * Update actions.ts * redirect to message id * Update page.tsx * Update page.tsx * handle run loading states with use client state with valtio * reduce first load JS * test action v1 * test action v2 * server action test 3 * test action 4 * test action 5 * test 6 * test 7 * test 7 * test 8 * test 9 * test 10 * test 11 * TEST 12 * TEST 13 * try and make it work * Update page.tsx * Update actions.ts * redirect added in * Update page.tsx * Update SchemaFlow.tsx * Update SchemaFlowHandler.tsx * 14 * Update SchemaFlow.tsx * move parse tables to client * a11y fixes --------- Co-authored-by: Terry Sutton <saltcod@gmail.com> Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
66 lines
2.0 KiB
TypeScript
66 lines
2.0 KiB
TypeScript
// import { UserMessage } from '@/lib/types'
|
|
// import dagre from '@dagrejs/dagre'
|
|
// import { Edge, Node, Position } from 'reactflow'
|
|
// import { NODE_HEIGHT, NODE_WIDTH } from './AllThreadsModal.constants'
|
|
// import { MessageNodeData } from './MessageNode'
|
|
|
|
// export const getGraphDataFromMessages = ({
|
|
// messages,
|
|
// onSelectMessage,
|
|
// }: {
|
|
// messages: UserMessage[]
|
|
// onSelectMessage: (message: UserMessage) => void
|
|
// }): { nodes: Node<MessageNodeData>[]; edges: Edge[] } => {
|
|
// const nodes: Node[] = messages.map((message, idx) => {
|
|
// return {
|
|
// id: message.id,
|
|
// type: 'message',
|
|
// data: {
|
|
// id: message.id,
|
|
// text: message.text,
|
|
// isStart: idx === 0,
|
|
// isEnd: idx === messages.length - 1,
|
|
// onSelectMessage: () => onSelectMessage(message),
|
|
// },
|
|
// position: { x: 0, y: 0 },
|
|
// }
|
|
// })
|
|
|
|
// const edges: Edge[] = []
|
|
// messages.forEach((message, idx) => {
|
|
// if (idx > 0) {
|
|
// edges.push({
|
|
// id: `edge-${idx}`,
|
|
// source: messages[idx - 1].id,
|
|
// target: message.id,
|
|
// type: 'smoothstep',
|
|
// animated: true,
|
|
// })
|
|
// }
|
|
// })
|
|
|
|
// const dagreGraph = new dagre.graphlib.Graph()
|
|
// dagreGraph.setDefaultEdgeLabel(() => ({}))
|
|
// dagreGraph.setGraph({ rankdir: 'TB', ranksep: 50, nodesep: 20 })
|
|
|
|
// nodes.forEach((node) =>
|
|
// dagreGraph.setNode(node.id, { width: NODE_WIDTH / 2, height: NODE_HEIGHT / 2 })
|
|
// )
|
|
// edges.forEach((edge) => dagreGraph.setEdge(edge.source, edge.target))
|
|
// dagre.layout(dagreGraph)
|
|
|
|
// nodes.forEach((node) => {
|
|
// const nodeWithPosition = dagreGraph.node(node.id)
|
|
// node.targetPosition = Position.Top
|
|
// node.sourcePosition = Position.Bottom
|
|
// node.position = {
|
|
// x: nodeWithPosition.x - nodeWithPosition.width / 2,
|
|
// y: nodeWithPosition.y - nodeWithPosition.height / 2,
|
|
// }
|
|
|
|
// return node
|
|
// })
|
|
|
|
// return { nodes, edges }
|
|
// }
|