Skip to content

QuXiangjie/NLP2SQL-ChatGPT-API-SQL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧠 ChatGPT-powered NLP2SQL System

A web-based application that allows users to upload Excel files, ask natural language questions, and receive automatically generated SQL queries powered by ChatGPT API, all using Node.js, Express, EJS, and JavaScript. The backend supports database login, SQL query execution, and data preview — perfect for turning non-technical Excel users into database query pros.


📦 Features

  • 🗂 Upload Excel files and preview content (headers + top 5 rows).
  • 🧾 Use ChatGPT API to generate SQL queries from natural language.
  • 🧪 Execute SQL queries directly from the interface.
  • 💾 Store and manage Excel and SQL query history with MongoDB.
  • 🖼 View detailed query and sheet data using EJS templates.

🛠 Tech Stack

Layer Technologies
Frontend HTML, CSS, JavaScript, EJS
Backend Node.js, Express
Database MongoDB (Excel & Query Storage), MS SQL Server (Data Source)
AI Service OpenAI ChatGPT API
File Handling multer, xlsx for parsing Excel
DB Connection msnodesqlv8 for SQL Server

Project Structure

image

Start

git clone https://github.com/yourusername/nlp2sql.git
cd nlp2sql

npm install

Create a .env file to manage secrets (optional if hardcoded):

OPENAI_API_KEY=your_openai_key_here
MONGO_URI=your_mongodb_uri
PORT=3000
npm start

About

NLP2SQL: 基于 ChatGPT API 的自然语言转 SQL 查询系统:一个使用 Node.js、Express.js、EJS 和 ChatGPT API 构建的 Web 应用程序,允许用户通过上传 Excel 表格并输入自然语言问题,自动生成 SQL 查询语句,连接 MSSQL 数据库并执行查询结果展示。

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors