elsayed85/laravel-github-copilot-chat

A Laravel package to add a chatbot powered by GitHub Copilot to your Laravel application.

v0.0.3 2023-08-21 04:13 UTC

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Chat With Github Copilot inside Command Line using Laravel.

Installation

You can install the package via composer:

composer require elsayed85/laravel-github-copilot-chat

You can publish the config file with:

php artisan vendor:publish --tag="laravel-github-copilot-chat-config"

This is the contents of the published config file:

return [
    'stream' => true,
    'intent' => false,
    'model' => 'copilot-chat',
    'temperature' => 0.1,
    'top_p' => 1,
    'n' => 1,

    'client_id' => '01ab8ac9400c4e429b23', // Don't change this
    'user_agent' => 'GithubCopilot/3.99.99', // Don't change this
];

Usage

Github Copilot Chat

Run :

php artisan copilot:chat

for First Time You need to login to your github account and copy the code from the terminal and auth with github

Got To https://github.com/login/device/ and enter the code: B720-C162

then after auth you need to confirm that

    ┌ Do you entered the code successfully? ───────────────────────┐
        Yes / No 
    └──────────────────────────────────────────────────────────────┘

Github Copilot CLI

NodeJs Package

To use github-copilot-cli

A CLI experience for letting GitHub Copilot help you on the command line.

GitHub Copilot CLI translates natural language into shell commands, with modes for different domains. After installation, you can use the following three command:

use Elsayed85\CopilotChat\CopilotCli;

$cli = new CopilotCli();
$q = "install laravel";
$cli = $cli->init();
$cli->setQuestion($q);
$a = $cli->shell(); // you can use shell() or git() or gitCli()
// call explanation() after shell() or git() or gitCli() to get explanation of the generated cli command
$explanation = $cli->explanation();
dd($a , $explanation);

Then We Will Generate Copilot Token and it will be saved locally using cache for (30 min) and when it expired another token will be generated automatically.

and Now You can Chat With Github copilot Have Fun :)

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.