elsayed85/copilot-ask-database
Composer 安装命令:
composer require elsayed85/copilot-ask-database
包简介
Use Your Github Copilot To Answer Your Database Questions
README 文档
README
Installation
You can install the package via composer:
composer require elsayed85/copilot-ask-database "dev-master"
You can publish the config file with:
php artisan vendor:publish --tag="copilot-ask-database-config"
This is the contents of the published config file:
return [ 'github_token' => env('COPILOT_ASK_GITHUB_TOKEN'), /** * The database connection name to use. Depending on your * use case, you might want to limit the database user * to have read-only access to the database. */ 'connection' => env('COPILOT_ASK_CONNECTION', 'mysql'), /** * Strict mode will throw an exception when the query * would perform a write/alter operation on the database. * * If you want to allow write operations - or if you are using a read-only * database user - you may disable strict mode. */ 'strict_mode' => env('COPILOT_ASK_STRICT_MODE', true), /** * The maximum number of tables to use before performing an additional * table name lookup call to OpenAI. * If you have a lot of database tables and columns, they might not fit * into a single request to OpenAI. In that case, we will perform a * lookup call to OpenAI to get the matching table names for the * provided question. */ 'max_tables_before_performing_lookup' => env('COPILOT_ASK_MAXIMUM_TABLES', 15), 'copilot' => [ 'intent' => false, 'model' => 'copilot-chat', // Don't change this 'top_p' => 1, 'n' => 1, 'client_id' => '01ab8ac9400c4e429b23', // Don't change this 'user_agent' => 'GithubCopilot/3.99.99', // Don't change this ], ];
Optionally, you can publish the views using
php artisan vendor:publish --tag="copilot-ask-database-views"
Views Contains Prompts templates , you can customize it as you want.
Setup Github Copilot
- Authenticate with Github Copilot using code :
php artisan copilot:github:auth
Please visit the following URL and login with your Github account:
https://github.com/login/device
Please enter the following code in the Github Device Activation page:
Your Github auth code is: 0EFA-6762
- Verify Github Copilot Authentication (After you login with your Github account and enter the code)
php artisan copilot:github:verify
Your Github access token is: gho_6E8rRBDL.........................
Please add the following line to your .env file:
COPILOT_ASK_GITHUB_TOKEN=gho_6E8rRBDL.........................
- Add Github Copilot Token to your .env file
COPILOT_ASK_GITHUB_TOKEN=gho_6E8rRBDL.........................
Usage
Ask For SQL Query
use Illuminate\Support\Facades\DB; $question = 'How many users are there?'; $query = DB::askCopilotForQuery($question);
Answer
SELECT COUNT(*) FROM users
Ask For Human Answer
use Illuminate\Support\Facades\DB; $question = 'How many users are there?'; $query = DB::askCopilot($question);
Answer
There are 10 users.
Testing
composer test
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.
elsayed85/copilot-ask-database 适用场景与选型建议
elsayed85/copilot-ask-database 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2 次下载、GitHub Stars 达 1, 最近一次更新时间为 2023 年 09 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「database」 「laravel」 「ask」 「question」 「answer」 「copilot」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 elsayed85/copilot-ask-database 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 elsayed85/copilot-ask-database 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 elsayed85/copilot-ask-database 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Dibi is Database Abstraction Library for PHP
Store your language lines in the database, yaml or other sources
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
Library containing a PHP implementation of the Ask query language
A PSR-7 compatible library for making CRUD API endpoints
PHP module for MySql database
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-09-23