diff --git a/static/app.js b/static/app.js
index 0265e74..f131aed 100644
--- a/static/app.js
+++ b/static/app.js
@@ -202,6 +202,8 @@ async function bootstrapApp() {
// 设置菜单状态
settingsOpen: false,
+ // 思考块滚动锁
+ thinkingScrollLocks: new Map(),
// 工具控制菜单
toolMenuOpen: false,
@@ -732,6 +734,7 @@ async function bootstrapApp() {
this.autoScrollEnabled = true;
this.userScrolling = false;
this.scrollToBottom();
+ this.thinkingScrollLocks.set(blockId, true);
this.$forceUpdate();
}
});
@@ -747,7 +750,11 @@ async function bootstrapApp() {
lastAction.content += data.content;
}
this.$forceUpdate();
- this.conditionalScrollToBottom();
+ if (lastAction && lastAction.blockId) {
+ this.$nextTick(() => this.scrollThinkingToBottom(lastAction.blockId));
+ } else {
+ this.conditionalScrollToBottom();
+ }
}
});
@@ -765,6 +772,7 @@ async function bootstrapApp() {
this.expandedBlocks.delete(lastAction.blockId);
this.$forceUpdate();
}, 1000);
+ this.$nextTick(() => this.scrollThinkingToBottom(lastAction.blockId));
}
}
msg.streamingThinking = '';
@@ -1295,6 +1303,7 @@ async function bootstrapApp() {
if (this.markdownCache) {
this.markdownCache.clear();
}
+ this.thinkingScrollLocks.clear();
// 强制更新视图
this.$forceUpdate();
@@ -3000,6 +3009,23 @@ async function bootstrapApp() {
this.scrollToBottom();
}
},
+
+ scrollThinkingToBottom(blockId) {
+ if (!this.thinkingScrollLocks.get(blockId)) return;
+ const refName = `thinkingContent-${blockId}`;
+ const elRef = this.$refs[refName];
+ const el = Array.isArray(elRef) ? elRef[0] : elRef;
+ if (el) {
+ el.scrollTop = el.scrollHeight;
+ }
+ },
+
+ handleThinkingScroll(blockId, event) {
+ const el = event.target;
+ const threshold = 12;
+ const atBottom = el.scrollHeight - el.scrollTop - el.clientHeight < threshold;
+ this.thinkingScrollLocks.set(blockId, atBottom);
+ },
// 面板调整方法
startResize(panel, event) {
diff --git a/static/index.html b/static/index.html
index cf305fb..3a9add7 100644
--- a/static/index.html
+++ b/static/index.html
@@ -298,7 +298,10 @@
{{ action.streaming ? '正在思考...' : '思考过程' }}
-
diff --git a/sub_agent/static/app.js b/sub_agent/static/app.js
index 8540927..af96928 100644
--- a/sub_agent/static/app.js
+++ b/sub_agent/static/app.js
@@ -239,6 +239,7 @@ async function bootstrapApp() {
// 设置菜单状态
settingsOpen: false,
+ thinkingScrollLocks: new Map(),
// 工具控制菜单
toolMenuOpen: false,
@@ -1089,6 +1090,7 @@ async function bootstrapApp() {
this.autoScrollEnabled = true;
this.userScrolling = false;
this.scrollToBottom();
+ this.thinkingScrollLocks.set(blockId, true);
this.$forceUpdate();
}
});
@@ -1104,7 +1106,11 @@ async function bootstrapApp() {
lastAction.content += data.content;
}
this.$forceUpdate();
- this.conditionalScrollToBottom();
+ if (lastAction && lastAction.blockId) {
+ this.$nextTick(() => this.scrollThinkingToBottom(lastAction.blockId));
+ } else {
+ this.conditionalScrollToBottom();
+ }
}
});
@@ -1122,6 +1128,7 @@ async function bootstrapApp() {
this.expandedBlocks.delete(lastAction.blockId);
this.$forceUpdate();
}, 1000);
+ this.$nextTick(() => this.scrollThinkingToBottom(lastAction.blockId));
}
}
msg.streamingThinking = '';
@@ -1645,6 +1652,7 @@ async function bootstrapApp() {
if (this.markdownCache) {
this.markdownCache.clear();
}
+ this.thinkingScrollLocks.clear();
// 强制更新视图
this.$forceUpdate();
@@ -3203,6 +3211,23 @@ async function bootstrapApp() {
this.scrollToBottom();
}
},
+
+ scrollThinkingToBottom(blockId) {
+ if (!this.thinkingScrollLocks.get(blockId)) return;
+ const refName = `thinkingContent-${blockId}`;
+ const elRef = this.$refs[refName];
+ const el = Array.isArray(elRef) ? elRef[0] : elRef;
+ if (el) {
+ el.scrollTop = el.scrollHeight;
+ }
+ },
+
+ handleThinkingScroll(blockId, event) {
+ const el = event.target;
+ const threshold = 12;
+ const atBottom = el.scrollHeight - el.scrollTop - el.clientHeight < threshold;
+ this.thinkingScrollLocks.set(blockId, atBottom);
+ },
// 面板调整方法
startResize(panel, event) {
diff --git a/sub_agent/static/index.html b/sub_agent/static/index.html
index 92aef06..cabc4b1 100644
--- a/sub_agent/static/index.html
+++ b/sub_agent/static/index.html
@@ -270,7 +270,10 @@
{{ action.streaming ? '正在思考...' : '思考过程' }}