fix: print full s11 continuation output

This commit is contained in:
Gui-Yue
2026-05-24 15:28:09 +00:00
parent 06ac34ed4d
commit a510aef5da
2 changed files with 13 additions and 8 deletions

View File

@@ -352,10 +352,14 @@ if __name__ == "__main__":
break break
if query.strip().lower() in ("q", "exit", ""): if query.strip().lower() in ("q", "exit", ""):
break break
turn_start = len(history)
history.append({"role": "user", "content": query}) history.append({"role": "user", "content": query})
agent_loop(history, context) agent_loop(history, context)
context = update_context(context, history) context = update_context(context, history)
for block in history[-1]["content"]: for msg in history[turn_start:]:
if msg.get("role") != "assistant":
continue
for block in msg["content"]:
if getattr(block, "type", None) == "text": if getattr(block, "type", None) == "text":
print(block.text) print(block.text)
print() print()

View File

@@ -2004,14 +2004,13 @@ def agent_loop(messages: list, context: dict):
messages.append({"role": "user", "content": build_user_content(results)}) messages.append({"role": "user", "content": build_user_content(results)})
def print_last_assistant(messages: list): def print_turn_assistants(messages: list, turn_start: int):
for msg in reversed(messages): for msg in messages[turn_start:]:
if msg.get("role") != "assistant": if msg.get("role") != "assistant":
continue continue
for block in msg.get("content", []): for block in msg.get("content", []):
if getattr(block, "type", None) == "text": if getattr(block, "type", None) == "text":
terminal_print(block.text) terminal_print(block.text)
break
def cron_autorun_loop(history: list, context: dict): def cron_autorun_loop(history: list, context: dict):
@@ -2021,6 +2020,7 @@ def cron_autorun_loop(history: list, context: dict):
if not fired: if not fired:
continue continue
with agent_lock: with agent_lock:
turn_start = len(history)
for job in fired: for job in fired:
history.append({"role": "user", history.append({"role": "user",
"content": f"[Scheduled] {job.prompt}"}) "content": f"[Scheduled] {job.prompt}"})
@@ -2028,7 +2028,7 @@ def cron_autorun_loop(history: list, context: dict):
f" \033[35m[cron auto] {job.prompt[:60]}\033[0m") f" \033[35m[cron auto] {job.prompt[:60]}\033[0m")
agent_loop(history, context) agent_loop(history, context)
context.update(update_context(context, history)) context.update(update_context(context, history))
print_last_assistant(history) print_turn_assistants(history, turn_start)
if __name__ == "__main__": if __name__ == "__main__":
@@ -2047,11 +2047,12 @@ if __name__ == "__main__":
if query.strip().lower() in ("q", "exit", ""): if query.strip().lower() in ("q", "exit", ""):
break break
trigger_hooks("UserPromptSubmit", query) trigger_hooks("UserPromptSubmit", query)
turn_start = len(history)
history.append({"role": "user", "content": query}) history.append({"role": "user", "content": query})
with agent_lock: with agent_lock:
agent_loop(history, context) agent_loop(history, context)
context = update_context(context, history) context = update_context(context, history)
print_last_assistant(history) print_turn_assistants(history, turn_start)
inbox = consume_lead_inbox(route_protocol=True) inbox = consume_lead_inbox(route_protocol=True)
if inbox: if inbox: