Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
chenge
commited on
Commit
·
fb8117a
1
Parent(s):
1472f6b
think 不自动折叠
Browse files
app.py
CHANGED
@@ -1351,9 +1351,13 @@ with gr.Blocks(css=css, fill_width=True) as demo:
|
|
1351 |
// 当thinking完成且有正式回答内容时,自动折叠
|
1352 |
const shouldCollapse = thinking_done && content && content.trim().length > 0
|
1353 |
|
|
|
|
|
|
|
1354 |
return {
|
1355 |
thinking_collapse_props: {
|
1356 |
-
|
|
|
1357 |
style: {
|
1358 |
display: (thinking_content || is_thinking) ? 'block' : 'none',
|
1359 |
marginBottom: thinking_content || is_thinking ? '12px' : '0'
|
|
|
1351 |
// 当thinking完成且有正式回答内容时,自动折叠
|
1352 |
const shouldCollapse = thinking_done && content && content.trim().length > 0
|
1353 |
|
1354 |
+
// 使用key来重新渲染组件,触发新的默认状态
|
1355 |
+
const collapseKey = thinking_done ? 'collapsed' : 'expanded'
|
1356 |
+
|
1357 |
return {
|
1358 |
thinking_collapse_props: {
|
1359 |
+
key: collapseKey, // 重新渲染组件以应用新的默认状态
|
1360 |
+
default_active_key: shouldCollapse ? [] : ['1'],
|
1361 |
style: {
|
1362 |
display: (thinking_content || is_thinking) ? 'block' : 'none',
|
1363 |
marginBottom: thinking_content || is_thinking ? '12px' : '0'
|