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
17 changes: 8 additions & 9 deletions src/Exceptions/Solutions/OpenAiSolution.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,16 @@ public function __construct(protected Throwable $throwable)
now()->addHour(),
fn () => OpenAI::chat()->create([
'model' => config('restify.ai_solutions.model', 'gpt-4.1-mini'),
'messages' =>
'messages' => [
[
[
'role' => 'user',
'content' => $this->generatePrompt($this->throwable),
],
[
'role' => 'system',
'content' => 'Provide a concise solution to the problem described, tailored for a Laravel application using the Restify framework. Avoid explanations, examples, or code snippets. Respond with only the direct answer.',
],
'role' => 'user',
'content' => $this->generatePrompt($this->throwable),
],
[
'role' => 'system',
'content' => 'Provide a concise solution to the problem described, tailored for a Laravel application using the Restify framework. Avoid explanations, examples, or code snippets. Respond with only the direct answer.',
],
],
'max_tokens' => config('restify.ai_solutions.max_tokens', 1000),
'temperature' => 0,
])->choices[0]->message->content
Expand Down
3 changes: 3 additions & 0 deletions src/Http/Controllers/Auth/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Binaryk\LaravelRestify\Tests\Fixtures\User\User;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;

class LoginController extends Controller
Expand All @@ -27,6 +28,8 @@ public function __invoke(Request $request)
abort(401, 'Invalid credentials.');
}

Auth::login($user);

return rest($user)->indexMeta([
'token' => $user->createToken('login')->plainTextToken,
]);
Expand Down