Skip to content

[Bug]: streamResponse doesn't seem to work when just returning it like from the docs #77

@shininglove

Description

@shininglove

What happened?

public function chat(Request $request)
{
    $message = $request->input('message');
    $agent = WeatherAgent::for(auth()->id());
    
    // Return a streamable response
    return $agent->streamResponse($message, 'plain');
}

This leds to a ob_flush error in Laravel. I'm using Laravel 12 and tried PHP 8.3 and 8.4.

How to reproduce the bug

I've created a repo with minimal setup (Laravel Breeze + React): https://github.com/shininglove/laragent-repro

Package Version

0.5

PHP Version

8.4

Laravel Version

12

Which operating systems does with happen with?

Linux

Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions