Skip to content

Conversation

@sixlive
Copy link
Contributor

@sixlive sixlive commented Jan 26, 2026

Description

Closes #870

Changes

  • Added markTextCompleted() method to StreamState that resets the textStarted flag
  • Called markTextCompleted() after emitting TextCompleteEvent in the OpenAI stream handler
  • Added unit test for the new method

Root Cause

When OpenAI returns multiple text content parts in a single response, the handler emitted TextStart only once (on first text delta) but TextComplete for each part. After the first TextComplete, subsequent text deltas arrived without triggering a new TextStart because textStarted remained true.

@kinsta
Copy link

kinsta bot commented Jan 26, 2026

Preview deployments for prism ⚡️

Status Branch preview Commit preview
✅ Ready Visit preview Visit preview

Commit: 3a684cd488f3de42f6ec574f91daa7fbf069cbf5

Deployment ID: 80a62352-dde7-455f-a4c4-e4190fffbe49

Static site name: prism-97nz9

@sixlive
Copy link
Contributor Author

sixlive commented Jan 26, 2026

Closing in favor of https://github.com/prism-php/prism/pull/874/files

@sixlive sixlive closed this Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Open AI (GPT-4.1-mini) multiple TextComplete without TextStart events

2 participants