Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions agent/deep_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,17 +148,8 @@ def _agent_init(self):
f"持久化: PostgreSQL (checkpointer + store)"
)

# 準備 middleware 列表
# 啟用 SummarizationMiddleware 來自動壓縮過長的對話歷史
middleware = [
SummarizationMiddleware(
model=self.model,
# 當訊息數量超過 50 條時觸發壓縮
trigger=("messages", 50),
# 壓縮後保留最近的 20 條訊息
keep=("messages", 20),
)
]
# middleware 由 create_deep_agent 在啟用 checkpointer 時自動管理
middleware = []

Comment on lines +151 to 153
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With middleware now always set to an empty list, the SummarizationMiddleware import becomes unused, and the later middleware=middleware if middleware else None will always pass None. Please remove the unused import and consider dropping the middleware local/argument entirely (or pass middleware=None directly) for clarity.

Copilot uses AI. Check for mistakes.
self.agent = create_deep_agent(
model=self.model,
Expand Down
Loading