PHP code example of mohammadsalamat / chat_ai

1. Go to this page and download the library: Download mohammadsalamat/chat_ai library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mohammadsalamat / chat_ai example snippets


use Salamat\chat_ai\Http\Controllers\ChatAiController;

public function sendMessage(Request $request, ChatAiController $controller)
{
    return $controller->generateText($request);
}

use Salamat\chat_ai\Http\Controllers\ChatAiController;

public function sendMessage(Request $request)
{
    $controller = new ChatAiController();
    return $controller->generateText($request);
}

use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Route;

Route::post('/sendMessage', [Controller::class, 'sendMessage']);
sh
php artisan vendor:publish
sh
php artisan migrate