MCPcopy Index your code
hub / github.com/caesarHQ/textSQL / explainSql

Function explainSql

client/censusGPT/src/App.js:422–450  ·  view source on GitHub ↗
(sql)

Source from the content-addressed store, hash-verified

420 }
421
422 const explainSql = (sql) => {
423 setIsExplainSqlLoading(true)
424
425 const options = {
426 method: 'POST',
427 headers: { 'content-type': 'application/json' },
428 body: JSON.stringify({
429 sql,
430 session_id: sessionId,
431 }),
432 }
433
434 fetch(api_endpoint + '/api/explain_sql', options)
435 .then((response) => response.json())
436 .then((response) => {
437 setSqlExplanation(response.explanation)
438 setIsExplainSqlLoading(false)
439 })
440 .catch((err) => {
441 setSqlExplanation()
442 logSentryError({ query }, err)
443 setIsExplainSqlLoading(false)
444 capturePosthog('explainSql_backend_error', {
445 error: err,
446 })
447 setErrorMessage(err.message || err)
448 console.error(err)
449 })
450 }
451
452 const getTables = async (natural_language_query) => {
453 setIsGetTablesLoading(true)

Callers 1

sqlDisplay.jsFile · 0.85

Calls 2

logSentryErrorFunction · 0.90
capturePosthogFunction · 0.90

Tested by

no test coverage detected