Skip to content

Commit ec3e7a4

Browse files
committed
feat: Add parameter configuration to hide show SQL button & hide execute log in chat
1 parent afbb3d7 commit ec3e7a4

8 files changed

Lines changed: 54 additions & 3 deletions

File tree

frontend/src/i18n/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@
7171
"platform_user_roles": "Third-Party Platform User Roles",
7272
"excessive_data_volume": "Disabling the 1000-row data limit may cause system lag due to excessive data volume.",
7373
"sqlbot_name": "Data Query Assistant Name",
74+
"hide_sql": "Hide Show SQL Button",
75+
"hide_log": "Hide Execution Log",
7476
"prompt": "Prompt",
7577
"disabling_successfully": "Disabling Successfully",
7678
"closed_by_default": "In the Question Count window, control whether the model thinking process is expanded or closed by default.",

frontend/src/i18n/ko-KR.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@
7171
"platform_user_roles": "타사 플랫폼 사용자 역할",
7272
"excessive_data_volume": "1,000행 데이터 제한을 비활성화하면 과도한 데이터 양으로 인해 시스템 지연이 발생할 수 있습니다.",
7373
"sqlbot_name": "데이터 질의 도우미 이름",
74+
"hide_sql": "SQL 표시 버튼 숨기기",
75+
"hide_log": "실행 로그 숨기기",
7476
"prompt": "프롬프트",
7577
"disabling_successfully": "비활성화 완료",
7678
"closed_by_default": "질문 수 창에서 모델 사고 프로세스를 기본적으로 확장할지 또는 닫을지 여부를 제어합니다.",

frontend/src/i18n/zh-CN.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@
7171
"platform_user_roles": "第三方平台用户角色",
7272
"excessive_data_volume": "关闭1000行的数据限制后,数据量过大,可能会造成系统卡顿",
7373
"sqlbot_name": "问数小助手名称",
74+
"hide_sql": "隐藏展示SQL按钮",
75+
"hide_log": "隐藏执行日志",
7476
"prompt": "提示",
7577
"disabling_successfully": "关闭成功",
7678
"closed_by_default": "在问数窗口中,控制模型思考过程默认展开或者关闭",

frontend/src/i18n/zh-TW.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@
7171
"platform_user_roles": "第三方平台使用者角色",
7272
"excessive_data_volume": "關閉1000列的資料限制後,資料量過大,可能會造成系統卡頓",
7373
"sqlbot_name": "問數小助手名稱",
74+
"hide_sql": "隱藏展示SQL按鈕",
75+
"hide_log": "隱藏執行日誌",
7476
"prompt": "提示",
7577
"disabling_successfully": "關閉成功",
7678
"closed_by_default": "在問數視窗中,控制模型思考過程預設展開或者關閉",

frontend/src/stores/chatConfig.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ interface ChatConfig {
77
sqlbot_name: string
88
expand_thinking_block: boolean
99
limit_rows: boolean
10+
hide_sql: boolean
11+
hide_log: boolean
1012
}
1113

