From 9caf19203f44743ee5000b528098c63487c8df83 Mon Sep 17 00:00:00 2001 From: ulleo Date: Fri, 25 Jul 2025 17:49:16 +0800 Subject: [PATCH 1/4] feat: copy sql --- .../src/assets/svg/icon_copy_outlined.svg | 3 ++ frontend/src/i18n/en.json | 5 ++-- frontend/src/i18n/zh-CN.json | 5 ++-- .../src/views/chat/chat-block/ChartBlock.vue | 29 ++++++++++++++++++- 4 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 frontend/src/assets/svg/icon_copy_outlined.svg diff --git a/frontend/src/assets/svg/icon_copy_outlined.svg b/frontend/src/assets/svg/icon_copy_outlined.svg new file mode 100644 index 00000000..acdd1f66 --- /dev/null +++ b/frontend/src/assets/svg/icon_copy_outlined.svg @@ -0,0 +1,3 @@ + + + diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json index c869eb99..d16e667e 100644 --- a/frontend/src/i18n/en.json +++ b/frontend/src/i18n/en.json @@ -118,7 +118,8 @@ "earlier": "Earlier", "no_time": "No Time", "rename_conversation_title": "Rename conversation title", - "conversation_title": "Conversation title" + "conversation_title": "Conversation title", + "copied": "Copied" }, "ds": { "title": "Data Source", @@ -513,4 +514,4 @@ "back_community": "Restore to Community Edition", "confirm_tips": "Are you sure to restore to Community Edition?" } -} \ No newline at end of file +} diff --git a/frontend/src/i18n/zh-CN.json b/frontend/src/i18n/zh-CN.json index 5d3d7861..4234340a 100644 --- a/frontend/src/i18n/zh-CN.json +++ b/frontend/src/i18n/zh-CN.json @@ -121,7 +121,8 @@ "earlier": "更早以前", "no_time": "没有时间", "rename_conversation_title": "重命名对话标题", - "conversation_title": "对话标题" + "conversation_title": "对话标题", + "copied": "已复制" }, "ds": { "title": "数据源", @@ -525,4 +526,4 @@ "back_community": "还原至社区版", "confirm_tips": "确定还原至社区版?" } -} \ No newline at end of file +} diff --git a/frontend/src/views/chat/chat-block/ChartBlock.vue b/frontend/src/views/chat/chat-block/ChartBlock.vue index a6d8546e..52e59969 100644 --- a/frontend/src/views/chat/chat-block/ChartBlock.vue +++ b/frontend/src/views/chat/chat-block/ChartBlock.vue @@ -15,6 +15,7 @@ import icon_export_outlined from '@/assets/svg/icon_export_outlined.svg' import icon_into_item_outlined from '@/assets/svg/icon_into-item_outlined.svg' import icon_window_max_outlined from '@/assets/svg/icon_window-max_outlined.svg' import icon_window_mini_outlined from '@/assets/svg/icon_window-mini_outlined.svg' +import icon_copy_outlined from '@/assets/svg/icon_copy_outlined.svg' import { useI18n } from 'vue-i18n' import SQLComponent from '@/views/chat/component/SQLComponent.vue' @@ -189,6 +190,13 @@ function showSql() { function addToDashboard() { console.log('todo') } + +function copy() { + if (props.message?.record?.sql) { + navigator.clipboard.writeText(props.message.record.sql) + ElMessage.info(t('qa.copied')) + } +}