emranpy's avatar

Facing Issues with OpenAI Chatbot Integration in Laravel: Need Help!

I just tried to build a chatbot using the OpenAI API, but no matter what I do, it's not working for me. I copied someone else's project, but it's still not working. I've tried everything I could, but nothing seems to fix it. Here is my controller, my route, and my blade template.

my route, ialso put my api key in the .env file

Route::get('/main', [ChatbotController::class, 'index']);
Route::post('/chat', [ChatbotController::class, 'chat'])->name('chat');

my controller

myblade file

first i run this command "composer require openai-php/laravel" then "php artisan openai:install" and i put my api key in the .env file and when i run the project it didn't work

0 likes
3 replies
rodosabbath's avatar

Can you provide which error messages are you getting in return?

Please or to participate in this conversation.