Skip to content
Open
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
6 changes: 3 additions & 3 deletions backend/app/api/feishu.py
Original file line number Diff line number Diff line change
Expand Up @@ -1497,11 +1497,11 @@ async def _call_agent_llm(
return f"⚠️ {agent.name} 未配置 LLM 模型,请在管理后台设置。"

# Build conversation messages (without system prompt — call_llm adds it)
# NOTE: history is already truncated to ctx_size by the SQL .limit() in
# each caller, so no further slicing is needed here.
messages: list[dict] = []
from app.models.agent import DEFAULT_CONTEXT_WINDOW_SIZE
ctx_size = agent.context_window_size or DEFAULT_CONTEXT_WINDOW_SIZE
if history:
messages.extend(history[-ctx_size:])
messages.extend(history)
messages.append({"role": "user", "content": user_text})

# Use actual user_id so the system prompt knows who it's chatting with
Expand Down