Code Monkey home page Code Monkey logo

gpt-trix-editor's Introduction

GPT Trix Editor ๐Ÿช„

The GPT Trix Editor is a form field component for the Filament PHP framework that enhances the Trix editor with OpenAI GPT features.

Features:

New - Run GPT on selected/highlighted text ๐Ÿ‘‡

Installation

You can install the package via composer:

composer require askerakbar/gpt-trix-editor

Quick Start

  1. Publish the configuration files by running the following commands:
php artisan vendor:publish --provider="OpenAI\Laravel\ServiceProvider"
php artisan vendor:publish --tag="gpt-trix-editor-config"
php artisan vendor:publish --tag="gpt-trix-editor-translations"
  1. We're using https://github.com/openai-php/laravel laravel package to call the OpenAI APIs, so you need to set your OpenAI API key in the .env file or in the config/openapi.php file:
OPENAI_API_KEY=YOUR_KEY

You can also set the GPT model in the .env

TRIX_GPT_MODEL=YOUR_MODEL
  1. Optionally, you can customize the configuration file at config/gpt-trix-editor.php. This includes adding more prompts to the menu dropdown, setting temperature and max_tokens.
  2. Clear the configuration cache to make sure your changes take effect: php artisan config:clear
  3. Done!

Usage

Import the field component:

use AskerAkbar\GptTrixEditor\Components\GptTrixEditor;

You can use the GPT Trix Editor field component like any other field component:

GptTrixEditor::make('content')->columnSpan('full');

By default, the GPT Toolbar Button is enabled in the GP Trix Editor. However, if you want to disable it, you can do so like this:

GptTrixEditor::make('content')->disableToolbarButtons([
    'gptTools',
])->columnSpan('full');

To do

  • โœ… Run the GPT actions on selected/highlighted text

Contribute / Report a bug / Security Vulnerabilities

If you would like to contriubte, please feel free to submit pull requests or open issues.

License

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.