From 33837ec903ad425851c1016873ba12efbbde82fd Mon Sep 17 00:00:00 2001 From: SwallowGG <1558143046@qq.com> Date: Mon, 28 Oct 2024 14:42:14 +0800 Subject: [PATCH 01/25] feat:support download task --- .../chat2db/plugin/clickhouse/builder/ClickHouseSqlBuilder.java | 2 ++ .../chat2db-h2/src/main/java/ai/chat2db/plugin/h2/H2Meta.java | 1 + .../java/ai/chat2db/plugin/hive/builder/HiveSqlBuilder.java | 2 ++ .../web/api/controller/rdb/converter/RdbWebConverter.java | 2 ++ 4 files changed, 7 insertions(+) diff --git a/chat2db-server/chat2db-plugins/chat2db-clickhouse/src/main/java/ai/chat2db/plugin/clickhouse/builder/ClickHouseSqlBuilder.java b/chat2db-server/chat2db-plugins/chat2db-clickhouse/src/main/java/ai/chat2db/plugin/clickhouse/builder/ClickHouseSqlBuilder.java index 9f313c27c..0eef415af 100644 --- a/chat2db-server/chat2db-plugins/chat2db-clickhouse/src/main/java/ai/chat2db/plugin/clickhouse/builder/ClickHouseSqlBuilder.java +++ b/chat2db-server/chat2db-plugins/chat2db-clickhouse/src/main/java/ai/chat2db/plugin/clickhouse/builder/ClickHouseSqlBuilder.java @@ -10,6 +10,8 @@ import ai.chat2db.spi.model.TableIndex; import org.apache.commons.lang3.StringUtils; +import java.util.List; + public class ClickHouseSqlBuilder extends DefaultSqlBuilder { @Override diff --git a/chat2db-server/chat2db-plugins/chat2db-h2/src/main/java/ai/chat2db/plugin/h2/H2Meta.java b/chat2db-server/chat2db-plugins/chat2db-h2/src/main/java/ai/chat2db/plugin/h2/H2Meta.java index 1b1cc2fd6..05f938c3b 100644 --- a/chat2db-server/chat2db-plugins/chat2db-h2/src/main/java/ai/chat2db/plugin/h2/H2Meta.java +++ b/chat2db-server/chat2db-plugins/chat2db-h2/src/main/java/ai/chat2db/plugin/h2/H2Meta.java @@ -3,6 +3,7 @@ import java.sql.Connection; import java.sql.ResultSet; import java.sql.ResultSetMetaData; +import java.sql.SQLException; import java.util.*; import java.util.stream.Collectors; diff --git a/chat2db-server/chat2db-plugins/chat2db-hive/src/main/java/ai/chat2db/plugin/hive/builder/HiveSqlBuilder.java b/chat2db-server/chat2db-plugins/chat2db-hive/src/main/java/ai/chat2db/plugin/hive/builder/HiveSqlBuilder.java index 02a761df7..a3ca677dd 100644 --- a/chat2db-server/chat2db-plugins/chat2db-hive/src/main/java/ai/chat2db/plugin/hive/builder/HiveSqlBuilder.java +++ b/chat2db-server/chat2db-plugins/chat2db-hive/src/main/java/ai/chat2db/plugin/hive/builder/HiveSqlBuilder.java @@ -2,6 +2,7 @@ import ai.chat2db.plugin.hive.type.HiveColumnTypeEnum; import ai.chat2db.plugin.hive.type.HiveIndexTypeEnum; +import ai.chat2db.spi.SqlBuilder; import ai.chat2db.spi.jdbc.DefaultSqlBuilder; import ai.chat2db.spi.model.Database; import ai.chat2db.spi.model.Table; @@ -9,6 +10,7 @@ import ai.chat2db.spi.model.TableIndex; import org.apache.commons.lang3.StringUtils; +import java.util.List; public class HiveSqlBuilder extends DefaultSqlBuilder implements SqlBuilder { diff --git a/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/rdb/converter/RdbWebConverter.java b/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/rdb/converter/RdbWebConverter.java index f9c529a5b..7881cf93a 100644 --- a/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/rdb/converter/RdbWebConverter.java +++ b/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/rdb/converter/RdbWebConverter.java @@ -42,6 +42,8 @@ public abstract class RdbWebConverter { public abstract DlExecuteParam request2param(DmlRequest request); + + public abstract GroupByParam request2param(GroupByRequest request); /** * Parameter conversion * From d37fd66981b6d09a63a93692c145149a46c56765 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=BA=E5=96=9C?= <86969353+shanhexi@users.noreply.github.com> Date: Mon, 28 Oct 2024 22:40:08 +0800 Subject: [PATCH 02/25] =?UTF-8?q?=E4=BF=AE=E6=94=B9jar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 61b492976..c5c31fbdf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -86,11 +86,7 @@ jobs: - name: Enable tls1 if: ${{ runner.os == 'Windows' }} run: | - # sed -i '' "s/\(^jdk.tls.disabledAlgorithms=\)\(.*\)\( TLSv1, TLSv1.1,\)\(.*\)/\1\2\4/" "${{ env.JAVA_HOME }}/conf/security/java.security" - $filePath = "${{ env.JAVA_HOME }}\conf\security\java.security" - $content = Get-Content $filePath -Raw - $updatedContent = $content -replace '^(jdk.tls.disabledAlgorithms=)(.*)( TLSv1, TLSv1.1,)(.*)', '$1$2$4' - $updatedContent | Set-Content $filePath + sed -i '' "s/\(^jdk.tls.disabledAlgorithms=\)\(.*\)\( TLSv1, TLSv1.1,\)\(.*\)/\1\2\4/" "${{ env.JAVA_HOME }}/conf/security/java.security" shell: pwsh # java.security open tls1 macOS From 85b99252f697a4296d94ac9ed143ce4eaac26213 Mon Sep 17 00:00:00 2001 From: SwallowGG <1558143046@qq.com> Date: Tue, 29 Oct 2024 09:50:57 +0800 Subject: [PATCH 03/25] feat:support download task --- .github/workflows/release.yml | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c5c31fbdf..9f2590a88 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -83,17 +83,31 @@ jobs: java-package: "jre" # java.security open tls1 Windows - - name: Enable tls1 - if: ${{ runner.os == 'Windows' }} - run: | - sed -i '' "s/\(^jdk.tls.disabledAlgorithms=\)\(.*\)\( TLSv1, TLSv1.1,\)\(.*\)/\1\2\4/" "${{ env.JAVA_HOME }}/conf/security/java.security" - shell: pwsh - - # java.security open tls1 macOS - - name: Enable tls1 - if: ${{ runner.os == 'macOS' }} +# - name: Enable tls1 +# if: ${{ runner.os == 'Windows' }} +# run: | +# sed -i '' "s/\(^jdk.tls.disabledAlgorithms=\)\(.*\)\( TLSv1, TLSv1.1,\)\(.*\)/\1\2\4/" "${{ env.JAVA_HOME }}/conf/security/java.security" +# shell: pwsh +# +# # java.security open tls1 macOS +# - name: Enable tls1 +# if: ${{ runner.os == 'macOS' }} +# run: | +# sed -i '' "s/\(^jdk.tls.disabledAlgorithms=\)\(.*\)\( TLSv1, TLSv1.1,\)\(.*\)/\1\2\4/" $JAVA_HOME/conf/security/java.security + # 开放TLS + - name: Enable TLS 1.0 and 1.1 in java.security run: | - sed -i '' "s/\(^jdk.tls.disabledAlgorithms=\)\(.*\)\( TLSv1, TLSv1.1,\)\(.*\)/\1\2\4/" $JAVA_HOME/conf/security/java.security + if [ "$RUNNER_OS" = "Windows" ]; then + sed -i "s/\(^jdk.tls.disabledAlgorithms=\)\(.*\)\(TLSv1, TLSv1.1,\)\(.*\)/\1\2\4/" "$JAVA_HOME/conf/security/java.security" + elif [ "$RUNNER_OS" = "Linux" ]; then + sed -i "s/\(^jdk.tls.disabledAlgorithms=\)\(.*\)\(TLSv1, TLSv1.1,\)\(.*\)/\1\2\4/" "$JAVA_HOME/conf/security/java.security" + elif [ "$RUNNER_OS" = "macOS" ]; then + sed -i '' "s/\(^jdk.tls.disabledAlgorithms=\)\(.*\)\(TLSv1, TLSv1.1,\)\(.*\)/\1\2\4/" "$JAVA_HOME/conf/security/java.security" + fi + shell: bash + env: + RUNNER_OS: ${{ runner.os }} + JAVA_HOME: ${{ env.JAVA_HOME }} # Copy jre Windows - name: Copy Jre for Windows From cb4fb975d5660c99b4b7961c2dc2414e1b02f118 Mon Sep 17 00:00:00 2001 From: SwallowGG <1558143046@qq.com> Date: Tue, 29 Oct 2024 16:25:08 +0800 Subject: [PATCH 04/25] feat:support download task --- .github/workflows/release.yml | 89 +++++++++++++++-------------------- 1 file changed, 37 insertions(+), 52 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9f2590a88..3d83f04f2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,14 +2,14 @@ name: Build Client # Workflow's trigger -# Pack when creating tags +# 在创建标签的时候打包 on: push: tags: - v* # Workflow's jobs -# A total of 3 computers are required to run +# 一共需要3台电脑运行 # windows # macos-latest x86_64 # macos-latest arm64 @@ -31,7 +31,7 @@ jobs: - name: Check out git repository uses: actions/checkout@main - # Obtaining the version number is not supported by workflow, so a plug-in is used. + # 获取版本号 workflow不支持 所以用插件 - name: Create version id: chat2db_version uses: bhowell2/github-substring-action@1.0.1 @@ -39,13 +39,13 @@ jobs: value: ${{ github.ref }} index_of_str: "refs/tags/v" - # Output basic information + # 输出基础信息 - name: Print basic information run: | echo "current environment: ${{ env.CHAT2DB_ENVIRONMENT }}" echo "current version: ${{ steps.chat2db_version.outputs.substring }}" - # Install jre Windows + # 安装jre Windows - name: Install Jre for Windows if: ${{ runner.os == 'Windows' }} uses: actions/setup-java@main @@ -54,7 +54,7 @@ jobs: distribution: "temurin" java-package: "jre" - # Install jre MacOS X64 + # 安装jre MacOS X64 - name: Install Jre MacOS X64 if: ${{ runner.os == 'macOS' && matrix.arch == 'x86_64' }} uses: actions/setup-java@main @@ -63,7 +63,7 @@ jobs: distribution: "temurin" java-package: "jre" - # Install jre MacOS arm64 + # 安装jre MacOS arm64 - name: Install Jre MacOS arm64 if: ${{ runner.os == 'macOS' && matrix.arch == 'arm64' }} uses: actions/setup-java@main @@ -73,7 +73,7 @@ jobs: java-package: "jre" architecture: "aarch64" - # Install jre Linux + # 安装jre Linux - name: Install Jre for Linux if: ${{ runner.os == 'Linux' }} uses: actions/setup-java@main @@ -82,41 +82,26 @@ jobs: distribution: "temurin" java-package: "jre" - # java.security open tls1 Windows -# - name: Enable tls1 -# if: ${{ runner.os == 'Windows' }} -# run: | -# sed -i '' "s/\(^jdk.tls.disabledAlgorithms=\)\(.*\)\( TLSv1, TLSv1.1,\)\(.*\)/\1\2\4/" "${{ env.JAVA_HOME }}/conf/security/java.security" -# shell: pwsh -# -# # java.security open tls1 macOS -# - name: Enable tls1 -# if: ${{ runner.os == 'macOS' }} -# run: | -# sed -i '' "s/\(^jdk.tls.disabledAlgorithms=\)\(.*\)\( TLSv1, TLSv1.1,\)\(.*\)/\1\2\4/" $JAVA_HOME/conf/security/java.security - # 开放TLS - - name: Enable TLS 1.0 and 1.1 in java.security + # java.security 开放tls1 Windows + - name: Enable tls1 + if: ${{ runner.os == 'Windows' }} + run: | + sed -i '' "s/\(^jdk.tls.disabledAlgorithms=\)\(.*\)\( TLSv1, TLSv1.1,\)\(.*\)/\1\2\4/" "${{ env.JAVA_HOME }}/conf/security/java.security" + + # java.security 开放tls1 macOS + - name: Enable tls1 + if: ${{ runner.os == 'macOS' }} run: | - if [ "$RUNNER_OS" = "Windows" ]; then - sed -i "s/\(^jdk.tls.disabledAlgorithms=\)\(.*\)\(TLSv1, TLSv1.1,\)\(.*\)/\1\2\4/" "$JAVA_HOME/conf/security/java.security" - elif [ "$RUNNER_OS" = "Linux" ]; then - sed -i "s/\(^jdk.tls.disabledAlgorithms=\)\(.*\)\(TLSv1, TLSv1.1,\)\(.*\)/\1\2\4/" "$JAVA_HOME/conf/security/java.security" - elif [ "$RUNNER_OS" = "macOS" ]; then - sed -i '' "s/\(^jdk.tls.disabledAlgorithms=\)\(.*\)\(TLSv1, TLSv1.1,\)\(.*\)/\1\2\4/" "$JAVA_HOME/conf/security/java.security" - fi - shell: bash - env: - RUNNER_OS: ${{ runner.os }} - JAVA_HOME: ${{ env.JAVA_HOME }} - - # Copy jre Windows + sed -i '' "s/\(^jdk.tls.disabledAlgorithms=\)\(.*\)\( TLSv1, TLSv1.1,\)\(.*\)/\1\2\4/" $JAVA_HOME/conf/security/java.security + + # 复制jre Windows - name: Copy Jre for Windows if: ${{ runner.os == 'Windows' }} run: | mkdir chat2db-client/static cp -r "${{ env.JAVA_HOME }}" chat2db-client/static/jre - # Copy jre macOS + # 复制jre macOS - name: Copy Jre for macOS if: ${{ runner.os == 'macOS' }} run: | @@ -124,7 +109,7 @@ jobs: cp -r $JAVA_HOME chat2db-client/static/jre chmod -R 777 chat2db-client/static/jre/ - # Copy jre Linux + # 复制jre Linux - name: Copy Jre for Linux if: ${{ runner.os == 'Linux' }} run: | @@ -132,7 +117,7 @@ jobs: cp -r $JAVA_HOME chat2db-client/static/jre chmod -R 777 chat2db-client/static/jre/ - # Install node + # 安装node - name: Install Node.js uses: actions/setup-node@main with: @@ -140,7 +125,7 @@ jobs: cache: "yarn" cache-dependency-path: chat2db-client/yarn.lock - # Install java + # 安装java - name: Install Java and Maven uses: actions/setup-java@main with: @@ -148,7 +133,7 @@ jobs: distribution: "temurin" cache: "maven" - # Build static file information + # 构建静态文件信息 - name: Yarn install & build & copy run: | cd chat2db-client @@ -160,7 +145,7 @@ jobs: yarn yarn run build - # Compile server-side java version + # 编译服务端java版本 - name: Build Java run: mvn clean package -B '-Dmaven.test.skip=true' -f chat2db-server/pom.xml @@ -175,7 +160,7 @@ jobs: echo -n ${{ steps.chat2db_version.outputs.substring }} > version cp -r version ./versions/ - # Copy server-side java to the specified location + # 复制服务端java 到指定位置 - name: Copy App run: | cp chat2db-server/chat2db-server-start/target/chat2db-server-start.jar chat2db-client/versions/${{ steps.chat2db_version.outputs.substring }}/static/ @@ -220,7 +205,7 @@ jobs: run: | xcrun notarytool store-credentials "Chat2DB" --apple-id "${{secrets.MAC_APPLE_ID}}" --password "${{secrets.MAC_APPLE_PASSWORD}}" --team-id "${{secrets.MAC_TEAM_ID}}" xcrun notarytool submit chat2db-client/release/Chat2DB-${{ steps.chat2db_version.outputs.substring }}.dmg --keychain-profile "Chat2DB" - + # macos arm64 - name: Build/release Electron app for MacOS arm64 if: ${{ runner.os == 'macOS' && matrix.arch == 'arm64' }} @@ -260,14 +245,14 @@ jobs: args: "-c.extraMetadata.version=${{ steps.chat2db_version.outputs.substring }} --linux" release: true - # Prepare the required data Windows + # 准备要需要的数据 Windows - name: Prepare upload for Windows if: runner.os == 'Windows' run: | mkdir oss_temp_file cp -r chat2db-client/release/*Setup*.exe ./oss_temp_file - # Prepare the required data MacOS x86_64 + # 准备要需要的数据 MacOS x86_64 - name: Prepare upload for MacOS x86_64 if: ${{ runner.os == 'macOS' && matrix.arch == 'x86_64' }} run: | @@ -280,21 +265,21 @@ jobs: cd static/ && zip -r chat2db-server-start.zip ./ cp -r chat2db-server-start.zip ../../../../oss_temp_file - # Prepare the required data MacOS arm64 + # 准备要需要的数据 MacOS arm64 - name: Prepare upload for MacOS arm64 if: ${{ runner.os == 'macOS' && matrix.arch == 'arm64' }} run: | mkdir oss_temp_file cp -r chat2db-client/release/*.dmg ./oss_temp_file - # Prepare the required data Linux + # 准备要需要的数据 Linux - name: Prepare upload for Linux if: runner.os == 'Linux' run: | mkdir oss_temp_file cp -r chat2db-client/release/*.AppImage ./oss_temp_file - # Upload files to OSS for easy downloading + # 把文件上传到OSS 方便下载 - name: Set up oss utils uses: yizhoumo/setup-ossutil@v1 with: @@ -306,7 +291,7 @@ jobs: run: | ossutil cp -rf --acl=public-read ./oss_temp_file/ oss://chat2db-client/release/${{ steps.chat2db_version.outputs.substring }}/ - # Build completion notification + # 构建完成通知 - name: Send dingtalk message for Windows if: ${{ runner.os == 'Windows' }} uses: ghostoy/dingtalk-action@master @@ -319,7 +304,7 @@ jobs: "text": "# Windows-release-打包完成通知 \n ![bang](https://oss.sqlgpt.cn/static/happy100.jpg) \n ### 任务id:[${{ github.run_id }}](https://github.com/chat2db/Chat2DB/actions/runs/${{ github.run_id }}) \n ### Windows下载地址:[https://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/Chat2DB%20Setup%20${{ steps.chat2db_version.outputs.substring }}.exe](https://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/Chat2DB%20Setup%20${{ steps.chat2db_version.outputs.substring }}.exe) " } - # Build completion notification + # 构建完成通知 - name: Send dingtalk message for MacOS x86_64 if: ${{ runner.os == 'macOS' && matrix.arch == 'x86_64' }} uses: ghostoy/dingtalk-action@master @@ -332,7 +317,7 @@ jobs: "text": "# MacOS-x86_64-release-打包完成通知 \n ![bang](https://oss.sqlgpt.cn/static/happy100.jpg) \n ### 任务id:[${{ github.run_id }}](https://github.com/chat2db/Chat2DB/actions/runs/${{ github.run_id }}) \n ### Intel芯片下载地址:[https://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/Chat2DB-${{ steps.chat2db_version.outputs.substring }}.dmg](https://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/Chat2DB-${{ steps.chat2db_version.outputs.substring }}.dmg) \n ### jar包下载地址:[https://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/chat2db-server-start.zip](https://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/chat2db-server-start.zip) " } - # Build completion notification + # 构建完成通知 - name: Send dingtalk message for MacOS arm64 if: ${{ runner.os == 'macOS' && matrix.arch == 'arm64' }} uses: ghostoy/dingtalk-action@master @@ -345,7 +330,7 @@ jobs: "text": "# MacOS-arm64-release-打包完成通知 \n ![bang](https://oss.sqlgpt.cn/static/happy100.jpg) \n ### 任务id:[${{ github.run_id }}](https://github.com/chat2db/Chat2DB/actions/runs/${{ github.run_id }}) \n ### Apple芯片下载地址:[https://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/Chat2DB-${{ steps.chat2db_version.outputs.substring }}-arm64.dmg](https://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/Chat2DB-${{ steps.chat2db_version.outputs.substring }}-arm64.dmg) " } - # Build completion notification + # 构建完成通知 - name: Send dingtalk message for Linux if: ${{ runner.os == 'Linux' }} uses: ghostoy/dingtalk-action@master From ecd350d41e682065dfd63425cbdda3eea10d38d3 Mon Sep 17 00:00:00 2001 From: SwallowGG <1558143046@qq.com> Date: Tue, 29 Oct 2024 17:09:42 +0800 Subject: [PATCH 05/25] feat:support download task --- .github/workflows/release.yml | 66 +++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3d83f04f2..cca88c92a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,14 +2,14 @@ name: Build Client # Workflow's trigger -# 在创建标签的时候打包 +# Pack when creating tags on: push: tags: - v* # Workflow's jobs -# 一共需要3台电脑运行 +# A total of 3 computers are required to run # windows # macos-latest x86_64 # macos-latest arm64 @@ -31,7 +31,7 @@ jobs: - name: Check out git repository uses: actions/checkout@main - # 获取版本号 workflow不支持 所以用插件 + # Obtaining the version number is not supported by workflow, so a plug-in is used. - name: Create version id: chat2db_version uses: bhowell2/github-substring-action@1.0.1 @@ -39,13 +39,13 @@ jobs: value: ${{ github.ref }} index_of_str: "refs/tags/v" - # 输出基础信息 + # Output basic information - name: Print basic information run: | echo "current environment: ${{ env.CHAT2DB_ENVIRONMENT }}" echo "current version: ${{ steps.chat2db_version.outputs.substring }}" - # 安装jre Windows + # Install jre Windows - name: Install Jre for Windows if: ${{ runner.os == 'Windows' }} uses: actions/setup-java@main @@ -54,7 +54,7 @@ jobs: distribution: "temurin" java-package: "jre" - # 安装jre MacOS X64 + # Install jre MacOS X64 - name: Install Jre MacOS X64 if: ${{ runner.os == 'macOS' && matrix.arch == 'x86_64' }} uses: actions/setup-java@main @@ -62,8 +62,9 @@ jobs: java-version: "17" distribution: "temurin" java-package: "jre" + architecture: "x64" - # 安装jre MacOS arm64 + # Install jre MacOS arm64 - name: Install Jre MacOS arm64 if: ${{ runner.os == 'macOS' && matrix.arch == 'arm64' }} uses: actions/setup-java@main @@ -73,7 +74,7 @@ jobs: java-package: "jre" architecture: "aarch64" - # 安装jre Linux + # Install jre Linux - name: Install Jre for Linux if: ${{ runner.os == 'Linux' }} uses: actions/setup-java@main @@ -82,26 +83,31 @@ jobs: distribution: "temurin" java-package: "jre" - # java.security 开放tls1 Windows + # java.security open tls1 Windows - name: Enable tls1 if: ${{ runner.os == 'Windows' }} run: | - sed -i '' "s/\(^jdk.tls.disabledAlgorithms=\)\(.*\)\( TLSv1, TLSv1.1,\)\(.*\)/\1\2\4/" "${{ env.JAVA_HOME }}/conf/security/java.security" - - # java.security 开放tls1 macOS + # sed -i '' "s/\(^jdk.tls.disabledAlgorithms=\)\(.*\)\( TLSv1, TLSv1.1,\)\(.*\)/\1\2\4/" "${{ env.JAVA_HOME }}\conf\security\java.security" + $filePath = "${{ env.JAVA_HOME }}\conf\security\java.security" + $content = Get-Content $filePath -Raw + $updatedContent = $content -replace '^(jdk.tls.disabledAlgorithms=)(.*)( TLSv1, TLSv1.1,)(.*)', '$1$2$4' + $updatedContent | Set-Content $filePath + shell: pwsh + + # java.security open tls1 macOS - name: Enable tls1 if: ${{ runner.os == 'macOS' }} run: | sed -i '' "s/\(^jdk.tls.disabledAlgorithms=\)\(.*\)\( TLSv1, TLSv1.1,\)\(.*\)/\1\2\4/" $JAVA_HOME/conf/security/java.security - # 复制jre Windows + # Copy jre Windows - name: Copy Jre for Windows if: ${{ runner.os == 'Windows' }} run: | mkdir chat2db-client/static cp -r "${{ env.JAVA_HOME }}" chat2db-client/static/jre - # 复制jre macOS + # Copy jre macOS - name: Copy Jre for macOS if: ${{ runner.os == 'macOS' }} run: | @@ -109,7 +115,7 @@ jobs: cp -r $JAVA_HOME chat2db-client/static/jre chmod -R 777 chat2db-client/static/jre/ - # 复制jre Linux + # Copy jre Linux - name: Copy Jre for Linux if: ${{ runner.os == 'Linux' }} run: | @@ -117,7 +123,7 @@ jobs: cp -r $JAVA_HOME chat2db-client/static/jre chmod -R 777 chat2db-client/static/jre/ - # 安装node + # Install node - name: Install Node.js uses: actions/setup-node@main with: @@ -125,7 +131,7 @@ jobs: cache: "yarn" cache-dependency-path: chat2db-client/yarn.lock - # 安装java + # Install java - name: Install Java and Maven uses: actions/setup-java@main with: @@ -133,7 +139,7 @@ jobs: distribution: "temurin" cache: "maven" - # 构建静态文件信息 + # Build static file information - name: Yarn install & build & copy run: | cd chat2db-client @@ -145,7 +151,7 @@ jobs: yarn yarn run build - # 编译服务端java版本 + # Compile server-side java version - name: Build Java run: mvn clean package -B '-Dmaven.test.skip=true' -f chat2db-server/pom.xml @@ -160,7 +166,7 @@ jobs: echo -n ${{ steps.chat2db_version.outputs.substring }} > version cp -r version ./versions/ - # 复制服务端java 到指定位置 + # Copy server-side java to the specified location - name: Copy App run: | cp chat2db-server/chat2db-server-start/target/chat2db-server-start.jar chat2db-client/versions/${{ steps.chat2db_version.outputs.substring }}/static/ @@ -245,14 +251,14 @@ jobs: args: "-c.extraMetadata.version=${{ steps.chat2db_version.outputs.substring }} --linux" release: true - # 准备要需要的数据 Windows + # Prepare the required data Windows - name: Prepare upload for Windows if: runner.os == 'Windows' run: | mkdir oss_temp_file cp -r chat2db-client/release/*Setup*.exe ./oss_temp_file - # 准备要需要的数据 MacOS x86_64 + # Prepare the required data MacOS x86_64 - name: Prepare upload for MacOS x86_64 if: ${{ runner.os == 'macOS' && matrix.arch == 'x86_64' }} run: | @@ -265,21 +271,21 @@ jobs: cd static/ && zip -r chat2db-server-start.zip ./ cp -r chat2db-server-start.zip ../../../../oss_temp_file - # 准备要需要的数据 MacOS arm64 + # Prepare the required data MacOS arm64 - name: Prepare upload for MacOS arm64 if: ${{ runner.os == 'macOS' && matrix.arch == 'arm64' }} run: | mkdir oss_temp_file cp -r chat2db-client/release/*.dmg ./oss_temp_file - # 准备要需要的数据 Linux + # Prepare the required data Linux - name: Prepare upload for Linux if: runner.os == 'Linux' run: | mkdir oss_temp_file cp -r chat2db-client/release/*.AppImage ./oss_temp_file - # 把文件上传到OSS 方便下载 + # Upload files to OSS for easy downloading - name: Set up oss utils uses: yizhoumo/setup-ossutil@v1 with: @@ -291,7 +297,7 @@ jobs: run: | ossutil cp -rf --acl=public-read ./oss_temp_file/ oss://chat2db-client/release/${{ steps.chat2db_version.outputs.substring }}/ - # 构建完成通知 + # Build completion notification - name: Send dingtalk message for Windows if: ${{ runner.os == 'Windows' }} uses: ghostoy/dingtalk-action@master @@ -304,7 +310,7 @@ jobs: "text": "# Windows-release-打包完成通知 \n ![bang](https://oss.sqlgpt.cn/static/happy100.jpg) \n ### 任务id:[${{ github.run_id }}](https://github.com/chat2db/Chat2DB/actions/runs/${{ github.run_id }}) \n ### Windows下载地址:[https://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/Chat2DB%20Setup%20${{ steps.chat2db_version.outputs.substring }}.exe](https://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/Chat2DB%20Setup%20${{ steps.chat2db_version.outputs.substring }}.exe) " } - # 构建完成通知 + # Build completion notification - name: Send dingtalk message for MacOS x86_64 if: ${{ runner.os == 'macOS' && matrix.arch == 'x86_64' }} uses: ghostoy/dingtalk-action@master @@ -317,7 +323,7 @@ jobs: "text": "# MacOS-x86_64-release-打包完成通知 \n ![bang](https://oss.sqlgpt.cn/static/happy100.jpg) \n ### 任务id:[${{ github.run_id }}](https://github.com/chat2db/Chat2DB/actions/runs/${{ github.run_id }}) \n ### Intel芯片下载地址:[https://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/Chat2DB-${{ steps.chat2db_version.outputs.substring }}.dmg](https://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/Chat2DB-${{ steps.chat2db_version.outputs.substring }}.dmg) \n ### jar包下载地址:[https://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/chat2db-server-start.zip](https://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/chat2db-server-start.zip) " } - # 构建完成通知 + # Build completion notification - name: Send dingtalk message for MacOS arm64 if: ${{ runner.os == 'macOS' && matrix.arch == 'arm64' }} uses: ghostoy/dingtalk-action@master @@ -330,7 +336,7 @@ jobs: "text": "# MacOS-arm64-release-打包完成通知 \n ![bang](https://oss.sqlgpt.cn/static/happy100.jpg) \n ### 任务id:[${{ github.run_id }}](https://github.com/chat2db/Chat2DB/actions/runs/${{ github.run_id }}) \n ### Apple芯片下载地址:[https://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/Chat2DB-${{ steps.chat2db_version.outputs.substring }}-arm64.dmg](https://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/Chat2DB-${{ steps.chat2db_version.outputs.substring }}-arm64.dmg) " } - # 构建完成通知 + # Build completion notification - name: Send dingtalk message for Linux if: ${{ runner.os == 'Linux' }} uses: ghostoy/dingtalk-action@master @@ -341,4 +347,4 @@ jobs: { "title": "Linux-test-打包完成通知", "text": "# Linux-test-打包完成通知 \n ![bang](https://oss.sqlgpt.cn/static/happy100.jpg) \n ### 任务id:[${{ github.run_id }}](https://github.com/chat2db/Chat2DB/actions/runs/${{ github.run_id }}) \n ### Linux下载地址:[https://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/Chat2DB-${{ steps.chat2db_version.outputs.substring }}.AppImage](https://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/Chat2DB-${{ steps.chat2db_version.outputs.substring }}.AppImage)" - } + } \ No newline at end of file From d383444213d5510b9e46294ec044ef36f676da3d Mon Sep 17 00:00:00 2001 From: SwallowGG <1558143046@qq.com> Date: Tue, 29 Oct 2024 17:33:01 +0800 Subject: [PATCH 06/25] delete demo data error --- .../main/resources/db/migration/V2_1_10__REMOVEdEMO.sql | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/resources/db/migration/V2_1_10__REMOVEdEMO.sql diff --git a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/resources/db/migration/V2_1_10__REMOVEdEMO.sql b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/resources/db/migration/V2_1_10__REMOVEdEMO.sql new file mode 100644 index 000000000..b0f5f6300 --- /dev/null +++ b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/resources/db/migration/V2_1_10__REMOVEdEMO.sql @@ -0,0 +1,7 @@ +delete from DATA_SOURCE where ALIAS ='DEMO@db.sqlgpt.cn'; + +delete from DASHBOARD where id =ID; + +delete from CHART where id<=3; + +delete from DASHBOARD_CHART_RELATION where CHART_ID<=3; From 1aa3b570ffd724dc21b5f23bd94b3e5ac19a838c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=BA=E5=96=9C?= <86969353+shanhexi@users.noreply.github.com> Date: Thu, 31 Oct 2024 17:50:55 +0800 Subject: [PATCH 07/25] =?UTF-8?q?fix:=E7=82=B9=E5=87=BB=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89ai=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chat2db-client/src/blocks/Setting/UpdateDetection/index.tsx | 6 +++--- chat2db-client/src/typings/ai.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/chat2db-client/src/blocks/Setting/UpdateDetection/index.tsx b/chat2db-client/src/blocks/Setting/UpdateDetection/index.tsx index 38ecfc756..e2c1e7880 100644 --- a/chat2db-client/src/blocks/Setting/UpdateDetection/index.tsx +++ b/chat2db-client/src/blocks/Setting/UpdateDetection/index.tsx @@ -41,9 +41,9 @@ const UpdateDetection = memo( const [notificationApi, notificationDom] = notification.useNotification(); const timesRef = React.useRef(0); - useEffect(() => { - checkUpdate(); - }, []); + // useEffect(() => { + // checkUpdate(); + // }, []); const close = () => {}; diff --git a/chat2db-client/src/typings/ai.ts b/chat2db-client/src/typings/ai.ts index 0ed1d7b2e..da79e4b7f 100644 --- a/chat2db-client/src/typings/ai.ts +++ b/chat2db-client/src/typings/ai.ts @@ -1,5 +1,5 @@ export enum AIType { - // CHAT2DBAI = 'CHAT2DBAI', + CHAT2DBAI = 'CHAT2DBAI', ZHIPUAI = 'ZHIPUAI', BAICHUANAI='BAICHUANAI', WENXINAI='WENXINAI', From ecf2f994789066eaabcd44e9b3c100ccbde7a8bf Mon Sep 17 00:00:00 2001 From: Chat2DB <1558143046@qq.com> Date: Thu, 7 Nov 2024 21:37:45 +0800 Subject: [PATCH 08/25] Update README_CN.md --- README_CN.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README_CN.md b/README_CN.md index 402bd9ec7..4ae049dc7 100644 --- a/README_CN.md +++ b/README_CN.md @@ -1,6 +1,5 @@ - - + 加群前请先 Star 和 Fork,谢谢~关注微信公众号可加入微信、钉钉、QQ 群一起讨论,并可以获取 Chat2DB 最新动态和更新。 From be4ecc21692652cf6a9ccf0d8abc723096e1c909 Mon Sep 17 00:00:00 2001 From: tmlx1990 Date: Mon, 16 Dec 2024 20:04:24 +0800 Subject: [PATCH 09/25] =?UTF-8?q?fix:1559=20=E4=BF=AE=E5=A4=8D=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89AI=E4=B8=8D=E8=83=BD=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/api/controller/ai/ChatController.java | 14 +- .../ai/rest/client/RestAIClient.java | 33 +++- .../ai/rest/client/RestAIStreamClient.java | 180 ++++++++++++++++++ .../ai/rest/client/RestAiStreamClient.java | 166 ---------------- .../listener/RestAIEventSourceListener.java | 26 ++- .../ai/rest/model/RestAIChatCompletions.java | 96 ++++++++++ .../controller/config/ConfigController.java | 11 +- 7 files changed, 338 insertions(+), 188 deletions(-) create mode 100644 chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ai/rest/client/RestAIStreamClient.java delete mode 100644 chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ai/rest/client/RestAiStreamClient.java create mode 100644 chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ai/rest/model/RestAIChatCompletions.java diff --git a/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ai/ChatController.java b/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ai/ChatController.java index 7b2a5ca69..8010a1258 100644 --- a/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ai/ChatController.java +++ b/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ai/ChatController.java @@ -235,7 +235,7 @@ public SseEmitter distributeAISql(ChatQueryRequest queryRequest, SseEmitter sseE case CHAT2DBAI: return chatWithChat2dbAi(queryRequest, sseEmitter, uid); case RESTAI : - return chatWithRestAi(queryRequest, sseEmitter); + return chatWithRestAi(queryRequest, sseEmitter, uid); case FASTCHATAI: return chatWithFastChatAi(queryRequest, sseEmitter, uid); case AZUREAI : @@ -261,9 +261,15 @@ public SseEmitter distributeAISql(ChatQueryRequest queryRequest, SseEmitter sseE * @param sseEmitter * @return */ - private SseEmitter chatWithRestAi(ChatQueryRequest prompt, SseEmitter sseEmitter) { - RestAIEventSourceListener eventSourceListener = new RestAIEventSourceListener(sseEmitter); - RestAIClient.getInstance().restCompletions(buildPrompt(prompt), eventSourceListener); + private SseEmitter chatWithRestAi(ChatQueryRequest queryRequest, SseEmitter sseEmitter, String uid) throws IOException { + String prompt = buildPrompt(queryRequest); + List messages = getFastChatMessage(uid, prompt); + + buildSseEmitter(sseEmitter, uid); + + RestAIEventSourceListener restAIEventSourceListener = new RestAIEventSourceListener(sseEmitter); + RestAIClient.getInstance().streamCompletions(messages, restAIEventSourceListener); + LocalCache.CACHE.put(uid, JSONUtil.toJsonStr(messages), LocalCache.TIMEOUT); return sseEmitter; } diff --git a/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ai/rest/client/RestAIClient.java b/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ai/rest/client/RestAIClient.java index b95c09348..ab13f07c4 100644 --- a/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ai/rest/client/RestAIClient.java +++ b/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ai/rest/client/RestAIClient.java @@ -6,6 +6,7 @@ import ai.chat2db.server.web.api.util.ApplicationContextUtil; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; /** * @author moji @@ -19,6 +20,11 @@ public class RestAIClient { */ public static final String AI_SQL_SOURCE = "ai.sql.source"; + /** + * Customized AI interface KEY + */ + public static final String REST_AI_API_KEY = "rest.ai.apiKey"; + /** * Customized AI interface address */ @@ -29,9 +35,16 @@ public class RestAIClient { */ public static final String REST_AI_STREAM_OUT = "rest.ai.stream"; - private static RestAiStreamClient REST_AI_STREAM_CLIENT; + /** + * Custom AI interface model + */ + public static final String REST_AI_MODEL = "rest.ai.model"; - public static RestAiStreamClient getInstance() { + + + private static RestAIStreamClient REST_AI_STREAM_CLIENT; + + public static RestAIStreamClient getInstance() { if (REST_AI_STREAM_CLIENT != null) { return REST_AI_STREAM_CLIENT; } else { @@ -39,7 +52,7 @@ public static RestAiStreamClient getInstance() { } } - private static RestAiStreamClient singleton() { + private static RestAIStreamClient singleton() { if (REST_AI_STREAM_CLIENT == null) { synchronized (RestAIClient.class) { if (REST_AI_STREAM_CLIENT == null) { @@ -55,17 +68,23 @@ private static RestAiStreamClient singleton() { */ public static void refresh() { String apiUrl = ""; - Boolean stream = Boolean.TRUE; + String apiKey = ""; + String model = ""; ConfigService configService = ApplicationContextUtil.getBean(ConfigService.class); Config apiHostConfig = configService.find(REST_AI_URL).getData(); if (apiHostConfig != null) { apiUrl = apiHostConfig.getContent(); } - Config config = configService.find(REST_AI_STREAM_OUT).getData(); + Config config = configService.find(REST_AI_API_KEY).getData(); if (config != null) { - stream = Boolean.valueOf(config.getContent()); + apiKey = config.getContent(); + } + Config deployConfig = configService.find(REST_AI_MODEL).getData(); + if (deployConfig != null && StringUtils.isNotBlank(deployConfig.getContent())) { + model = deployConfig.getContent(); } - REST_AI_STREAM_CLIENT = new RestAiStreamClient(apiUrl, stream); + REST_AI_STREAM_CLIENT = RestAIStreamClient.builder().apiKey(apiKey).apiHost(apiUrl).model(model) + .build(); } } diff --git a/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ai/rest/client/RestAIStreamClient.java b/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ai/rest/client/RestAIStreamClient.java new file mode 100644 index 000000000..55ab922d7 --- /dev/null +++ b/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ai/rest/client/RestAIStreamClient.java @@ -0,0 +1,180 @@ +package ai.chat2db.server.web.api.controller.ai.rest.client; + +import ai.chat2db.server.tools.common.exception.ParamBusinessException; +import ai.chat2db.server.web.api.controller.ai.fastchat.interceptor.FastChatHeaderAuthorizationInterceptor; +import ai.chat2db.server.web.api.controller.ai.fastchat.model.FastChatCompletionsOptions; +import ai.chat2db.server.web.api.controller.ai.fastchat.model.FastChatMessage; +import cn.hutool.http.ContentType; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.Getter; +import lombok.extern.slf4j.Slf4j; +import okhttp3.MediaType; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.sse.EventSource; +import okhttp3.sse.EventSourceListener; +import okhttp3.sse.EventSources; +import org.apache.commons.collections4.CollectionUtils; +import org.jetbrains.annotations.NotNull; + +import java.util.List; +import java.util.Objects; +import java.util.concurrent.TimeUnit; + +/** + * Custom AI interface client + * @author moji + */ +@Slf4j +public class RestAIStreamClient { + /** + * apikey + */ + @Getter + @NotNull + private String apiKey; + + /** + * apiHost + */ + @Getter + @NotNull + private String apiHost; + + /** + * model + */ + @Getter + private String model; + /** + * okHttpClient + */ + @Getter + private OkHttpClient okHttpClient; + + /** + * Construct instance object + * + * @param builder + */ + public RestAIStreamClient(Builder builder) { + this.apiKey = builder.apiKey; + this.apiHost = builder.apiHost; + this.model = builder.model; + this.okHttpClient = new OkHttpClient + .Builder() + .addInterceptor(new FastChatHeaderAuthorizationInterceptor(this.apiKey)) + .connectTimeout(10, TimeUnit.SECONDS) + .writeTimeout(50, TimeUnit.SECONDS) + .readTimeout(50, TimeUnit.SECONDS) + .build(); + } + + /** + * structure + * + * @return + */ + public static RestAIStreamClient.Builder builder() { + return new RestAIStreamClient.Builder(); + } + + /** + * builder + */ + public static final class Builder { + private String apiKey; + + private String apiHost; + + private String model; + + + /** + * OkhttpClient + */ + private OkHttpClient okHttpClient; + + public Builder() { + } + + public RestAIStreamClient.Builder apiKey(String apiKeyValue) { + this.apiKey = apiKeyValue; + return this; + } + + /** + * @param apiHostValue + * @return + */ + public RestAIStreamClient.Builder apiHost(String apiHostValue) { + this.apiHost = apiHostValue; + return this; + } + + /** + * @param modelValue + * @return + */ + public RestAIStreamClient.Builder model(String modelValue) { + this.model = modelValue; + return this; + } + + + public RestAIStreamClient.Builder okHttpClient(OkHttpClient val) { + this.okHttpClient = val; + return this; + } + + public RestAIStreamClient build() { + return new RestAIStreamClient(this); + } + + } + + + /** + * Q&A interface stream form + * + * @param chatMessages + * @param eventSourceListener + */ + public void streamCompletions(List chatMessages, EventSourceListener eventSourceListener) { + if (CollectionUtils.isEmpty(chatMessages)) { + log.error("param error:Rest AI Prompt cannot be empty"); + throw new ParamBusinessException("prompt"); + } + if (Objects.isNull(eventSourceListener)) { + log.error("param error:RestAIEventSourceListener cannot be empty"); + throw new ParamBusinessException(); + } + log.info("Rest AI, prompt:{}", chatMessages.get(chatMessages.size() - 1).getContent()); + try { + + FastChatCompletionsOptions chatCompletionsOptions = new FastChatCompletionsOptions(chatMessages); + chatCompletionsOptions.setStream(true); + chatCompletionsOptions.setModel(this.model); + + EventSource.Factory factory = EventSources.createFactory(this.okHttpClient); + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + String requestBody = mapper.writeValueAsString(chatCompletionsOptions); + Request request = new Request.Builder() + .url(apiHost) + .post(RequestBody.create(MediaType.parse(ContentType.JSON.getValue()), requestBody)) + .build(); + //Create event + EventSource eventSource = factory.newEventSource(request, eventSourceListener); + log.info("finish invoking rest ai"); + } catch (Exception e) { + log.error("rest ai error", e); + eventSourceListener.onFailure(null, e, null); + throw new ParamBusinessException(); + } + } + + +} diff --git a/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ai/rest/client/RestAiStreamClient.java b/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ai/rest/client/RestAiStreamClient.java deleted file mode 100644 index 7d5164e5b..000000000 --- a/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ai/rest/client/RestAiStreamClient.java +++ /dev/null @@ -1,166 +0,0 @@ -package ai.chat2db.server.web.api.controller.ai.rest.client; - -import java.io.IOException; -import java.util.Objects; -import java.util.concurrent.TimeUnit; - -import ai.chat2db.server.tools.common.exception.ParamBusinessException; -import ai.chat2db.server.web.api.controller.ai.rest.model.RestAiCompletion; -import cn.hutool.http.ContentType; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.unfbx.chatgpt.sse.ConsoleEventSourceListener; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.MediaType; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import okhttp3.ResponseBody; -import okhttp3.sse.EventSource; -import okhttp3.sse.EventSourceListener; -import okhttp3.sse.EventSources; -import org.apache.commons.lang3.StringUtils; - -/** - * Custom AI interface client - * @author moji - */ -@Slf4j -public class RestAiStreamClient { - /** - * rest api url - */ - @Getter - private String apiUrl; - - /** - * Whether to stream interface - */ - @Getter - private Boolean stream; - /** - * okHttpClient - */ - @Getter - private OkHttpClient okHttpClient; - - /** - * Construct instance object - * - * @param url - */ - public RestAiStreamClient(String url, Boolean stream) { - this.apiUrl = url; - this.stream = stream; - this.okHttpClient = new OkHttpClient - .Builder() - .connectTimeout(10, TimeUnit.SECONDS) - .writeTimeout(50, TimeUnit.SECONDS) - .readTimeout(50, TimeUnit.SECONDS) - .build(); - } - - /** - * Request RESTAI interface - * - * @param prompt - * @param eventSourceListener - */ - public void restCompletions(String prompt, - EventSourceListener eventSourceListener) { - log.info("Start calling the custom AI, prompt:{}", prompt); - RestAiCompletion completion = new RestAiCompletion(); - completion.setPrompt(prompt); - if (Objects.isNull(stream) || stream) { - streamCompletions(completion, eventSourceListener); - log.info("End calling streaming output custom AI"); - return; - } - nonStreamCompletions(completion, eventSourceListener); - log.info("End calling non-streaming output custom AI"); - } - - /** - * Q&A interface stream form - * - * @param completion open ai parameter - * @param eventSourceListener sse listener - * @see ConsoleEventSourceListener - */ - public void streamCompletions(RestAiCompletion completion, EventSourceListener eventSourceListener) { - if (Objects.isNull(eventSourceListener)) { - log.error("Parameter exception: EventSourceListener cannot be empty"); - throw new ParamBusinessException(); - } - if (StringUtils.isBlank(completion.getPrompt())) { - log.error("Parameter exception: Prompt cannot be empty"); - throw new ParamBusinessException(); - } - try { - EventSource.Factory factory = EventSources.createFactory(this.okHttpClient); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - String requestBody = mapper.writeValueAsString(completion); - Request request = new Request.Builder() - .url(this.apiUrl) - .post(RequestBody.create(MediaType.parse(ContentType.JSON.getValue()), requestBody)) - .build(); - //Create event - EventSource eventSource = factory.newEventSource(request, eventSourceListener); - } catch (Exception e) { - log.error("Request parameter parsing exception", e); - throw new ParamBusinessException(); - } - } - - /** - * Request non-streaming output interface - * - * @param completion - * @param eventSourceListener - */ - public void nonStreamCompletions(RestAiCompletion completion, EventSourceListener eventSourceListener) { - if (StringUtils.isBlank(completion.getPrompt())) { - log.error("Parameter exception: Prompt cannot be empty"); - throw new ParamBusinessException(); - } - try { - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - String requestBody = mapper.writeValueAsString(completion); - Request request = new Request.Builder() - .url(this.apiUrl) - .post(RequestBody.create(MediaType.parse(ContentType.JSON.getValue()), requestBody)) - .build(); - - this.okHttpClient.newCall(request).enqueue(new Callback() { - @Override - public void onFailure(Call call, IOException e) { - eventSourceListener.onFailure(null, e, null); - } - - @Override - public void onResponse(Call call, Response response) throws IOException { - try (ResponseBody responseBody = response.body()) { - if (responseBody != null) { - String content = responseBody.string(); - eventSourceListener.onEvent(null, "[DATA]", null, content); - eventSourceListener.onEvent(null, "[DONE]", null, "[DONE]"); - } - } catch (IOException e) { - eventSourceListener.onFailure(null, e, response); - } - } - }); - - } catch (Exception e) { - log.error("Request parameter parsing exception", e); - throw new ParamBusinessException(); - } - } - -} diff --git a/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ai/rest/listener/RestAIEventSourceListener.java b/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ai/rest/listener/RestAIEventSourceListener.java index bb5524783..0509ac6fe 100644 --- a/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ai/rest/listener/RestAIEventSourceListener.java +++ b/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ai/rest/listener/RestAIEventSourceListener.java @@ -1,7 +1,12 @@ package ai.chat2db.server.web.api.controller.ai.rest.listener; +import java.io.IOException; import java.util.Objects; +import ai.chat2db.server.web.api.controller.ai.rest.model.RestAIChatCompletions; +import ai.chat2db.server.web.api.controller.ai.zhipu.model.ZhipuChatCompletions; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; import com.unfbx.chatgpt.entity.chat.Message; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; @@ -27,6 +32,7 @@ public RestAIEventSourceListener(SseEmitter sseEmitter) { this.sseEmitter = sseEmitter; } + private ObjectMapper mapper = new ObjectMapper().disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); /** * {@inheritDoc} */ @@ -54,9 +60,11 @@ public void onEvent(EventSource eventSource, String id, String type, String data } Message message = new Message(); if (StringUtils.isNotBlank(data)) { - data = data.replaceAll("^\"|\"$", ""); - data = data.replaceAll("\\\\n", "\n"); - message.setContent(data); + RestAIChatCompletions chatCompletions = mapper.readValue(data, RestAIChatCompletions.class); + String text = chatCompletions.getChoices().get(0).getDelta()==null? + chatCompletions.getChoices().get(0).getText() + :chatCompletions.getChoices().get(0).getDelta().getContent(); + message.setContent(text); sseEmitter.send(SseEmitter.event() .id(id) .data(message) @@ -68,10 +76,14 @@ public void onEvent(EventSource eventSource, String id, String type, String data @Override public void onClosed(EventSource eventSource) { log.info("REST AI close sse connection..."); - sseEmitter.send(SseEmitter.event() - .id("[DONE]") - .data("[DONE]") - .reconnectTime(3000)); + try { + sseEmitter.send(SseEmitter.event() + .id("[DONE]") + .data("[DONE]") + .reconnectTime(3000)); + } catch (IOException e) { + throw new RuntimeException(e); + } sseEmitter.complete(); } diff --git a/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ai/rest/model/RestAIChatCompletions.java b/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ai/rest/model/RestAIChatCompletions.java new file mode 100644 index 000000000..6d3915322 --- /dev/null +++ b/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ai/rest/model/RestAIChatCompletions.java @@ -0,0 +1,96 @@ +package ai.chat2db.server.web.api.controller.ai.rest.model; + +import ai.chat2db.server.web.api.controller.ai.fastchat.model.FastChatChoice; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; + +import java.util.List; + +@Data +public class RestAIChatCompletions { + + /* + * A unique identifier associated with this chat completions response. + */ + private String id; + + /* + * The first timestamp associated with generation activity for this completions response, + * represented as seconds since the beginning of the Unix epoch of 00:00 on 1 Jan 1970. + */ + private int created; + + /** + * model + */ + private String model; + + /** + * object + */ + private String object; + + /* + * The collection of completions choices associated with this completions response. + * Generally, `n` choices are generated per provided prompt with a default value of 1. + * Token limits and other settings may limit the number of choices generated. + */ + @JsonProperty(value = "choices") + private List choices; + + + /** + * Creates an instance of ChatCompletions class. + * + * @param id the id value to set. + * @param created the created value to set. + * @param choices the choices value to set. + */ + @JsonCreator + private RestAIChatCompletions( + @JsonProperty(value = "id") String id, + @JsonProperty(value = "created") int created, + @JsonProperty(value = "model") String model, + @JsonProperty(value = "object") String object, + @JsonProperty(value = "choices") List choices) { + this.id = id; + this.created = created; + this.model = model; + this.object = object; + this.choices = choices; + } + + /** + * Get the id property: A unique identifier associated with this chat completions response. + * + * @return the id value. + */ + public String getId() { + return this.id; + } + + /** + * Get the created property: The first timestamp associated with generation activity for this completions response, + * represented as seconds since the beginning of the Unix epoch of 00:00 on 1 Jan 1970. + * + * @return the created value. + */ + public int getCreated() { + return this.created; + } + + /** + * Get the choices property: The collection of completions choices associated with this completions response. + * Generally, `n` choices are generated per provided prompt with a default value of 1. Token limits and other + * settings may limit the number of choices generated. + * + * @return the choices value. + */ + public List getChoices() { + return this.choices; + } + + + +} diff --git a/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/config/ConfigController.java b/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/config/ConfigController.java index 0d8625cd9..92f5eb360 100644 --- a/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/config/ConfigController.java +++ b/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/config/ConfigController.java @@ -83,7 +83,7 @@ public ActionResult addChatGptSystemConfig(@RequestBody AIConfigCreateRequest re saveChat2dbAIConfig(request); break; case RESTAI: - saveFastChatAIConfig(request); + saveRestAIConfig(request); break; case AZUREAI: saveAzureAIConfig(request); @@ -152,12 +152,15 @@ private void saveOpenAIConfig(AIConfigCreateRequest request) { * @param request */ private void saveRestAIConfig(AIConfigCreateRequest request) { + SystemConfigParam param = SystemConfigParam.builder().code(RestAIClient.REST_AI_API_KEY).content( + request.getApiKey()).build(); + configService.createOrUpdate(param); SystemConfigParam restParam = SystemConfigParam.builder().code(RestAIClient.REST_AI_URL).content( request.getApiHost()).build(); configService.createOrUpdate(restParam); - SystemConfigParam methodParam = SystemConfigParam.builder().code(RestAIClient.REST_AI_STREAM_OUT).content( - request.getStream().toString()).build(); - configService.createOrUpdate(methodParam); + SystemConfigParam modelParam = SystemConfigParam.builder().code(RestAIClient.REST_AI_MODEL) + .content(request.getModel()).build(); + configService.createOrUpdate(modelParam); RestAIClient.refresh(); } From 4c51a1912aebc5b1fe5ff793c68f2b71f3eae1ad Mon Sep 17 00:00:00 2001 From: Chat2DB <1558143046@qq.com> Date: Fri, 20 Dec 2024 13:54:14 +0800 Subject: [PATCH 10/25] Update Chat2DB_LICENSE --- Chat2DB_LICENSE | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Chat2DB_LICENSE b/Chat2DB_LICENSE index fe37e14f8..cb817b0f4 100644 --- a/Chat2DB_LICENSE +++ b/Chat2DB_LICENSE @@ -16,8 +16,6 @@ The Chat2DB License 您不得出于任何商业、军事或非法目的使用、复制、修改、合并、发布、分发、复制或创建本软件的全部或部分衍生作品。 -您不得利用本软件从事任何危害国家安全和国家统一、危害社会公共利益、侵犯人身权益的行为。 - 4.免责声明 本软件“按原样”提供,不提供任何明示或暗示的保证,包括但不限于对适销性、特定用途的适用性和非侵权性的保证。 在任何情况下,作者或版权持有人均不对任何索赔、损害或其他责任负责,无论是在合同诉讼、侵权行为还是其他方面,由软件或软件的使用或其他交易引起、由软件引起或与之相关 软件。 @@ -49,8 +47,6 @@ The above copyright notice and this permission notice shall be included in all c You will not use, copy, modify, merge, publish, distribute, reproduce, or create derivative works of the Software, in whole or in part, for any commercial, military, or illegal purposes. -You will not use the Software for any act that may undermine China's national security and national unity, harm the public interest of society, or infringe upon the rights and interests of human beings. - 4. Disclaimer THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. From 469ac493141d1c38ea82e8477d8f7ed381fdf2c4 Mon Sep 17 00:00:00 2001 From: Chat2DB <1558143046@qq.com> Date: Mon, 23 Dec 2024 17:49:46 +0800 Subject: [PATCH 11/25] Update suggest.md --- .github/ISSUE_TEMPLATE/suggest.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/suggest.md b/.github/ISSUE_TEMPLATE/suggest.md index 2e869ab58..075e393ab 100644 --- a/.github/ISSUE_TEMPLATE/suggest.md +++ b/.github/ISSUE_TEMPLATE/suggest.md @@ -1,6 +1,6 @@ --- name: "💌 Suggest" about: suggest template -title: '建议: ' +title: 'suggest: ' labels: 'suggest' ---- \ No newline at end of file +--- From e9f46af58da39392ea07ccb47e9810cea28f8e24 Mon Sep 17 00:00:00 2001 From: SwallowGG <1558143046@qq.com> Date: Thu, 26 Dec 2024 12:45:25 +0800 Subject: [PATCH 12/25] update README_CN.md --- README_CN.md | 430 ++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 302 insertions(+), 128 deletions(-) diff --git a/README_CN.md b/README_CN.md index 4ae049dc7..fbefd397f 100644 --- a/README_CN.md +++ b/README_CN.md @@ -1,135 +1,311 @@ - - -加群前请先 Star 和 Fork,谢谢~关注微信公众号可加入微信、钉钉、QQ 群一起讨论,并可以获取 Chat2DB 最新动态和更新。 -# Chat2DB - -**中文** | [English](README.md)· [更新日志](CHANGELOG.md) · [文档](https://docs.chat2db-ai.com/) · [报告问题](https://github.com/chat2db/Chat2DB/issues) · [提交PR](https://github.com/chat2db/Chat2DB/pulls) - -[![License](https://img.shields.io/github/license/alibaba/fastjson2?color=4D7A97&logo=apache)](https://www.apache.org/licenses/LICENSE-2.0.html) -[![Java support](https://img.shields.io/badge/Java-17+-green?logo=java&logoColor=white)](https://openjdk.java.net/) -[![GitHub release](https://img.shields.io/github/release/chat2db/Chat2DB)](https://github.com/chat2db/Chat2DB/releases) -[![GitHub Stars](https://img.shields.io/github/stars/chat2db/Chat2DB)](https://github.com/chat2db/Chat2DB/stargazers) -[![GitHub Forks](https://img.shields.io/github/forks/chat2db/Chat2DB)](https://github.com/chat2db/Chat2DB/fork) -[![GitHub Contributors](https://img.shields.io/github/contributors/chat2db/Chat2DB)](https://github.com/chat2db/Chat2DB/graphs/contributors) - - - -
-

分享Chat2DB仓库

- + + + chat on Discord + Share on Telegram Share on Reddit -

- + + License + + GitHub release -
- 如果你觉得Chat2DB有帮助,请点击右上角的⭐Stargithub star和Fork,你的支持是Chat2DB变得更好的最大动力 +

+
+ README in English + 简体中文版自述文件 + 日本語のREADME + README en Español + README en Français + README tlhIngan Hol + README in Korean + README بالعربية + Türkçe README + README Tiếng Việt
+# +
+ CodePhiliaX%2FChat2DB | Trendshift
-## ⏬ 下载和安装Chat2DB(Pro) - -- 从[官网](https://chat2db-ai.com/download)下载安装包 -- 双击安装包进行安装 - -# 最近更新 - -### 期待已久的Chat2DB Pro版本终于来了,新增了以下几个核心亮点。 -#### AI驱动的智能SQL开发 - - Chat2DB - - - Chat2DB - - -Chat2DB - - -#### AI驱动的智能报告 - - Chat2DB - - -#### AI驱动的数据探索 - -Chat2DB - - -### 我们还开源了我们的第一个GLM,[Chat2DB-SQL-7B](https://github.com/chat2db/Chat2DB-GLM)。你可以从下面的链接了解更多详情。 - -- GitHub: [Chat2DB-SQL-7B](https://github.com/chat2db/Chat2DB-GLM) -- huggingface🤗:[Chat2DB-SQL-7B](https://huggingface.co/Chat2DB/Chat2DB-SQL-7B) -- modelscope:[Chat2DB-SQL-7B](https://modelscope.cn/models/Chat2DB/Chat2DB-SQL-7B/summary) - -### 在Chat2DB上即成InternLM模型 - -感谢InternLM对本项目的大力支持,在本项目中的自定义模型中,可以集成InternLM的多个模型权重,具体请参考[chat2db-internlm-deploy](https://github.com/chat2db/chat2db-internlm-deploy) - -## 支持的数据库 -Chat2DB Pro支持以下所有数据库,包括备受期待的Redis功能。 -- MySQL -- PostgreSQL -- H2 -- Oracle -- SQLServer -- SQLite -- MariaDB -- ClickHouse -- DM -- Presto -- DB2 -- OceanBase -- Hive -- KingBase -- MongoDB -- Redis -- Snowflake - - -## 使用Chat2DB -参考[快速开始指南](https://docs.chat2db-ai.com/),开始使用Chat2DB。 - -## 常见问题 - -### 1、无法获取数据源驱动:getJDBCDriver error: null - -问题原因:无法联网导致下载数据库驱动包失败。 - -解决办法:手动下载相关驱动放入到 ~/.chat2db/jdbc-lib 目录下 - -下载链接 参考:Application jdbc-jar-downLoad-urls - -- https://cdn.chat2db-ai.com/lib/mysql-connector-java-8.0.30.jar -- https://cdn.chat2db-ai.com/lib/mysql-connector-java-5.1.47.jar -- https://cdn.chat2db-ai.com/lib/clickhouse-jdbc-0.3.2-patch8-http.jar -- https://cdn.chat2db-ai.com/lib/mariadb-java-client-3.0.8.jar -- https://cdn.chat2db-ai.com/lib/mssql-jdbc-11.2.1.jre17.jar -- https://cdn.chat2db-ai.com/lib/oceanbase-client-2.4.2.jar -- https://cdn.chat2db-ai.com/lib/postgresql-42.5.1.jar -- https://cdn.chat2db-ai.com/lib/sqlite-jdbc-3.39.3.0.jar -- https://cdn.chat2db-ai.com/lib/ojdbc11.jar - -## Stargazers - -[![Stargazers repo roster for @chat2db/Chat2DB](https://reporoster.com/stars/chat2db/Chat2DB)](https://github.com/chat2db/Chat2DB/stargazers) - -## Forkers - -[![Forkers repo roster for @chat2db/Chat2DB](https://reporoster.com/forks/chat2db/Chat2DB)](https://github.com/chat2db/Chat2DB/network/members) - -## ☎️ 加入我们 - - -## ❤️ 致谢 +Chat2DB 是一个智能的通用SQL客户端和数据报表工具,它集成了AI的能力。Chat2DB可以帮助您更快地编写SQL查询、管理数据库、生成报告、探索数据、并且可以与多种数据库进行交互。Chat2DB是一个开源项目,我们欢迎您的贡献。 + +**1. 智能生成SQL**: +Chat2DB Pro支持AI驱动的智能SQL开发,可以帮助您更快地编写SQL查询。 + + +**2. 数据库管理**: + 支持多种10+数据库,包括MySQL、PostgreSQL、H2、Oracle、SQLServer、SQLite、MariaDB、ClickHouse、DM、Presto、DB2、OceanBase、Hive、KingBase、MongoDB、Redis、Snowflake等。 + + + +**3. 智能生成报表**: + Chat2DB Pro支持AI驱动的智能数据报表,可以帮助您更快地生成看板。 + +**4. 数据结构同步**: + Chat2DB Pro支持数据库表结构同步,可以帮助您更快地同步数据库表结构。 + +## 功能比较 + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
功能社区开源版Local版(收费)Pro版(收费)
数据库类型16+目标100+目标100+
支持的 AI需要配置AI安装即可使用AI安装即可使用AI
AI 能力简单多样多样
可视化编辑表
SQL控制台
SQL格式化
保存查询记录
主题颜色设置
数据结构同步
数据库分组
数据库结构导入导出
数据导入导出
数据迁移
复制/清空表
打开运行SQL文件
UML图开发中开发中
生成代码
复制结果为 +Insert/update +
修改查询结果
智能SQL编辑器
AI建表
AI数据集
Chat2Excel
智能看板
编辑器设置
自定义快捷键
跨多设备使用
+ +## 下载安装 +Chat2DB 是一个跨平台的应用程序,支持Windows、MacOS和Linux。您可以从以下链接下载Chat2DB。 +- [下载 Pro 版](https://chat2db.ai/download) +- [下载 Local 版](https://chat2db.ai/download) +- [下载开源版](https://github.com/CodePhiliaX/Chat2DB/releases/tag/v0.3.6) + +## 社区版 Docker 安装 + +### 系统要求 + +在安装 Chat2DB 之前,请确保您的系统满足以下要求: +- Docker 19.03.0 或更高版本 +- Docker Compose 1.25.0 或更高版本 +- CPU >= 2 Core +- RAM >= 4 GiB + + +```bash + // 拉取最新客户端,然后运行docker,名字是 `chat2db` , 并且将 `/root/.chat2db` 挂载到 `~/.chat2db-docker` + docker run --name=chat2db -ti -p 10824:10824 -v ~/.chat2db-docker:/root/.chat2db chat2db/chat2db:latest + // 这里正常会提示`Tomcat started on port(s): 10824 (http) with context path` 就可以结束了 + + // 如果这里提示 `The container name "/chat2db" is already in use by container`, 代表已经存在容器了 运行 + docker start chat2db + // 如果想更新chat2db 则需要先rm + docker rm chat2db +``` +## 代码调试 + + +## 运行环境 + +注意: +如果需要本地调试 + +- java 运行 Open JDK 17 +- Node 运行环境 Node16 Node.js. + +**git clone 到本地** + +```bash +$ git clone git@github.com:chat2db/Chat2DB.git +``` + +**前端调试** + +```bash +node版本必须为16及以上 +一定要用yarn +$ cd Chat2DB/chat2db-client +$ yarn +$ yarn run start:web +``` + +**后端调试** + +```bash +$ cd ../chat2db-server +$ mvn clean install # 需要安装maven 3.8以上版本 +$ 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功能 +``` +**独立部署** +```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 + +# 再打包后端服务 +``` + +## 加入我们 + + +## 致谢 感谢所有为 Chat2DB 贡献力量的同学们~~ @@ -139,18 +315,16 @@ Chat2DB Pro支持以下所有数据库,包括备受期待的Redis功能。 ## Star History - + - - - Star History Chart + + + Star History Chart -## 友情链接 -

- - sa-token - -

+## License +The primary license used by this software is the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0), supplemented by the [Chat2DB License](./Chat2DB_LICENSE). + + From 9b22a462886f853101b9eb570f8ca4830c1072c4 Mon Sep 17 00:00:00 2001 From: SwallowGG <1558143046@qq.com> Date: Thu, 26 Dec 2024 12:47:57 +0800 Subject: [PATCH 13/25] update README_CN.md --- README_CN.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/README_CN.md b/README_CN.md index fbefd397f..ed218b875 100644 --- a/README_CN.md +++ b/README_CN.md @@ -12,12 +12,6 @@ Share on Reddit - - License - - GitHub release

From 8c09b3423e4d374f3ecd967c87f6233ae3757808 Mon Sep 17 00:00:00 2001 From: SwallowGG <1558143046@qq.com> Date: Thu, 26 Dec 2024 12:48:56 +0800 Subject: [PATCH 14/25] update README_CN.md --- README_CN.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/README_CN.md b/README_CN.md index ed218b875..41c80249d 100644 --- a/README_CN.md +++ b/README_CN.md @@ -1,7 +1,9 @@ - +
+ CodePhiliaX%2FChat2DB | Trendshift +

@@ -27,10 +29,7 @@ README Tiếng Việt

-# -
- CodePhiliaX%2FChat2DB | Trendshift -
+ Chat2DB 是一个智能的通用SQL客户端和数据报表工具,它集成了AI的能力。Chat2DB可以帮助您更快地编写SQL查询、管理数据库、生成报告、探索数据、并且可以与多种数据库进行交互。Chat2DB是一个开源项目,我们欢迎您的贡献。 From 4fd9e30b43c36207a6edeee311beb0be13bd86cd Mon Sep 17 00:00:00 2001 From: SwallowGG <1558143046@qq.com> Date: Thu, 26 Dec 2024 12:50:28 +0800 Subject: [PATCH 15/25] update README_CN.md --- README_CN.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README_CN.md b/README_CN.md index 41c80249d..ec94dd7bf 100644 --- a/README_CN.md +++ b/README_CN.md @@ -4,8 +4,8 @@
CodePhiliaX%2FChat2DB | Trendshift
+

- chat on Discord @@ -29,8 +29,7 @@ README Tiếng Việt - - +# Chat2DB 是一个智能的通用SQL客户端和数据报表工具,它集成了AI的能力。Chat2DB可以帮助您更快地编写SQL查询、管理数据库、生成报告、探索数据、并且可以与多种数据库进行交互。Chat2DB是一个开源项目,我们欢迎您的贡献。 **1. 智能生成SQL**: From d0503c994175033e54c4b351b367a24898b27cfd Mon Sep 17 00:00:00 2001 From: Chat2DB <1558143046@qq.com> Date: Thu, 26 Dec 2024 13:49:56 +0800 Subject: [PATCH 16/25] Update README_CN.md --- README_CN.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README_CN.md b/README_CN.md index ec94dd7bf..aca666140 100644 --- a/README_CN.md +++ b/README_CN.md @@ -29,6 +29,12 @@ README Tiếng Việt + + +https://github.com/user-attachments/assets/1bdcfba8-66a4-41e6-9aca-a0785774e024 + + + # Chat2DB 是一个智能的通用SQL客户端和数据报表工具,它集成了AI的能力。Chat2DB可以帮助您更快地编写SQL查询、管理数据库、生成报告、探索数据、并且可以与多种数据库进行交互。Chat2DB是一个开源项目,我们欢迎您的贡献。 From 4f3bda903fa88029f1b272947591b8772ab97c02 Mon Sep 17 00:00:00 2001 From: Chat2DB <1558143046@qq.com> Date: Thu, 26 Dec 2024 14:12:16 +0800 Subject: [PATCH 17/25] Update README_CN.md --- README_CN.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README_CN.md b/README_CN.md index aca666140..d4be774f7 100644 --- a/README_CN.md +++ b/README_CN.md @@ -31,7 +31,8 @@ -https://github.com/user-attachments/assets/1bdcfba8-66a4-41e6-9aca-a0785774e024 + +https://github.com/user-attachments/assets/4ae824cf-7d14-4d5b-9ceb-66481bcefc19 From 19f5ad6045fe451db6669979aaf55b86c4ee5817 Mon Sep 17 00:00:00 2001 From: Chat2DB <1558143046@qq.com> Date: Thu, 26 Dec 2024 14:22:32 +0800 Subject: [PATCH 18/25] Update README_CN.md --- README_CN.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README_CN.md b/README_CN.md index d4be774f7..75de60d40 100644 --- a/README_CN.md +++ b/README_CN.md @@ -301,7 +301,15 @@ $ cp -r dist/index.html ../chat2db-server/chat2db-server-start/src/main/resource # 再打包后端服务 ``` -## 加入我们 +## 联系我们 + +![image](https://github.com/user-attachments/assets/20c99be6-e6ff-4f18-972c-cea9a6ab7971) + +- Email: Chat2DB@ch2db.com +- Discord: [Join our Discord server](https://discord.gg/JDkwB6JS8A) +- Twitter: [@Chat2DB](https://x.com/Chat2DB_AI) +- YouTube: [Chat2DB Channel](https://www.youtube.com/@chat2db.tutorial) +- GitHub: [Chat2DB GitHub](https://github.com/codePhiliaX/chat2db) ## 致谢 From 2f707278a9ae8057a7af80255b3a1d8670ef8e66 Mon Sep 17 00:00:00 2001 From: Chat2DB <1558143046@qq.com> Date: Thu, 26 Dec 2024 14:25:12 +0800 Subject: [PATCH 19/25] Update README_CN.md --- README_CN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README_CN.md b/README_CN.md index 75de60d40..b1123bc4e 100644 --- a/README_CN.md +++ b/README_CN.md @@ -303,7 +303,7 @@ $ cp -r dist/index.html ../chat2db-server/chat2db-server-start/src/main/resource ## 联系我们 -![image](https://github.com/user-attachments/assets/20c99be6-e6ff-4f18-972c-cea9a6ab7971) + - Email: Chat2DB@ch2db.com - Discord: [Join our Discord server](https://discord.gg/JDkwB6JS8A) From 1d00a1e7668ce9c98945f45bcf2828b9d0bb4662 Mon Sep 17 00:00:00 2001 From: Chat2DB <1558143046@qq.com> Date: Thu, 26 Dec 2024 14:25:36 +0800 Subject: [PATCH 20/25] Update README_CN.md --- README_CN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README_CN.md b/README_CN.md index b1123bc4e..fe72bf8c0 100644 --- a/README_CN.md +++ b/README_CN.md @@ -303,7 +303,7 @@ $ cp -r dist/index.html ../chat2db-server/chat2db-server-start/src/main/resource ## 联系我们 - + - Email: Chat2DB@ch2db.com - Discord: [Join our Discord server](https://discord.gg/JDkwB6JS8A) From a7e1e6c17b082d265aa1f48c09387b27e50f11d1 Mon Sep 17 00:00:00 2001 From: SwallowGG <1558143046@qq.com> Date: Thu, 26 Dec 2024 14:55:31 +0800 Subject: [PATCH 21/25] update README_CN.md --- README.md | 407 ++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 301 insertions(+), 106 deletions(-) diff --git a/README.md b/README.md index 0e5565753..df765f15d 100644 --- a/README.md +++ b/README.md @@ -1,107 +1,305 @@ -# Chat2DB -Coming soon on 10.25 for offline version, please get notified on Product Hunt! -Chat2DB Local - Make everyone a database expert and data analyst. | Product Hunt +

+ CodePhiliaX%2FChat2DB | Trendshift +
+
+

+ + chat on Discord + +Share on Telegram + +Share on Reddit + -**English** | [中文](README_CN.md)· 🏆 Top 100 Open Project! - -## Download and Install Chat2DB(Pro) - -[Download](https://chat2db.ai/download) -Double click package to install - -#### AI-driven intelligent SQL development - - Chat2DB - - - Chat2DB - - -Chat2DB - - -#### AI-driven Intelligent Reports - - Chat2DB - - -#### AI-driven Data Exploration - -Chat2DB - - -### We have also open-sourced our first GLM, [Chat2DB-SQL-7B](https://github.com/chat2db/Chat2DB-GLM). You can refer more details from below links. - -- github: [Chat2DB-SQL-7B](https://github.com/chat2db/Chat2DB-GLM) -- huggingface🤗:[Chat2DB-SQL-7B](https://huggingface.co/Chat2DB/Chat2DB-SQL-7B) -- modelscope:[Chat2DB-SQL-7B](https://modelscope.cn/models/Chat2DB/Chat2DB-SQL-7B/summary) - -### Deploy the InternLM model on Chat2DB - -Thanks to [InternLM](https://github.com/InternLM/InternLM) for the strong support for this project. In the custom models of this project, multiple model weights from InternLM can be integrated. For more details, please refer to [chat2db-internlm-deploy](https://github.com/chat2db/chat2db-internlm-deploy) - -## Supported databases -Chat2DB Pro supports all the following databases, including the most requested Redis feature. -- MySQL -- PostgreSQL -- H2 -- Oracle -- SQLServer -- SQLite -- MariaDB -- ClickHouse -- DM -- Presto -- DB2 -- OceanBase -- Hive -- KingBase -- MongoDB -- Redis -- Snowflake - - -## Using Chat2DB -Refer to the [Quick Start Guide](https://docs.chat2db.ai/) to get started with Chat2DB. - - -## Contribution Guide -We welcome and encourage community members to contribute to the Chat2DB project. Whether it's by reporting issues, proposing new features, or directly submitting code fixes and improvements, your help is invaluable. -If you're interested in contributing, please follow our contribution guidelines: - -- Report Issues: Report any issues or bugs encountered via GitHub Issues. -- Submit Pull Requests: If you wish to contribute directly to the codebase, please fork the repository and submit a pull request (PR). -- Improve Documentation: Contributions to best practices, example code, documentation improvements, etc., are welcome. - -## Stargazers - -[![Stargazers repo roster for @chat2db/Chat2DB](https://reporoster.com/stars/chat2db/Chat2DB)](https://github.com/chat2db/Chat2DB/stargazers) - -## Forkers - -[![Forkers repo roster for @chat2db/Chat2DB](https://reporoster.com/forks/chat2db/Chat2DB)](https://github.com/chat2db/Chat2DB/network/members) - -## 👋 Join Us - -### On WeChat - - - -### On Discord - -[![Discord](https://img.shields.io/badge/-Join%20us%20on%20Discord-%237289DA.svg?style=flat&logo=discord&logoColor=white)](https://discord.com/invite/uNjb3n5JVN) - -## LICENSE - -The primary license used by this software is the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0), supplemented by the [Chat2DB License](./Chat2DB_LICENSE). - - -## ❤️ Acknowledgements +

+
+ README in English + 简体中文版自述文件 + 日本語のREADME + README en Español + README en Français + README tlhIngan Hol + README in Korean + README بالعربية + Türkçe README + README Tiếng Việt +
+ + +https://github.com/user-attachments/assets/4ae824cf-7d14-4d5b-9ceb-66481bcefc19 + + +Chat2DB is an intelligent, universal SQL client and data reporting tool that integrates AI capabilities. Chat2DB helps you write SQL queries faster, manage databases, generate reports, explore data, and interact with multiple databases. Chat2DB is an open-source project, and we welcome your contributions. + +**1. Intelligent SQL Generation**: +Chat2DB Pro supports AI-driven intelligent SQL development to help you write SQL queries faster. + +**2. Database Management**: +Supports more than 10 databases, including MySQL, PostgreSQL, H2, Oracle, SQLServer, SQLite, MariaDB, ClickHouse, DM, Presto, DB2, OceanBase, Hive, KingBase, MongoDB, Redis, Snowflake, and more. + +**3. Intelligent Report Generation**: +Chat2DB Pro supports AI-driven intelligent data reporting to help you generate dashboards faster. + +**4. Data Structure Synchronization**: +Chat2DB Pro supports database table structure synchronization to help you sync database table structures faster. + +## Feature Comparison + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FeatureCommunity Open SourceLocalPro
Database Types16+Target 100+Target 100+
Supported AIRequires AI ConfigurationAI ready on installationAI ready on installation
AI CapabilitiesBasicVariedVaried
Visual Table Editor
SQL Console
SQL Formatting
Save Query Records
Theme Color Settings
Data Structure Sync
Database Grouping
Database Structure Import/Export
Data Import/Export
Data Migration
Copy/Clear Table
Open and Run SQL Files
UML DiagramIn DevelopmentIn Development
Generate Code
Copy Results as Insert/Update
Modify Query Results
Intelligent SQL Editor
AI Table Creation
AI Data Sets
Chat2Excel
Intelligent Dashboard
Editor Settings
Custom Shortcuts
Cross-device Usage
+ +## Download and Installation +Chat2DB is a cross-platform application that supports Windows, MacOS, and Linux. You can download Chat2DB from the following links: +- [Download Pro Version](https://chat2db.ai/download) +- [Download Local Version](https://chat2db.ai/download) +- [Download Open Source Version](https://github.com/CodePhiliaX/Chat2DB/releases/tag/v0.3.6) + +## Community Edition Docker Installation + +### System Requirements + +Before installing Chat2DB, ensure your system meets the following requirements: +- Docker 19.03.0 or later +- Docker Compose 1.25.0 or later +- CPU >= 2 Cores +- RAM >= 4 GiB + +```bash + docker rm chat2db + + docker run --name=chat2db -ti -p 10824:10824 -v ~/.chat2db-docker:/root/.chat2db chat2db/chat2db:latest + + docker start chat2db + +``` +## Code Debugging + +## Runtime Environment + +Note: +If local debugging is needed: + +- Java runtime: Open JDK 17 +- Node.js runtime: Node 16 Node.js. + +**Clone the repository locally** + +```bash +$ git clone git@github.com:chat2db/Chat2DB.git +``` + +**Frontend Debugging** + +```bash +Node version must be 16 or higher +Use yarn only, npm is not supported +$ cd Chat2DB/chat2db-client +$ yarn +$ yarn run start:web +``` + +**Backend Debugging** + +```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功能 +``` +**Standalone Deployment** +```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 +``` + +## Contact Us + +- Email: Chat2DB@ch2db.com +- Discord: [Join our Discord server](https://discord.gg/JDkwB6JS8A) +- Twitter: [@Chat2DB](https://x.com/Chat2DB_AI) +- YouTube: [Chat2DB Channel](https://www.youtube.com/@chat2db.tutorial) +- GitHub: [Chat2DB GitHub](https://github.com/codePhiliaX/chat2db) + + +## Acknowledgments + + +Thanks to everyone who has contributed to Chat2DB~~ -Thanks to all who contributed to Chat2DB~~ @@ -109,7 +307,7 @@ Thanks to all who contributed to Chat2DB~~ ## Star History - + @@ -117,9 +315,6 @@ Thanks to all who contributed to Chat2DB~~ -## link -

- - sa-token - -

+## License +The primary license used by this software is the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0), supplemented by the [Chat2DB License](./Chat2DB_LICENSE). + From 89302f348a7fca690cc2ed40e0aa76d050ec1bf6 Mon Sep 17 00:00:00 2001 From: SwallowGG <1558143046@qq.com> Date: Thu, 26 Dec 2024 15:20:45 +0800 Subject: [PATCH 22/25] update README_CN.md --- README.md | 8 +- README_CN.md | 8 +- README_JA.md | 312 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 314 insertions(+), 14 deletions(-) create mode 100644 README_JA.md diff --git a/README.md b/README.md index df765f15d..81402a844 100644 --- a/README.md +++ b/README.md @@ -20,13 +20,7 @@ README in English 简体中文版自述文件 日本語のREADME - README en Español - README en Français - README tlhIngan Hol - README in Korean - README بالعربية - Türkçe README - README Tiếng Việt + diff --git a/README_CN.md b/README_CN.md index fe72bf8c0..07097519d 100644 --- a/README_CN.md +++ b/README_CN.md @@ -20,13 +20,7 @@ README in English 简体中文版自述文件 日本語のREADME - README en Español - README en Français - README tlhIngan Hol - README in Korean - README بالعربية - Türkçe README - README Tiếng Việt + diff --git a/README_JA.md b/README_JA.md new file mode 100644 index 000000000..732b01762 --- /dev/null +++ b/README_JA.md @@ -0,0 +1,312 @@ + + + +
+ CodePhiliaX%2FChat2DB | Trendshift +
+
+

+ + chat on Discord + +Share on Telegram + +Share on Reddit + + +

+
+ README in English + 简体中文版自述文件 + 日本語のREADME +
+ + +https://github.com/user-attachments/assets/4ae824cf-7d14-4d5b-9ceb-66481bcefc19 + + +Chat2DBはAI機能を統合したインテリジェントで汎用的なSQLクライアントおよびデータ報告ツールです。Chat2DBは、SQLクエリの作成を迅速化し、データベースの管理、レポートの生成、データの探索、および複数のデータベースとのインタラクションをサポートします。Chat2DBはオープンソースプロジェクトであり、皆様の貢献を歓迎します。 + +**1. インテリジェントSQL生成**: +Chat2DB Proは、AI駆動によるインテリジェントなSQL開発をサポートし、SQLクエリをより速く作成する手助けをします。 + +**2. データベース管理**: +MySQL、PostgreSQL、H2、Oracle、SQLServer、SQLite、MariaDB、ClickHouse、DM、Presto、DB2、OceanBase、Hive、KingBase、MongoDB、Redis、Snowflakeなど、10種類以上のデータベースをサポートしています。 + +**3. インテリジェントレポート生成**: +Chat2DB Proは、AI駆動によるインテリジェントなデータ報告をサポートし、ダッシュボードの作成を迅速に行う手助けをします。 + +**4. データ構造の同期**: +Chat2DB Proは、データベーステーブル構造の同期をサポートし、データベーステーブルの構造を迅速に同期する手助けをします。 + +## 機能比較 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
機能コミュニティ オープンソースローカルPro
データベースの種類16種類以上100種類以上を対象100種類以上を対象
サポートされているAIAI設定が必要インストール時にAIが利用可能インストール時にAIが利用可能
AI機能基本的多様多様
視覚的テーブルエディタ
SQLコンソール
SQLフォーマット
クエリ記録の保存
テーマカラー設定
データ構造の同期
データベースのグループ化
データベース構造のインポート/エクスポート
データのインポート/エクスポート
データ移行
テーブルのコピー/削除
SQLファイルのオープンと実行
UMLダイアグラム開発中開発中
コード生成
インサート/アップデートとして結果をコピー
クエリ結果の修正
インテリジェントSQLエディタ
AIによるテーブル作成
AIデータセット
Chat2Excel
インテリジェントダッシュボード
エディタ設定
カスタムショートカット
クロスデバイス使用
+ + +## ダウンロードとインストール +Chat2DBは、Windows、MacOS、Linuxをサポートするクロスプラットフォームアプリケーションです。以下のリンクからChat2DBをダウンロードできます: +- [Proバージョンのダウンロード](https://chat2db.ai/download) +- [ローカルバージョンのダウンロード](https://chat2db.ai/download) +- [オープンソースバージョンのダウンロード](https://github.com/CodePhiliaX/Chat2DB/releases/tag/v0.3.6) + +## コミュニティエディションのDockerインストール + +### システム要件 + +Chat2DBをインストールする前に、システムが以下の要件を満たしていることを確認してください: +- Docker 19.03.0以上 +- Docker Compose 1.25.0以上 +- CPU >= 2コア +- RAM >= 4 GiB + +```bash + docker rm chat2db + + docker run --name=chat2db -ti -p 10824:10824 -v ~/.chat2db-docker:/root/.chat2db chat2db/chat2db:latest + + docker start chat2db +``` +## コードデバッグ + +## 実行環境 + +注意: ローカルデバッグが必要な場合: + +- Java runtime: Open JDK 17 +- Node.js runtime: Node 16 Node.js. + +**リポジトリをローカルにクローン** + +```bash +$ git clone git@github.com:chat2db/Chat2DB.git +``` + +**フロントエンドデバッグ** + +```bash +Node version must be 16 or higher +Use yarn only, npm is not supported +$ cd Chat2DB/chat2db-client +$ yarn +$ yarn run start:web +``` + +**バックエンドデバッグ** + +```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功能 +``` +**スタンドアロンデプロイ** +```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 +``` + +## お問い合わせ + +- メール: Chat2DB@ch2db.com +- Discord: [Discordサーバーに参加](https://discord.gg/JDkwB6JS8A) +- Twitter: [@Chat2DB](https://x.com/Chat2DB_AI) +- YouTube: [Chat2DB チャンネル](https://www.youtube.com/@chat2db.tutorial) +- GitHub: [Chat2DB GitHub](https://github.com/codePhiliaX/chat2db) + +## 謝辞 + +Chat2DBに貢献してくださったすべての方々に感謝します~~ + + + + + + + +## Star History + + + + + + Star History Chart + + + +## License +このソフトウェアで使用されている主なライセンスは[Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0)であり、[Chat2DB License](./Chat2DB_LICENSE)が補完されています。 + + From 41056653762b536edd99368a8d30392e1dfc2959 Mon Sep 17 00:00:00 2001 From: Chat2DB <1558143046@qq.com> Date: Thu, 26 Dec 2024 15:31:43 +0800 Subject: [PATCH 23/25] Update README_CN.md --- README_CN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README_CN.md b/README_CN.md index 07097519d..48e5d8d41 100644 --- a/README_CN.md +++ b/README_CN.md @@ -25,8 +25,8 @@ +https://github.com/user-attachments/assets/e276247e-5842-40db-949a-c7764870679d -https://github.com/user-attachments/assets/4ae824cf-7d14-4d5b-9ceb-66481bcefc19 From e0792d15cad7b42afa132d2d612c94f9395f860b Mon Sep 17 00:00:00 2001 From: Chat2DB <1558143046@qq.com> Date: Thu, 26 Dec 2024 15:32:28 +0800 Subject: [PATCH 24/25] Update README_CN.md --- README_CN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README_CN.md b/README_CN.md index 48e5d8d41..846494937 100644 --- a/README_CN.md +++ b/README_CN.md @@ -25,8 +25,8 @@ -https://github.com/user-attachments/assets/e276247e-5842-40db-949a-c7764870679d +https://github.com/user-attachments/assets/3c857883-8153-4bda-92b8-d25c6adb5b13 From aff25645fae7c75ddddc83c05623ba8e0befaac5 Mon Sep 17 00:00:00 2001 From: Chat2DB <1558143046@qq.com> Date: Thu, 26 Dec 2024 15:33:07 +0800 Subject: [PATCH 25/25] Update README_JA.md --- README_JA.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README_JA.md b/README_JA.md index 732b01762..d440e22a5 100644 --- a/README_JA.md +++ b/README_JA.md @@ -23,7 +23,10 @@ -https://github.com/user-attachments/assets/4ae824cf-7d14-4d5b-9ceb-66481bcefc19 + +https://github.com/user-attachments/assets/bd5d5f64-540f-4793-a801-17fa96c4766e + + Chat2DBはAI機能を統合したインテリジェントで汎用的なSQLクライアントおよびデータ報告ツールです。Chat2DBは、SQLクエリの作成を迅速化し、データベースの管理、レポートの生成、データの探索、および複数のデータベースとのインタラクションをサポートします。Chat2DBはオープンソースプロジェクトであり、皆様の貢献を歓迎します。