
Error page screenshot¶
TYPO3 extension solver
📦 Packagist | 🐥 TYPO3 extension repository | 💾 Repository | 🐛 Issue tracker
An extension for TYPO3 CMS to solve exceptions with AI generated solutions. It uses the OpenAI PHP client to send a prompt to a configured model and uses the responded completion as solution. Several completion attributes (model, tokens, temperature, number of completions) are configurable. It also provides a console command to solve problems from command line.
🚀 Features¶
Extended exception handler with AI generated solutions
Configurable AI completion attributes (model, tokens, temperature, number of completions)
Caching integration for solved problems
Command to solve problems from command line
Customizable solution providers and prompts
Compatible with TYPO3 11.5 LTS and 12.2
🔥 Installation¶
Via Composer:
composer require eliashaeussler/typo3-solver
Or download the zip file from TYPO3 extension repository (TER).
📂 Configuration¶
API key¶
You need an API key to perform requests at OpenAI. Once generated, the key must be configured in the extension configuration.
Extension configuration¶
The following extension configuration is available:
Configu ration |
Description |
Default value |
---|---|---|
|
FQCN of the solution provider |
|
|
FQCN of the prompt generator |
|
``ignor edCodes `` |
Comma-separated list of exception codes to ignore |
– |
|
API key for OpenAI requests |
– |
|
OpenAI model to use (see List available models _ to show a list of available models) |
|
|
Maximum number of tokens to use per request |
|
|
Temperature
to use for completion requests
(must be a value between |
|
|
`Number of completions <https://platform.ope nai.com/docs/api-reference/comple tions/create#completions/create-n >`__ to generate for each prompt |
|
|
Lifetime in seconds of the
solutions cache (use |
|
⚡ Usage¶
Exception handler¶
The extension provides a modified debug exception handler in
`Error/AiSolverExceptionHandler
<Classes/Error/AiSolverExceptionHandler.php>`__.
It can be activated in the system configuration (aka
LocalConfiguration.php
):
# config/system/settings.php
return [
'SYS' => [
'debugExceptionHandler' => 'EliasHaeussler\\Typo3Solver\\Error\\AiSolverExceptionHandler',
],
];
Once configured, the exception handler tries to provide a solution for the current exception and shows it on the exception page.
Solve a problem on the command line¶
Next to the exception handler integration, one can also explicitly solve
problems using the provided console command solver:solve
.
vendor/bin/typo3 solver:solve <problem> [--code=CODE] [--file=FILE] [--line=LINE] [--refresh] [--json]
The following input parameters are available:
Parameter |
Description |
---|---|
``problem` ` |
The exception message to solve |
|
Optional exception code |
|
Optional file where the exception occurs |
|
Optional line number within the given file |
|
Refresh a cached solution (requests a new solution and ignores the cached solution) |
|
Print solution as JSON |
List available models¶
The command solver:list-models
can be used to list all available
models for the configured OpenAI API key.
vendor/bin/typo3 solver:list-models
💡 All available models are listed in the OpenAI documentation.
Flush solution cache¶
Every solution is cached to reduce the amount of requests sent by the
OpenAI client. In order to flush the solution cache or remove single
cache entries, the command solver:cache:flush
cam be used.
vendor/bin/typo3 solver:cache:flush [<identifier>]
The following input parameters are available:
Parameter |
Description |
---|---|
|
Optional cache identifier to remove a single cache entry |
💎 Credits¶
The extension icon (“lightbulb-on”) is a modified version of the
original
`actions-lightbulb-on
<https://typo3.github.io/TYPO3.Icons/icons/actions/actions-lightbulb-on.html>`__
icon from TYPO3 core. In addition, the icons
`actions-calendar
<https://typo3.github.io/TYPO3.Icons/icons/actions/actions-calendar.html>`__,
`actions-cpu
<https://typo3.github.io/TYPO3.Icons/icons/actions/actions-cpu.html>`__,
`actions-debug
<https://typo3.github.io/TYPO3.Icons/icons/actions/actions-debug.html>`__
and
`actions-exclamation-triangle-alt
<https://typo3.github.io/TYPO3.Icons/icons/actions/actions-exclamation-triangle-alt.html>`__
from TYPO3 core are used. All icons are originally licensed under MIT
License.
This project is highly inspired by the article
`Fix your Laravel exceptions with AI
<https://beyondco.de/blog/ai-powered-error-solutions-for-laravel>`__
by Marcel Pociot.
In addition, I’d like to thank Nuno Maduro
and all contributors of the
`openai-php/client
<https://github.com/openai-php/client>`__ library
for this beautiful piece of code.
⭐ License¶
This project is licensed under GNU General Public License 2.0 (or later).