Skip to content

Commit f95ba96

Browse files
committed
feat: add hide thinking block configuration
#1229
1 parent f73cca9 commit f95ba96

8 files changed

Lines changed: 32 additions & 13 deletions

File tree

backend/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ dependencies = [
3939
"pyyaml (>=6.0.2,<7.0.0)",
4040
"fastapi-mcp (>=0.3.4,<0.4.0)",
4141
"tabulate>=0.9.0",
42-
"sqlbot-xpack>=0.0.5.23,<0.0.6.0",
42+
"sqlbot-xpack>=0.0.5.24,<0.0.6.0",
4343
"fastapi-cache2>=0.2.2",
4444
"sqlparse>=0.5.3",
4545
"redis>=6.2.0",

frontend/src/i18n/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
"context_record_count": "Context Record Count",
7777
"context_record_count_hint": "Number of user question rounds",
7878
"model_thinking_process": "Expand Model Thinking Process",
79+
"hide_model_thinking_process": "Hide Model Thinking Process",
7980
"rows_of_data": "Limit 1000 Rows of Data",
8081
"third_party_platform_settings": "Authentication Settings",
8182
"by_third_party_platform": "Automatic User Creation",

frontend/src/i18n/ko-KR.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
"context_record_count": "컨텍스트 기록 수",
7777
"context_record_count_hint": "사용자 질문 라운드 수",
7878
"model_thinking_process": "모델 사고 프로세스 확장",
79+
"hide_model_thinking_process": "모델 사고 과정 숨기기",
7980
"rows_of_data": "데이터 1,000행 제한",
8081
"third_party_platform_settings": "로그인 인증 설정",
8182
"by_third_party_platform": "자동 사용자 생성",

frontend/src/i18n/zh-CN.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
"context_record_count": "上下文记录数",
7777
"context_record_count_hint": "用户提问轮数",
7878
"model_thinking_process": "展开模型思考过程",
79+
"hide_model_thinking_process": "隐藏模型思考过程",
7980
"rows_of_data": "限制 1000 行数据",
8081
"third_party_platform_settings": "登录认证设置",
8182
"by_third_party_platform": "自动创建用户",

frontend/src/i18n/zh-TW.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
"context_record_count": "上下文記錄數",
7777
"context_record_count_hint": "使用者提問輪數",
7878
"model_thinking_process": "展開模型思考過程",
79+
"hide_model_thinking_process": "隱藏模型思考過程",
7980
"rows_of_data": "限制 1000 列資料",
8081
"third_party_platform_settings": "登入認證設定",
8182
"by_third_party_platform": "自動建立使用者",

frontend/src/stores/chatConfig.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { formatArg } from '@/utils/utils.ts'
66
interface ChatConfig {
77
sqlbot_name: string
88
expand_thinking_block: boolean
9+
hide_thinking_block: boolean
910
limit_rows: boolean
1011
show_sql: boolean
1112
show_log: boolean
@@ -16,6 +17,7 @@ export const chatConfigStore = defineStore('chatConfigStore', {
1617
return {
1718
sqlbot_name: 'SQLBot',
1819
expand_thinking_block: false,
20+
hide_thinking_block: false,
1921
limit_rows: true,
2022
show_sql: true,
2123
show_log: true,
@@ -28,6 +30,9 @@ export const chatConfigStore = defineStore('chatConfigStore', {
2830
getExpandThinkingBlock(): boolean {
2931
return this.expand_thinking_block
3032
},
33+
getHideThinkingBlock(): boolean {
34+
return this.hide_thinking_block
35+
},
3136
getShowSQL(): boolean {
3237
return this.show_sql
3338
},
@@ -43,6 +48,9 @@ export const chatConfigStore = defineStore('chatConfigStore', {
4348
request.get('/system/parameter/chat').then((res: any) => {
4449
if (res) {
4550
res.forEach((item: any) => {
51+
if (item.pkey === 'chat.hide_thinking_block') {
52+
this.hide_thinking_block = formatArg(item.pval)
53+
}
4654
if (item.pkey === 'chat.expand_thinking_block') {
4755
this.expand_thinking_block = formatArg(item.pval)
4856
}

frontend/src/views/chat/answer/BaseAnswer.vue

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,12 @@ const reasoningContent = computed<Array<string>>(() => {
5050
})
5151
5252
const hasReasoning = computed<boolean>(() => {
53-
if (reasoningContent.value.length > 0) {
54-
for (let i = 0; i < reasoningContent.value.length; i++) {
55-
if (reasoningContent.value[i] && reasoningContent.value[i].trim() !== '') {
56-
return true
53+
if (!chatConfig.getHideThinkingBlock) {
54+
if (reasoningContent.value.length > 0) {
55+
for (let i = 0; i < reasoningContent.value.length; i++) {
56+
if (reasoningContent.value[i] && reasoningContent.value[i].trim() !== '') {
57+
return true
58+
}
5759
}
5860
}
5961
}

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

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const { t } = useI18n()
1010
const state = reactive({
1111
parameterForm: reactive<any>({
1212
'chat.sqlbot_name': 'SQLBot',
13+
'chat.hide_thinking_block': false,
1314
'chat.expand_thinking_block': false,
1415
'chat.limit_rows': false,
1516
'chat.show_sql': false,
@@ -114,8 +115,16 @@ onMounted(() => {
114115
</div>
115116
</div>
116117
</el-row>
117-
<el-row>
118+
<div style="display: grid; grid-template-columns: 1fr 1fr">
118119
<div class="card-item">
120+
<div class="label">
121+
{{ t('parameter.hide_model_thinking_process') }}
122+
</div>
123+
<div class="value">
124+
<el-switch v-model="state.parameterForm['chat.hide_thinking_block']" />
125+
</div>
126+
</div>
127+
<div v-if="!state.parameterForm['chat.hide_thinking_block']" class="card-item">
119128
<div class="label">
120129
{{ t('parameter.model_thinking_process') }}
121130

@@ -129,7 +138,7 @@ onMounted(() => {
129138
<el-switch v-model="state.parameterForm['chat.expand_thinking_block']" />
130139
</div>
131140
</div>
132-
<div class="card-item" style="margin-left: 16px">
141+
<div class="card-item">
133142
<div class="label">
134143
{{ t('parameter.rows_of_data') }}
135144
<el-tooltip
@@ -149,8 +158,6 @@ onMounted(() => {
149158
/>
150159
</div>
151160
</div>
152-
</el-row>
153-
<el-row>
154161
<div class="card-item">
155162
<div class="label">
156163
{{ t('parameter.show_sql') }}
@@ -159,16 +166,14 @@ onMounted(() => {
159166
<el-switch v-model="state.parameterForm['chat.show_sql']" />
160167
</div>
161168
</div>
162-
<div class="card-item" style="margin-left: 16px">
169+
<div class="card-item">
163170
<div class="label">
164171
{{ t('parameter.show_log') }}
165172
</div>
166173
<div class="value">
167174
<el-switch v-model="state.parameterForm['chat.show_log']" />
168175
</div>
169176
</div>
170-
</el-row>
171-
<el-row>
172177
<div class="card-item">
173178
<div class="label">
174179
{{ t('parameter.context_record_count') }}
@@ -191,7 +196,7 @@ onMounted(() => {
191196
/>
192197
</div>
193198
</div>
194-
</el-row>
199+
</div>
195200
</div>
196201

197202
<platform-param />

0 commit comments

Comments
 (0)