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
11 changes: 11 additions & 0 deletions afk/agents/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,19 @@ def respond(self, user_message: str) -> Iterator[StreamChunk]:
had_post_end = False
call_seen = False
rollback_len = len(self.history)
start_injected = False
if not in_thought and not content:
self.history.append({"role": "assistant", "content": START_TAG})
start_injected = True
try:
for c in self.stream(content):
if start_injected:
yield {"status": "start_thinking", "thinking": True}
in_thought = True
start_injected = False
if c.get("status") == "start_thinking":
in_thought = True
continue
orig_thinking = c.get("thinking", orig_thinking)
if c.get("status") == "start_thinking":
in_thought = True
Expand Down