diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 21c7981e..7310d000 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -285,7 +285,7 @@ jobs:
content: |
{
"title": "Windows-release-打包完成通知",
- "text": "# Windows-release-打包完成通知 \n ![bang]http://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-chat2db.alibaba.com/release/${{ steps.chat2db_version.outputs.substring }}/Chat2DB%20Setup%20${{ steps.chat2db_version.outputs.substring }}.exe]http://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/Chat2DB%20Setup%20${{ steps.chat2db_version.outputs.substring }}.exe) "
+ "text": "# Windows-release-打包完成通知 \n  \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) "
}
# 构建完成通知
@@ -298,7 +298,7 @@ jobs:
content: |
{
"title": "MacOS-amd64-release-构建完成通知",
- "text": "# MacOS-amd64-release-打包完成通知 \n ![bang]http://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-chat2db.alibaba.com/release/${{ steps.chat2db_version.outputs.substring }}/Chat2DB-${{ steps.chat2db_version.outputs.substring }}.dmg]http://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/Chat2DB-${{ steps.chat2db_version.outputs.substring }}.dmg) \n ### jar包下载地址:[https://oss-chat2db.alibaba.com/release/${{ steps.chat2db_version.outputs.substring }}/chat2db-server-start.zip]http://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/chat2db-server-start.zip) "
+ "text": "# MacOS-amd64-release-打包完成通知 \n  \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) "
}
# 构建完成通知
@@ -311,7 +311,7 @@ jobs:
content: |
{
"title": "MacOS-arm64-release-构建完成通知",
- "text": "# MacOS-arm64-release-打包完成通知 \n ![bang]http://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-chat2db.alibaba.com/release/${{ steps.chat2db_version.outputs.substring }}/Chat2DB-${{ steps.chat2db_version.outputs.substring }}-arm64.dmg]http://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/Chat2DB-${{ steps.chat2db_version.outputs.substring }}-arm64.dmg) "
+ "text": "# MacOS-arm64-release-打包完成通知 \n  \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) "
}
# 构建完成通知
@@ -324,5 +324,5 @@ jobs:
content: |
{
"title": "Linux-test-打包完成通知",
- "text": "# Linux-test-打包完成通知 \n ![bang]http://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-chat2db.alibaba.com/release/${{ steps.chat2db_version.outputs.substring }}/Chat2DB-${{ steps.chat2db_version.outputs.substring }}.AppImage]http://oss.sqlgpt.cn/release/${{ steps.chat2db_version.outputs.substring }}/Chat2DB-${{ steps.chat2db_version.outputs.substring }}.AppImage)"
+ "text": "# Linux-test-打包完成通知 \n  \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)"
}
diff --git a/.github/workflows/release_test.yml b/.github/workflows/release_test.yml
index f4fad7d0..9aa98e91 100644
--- a/.github/workflows/release_test.yml
+++ b/.github/workflows/release_test.yml
@@ -274,7 +274,7 @@ jobs:
content: |
{
"title": "Windows-test-打包完成通知",
- "text": "# Windows-test-打包完成通知 \n  \n ### 任务id:[${{ github.run_id }}](https://github.com/chat2db/Chat2DB/actions/runs/${{ github.run_id }}) \n ### Windows下载地址:[http://oss.sqlgpt.cn/test/99.0.${{ github.run_id }}/Chat2DB-Test%20Setup%2099.0.${{ github.run_id }}-Test.exe](http://oss.sqlgpt.cn/test/99.0.${{ github.run_id }}/Chat2DB-Test%20Setup%2099.0.${{ github.run_id }}-Test.exe) "
+ "text": "# Windows-test-打包完成通知 \n  \n ### 任务id:[${{ github.run_id }}](https://github.com/chat2db/Chat2DB/actions/runs/${{ github.run_id }}) \n ### Windows下载地址:[https://oss.sqlgpt.cn/test/99.0.${{ github.run_id }}/Chat2DB-Test%20Setup%2099.0.${{ github.run_id }}-Test.exe](https://oss.sqlgpt.cn/test/99.0.${{ github.run_id }}/Chat2DB-Test%20Setup%2099.0.${{ github.run_id }}-Test.exe) "
}
# 构建完成通知
@@ -287,7 +287,7 @@ jobs:
content: |
{
"title": "MacOS-amd64-test-构建完成通知",
- "text": "# MacOS-amd64-test-打包完成通知 \n  \n ### 任务id:[${{ github.run_id }}](https://github.com/chat2db/Chat2DB/actions/runs/${{ github.run_id }}) \n ### Intel芯片下载地址:[http://oss.sqlgpt.cn/test/99.0.${{ github.run_id }}/Chat2DB-Test-99.0.${{ github.run_id }}-Test.dmg](http://oss.sqlgpt.cn/test/99.0.${{ github.run_id }}/Chat2DB-Test-99.0.${{ github.run_id }}-Test.dmg) \n ### jar包下载地址:[http://oss.sqlgpt.cn/test/99.0.${{ github.run_id }}/chat2db-server-start.zip](http://oss.sqlgpt.cn/test/99.0.${{ github.run_id }}/${{ github.run_id }}/chat2db-server-start.zip) "
+ "text": "# MacOS-amd64-test-打包完成通知 \n  \n ### 任务id:[${{ github.run_id }}](https://github.com/chat2db/Chat2DB/actions/runs/${{ github.run_id }}) \n ### Intel芯片下载地址:[https://oss.sqlgpt.cn/test/99.0.${{ github.run_id }}/Chat2DB-Test-99.0.${{ github.run_id }}-Test.dmg](https://oss.sqlgpt.cn/test/99.0.${{ github.run_id }}/Chat2DB-Test-99.0.${{ github.run_id }}-Test.dmg) \n ### jar包下载地址:[https://oss.sqlgpt.cn/test/99.0.${{ github.run_id }}/chat2db-server-start.zip](https://oss.sqlgpt.cn/test/99.0.${{ github.run_id }}/${{ github.run_id }}/chat2db-server-start.zip) "
}
# 构建完成通知
@@ -300,7 +300,7 @@ jobs:
content: |
{
"title": "MacOS-arm64-test-构建完成通知",
- "text": "# MacOS-arm64-test-打包完成通知 \n  \n ### 任务id:[${{ github.run_id }}](https://github.com/chat2db/Chat2DB/actions/runs/${{ github.run_id }}) \n ### Apple芯片下载地址:[http://oss.sqlgpt.cn/test/99.0.${{ github.run_id }}/Chat2DB-Test-99.0.${{ github.run_id }}-Test-arm64.dmg](http://oss.sqlgpt.cn/test/99.0.${{ github.run_id }}/Chat2DB-Test-99.0.${{ github.run_id }}-Test-arm64.dmg) "
+ "text": "# MacOS-arm64-test-打包完成通知 \n  \n ### 任务id:[${{ github.run_id }}](https://github.com/chat2db/Chat2DB/actions/runs/${{ github.run_id }}) \n ### Apple芯片下载地址:[https://oss.sqlgpt.cn/test/99.0.${{ github.run_id }}/Chat2DB-Test-99.0.${{ github.run_id }}-Test-arm64.dmg](https://oss.sqlgpt.cn/test/99.0.${{ github.run_id }}/Chat2DB-Test-99.0.${{ github.run_id }}-Test-arm64.dmg) "
}
# 构建完成通知
@@ -313,5 +313,5 @@ jobs:
content: |
{
"title": "Linux-test-打包完成通知",
- "text": "# Linux-test-打包完成通知 \n  \n ### 任务id:[${{ github.run_id }}](https://github.com/chat2db/Chat2DB/actions/runs/${{ github.run_id }}) \n ### Linux下载地址:[http://oss.sqlgpt.cn/test/99.0.${{ github.run_id }}/Chat2DB-Test-99.0.${{ github.run_id }}-Test.AppImage](http://oss.sqlgpt.cn/test/99.0.${{ github.run_id }}/Chat2DB-Test-99.0.${{ github.run_id }}-Test.AppImage) "
+ "text": "# Linux-test-打包完成通知 \n  \n ### 任务id:[${{ github.run_id }}](https://github.com/chat2db/Chat2DB/actions/runs/${{ github.run_id }}) \n ### Linux下载地址:[https://oss.sqlgpt.cn/test/99.0.${{ github.run_id }}/Chat2DB-Test-99.0.${{ github.run_id }}-Test.AppImage](https://oss.sqlgpt.cn/test/99.0.${{ github.run_id }}/Chat2DB-Test-99.0.${{ github.run_id }}-Test.AppImage) "
}
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index e3ccaa0d..dbc7a632 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -8,6 +8,8 @@
# fail-fast: false
# matrix:
# include:
+# - os: macos-latest
+# arch: amd64
# - os: ubuntu-latest
# runs-on: ${{ matrix.os }}
# steps:
@@ -24,7 +26,7 @@
#
# # java.security 开放tls1 Linux
# - name: Enable tls1
-# if: ${{ runner.os == 'Linux' }}
# run: |
-# sed -i "s/\(^jdk.tls.disabledAlgorithms=\)\(.*\)\( TLSv1, TLSv1.1,\)\(.*\)/\1\2\4/" ${{ env.JAVA_HOME }}/conf/security/java.security
-# cat ${{ env.JAVA_HOME }}/conf/security/java.security
\ No newline at end of file
+# ls ${{ env.JAVA_HOME }}
+# ls ${{ env.JAVA_HOME }}/legal/jdk.zipfs/
+# cat ${{ env.JAVA_HOME }}/legal/jdk.zipfs/ADDITIONAL_LICENSE_INFO
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0326f5ed..92fcb974 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,28 @@
+
+# 2.0.9
+
+## 🐞 Bug Fixes
+
+-Fix the issue of Windows flash back
+
+## 🐞 问题修复
+
+- 修复windows闪退的问题
+
+# 2.0.8
+
+## 🐞 Bug Fixes
+
+- Repair the Scientific notation in some databases [Issue #378](https://github.com/chat2db/Chat2DB/issues/378)
+- Fix some cases where data is not displayed
+
+## 🐞 问题修复
+
+- 修复部分数据库出现科学计数法的情况 [Issue #378](https://github.com/chat2db/Chat2DB/issues/378)
+- 修复部分情况数据不展示
+
# 2.0.7
+
## ⭐ New Features
- Export query result as file is supported
@@ -7,12 +31,20 @@
- Fixed ai config issues [Issue #346](https://github.com/chat2db/Chat2DB/issues/346)
+## ⭐ 新特性
+
+- 支持导出查询结果
+
+## 🐞 问题修复
+
+- 修复ai配置 [Issue #346](https://github.com/chat2db/Chat2DB/issues/346)
# 2.0.6
## 🐞 Bug Fixes
-- Fixed: When there are too many tables under the selected library, the "New Console" button at the bottom disappears [Issue #314](https://github.com/chat2db/Chat2DB/issues/314)
+- Fixed: When there are too many tables under the selected library, the "New Console" button at the bottom
+ disappears [Issue #314](https://github.com/chat2db/Chat2DB/issues/314)
## 🐞 问题修复
diff --git a/README.md b/README.md
index d9856c23..ea6cc509 100644
--- a/README.md
+++ b/README.md
@@ -169,7 +169,7 @@ $ yarn run start:web
$ cd ../chat2db-server
$ mvn clean install # maven 3.8 or later needs to be installed
$ cd chat2db-server/chat2db-server-start/target/
-$ java -jar -Dchatgpt.apiKey=xxxxx chat2db-server-start.jar # To launch the chat application, you need to enter the ChatGPT key for the chatgpt.apiKey. Without entering it, you won't be able to use the AIGC function.
+$ java -jar -Dloader.path=/lib -Dchatgpt.apiKey=xxxxx chat2db-server-start.jar # To launch the chat application, you need to enter the ChatGPT key for the chatgpt.apiKey. Without entering it, you won't be able to use the AIGC function.
```
## 📑 Documentation
diff --git a/README_CN.md b/README_CN.md
index 4450f6a9..de74739a 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -162,7 +162,7 @@ $ yarn run start:web
$ cd ../chat2db-server
$ mvn clean install # 需要安装maven 3.8以上版本
$ cd chat2db-server/chat2db-server-start/target/
-$ java -jar -Dchatgpt.apiKey=xxxxx chat2db-server-start.jar # 启动应用 chatgpt.apiKey 需要输入ChatGPT的key,如果不输入无法使用AIGC功能
+$ java -jar -Dloader.path=/lib -Dchatgpt.apiKey=xxxxx chat2db-server-start.jar # 启动应用 chatgpt.apiKey 需要输入ChatGPT的key,如果不输入无法使用AIGC功能
```
## 📑 文档
diff --git a/chat2db-client/.umirc.prod.ts b/chat2db-client/.umirc.prod.ts
index 4ca9c1f4..bc5b7987 100644
--- a/chat2db-client/.umirc.prod.ts
+++ b/chat2db-client/.umirc.prod.ts
@@ -1,8 +1,7 @@
import { defineConfig } from 'umi';
import { extractYarnConfig } from './src/utils/webpack';
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
-
-// const UMI_PublicPath = process.env.UMI_PublicPath || './static/front/';
+const UMI_PublicPath = process.env.UMI_PublicPath || './static/front/';
const yarn_config = extractYarnConfig(process.argv);
const chainWebpack = (config: any, { webpack }: any) => {
@@ -14,7 +13,7 @@ const chainWebpack = (config: any, { webpack }: any) => {
};
export default defineConfig({
- publicPath: './static/front/',
+ publicPath: UMI_PublicPath,
chainWebpack,
define: {
'process.env.UMI_ENV': process.env.UMI_ENV,
diff --git a/chat2db-client/.umirc.ts b/chat2db-client/.umirc.ts
index 5654097a..56c48c9a 100644
--- a/chat2db-client/.umirc.ts
+++ b/chat2db-client/.umirc.ts
@@ -44,6 +44,9 @@ export default defineConfig({
changeOrigin: true,
},
},
+ targets:{
+ chrome: 80,
+ },
headScripts: [
`if (localStorage.getItem('app-local-storage-versions') !== 'v2') {
localStorage.clear();
diff --git a/chat2db-client/.vscode/settings.json b/chat2db-client/.vscode/settings.json
index 081320b7..ec1df7b9 100644
--- a/chat2db-client/.vscode/settings.json
+++ b/chat2db-client/.vscode/settings.json
@@ -35,6 +35,7 @@
"USERANDPASSWORD",
"ahooks",
"antd",
+ "bgcolor",
"chatgpt",
"datas",
"datasource",
@@ -42,6 +43,7 @@
"echarts",
"favicons",
"findstr",
+ "gtag",
"lsof",
"netstat",
"pgsql",
diff --git a/chat2db-client/package.json b/chat2db-client/package.json
index 78c21f78..57a9f2ce 100644
--- a/chat2db-client/package.json
+++ b/chat2db-client/package.json
@@ -16,7 +16,7 @@
"build:prod": "npm run build:web:prod && npm run build:main:prod",
"build:web": "umi build",
"build:web:desktop": "cross-env UMI_ENV=desktop cross-env APP_VERSION=${npm_config_app_version} cross-env APP_PORT=${npm_config_app_port} umi build",
- "build:web:prod": "cross-env UMI_ENV=prod cross-env APP_VERSION=${npm_config_app_version} cross-env APP_PORT=${npm_config_app_port} umi build",
+ "build:web:prod": "cross-env UMI_ENV=prod cross-env APP_VERSION=${npm_config_app_version} cross-env APP_PORT=${npm_config_app_port} cross-env UMI_PublicPath=${npm_config_public_path} umi build",
"postinstall": "umi setup",
"lint": "umi lint",
"start": "concurrently \"npm run start:web\" \"npm run start:main\"",
@@ -28,6 +28,7 @@
"ahooks": "^3.7.7",
"ali-react-table": "^2.6.1",
"antd": "^5.6.0",
+ "copy-to-clipboard": "^3.3.3",
"echarts": "^5.4.2",
"echarts-for-react": "^3.0.2",
"event-source-polyfill": "^1.0.31",
@@ -52,7 +53,7 @@
"@umijs/plugins": "^4.0.55",
"concurrently": "^8.1.0",
"cross-env": "^7.0.3",
- "electron": "^22.0.0",
+ "electron": "^22.3.0",
"electron-builder": "^23.6.0",
"electron-debug": "^3.2.0",
"electron-reload": "^2.0.0-alpha.1",
@@ -118,4 +119,4 @@
]
}
}
-}
+}
\ No newline at end of file
diff --git a/chat2db-client/src/components/Console/ChatInput/index.less b/chat2db-client/src/components/Console/ChatInput/index.less
index 1364616d..e104fdec 100644
--- a/chat2db-client/src/components/Console/ChatInput/index.less
+++ b/chat2db-client/src/components/Console/ChatInput/index.less
@@ -63,7 +63,7 @@
padding: 4px 12px;
&:hover {
- cursor: pointer;
+ //cursor: pointer;
}
}
diff --git a/chat2db-client/src/components/Console/ChatInput/index.tsx b/chat2db-client/src/components/Console/ChatInput/index.tsx
index 2a2fed00..c18b184e 100644
--- a/chat2db-client/src/components/Console/ChatInput/index.tsx
+++ b/chat2db-client/src/components/Console/ChatInput/index.tsx
@@ -73,7 +73,7 @@ function ChatInput(props: IProps) {
{
- props.onClickRemainBtn && props.onClickRemainBtn();
+ // props.onClickRemainBtn && props.onClickRemainBtn();
}}
>
{i18n('chat.input.remain', remainCnt)}
diff --git a/chat2db-client/src/components/Console/MonacoEditor/index.tsx b/chat2db-client/src/components/Console/MonacoEditor/index.tsx
index c53ec705..a412cd07 100644
--- a/chat2db-client/src/components/Console/MonacoEditor/index.tsx
+++ b/chat2db-client/src/components/Console/MonacoEditor/index.tsx
@@ -206,7 +206,7 @@ function MonacoEditor(props: IProps, ref: ForwardedRef
) {
return Object.keys(hintData).map((key) => ({
label: key,
kind: monaco.languages.CompletionItemKind.Method,
- insertText: key,
+ insertText: `\`${key}\``,
detail: '',
}));
};
diff --git a/chat2db-client/src/components/Console/index.tsx b/chat2db-client/src/components/Console/index.tsx
index 5d2bf248..071ed1d0 100644
--- a/chat2db-client/src/components/Console/index.tsx
+++ b/chat2db-client/src/components/Console/index.tsx
@@ -11,13 +11,14 @@ import aiServer from '@/service/ai';
import { v4 as uuidv4 } from 'uuid';
import { DatabaseTypeCode, ConsoleStatus } from '@/constants';
import Iconfont from '../Iconfont';
-import { ITreeNode } from '@/typings';
+import { IAiConfig, ITreeNode } from '@/typings';
import { IAIState } from '@/models/ai';
import Popularize from '@/components/Popularize';
import { handleLocalStorageSavedConsole, readLocalStorageSavedConsoleText } from '@/utils';
import { chatErrorForKey, chatErrorToLogin } from '@/constants/chat';
import { AiSqlSourceType } from '@/typings/ai';
import i18n from '@/i18n';
+import configService from '@/service/config';
import styles from './index.less';
enum IPromptType {
@@ -213,8 +214,14 @@ function Console(props: IProps) {
}
};
- const handleAiChat = async (content: string, promptType: IPromptType) => {
- const { apiKey } = aiModel?.aiConfig || {};
+ const handleAIChatInEditor = async (content: string, promptType: IPromptType) => {
+ const aiConfig = await configService.getAiSystemConfig({});
+ handleAiChat(content, promptType, aiConfig);
+ };
+
+ const handleAiChat = async (content: string, promptType: IPromptType, aiConfig?: IAiConfig) => {
+ const { apiKey, aiSqlSource } = aiConfig || props.aiModel?.aiConfig || {};
+ const isChat2DBAi = aiSqlSource === AiSqlSourceType.CHAT2DBAI;
if (!apiKey && isChat2DBAi) {
handleApiKeyEmptyOrGetQrCode(true);
return;
@@ -345,26 +352,23 @@ function Console(props: IProps) {
});
};
- const addAction = useMemo(
- () => [
- {
- id: 'explainSQL',
- label: i18n('common.text.explainSQL'),
- action: (selectedText: string) => handleAiChat(selectedText, IPromptType.SQL_EXPLAIN),
- },
- {
- id: 'optimizeSQL',
- label: i18n('common.text.optimizeSQL'),
- action: (selectedText: string) => handleAiChat(selectedText, IPromptType.SQL_OPTIMIZER),
- },
- {
- id: 'changeSQL',
- label: i18n('common.text.conversionSQL'),
- action: (selectedText: string) => handleAiChat(selectedText, IPromptType.SQL_2_SQL),
- },
- ],
- [],
- );
+ const addAction = [
+ {
+ id: 'explainSQL',
+ label: i18n('common.text.explainSQL'),
+ action: (selectedText: string) => handleAIChatInEditor(selectedText, IPromptType.SQL_EXPLAIN),
+ },
+ {
+ id: 'optimizeSQL',
+ label: i18n('common.text.optimizeSQL'),
+ action: (selectedText: string) => handleAIChatInEditor(selectedText, IPromptType.SQL_OPTIMIZER),
+ },
+ {
+ id: 'changeSQL',
+ label: i18n('common.text.conversionSQL'),
+ action: (selectedText: string) => handleAIChatInEditor(selectedText, IPromptType.SQL_2_SQL),
+ },
+ ];
const handleClickRemainBtn = async () => {
if (!isChat2DBAi) return;
@@ -382,11 +386,12 @@ function Console(props: IProps) {
*/
const handlePopUp = () => {
setModalProps({
- imageUrl: 'http://oss.sqlgpt.cn/static/chat2db-wechat.jpg?x-oss-process=image/auto-orient,1/resize,m_lfit,w_256/quality,Q_80/format,webp',
+ imageUrl:
+ 'http://oss.sqlgpt.cn/static/chat2db-wechat.jpg?x-oss-process=image/auto-orient,1/resize,m_lfit,w_256/quality,Q_80/format,webp',
tip: (
<>
{aiModel.remainingUse?.remainingUses === 0 && Key次数用完或者过期
}
- 微信扫描二维码并关注公众号“每天”可以获得 25 次 AI 使用机会。
+ 微信扫描二维码并关注公众号获得 AI 使用机会。
>
),
});
@@ -432,7 +437,7 @@ function Console(props: IProps) {
onExecute={executeSQL}
options={props.editorOptions}
tables={props.tables}
- // onChange={}
+ // onChange={}
/>
{/* {modelConfig.content} */}
setIsAiDrawerOpen(false)}>
diff --git a/chat2db-client/src/components/SearchResult/TableBox/index.tsx b/chat2db-client/src/components/SearchResult/TableBox/index.tsx
index 4ed7c415..f893eec3 100644
--- a/chat2db-client/src/components/SearchResult/TableBox/index.tsx
+++ b/chat2db-client/src/components/SearchResult/TableBox/index.tsx
@@ -1,21 +1,22 @@
import React, { useMemo, useState } from 'react';
-import { TableDataType } from '@/constants/table';
-import { IManageResultData, IResultConfig } from '@/typings/database';
-import { formatDate } from '@/utils/date';
import { Button, Dropdown, MenuProps, message, Modal, Space } from 'antd';
import { BaseTable, ArtColumn, useTablePipeline, features, SortItem } from 'ali-react-table';
-import Iconfont from '../../Iconfont';
-import classnames from 'classnames';
-import StateIndicator from '../../StateIndicator';
-import MonacoEditor from '../../Console/MonacoEditor';
-import { useTheme } from '@/hooks/useTheme';
import styled from 'styled-components';
-import { ThemeType } from '@/constants';
+import classnames from 'classnames';
import i18n from '@/i18n';
+import { ThemeType } from '@/constants';
+import { TableDataType } from '@/constants/table';
+import { useTheme } from '@/hooks/useTheme';
+import { IManageResultData, IResultConfig } from '@/typings/database';
import { compareStrings } from '@/utils/sort';
-import MyPagination from '../Pagination';
import { DownOutlined, UserOutlined } from '@ant-design/icons';
import { ExportSizeEnum, ExportTypeEnum } from '@/typings/resultTable';
+import { formatDate } from '@/utils/date';
+import { copy } from '@/utils';
+import Iconfont from '../../Iconfont';
+import StateIndicator from '../../StateIndicator';
+import MonacoEditor from '../../Console/MonacoEditor';
+import MyPagination from '../Pagination';
import styles from './index.less';
interface ITableProps {
@@ -49,10 +50,11 @@ const DarkSupportBaseTable: any = styled(BaseTable)`
export default function TableBox(props: ITableProps) {
const { className, data, config, onConfigChange, onSearchTotal } = props;
- const { headerList, dataList, duration, description } = data || {};
+ const { headerList, dataList, duration, description, sqlType } = data || {};
const [viewTableCellData, setViewTableCellData] = useState(null);
const [appTheme] = useTheme();
const isDarkTheme = useMemo(() => appTheme.backgroundColor === ThemeType.Dark, [appTheme]);
+ const [messageApi, contextHolder] = message.useMessage();
const handleExport = (exportType: ExportTypeEnum, exportSize: ExportSizeEnum) => {
props.onExport && props.onExport(data.sql, data.originalSql, exportType, exportSize);
@@ -61,7 +63,7 @@ export default function TableBox(props: ITableProps) {
const items: MenuProps['items'] = useMemo(
() => [
{
- label: '导出全部数据为csv',
+ label: i18n('workspace.table.export.all.csv'),
key: '1',
// icon: ,
onClick: () => {
@@ -69,7 +71,7 @@ export default function TableBox(props: ITableProps) {
},
},
{
- label: '导出全部数据为插入语句',
+ label: i18n('workspace.table.export.all.insert'),
key: '2',
// icon: ,
onClick: () => {
@@ -77,7 +79,7 @@ export default function TableBox(props: ITableProps) {
},
},
{
- label: '导出当前页数据为csv',
+ label: i18n('workspace.table.export.cur.csv'),
key: '3',
// icon: ,
onClick: () => {
@@ -85,7 +87,7 @@ export default function TableBox(props: ITableProps) {
},
},
{
- label: '导出当前页数据为插入语句',
+ label: i18n('workspace.table.export.cur.insert'),
key: '4',
// icon: ,
onClick: () => {
@@ -110,8 +112,8 @@ export default function TableBox(props: ITableProps) {
}
function copyTableCell(data: IViewTableCellData) {
- navigator.clipboard.writeText(data?.value || viewTableCellData?.value);
- message.success(i18n('common.button.copySuccessfully'));
+ copy(data?.value || viewTableCellData?.value);
+ messageApi.success(i18n('common.button.copySuccessfully'));
}
function handleCancel() {
@@ -175,12 +177,11 @@ export default function TableBox(props: ITableProps) {
if (type === TableDataType.DATETIME && i) {
rowData[columns[index].name] = formatDate(i, 'yyyy-MM-dd hh:mm:ss');
} else if (i === null) {
- rowData[columns[index].name] = '';
+ rowData[columns[index].name] = '';
} else {
rowData[columns[index].name] = i;
}
});
- rowData.key = rowIndex;
return rowData;
});
}
@@ -220,9 +221,24 @@ export default function TableBox(props: ITableProps) {
return await props.onSearchTotal();
}
};
- return (
-
- {columns.length ? (
+ const renderContent = () => {
+ const bottomStatus = (
+
+ {`【${i18n('common.text.result')}】${description}.`}
+ {`【${i18n('common.text.timeConsuming')}】${duration}ms.`}
+ {`【${i18n('common.text.searchRow')}】${tableData.length} ${i18n('common.text.row')}.`}
+
+ );
+
+ if (!columns.length || sqlType !== 'SELECT') {
+ return (
+ <>
+
+
{bottomStatus}
+ >
+ );
+ } else {
+ return (
<>
@@ -250,15 +266,14 @@ export default function TableBox(props: ITableProps) {
stickyTop={31}
{...pipeline.getProps()}
/>
-
- {`【${i18n('common.text.result')}】${description}.`}
- {`【${i18n('common.text.timeConsuming')}】${duration}ms.`}
- {`【${i18n('common.text.searchRow')}】${tableData.length} ${i18n('common.text.row')}.`}
-
+ {bottomStatus}
>
- ) : (
-
- )}
+ );
+ }
+ };
+ return (
+
+ {renderContent()}
+ {contextHolder}
);
}
diff --git a/chat2db-client/src/i18n/en-us/workspace.ts b/chat2db-client/src/i18n/en-us/workspace.ts
index 0c1e86d9..4fea0400 100644
--- a/chat2db-client/src/i18n/en-us/workspace.ts
+++ b/chat2db-client/src/i18n/en-us/workspace.ts
@@ -11,4 +11,8 @@ export default {
'The table name you entered is not the same as the table name you want to delete, please confirm again',
'workspace.table.total': 'Total',
'workspace.table.total.tip': 'Load total number of rows',
+ 'workspace.table.export.all.csv': 'Export result set csv',
+ 'workspace.table.export.cur.csv': 'Export result of current page set csv',
+ 'workspace.table.export.all.insert': 'Export result set insert sql',
+ 'workspace.table.export.cur.insert': 'Export result of current page set insert sql',
};
diff --git a/chat2db-client/src/i18n/zh-cn/workspace.ts b/chat2db-client/src/i18n/zh-cn/workspace.ts
index 33182677..4025b522 100644
--- a/chat2db-client/src/i18n/zh-cn/workspace.ts
+++ b/chat2db-client/src/i18n/zh-cn/workspace.ts
@@ -10,4 +10,8 @@ export default {
'workspace.tips.affirmDeleteTable': '输入的表名与要删除的表名不一致,请再次确认',
'workspace.table.total': '总数',
'workspace.table.total.tip': '加载总行数',
+ 'workspace.table.export.all.csv': '导出结果集 csv',
+ 'workspace.table.export.cur.csv': '导出当前页结果集 csv',
+ 'workspace.table.export.all.insert': '导出结果集 insert sql',
+ 'workspace.table.export.cur.insert': '导出当前页结果集 insert sql',
};
diff --git a/chat2db-client/src/main/index.js b/chat2db-client/src/main/index.js
index 4c45f579..ff82e78f 100644
--- a/chat2db-client/src/main/index.js
+++ b/chat2db-client/src/main/index.js
@@ -47,6 +47,8 @@ function createWindow() {
// const menu = Menu.buildFromTemplate(menuBar);
// Menu.setApplicationMenu(menu);
+app.commandLine.appendSwitch('--disable-gpu-sandbox');
+
app.on('ready', () => {
createWindow();
registerAppMenu();
diff --git a/chat2db-client/src/pages/main/workspace/components/Tree/TreeNodeRightClick/index.tsx b/chat2db-client/src/pages/main/workspace/components/Tree/TreeNodeRightClick/index.tsx
index 17b2b64e..92436521 100644
--- a/chat2db-client/src/pages/main/workspace/components/Tree/TreeNodeRightClick/index.tsx
+++ b/chat2db-client/src/pages/main/workspace/components/Tree/TreeNodeRightClick/index.tsx
@@ -65,7 +65,7 @@ function TreeNodeRightClick(props: IProps) {
handle: () => {
mysqlServer.exportCreateTableSql({
...curWorkspaceParams,
- tableName: data.name
+ tableName: data.key
} as any).then(res => {
setMonacoDefaultValue(res);
setMonacoVerifyDialog(true);
@@ -91,7 +91,7 @@ function TreeNodeRightClick(props: IProps) {
text: '新建表',
icon: '\ue6b6',
handle: () => {
- const operationData: IOperationData = {
+ const operationData = {
type: 'new',
nodeData: data
}
@@ -132,9 +132,7 @@ function TreeNodeRightClick(props: IProps) {
return {
text: data.pinned ? i18n('workspace.menu.unPin') : i18n('workspace.menu.pin'),
icon: data.pinned ? '\ue61d' : '\ue627',
- handle: () => {
- handelTop();
- }
+ handle: handelTop
}
},
}
@@ -143,7 +141,7 @@ function TreeNodeRightClick(props: IProps) {
const api = data.pinned ? 'deleteTablePin' : 'addTablePin'
mysqlServer[api]({
...curWorkspaceParams,
- tableName: data.name
+ tableName: data.key
} as any).then(res => {
dispatch({
type: 'workspace/fetchGetCurTableList',
@@ -173,10 +171,10 @@ function TreeNodeRightClick(props: IProps) {
}
function handleOk() {
- if (verifyTableName === data.name) {
+ if (verifyTableName === data.key) {
let p: any = {
...data.extraParams,
- tableName: data.name,
+ tableName: data.key,
}
mysqlServer.deleteTable(p).then(res => {
// notificationApi.success(
@@ -257,11 +255,12 @@ function TreeNodeRightClick(props: IProps) {
}
{ setVerifyDialog(false) })}>
+ onCancel={(() => { setVerifyDialog(false) })}
+ >
{ setVerifyTableName(e.target.value) }}>
{/* 这里后续肯定是要提出去的 */}
@@ -269,10 +268,12 @@ function TreeNodeRightClick(props: IProps) {
monacoVerifyDialog &&
{ setMonacoVerifyDialog(false) })}>
+ onCancel={(() => { setMonacoVerifyDialog(false) })}
+ footer={false}
+ >
{
diff --git a/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/rdb/vo/ExecuteResultVO.java b/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/rdb/vo/ExecuteResultVO.java
index 912b9b3d..6ca3ad25 100644
--- a/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/rdb/vo/ExecuteResultVO.java
+++ b/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/rdb/vo/ExecuteResultVO.java
@@ -38,6 +38,11 @@ public class ExecuteResultVO {
*/
private Boolean success;
+ /**
+ * 修改行数 查询sql不会返回
+ */
+ private Integer updateCount;
+
/**
* 展示头的列表
*/
diff --git a/chat2db-server/chat2db-spi/src/main/java/ai/chat2db/spi/sql/SQLExecutor.java b/chat2db-server/chat2db-spi/src/main/java/ai/chat2db/spi/sql/SQLExecutor.java
index 6c892825..8b38199d 100644
--- a/chat2db-server/chat2db-spi/src/main/java/ai/chat2db/spi/sql/SQLExecutor.java
+++ b/chat2db-server/chat2db-spi/src/main/java/ai/chat2db/spi/sql/SQLExecutor.java
@@ -184,11 +184,11 @@ public class SQLExecutor {
}
}
executeResult.setDuration(timeInterval.interval());
- return executeResult;
} finally {
JdbcUtils.closeResultSet(rs);
}
} else {
+ executeResult.setDuration(timeInterval.interval());
// 修改或者其他
executeResult.setUpdateCount(stmt.getUpdateCount());
}
diff --git a/chat2db-server/chat2db-spi/src/main/java/ai/chat2db/spi/util/JdbcUtils.java b/chat2db-server/chat2db-spi/src/main/java/ai/chat2db/spi/util/JdbcUtils.java
index c14d0429..e157eb1b 100644
--- a/chat2db-server/chat2db-spi/src/main/java/ai/chat2db/spi/util/JdbcUtils.java
+++ b/chat2db-server/chat2db-spi/src/main/java/ai/chat2db/spi/util/JdbcUtils.java
@@ -1,5 +1,6 @@
package ai.chat2db.spi.util;
+import java.math.BigDecimal;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.Connection;
@@ -180,6 +181,15 @@ public class JdbcUtils {
if (obj instanceof LocalDate localDate) {
return Objects.toString(localDate);
}
+ if (obj instanceof BigDecimal bigDecimal) {
+ return bigDecimal.toPlainString();
+ }
+ if (obj instanceof Double d) {
+ return BigDecimal.valueOf(d).toPlainString();
+ }
+ if (obj instanceof Float f) {
+ return BigDecimal.valueOf(f).toPlainString();
+ }
if (obj instanceof Number num) {
return Objects.toString(num);
}
@@ -196,11 +206,11 @@ public class JdbcUtils {
* @return
*/
public static DataSourceConnect testConnect(String url, String host, String port,
- String userName, String password, String dbType,
- DriverConfig driverConfig, SSHInfo ssh, Map properties) {
+ String userName, String password, String dbType,
+ DriverConfig driverConfig, SSHInfo ssh, Map properties) {
DataSourceConnect dataSourceConnect = DataSourceConnect.builder()
- .success(Boolean.TRUE)
- .build();
+ .success(Boolean.TRUE)
+ .build();
Session session = null;
Connection connection = null;
// 加载驱动
@@ -213,7 +223,7 @@ public class JdbcUtils {
}
// 创建连接
connection = IDriverManager.getConnection(url, userName, password,
- driverConfig, properties);
+ driverConfig, properties);
} catch (Exception e) {
log.error("connection fail:", e);
dataSourceConnect.setSuccess(Boolean.FALSE);
@@ -235,7 +245,7 @@ public class JdbcUtils {
}
if (session != null) {
try {
- if(StringUtils.isNotBlank(ssh.getLocalPort())) {
+ if (StringUtils.isNotBlank(ssh.getLocalPort())) {
session.delPortForwardingL(Integer.parseInt(ssh.getLocalPort()));
}
session.disconnect();