Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: add a button to allow bring the chatsql back (#7709)

Liu Jie2e0c981ccab
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index b66ec15eb3..a11ec31c96 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -2474,7 +2474,8 @@
"3": "What's the gender ratio in each department?"
},
"statement-copied": "Statement copied to clipboard",
- "dont-show-again": "Don't show again"
+ "dont-show-again": "Don't show again",
+ "chat-sql": "ChatSQL"
}
},
"custom-approval": {
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index d1acfb4f1d..3c005e2130 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -2469,7 +2469,8 @@
"3": "¿Cuál es la proporción de género en cada departamento?"
},
"statement-copied": "Declaración copiada al portapapeles",
- "dont-show-again": "No mostrar de nuevo"
+ "dont-show-again": "No mostrar de nuevo",
+ "chat-sql": "ChatSQL"
}
},
"custom-approval": {
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 28cf02a93a..102db9579c 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -2467,7 +2467,8 @@
"3": "各个部门的性别比例如何?"
},
"statement-copied": "语句已复制到剪贴板",
- "dont-show-again": "不再显示"
+ "dont-show-again": "不再显示",
+ "chat-sql": "ChatSQL"
}
},
"custom-approval": {
diff --git a/frontend/src/plugins/ai/components/MockInputPlaceholder.vue b/frontend/src/plugins/ai/components/MockInputPlaceholder.vue
index af6078a3e8..31f077ef1d 100644
--- a/frontend/src/plugins/ai/components/MockInputPlaceholder.vue
+++ b/frontend/src/plugins/ai/components/MockInputPlaceholder.vue
@@ -1,5 +1,5 @@
<template>
- <div v-if="!dismissed" class="w-full px-4 py-2 border-t">
+ <div v-if="!DISMISS_PLACEHOLDER" class="w-full px-4 py-2 border-t">
<NInputGroup>
<NInput
size="small"
@@ -34,22 +34,18 @@
</template>
<script lang="ts" setup>
-import { useLocalStorage } from "@vueuse/core";
import { NInput, NInputGroup, NButton, NTooltip } from "naive-ui";
import { useRouter } from "vue-router";
+import { DISMISS_PLACEHOLDER } from "./state";
const router = useRouter();
-const dismissed = useLocalStorage<boolean>(
- "bb.plugin.open-ai.dismiss-placeholder",
- false
-);
const handleClick = () => {
router.push({ name: "setting.workspace.general", hash: "#ai-augmentation" });
};
const handleDismiss = () => {
- dismissed.value = true;
+ DISMISS_PLACEHOLDER.value = true;
};
</script>
diff --git a/frontend/src/plugins/ai/components/state.ts b/frontend/src/plugins/ai/components/state.ts
new file mode 100644
index 0000000000..3c606c2a97
--- /dev/null
+++ b/frontend/src/plugins/ai/components/state.ts
@@ -0,0 +1,6 @@
+import { useLocalStorage } from "@vueuse/core";
+
+export const DISMISS_PLACEHOLDER = useLocalStorage(
+ "bb.plugin.open-ai.dismiss-placeholder",
+ false
+);
diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue
index e35a7a0252..a681a14403 100644
--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue
@@ -45,6 +45,22 @@
>
{{ $t("sql-editor.visualize-explain") }}
</NButton>
+ <NTooltip v-if="DISMISS_PLACEHOLDER">
+ <template #trigger>
+ <NButton
+ size="small"
+ style="--n-padding: 0 8px"
+ @click="DISMISS_PLACEHOLDER = false"
+ >
+ <template #icon>
+ <heroicons:academic-cap class="w-4 h-4" />
+ </template>
+ </NButton>
+ </template>
+ <template #default>
+ {{ $t("plugin.ai.chat-sql") }}
+ </template>
+ </NTooltip>
<DataExportButton
v-if="showExportButton"
size="small"
@@ -117,12 +133,13 @@ import {
} from "@tanstack/vue-table";
import { useDebounceFn } from "@vueuse/core";
import { isEmpty } from "lodash-es";
-import { NInput, NPagination } from "naive-ui";
+import { NInput, NPagination, NTooltip } from "naive-ui";
import { BinaryLike } from "node:crypto";
import { computed, reactive, ref } from "vue";
import { useI18n } from "vue-i18n";
import { ExportFormat } from "@/components/DataExportButton.vue";
import RequestExportPanel from "@/components/Issue/panel/RequestExportPanel/index.vue";
+import { DISMISS_PLACEHOLDER } from "@/plugins/ai/components/state";
import {
useInstanceV1Store,
useTabStore,