Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions src/Providers/Ollama/Handlers/Stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,12 @@ protected function processStream(Response $response, Request $request, int $dept

// If we were emitting thinking and it's now stopped, mark it complete
if ($this->state->hasThinkingStarted()) {
$this->state->markThinkingCompleted();
yield new ThinkingCompleteEvent(
id: EventID::generate(),
timestamp: time(),
reasoningId: $this->state->reasoningId()
);
// Note: Can't easily reset just thinking flag with current StreamState API
// This may need adjustment if tests fail
// Don't continue here - we want to process the rest of this data chunk
}

Expand Down
7 changes: 7 additions & 0 deletions src/Streaming/StreamState.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ public function markThinkingStarted(): self
return $this;
}

public function markThinkingCompleted(): self
{
$this->thinkingStarted = false;

return $this;
}

public function appendText(string $text): self
{
$this->currentText .= $text;
Expand Down