1214
export const chatConfigStore = defineStore('chatConfigStore', {
@@ -15,6 +17,8 @@ export const chatConfigStore = defineStore('chatConfigStore', {
1517
sqlbot_name: 'SQLBot',
1618
expand_thinking_block: false,
1719
limit_rows: true,
20+
hide_sql: false,
21+
hide_log: false,
1822
}
1923
},
2024
getters: {
@@ -24,6 +28,12 @@ export const chatConfigStore = defineStore('chatConfigStore', {
2428
getExpandThinkingBlock(): boolean {
2529
return this.expand_thinking_block
2630
},
31+
getHideSQL(): boolean {
32+
return this.hide_sql
33+
},
34+
getHideLog(): boolean {
35+
return this.hide_log
36+
},
2737
getLimitRows(): boolean {
2838
return this.limit_rows
2939
},
@@ -36,6 +46,12 @@ export const chatConfigStore = defineStore('chatConfigStore', {
3646
if (item.pkey === 'chat.expand_thinking_block') {
3747
this.expand_thinking_block = formatArg(item.pval)
3848
}
49+
if (item.pkey === 'chat.hide_sql') {
50+
this.hide_sql = formatArg(item.pval)
51+
}
52+
if (item.pkey === 'chat.hide_log') {
53+
this.hide_log = formatArg(item.pval)
54+
}
3955
if (item.pkey === 'chat.limit_rows') {
4056
this.limit_rows = formatArg(item.pval)
4157
}

frontend/src/views/chat/ChatTokenTime.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
import { ref } from 'vue'
33
import icon_logs_outlined from '@/assets/svg/icon_logs_outlined.svg'
44
import ExecutionDetails from './ExecutionDetails.vue'
5+
import { useChatConfigStore } from '@/stores/chatConfig.ts'
56
const props = defineProps<{
67
recordId?: number
78
duration?: number | undefined
89
totalTokens?: number | undefined
910
}>()
10-
11+
const chatConfig = useChatConfigStore()
12+
const showLogBtn = !chatConfig.getHideLog
1113
const executionDetailsRef = ref()
1214
function getLogList() {
1315
executionDetailsRef.value.getLogList(props.recordId)
@@ -19,7 +21,7 @@ function getLogList() {
1921
<span>{{ $t('parameter.tokens_required') }} {{ totalTokens }}</span>
2022
<span style="margin-left: 12px">{{ $t('parameter.time_execution') }} {{ duration }} s</span>
2123

22-
<div class="detail" @click="getLogList">
24+
<div v-if="showLogBtn" class="detail" @click="getLogList">
2325
<el-icon style="margin-right: 4px" size="16">
2426
<icon_logs_outlined></icon_logs_outlined>
2527
</el-icon>

frontend/src/views/chat/chat-block/ChartBlock.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ import { useAssistantStore } from '@/stores/assistant'
2626
import AddViewDashboard from '@/views/dashboard/common/AddViewDashboard.vue'
2727
import html2canvas from 'html2canvas'
2828
import { chatApi } from '@/api/chat'
29+
import { useChatConfigStore } from '@/stores/chatConfig.ts'
2930
31+
const chatConfig = useChatConfigStore()
32+
const showSQLBtn = !chatConfig.getHideSQL
3033
const props = withDefaults(
3134
defineProps<{
3235
recordId?: number
@@ -420,7 +423,7 @@ watch(
420423
</el-tooltip>
421424
</div>
422425

423-
<div v-if="message?.record?.sql">
426+
<div v-if="message?.record?.sql && showSQLBtn">
424427
<el-tooltip effect="dark" :offset="8" :content="t('chat.show_sql')" placement="top">
425428
<el-button class="tool-btn" text @click="showSql">
426429
<el-icon size="16">

frontend/src/views/system/parameter/index.vue

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ const state = reactive({
1212
'chat.sqlbot_name': 'SQLBot',
1313
'chat.expand_thinking_block': false,
1414
'chat.limit_rows': false,
15+
'chat.hide_sql': false,
16+
'chat.hide_log': false,
1517
}),
1618
})
1719
provide('parameterForm', state.parameterForm)
@@ -105,6 +107,8 @@ onMounted(() => {
105107
<el-input v-model="state.parameterForm['chat.sqlbot_name']" />
106108
</div>
107109
</div>
110+
</el-row>
111+
<el-row>
108112
<div class="card-item">
109113
<div class="label">
110114
{{ t('parameter.model_thinking_process') }}
@@ -140,6 +144,24 @@ onMounted(() => {
140144
</div>
141145
</div>
142146
</el-row>
147+
<el-row>
148+
<div class="card-item">
149+
<div class="label">
150+
{{ t('parameter.hide_sql') }}
151+
</div>
152+
<div class="value">
153+
<el-switch v-model="state.parameterForm['chat.hide_sql']" />
154+
</div>
155+
</div>
156+
<div class="card-item" style="margin-left: 16px">
157+
<div class="label">
158+
{{ t('parameter.hide_log') }}
159+
</div>
160+
<div class="value">
161+
<el-switch v-model="state.parameterForm['chat.hide_log']" />
162+
</div>
163+
</div>
164+
</el-row>
143165
<el-row>
144166
<div class="card-item">
145167
<div class="label">

0 commit comments

Comments
 (0)