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