fix: resolve staging blockers B1-B5, S6, X5 (quality review v1)
This commit is contained in:
@@ -76,13 +76,15 @@ async def run_agent_turn(
|
||||
if not agent["enabled"]:
|
||||
raise ValueError(f"Agent '{agent_id}' ist deaktiviert")
|
||||
|
||||
# History laden (letzte 20 Messages) — VOR dem Speichern der neuen User-Message,
|
||||
# damit die neue Turn-User-Message nicht versehentlich aus dem Slice fällt.
|
||||
history = await get_messages(db, conversation_id, limit=20)
|
||||
|
||||
# User-Message speichern
|
||||
await add_message(db, conversation_id, "user", user_message)
|
||||
|
||||
# History laden (letzte 20 Messages)
|
||||
history = await get_messages(db, conversation_id, limit=20)
|
||||
messages: List[dict] = [{"role": "system", "content": agent["system_prompt"]}]
|
||||
for row in history[:-1]: # ohne die gerade gespeicherte user-Message
|
||||
for row in history:
|
||||
role, content, tool_calls_json, _, _ = row
|
||||
if role == "tool":
|
||||
continue
|
||||
@@ -94,6 +96,9 @@ async def run_agent_turn(
|
||||
pass
|
||||
messages.append(msg)
|
||||
|
||||
# Aktuelle User-Message explizit anhängen, damit das LLM den neuen Turn sieht.
|
||||
messages.append({"role": "user", "content": user_message})
|
||||
|
||||
# MCP-Tools laden (gefiltert nach allowed_tools)
|
||||
mcp_client = get_mcp_client()
|
||||
tools = []
|
||||
|
||||
Reference in New Issue
Block a user