chore: Integrate OpenAI API for completions on Ignition error page.

- Add OpenAI API to composer dev requirements.
- Add OpenAI API key to environment variables in .env.example.
This commit is contained in:
Jonny Barnes 2023-06-18 08:53:28 +01:00
parent 8e2535206e
commit a06d00210b
Signed by: jonny
SSH key fingerprint: SHA256:CTuSlns5U7qlD9jqHvtnVmfYV3Zwl2Z7WnJ4/dqOaL8
7 changed files with 248 additions and 17 deletions

View file

@ -84,6 +84,7 @@ SESSION_SECURE_COOKIE=true
LOG_SLACK_WEBHOOK_URL=
FLARE_KEY=
IGNITION_OPEN_AI_KEY=
FONT_LINK=

View file

@ -39,6 +39,7 @@
"laravel/sail": "^1.18",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^7.0",
"openai-php/client": "^0.6.1",
"phpunit/php-code-coverage": "^10.0",
"phpunit/phpunit": "^10.1",
"spatie/laravel-ray": "^1.12",

228
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "bc6e8ed12c7878c4ae9c94f2c143d97e",
"content-hash": "ebd4c00143a4dfb090f4d12d808d4782",
"packages": [
{
"name": "aws/aws-crt-php",
@ -9642,6 +9642,98 @@
],
"time": "2023-06-15T10:51:08+00:00"
},
{
"name": "openai-php/client",
"version": "v0.6.1",
"source": {
"type": "git",
"url": "https://github.com/openai-php/client.git",
"reference": "67937756931af848c03112e52706aa6ad175aa7a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/openai-php/client/zipball/67937756931af848c03112e52706aa6ad175aa7a",
"reference": "67937756931af848c03112e52706aa6ad175aa7a",
"shasum": ""
},
"require": {
"php": "^8.1.0",
"php-http/discovery": "^1.18.1",
"php-http/multipart-stream-builder": "^1.3.0",
"psr/http-client": "^1.0.2",
"psr/http-client-implementation": "^1.0.1",
"psr/http-factory-implementation": "*",
"psr/http-message": "^1.1.0|^2.0.0"
},
"require-dev": {
"guzzlehttp/guzzle": "^7.7.0",
"guzzlehttp/psr7": "^2.5.0",
"laravel/pint": "^1.10.2",
"nunomaduro/collision": "^7.5.2",
"pestphp/pest": "dev-develop as 2.6.2",
"pestphp/pest-plugin-arch": "^2.2.0",
"pestphp/pest-plugin-mock": "^2.0.0",
"pestphp/pest-plugin-type-coverage": "^2.0.0",
"phpstan/phpstan": "^1.10.15",
"rector/rector": "^0.16.0",
"symfony/var-dumper": "^6.3.0"
},
"type": "library",
"autoload": {
"files": [
"src/OpenAI.php"
],
"psr-4": {
"OpenAI\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nuno Maduro",
"email": "enunomaduro@gmail.com"
},
{
"name": "Sandro Gehri"
}
],
"description": "OpenAI PHP is a supercharged PHP API client that allows you to interact with the Open AI API",
"keywords": [
"GPT-3",
"api",
"client",
"codex",
"dall-e",
"language",
"natural",
"openai",
"php",
"processing",
"sdk"
],
"support": {
"issues": "https://github.com/openai-php/client/issues",
"source": "https://github.com/openai-php/client/tree/v0.6.1"
},
"funding": [
{
"url": "https://www.paypal.com/paypalme/enunomaduro",
"type": "custom"
},
{
"url": "https://github.com/gehrisandro",
"type": "github"
},
{
"url": "https://github.com/nunomaduro",
"type": "github"
}
],
"time": "2023-06-15T04:11:23+00:00"
},
{
"name": "phar-io/manifest",
"version": "2.0.3",
@ -9753,6 +9845,140 @@
},
"time": "2022-02-21T01:04:05+00:00"
},
{
"name": "php-http/discovery",
"version": "1.18.1",
"source": {
"type": "git",
"url": "https://github.com/php-http/discovery.git",
"reference": "f258b3a1d16acb7b21f3b42d7a2494a733365237"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-http/discovery/zipball/f258b3a1d16acb7b21f3b42d7a2494a733365237",
"reference": "f258b3a1d16acb7b21f3b42d7a2494a733365237",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.0|^2.0",
"php": "^7.1 || ^8.0"
},
"conflict": {
"nyholm/psr7": "<1.0",
"zendframework/zend-diactoros": "*"
},
"provide": {
"php-http/async-client-implementation": "*",
"php-http/client-implementation": "*",
"psr/http-client-implementation": "*",
"psr/http-factory-implementation": "*",
"psr/http-message-implementation": "*"
},
"require-dev": {
"composer/composer": "^1.0.2|^2.0",
"graham-campbell/phpspec-skip-example-extension": "^5.0",
"php-http/httplug": "^1.0 || ^2.0",
"php-http/message-factory": "^1.0",
"phpspec/phpspec": "^5.1 || ^6.1 || ^7.3",
"symfony/phpunit-bridge": "^6.2"
},
"type": "composer-plugin",
"extra": {
"class": "Http\\Discovery\\Composer\\Plugin",
"plugin-optional": true
},
"autoload": {
"psr-4": {
"Http\\Discovery\\": "src/"
},
"exclude-from-classmap": [
"src/Composer/Plugin.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com"
}
],
"description": "Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations",
"homepage": "http://php-http.org",
"keywords": [
"adapter",
"client",
"discovery",
"factory",
"http",
"message",
"psr17",
"psr7"
],
"support": {
"issues": "https://github.com/php-http/discovery/issues",
"source": "https://github.com/php-http/discovery/tree/1.18.1"
},
"time": "2023-05-17T08:53:10+00:00"
},
{
"name": "php-http/multipart-stream-builder",
"version": "1.3.0",
"source": {
"type": "git",
"url": "https://github.com/php-http/multipart-stream-builder.git",
"reference": "f5938fd135d9fa442cc297dc98481805acfe2b6a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-http/multipart-stream-builder/zipball/f5938fd135d9fa442cc297dc98481805acfe2b6a",
"reference": "f5938fd135d9fa442cc297dc98481805acfe2b6a",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0",
"php-http/discovery": "^1.15",
"psr/http-factory-implementation": "^1.0"
},
"require-dev": {
"nyholm/psr7": "^1.0",
"php-http/message": "^1.5",
"php-http/message-factory": "^1.0.2",
"phpunit/phpunit": "^7.5.15 || ^8.5 || ^9.3"
},
"type": "library",
"autoload": {
"psr-4": {
"Http\\Message\\MultipartStream\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com"
}
],
"description": "A builder class that help you create a multipart stream",
"homepage": "http://php-http.org",
"keywords": [
"factory",
"http",
"message",
"multipart stream",
"stream"
],
"support": {
"issues": "https://github.com/php-http/multipart-stream-builder/issues",
"source": "https://github.com/php-http/multipart-stream-builder/tree/1.3.0"
},
"time": "2023-04-28T14:10:22+00:00"
},
{
"name": "php-webdriver/webdriver",
"version": "1.14.0",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,8 @@
{
"/app.js": "/app.js?id=4f93645700a6c5485654",
"/app.css": "/app.css?id=99048465add47d086ac7",
"/app-dark.css": "/app-dark.css?id=f42b555818ed19478827"
"/app.js": "/app.js?id=c6187bff8d842d49dbb4d3de4b583600",
"/app-dark.css": "/app-dark.css?id=15c72df05e2b1147fa3e4b0670cfb435",
"/app.css": "/app.css?id=4d6a1a7fe095eedc2cb2a4ce822ea8a5",
"/img/favicon.png": "/img/favicon.png?id=1542bfe8a0010dcbee710da13cce367f",
"/img/horizon.svg": "/img/horizon.svg?id=904d5b5185fefb09035384e15bfca765",
"/img/sprite.svg": "/img/sprite.svg?id=afc4952b74895bdef3ab4ebe9adb746f"
}