Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:sparkles: AI Agent https://github.com/siyuan-note/siyuan/issues/17797

Daniel3f1f3975e0f1
diff --git a/app/src/layout/dock/agent/AgentChat.ts b/app/src/layout/dock/agent/AgentChat.ts
index 875fc96a59..0f0296df7e 100644
--- a/app/src/layout/dock/agent/AgentChat.ts
+++ b/app/src/layout/dock/agent/AgentChat.ts
@@ -2272,14 +2272,19 @@ export class AgentChat extends Model {
});
});
});
- // 快照应在执行框(思考卡片)之前,需向前查找活跃的思考卡片而非追加到末尾
- const activeThinking = this.messagesContainer.querySelector(
- ".agent-chat__msg--thinking:not(.agent-chat__msg--thinking-done)"
- );
- if (activeThinking) {
- this.messagesContainer.insertBefore(el, activeThinking);
+ // 快照应在执行区域之前:有确认卡片时插到确认卡片前,否则查找活跃的思考卡片
+ const confirmCards = this.messagesContainer.querySelectorAll(".agent-chat__msg--confirm");
+ if (confirmCards.length > 0) {
+ this.messagesContainer.insertBefore(el, confirmCards[confirmCards.length - 1]);
} else {
- this.insertBeforeAI(el);
+ const activeThinking = this.messagesContainer.querySelector(
+ ".agent-chat__msg--thinking:not(.agent-chat__msg--thinking-done)"
+ );
+ if (activeThinking) {
+ this.messagesContainer.insertBefore(el, activeThinking);
+ } else {
+ this.insertBeforeAI(el);
+ }
}
this.scrollToBottom(true);
this.hasInterveningCard = true;