The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat(sql-editor): ai telemetry
Greg Richardson67c4fd64bedc
diff --git a/studio/components/interfaces/SQLEditor/SQLEditor.tsx b/studio/components/interfaces/SQLEditor/SQLEditor.tsxindex c54bfff9e4a..2e843c165c8 100644--- a/studio/components/interfaces/SQLEditor/SQLEditor.tsx+++ b/studio/components/interfaces/SQLEditor/SQLEditor.tsx@@ -1,4 +1,4 @@-import { useParams } from 'common'+import { useParams, useTelemetryProps } from 'common'import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'import ConfirmModal from 'components/ui/Dialogs/ConfirmDialog'import { useSqlEditMutation } from 'data/ai/sql-edit-mutation'@@ -19,6 +19,7 @@ import useLatest from 'hooks/misc/useLatest'import { IS_PLATFORM } from 'lib/constants'import { uuidv4 } from 'lib/helpers'import { useProfile } from 'lib/profile'+import Telemetry from 'lib/telemetry'import dynamic from 'next/dynamic'import { useRouter } from 'next/router'import {@@ -123,6 +124,7 @@ const SQLEditor = () => {const { ui } = useStore()const { ref, id } = useParams()const router = useRouter()+ const telemetryProps = useTelemetryProps()const { profile } = useProfile()const { project } = useProjectContext()const snap = useSqlEditorStateSnapshot()@@ -299,6 +301,16 @@ const SQLEditor = () => {])}+ Telemetry.sendEvent(+ {+ category: 'sql_editor',+ action: 'ai_suggestion_accept',+ label: debugSolution ? 'debug_snippet' : 'edit_snippet',+ },+ telemetryProps,+ router+ )+setAiInput('')setSelectedDiffType(DiffType.Modification)setDebugSolution(undefined)@@ -309,15 +321,25 @@ const SQLEditor = () => {} finally {setIsAcceptDiffLoading(false)}- }, [sqlDiff, selectedDiffType, handleNewQuery, titleSql])+ }, [sqlDiff, selectedDiffType, handleNewQuery, titleSql, debugSolution, telemetryProps, router])const discardAiHandler = useCallback(() => {+ Telemetry.sendEvent(+ {+ category: 'sql_editor',+ action: 'ai_suggestion_reject',+ label: debugSolution ? 'debug_snippet' : 'edit_snippet',+ },+ telemetryProps,+ router+ )+setDebugSolution(undefined)setSqlDiff(undefined)setTimeout(() => {inputRef.current?.focus()}, 0)- }, [])+ }, [debugSolution, telemetryProps, router])useEffect(() => {const handler = (e: KeyboardEvent) => {