perf: Data Q&A Language

This commit is contained in:
fit2cloud-chenyw
2025-06-10 17:51:47 +08:00
parent 167505a74c
commit f110b76765
4 changed files with 73 additions and 10 deletions
+30
View File
@@ -10,5 +10,35 @@
"confirm": "Confirm",
"cancel": "Cancel",
"system_manage": "System Management"
},
"qa": {
"New Conversation": "New Conversation",
"title": "Smart Query",
"placeholder": "Enter your question",
"ask": "Ask",
"loading": "Loading...",
"no_data": "No Data",
"error": "An error occurred, please try again later",
"question_placeholder": "Press Enter to submit, or use Ctrl + Enter for new line",
"greeting": "Hi, I'm SQLBot, nice to serve you",
"description": "I can help query data, generate charts, detect data anomalies, predict data, etc. Please select a data source to start smart querying~",
"select_datasource": "Select Data Source",
"view_more": "View More",
"selected_datasource": "Selected Data Source",
"empty_datasource": "No data source available, please create one first!",
"datasource_not_exist": "Data source does not exist"
},
"ds": {
"title": "Data Source",
"add": "Add Data Source",
"edit": "Edit Data Source",
"delete": "Delete Data Source",
"name": "Data Source Name",
"type": "Data Source Type",
"status": "Status",
"actions": "Actions",
"test_connection": "Test Connection",
"connection_success": "Connection Successful",
"connection_failed": "Connection Failed, Please Check Configuration"
}
}
+30
View File
@@ -10,5 +10,35 @@
"confirm": "确认",
"cancel": "取消",
"system_manage": "系统管理"
},
"qa": {
"New Conversation": "开启新问数",
"title": "智能问数",
"placeholder": "请输入您的问题",
"ask": "提问",
"loading": "加载中...",
"no_data": "暂无数据",
"error": "发生错误,请稍后再试",
"question_placeholder": "按下 Enter 提交问题, 或使用 Ctrl + Enter 换行",
"greeting": "你好,我是SQLBot,很高兴为你服务",
"description": "我可以帮忙查询数据、生成图表、检测数据异常、预测数据等,请选择一个数据源,开启智能问数吧~",
"select_datasource": "选择数据源",
"view_more": "查看更多",
"selected_datasource": "已选择数据源",
"empty_datasource": "数据源为空,请新建后再开启智能问数!",
"datasource_not_exist": "数据源不存在"
},
"ds": {
"title": "数据源",
"add": "添加数据源",
"edit": "编辑数据源",
"delete": "删除数据源",
"name": "数据源名称",
"type": "数据源类型",
"status": "状态",
"actions": "操作",
"test_connection": "测试连接",
"connection_success": "连接成功",
"connection_failed": "连接失败,请检查配置"
}
}
+8 -7
View File
@@ -4,7 +4,8 @@ import {ChatInfo} from "@/api/chat.ts";
import {computed, onMounted, ref} from "vue";
import {datasourceApi} from "@/api/datasource.ts";
import DatasourceItemCard from '../ds/DatasourceItemCard.vue'
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
const props = withDefaults(defineProps<{
modelValue?: number
currentChat: ChatInfo
@@ -64,13 +65,13 @@ onMounted(() => {
<template>
<ChatBlock>
<div class="welcome-content">
<div>你好,我是SQLBot,很高兴为你服务</div>
<div class="sub">我可以帮忙查询数据、生成图表、检测数据异常、预测数据等,请选择一个数据源,开启智能问数吧~</div>
<div>{{ t('qa.greeting') }}</div>
<div class="sub">{{ t('qa.description') }}</div>
<template v-if="editable">
<template v-if="dsList.length>0">
<div class="ds-select-row">
<div>选择数据源</div>
<el-button @click="showDs" link type="primary">查看更多</el-button>
<div>{{ t('qa.select_datasource') }}</div>
<el-button @click="showDs" link type="primary">{{ t('qa.view_more') }}</el-button>
</div>
<div class="ds-row-container">
<template v-for="(item, _index) in dsList" :key="_index">
@@ -80,12 +81,12 @@ onMounted(() => {
</div>
</template>
<div v-else>
数据源为空,请新建后再开启智能问数!
{{ t('qa.empty_datasource') }}
</div>
</template>
<template v-else>
<div class="ds-select-row">
<div>已选择数据源</div>
<div>{{ t('qa.selected_datasource') }}</div>
</div>
<div class="ds-row-container">
<DatasourceItemCard :ds="ds"/>
+5 -3
View File
@@ -7,7 +7,7 @@
<el-icon>
<Plus/>
</el-icon>
New Conversation
{{ t('qa.New Conversation') }}
</el-button>
</el-header>
<el-main class="chat-list">
@@ -46,7 +46,7 @@
<template
v-if="currentChat.datasource && currentChat.datasource_name"
>
Datasource:{{ currentChat.datasource_name }}
{{ t('ds.title') }}:{{ currentChat.datasource_name }}
</template>
</div>
<div class="input-wrapper">
@@ -57,7 +57,7 @@
type="textarea"
:rows="1"
:autosize="{ minRows: 1, maxRows: 8 }"
placeholder="Press Enter to send, Ctrl + Enter for new line"
:placeholder="t('qa.question_placeholder')"
@keydown.enter.exact.prevent="sendMessage"
@keydown.ctrl.enter.exact.prevent="handleCtrlEnter"
/>
@@ -85,6 +85,8 @@ import {Chat, chatApi, ChatInfo, type ChatMessage, ChatRecord, questionApi,} fro
import ChatList from "./ChatList.vue";
import ChatRow from "./ChatRow.vue";
import ChatAnswer from "./ChatAnswer.vue";
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
const inputMessage = ref("");