Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| RemoveOutputPrefix | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| handle | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Filters\AIResponseFilter; |
| 4 | |
| 5 | use Closure; |
| 6 | |
| 7 | /** |
| 8 | * Removes the "OUTPUT:" prefix that the AI sometimes includes in responses. |
| 9 | */ |
| 10 | class RemoveOutputPrefix |
| 11 | { |
| 12 | public function handle($data, Closure $next) |
| 13 | { |
| 14 | $data = trim(str_replace('OUTPUT:', ' ', $data)); |
| 15 | |
| 16 | return $next($data); |
| 17 | } |
| 18 | } |