### Frontend Debugging Setup Source: https://github.com/ottermind/chat2db/blob/main/README.md Install frontend dependencies using yarn and start the development server. Ensure Node.js version 16 or higher is used. ```bash Node version must be 16 or higher Use yarn only, npm is not supported $ cd Chat2DB/chat2db-client $ yarn $ yarn run start:web ``` -------------------------------- ### Compile and Install Backend Code Source: https://github.com/ottermind/chat2db/wiki/Chat2DB-源码部署和Docker部署 Cleans the project and installs dependencies, skipping test execution. This is a prerequisite for building the deployable artifact. ```bash mvn clean install -DskipTests ``` -------------------------------- ### Run Chat2DB Docker Container Source: https://github.com/ottermind/chat2db/blob/main/README.md Removes an existing container, runs a new one with port mapping and volume mounting, and then starts the container. Ensure Docker and Docker Compose are installed and meet the system requirements. ```bash docker rm chat2db docker run --name=chat2db -ti -p 10824:10824 -v ~/.chat2db-docker:/root/.chat2db chat2db/chat2db:latest docker start chat2db ``` -------------------------------- ### Chatbot Contextual Query Example Source: https://github.com/ottermind/chat2db/blob/main/CHAT2DB_AI_SQL.md Demonstrates how to interact with the Chatbot, including providing context for follow-up questions. This example shows adding an index to a table. ```sql SHOW INDEX FROM student; ``` ```sql ALTER TABLE student ADD INDEX name_index (name); ``` ```sql SELECT score.score FROM score INNER JOIN student ON score.student_id = student.id WHERE student.name = '小明'; ``` -------------------------------- ### Backend Debugging Setup Source: https://github.com/ottermind/chat2db/blob/main/README.md Build the backend using Maven and run the application. Requires Java 17+ and a ChatGPT API key for AIGC features. ```bash $ cd ../chat2db-server $ mvn clean install # Maven version 3.8 or higher is required $ cd chat2db-server/chat2db-server-start/target/ $ java -jar -Dloader.path=./lib -Dchatgpt.apiKey=xxxxx chat2db-server-start.jar # 需要安装java 17以上版本,启动应用 chatgpt.apiKey 需要输入ChatGPT的key,如果不输入无法使用AIGC功能 ``` -------------------------------- ### SQL Optimization Example Source: https://github.com/ottermind/chat2db/blob/main/CHAT2DB_AI_SQL.md Provides optimization suggestions for SQL queries. Focuses on improving query efficiency and performance. ```sql SELECT * FROM department ORDER BY gmt_create DESC ``` -------------------------------- ### Install Yarn Package Manager Source: https://github.com/ottermind/chat2db/wiki/Chat2DB-源码部署和Docker部署 Installs the Yarn package manager globally using npm. This is necessary if Yarn is not already installed or recognized. ```powershell node --version npm i -g yarn ``` -------------------------------- ### SQL Conversion Example (NULL to NVL) Source: https://github.com/ottermind/chat2db/blob/main/CHAT2DB_AI_SQL.md Converts SQL statements between different database dialects. This example shows converting IFNULL to NVL for Oracle SQL. ```sql SELECT NVL(NULL, 'W3Schools.com') FROM dual; ``` -------------------------------- ### SQL Explanation Example Source: https://github.com/ottermind/chat2db/blob/main/CHAT2DB_AI_SQL.md Explains complex SQL queries in natural language. This helps users understand the purpose and logic of SQL statements. ```sql SELECT department_name FROM departments WHERE department_id IN (SELECT department_id FROM employees GROUP BY department_id HAVING COUNT(*) > 10) ``` -------------------------------- ### Natural Language to SQL Example Source: https://github.com/ottermind/chat2db/blob/main/CHAT2DB_AI_SQL.md Converts natural language queries into executable SQL statements. Ensure to provide relevant table structures for accurate results. ```sql SELECT score.score FROM score INNER JOIN student_course ON score.course_id = student_course.course_id INNER JOIN student ON student_course.student_id = student.id WHERE student.name = '小明' ``` -------------------------------- ### Standalone Deployment - Frontend Build Source: https://github.com/ottermind/chat2db/blob/main/README.md Build the production version of the frontend and copy the static assets and index.html to the server's resource directories. ```bash # chat2db-client $ npm run build:web:prod $ cp -r dist ../chat2db-server/chat2db-server-start/src/main/resources/static/front $ cp -r dist/index.html ../chat2db-server/chat2db-server-start/src/main/resources/thymeleaf ``` -------------------------------- ### Navigate to Target Directory Source: https://github.com/ottermind/chat2db/wiki/Chat2DB-源码部署和Docker部署 Changes the current directory to the target directory where build artifacts are located. ```bash cd chat2db-server-start/target ``` -------------------------------- ### Configure JAVA_HOME Environment Variable Source: https://github.com/ottermind/chat2db/wiki/Chat2DB-源码部署和Docker部署 Sets the JAVA_HOME environment variable in the .zshrc file. Ensure this points to a compatible JDK version for your Maven project. ```bash # Example configuration for JAVA_HOME export JAVA_HOME=/path/to/your/jdk ``` -------------------------------- ### Enable Script Execution on Windows Source: https://github.com/ottermind/chat2db/wiki/Chat2DB-源码部署和Docker部署 Allows PowerShell to run scripts. Use 'RemoteSigned' for a balance of security and usability. ```powershell Get-ExecutionPolicy Set-ExecutionPolicy RemoteSigned ``` -------------------------------- ### Clone Chat2DB Repository Source: https://github.com/ottermind/chat2db/blob/main/README.md Clone the Chat2DB repository from GitHub to your local machine. ```bash $ git clone git@github.com:chat2db/Chat2DB.git ``` -------------------------------- ### Linking Issues in Pull Requests Source: https://github.com/ottermind/chat2db/blob/main/CONTRIBUTING.md Use these formats to link issues in your pull request descriptions. This helps maintainers track related work. ```text Fixes #123 ``` ```text Related to #123 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.