Skip to content

Commit

Permalink
Beta Release
Browse files Browse the repository at this point in the history
  • Loading branch information
jiten14 committed Sep 9, 2024
1 parent d0889d1 commit 7e8d0ec
Show file tree
Hide file tree
Showing 4 changed files with 172 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ All notable changes to `jitone-ai` will be documented in this file.
## v0.0.1-alpha - 2024-09-08

- Alpha Release for Internal Testing

## v0.0.8-beta - 2024-09-09

- Release beta version
170 changes: 166 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,175 @@



**⚠️ Warning: This package is in alpha and should not be used in production environments. It is currently intended for testing and internal use only.**
**⚠️ Warning: This package is currently in beta. While it includes many features and improvements, it may still have bugs or incomplete functionality. Please test it thoroughly and provide feedback, but do not use it in production environments.**

## Installation

### Beta version for Testing

To install the beta version of this package, use the following Composer command:

```bash
composer require jiten14/jitone-ai:^0.0.8-beta
```
### Stable Verion (Comming Soon)

You can install the package via composer:

```bash
composer require jiten14/jitone-ai
```
## Usage
1. After downloading, Run the package installation command:

```bash
php artisan jitone-ai:install
```

**This command will:**
- Publish the configuration file
- Create a symbolic link for storage
2. We use [openai-php/laravel](https://github.com/openai-php/laravel) package to connect with OpenAI API. Configure your OpenAI API key in your .env file:

```env
OPENAI_API_KEY=your_api_key_here
```
# JitoneAI

## Configuration

The `config/jitone-ai.php` file allows you to set default values and templates:

* Set default AI models, max tokens, and temperature
* Configure image generation settings
* Add custom content templates

## Usage for Developers

### Adding AI to Built-in Filament Form Fields

You can add AI generation capabilities to `TextInput`, `Textarea`, and `RichEditor` fields using the `withAI()` method:

#### Without Options

```php
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\RichEditor;

TextInput::make('title')
->withAI()

Textarea::make('description')
->withAI()

RichEditor::make('content')
->withAI()
```

#### With Options

```php
TextInput::make('title')
->withAI([
'model' => 'gpt-4',
'max_tokens' => 100,
'temperature' => 0.7,
])

Textarea::make('description')
->withAI([
'model' => 'gpt-3.5-turbo',
'max_tokens' => 200,
'temperature' => 0.5,
])

RichEditor::make('content')
->withAI([
'model' => 'gpt-4',
'max_tokens' => 500,
'temperature' => 0.8,
])
```

### Using Dedicated AI Fields

#### AITextField

The package provides a dedicated `AITextField` for enhanced content generation:

##### Without Options:

```php
use Jiten14\JitoneAi\Forms\Components\AITextField;

AITextField::make('content')
```

##### With Options:

```php
AITextField::make('content')
->withAI([
'model' => 'gpt-4',
'max_tokens' => 300,
'temperature' => 0.6,
])
```

#### AIFileUpload for Image Generation

Use the `AIFileUpload` field with the `imageAI()` method to enable AI image generation:

##### Without Options:

```php
use Jiten14\JitoneAi\Forms\Components\AIFileUpload;

AIFileUpload::make('image')
->imageAI()
```

##### With Options:

```php
AIFileUpload::make('image')
->imageAI([
'size' => '1024x1024',
])
```

## Usage for End-Users

### Generating Content

1. In a form with AI-enabled fields, users will see a "Generate with AI" link right upper to the field.
2. Clicking this link opens a modal where users can:
* Enter a custom prompt
* Choose from pre-defined templates (if configured)
* Use existing content for modification
3. If modifying existing content, users can choose to:
* Refine: Improve the existing text
* Expand: Add more details to the existing text
* Shorten: Summarize the existing text
4. After entering the prompt, selecting a template, or choosing a modification option, click "Generate" to create or modify the content.
5. The generated or modified content will be inserted into the form field.

### Generating Images

1. For fields with AI image generation, users will see a "Generate with AI" link right upper to the upload field.
2. Clicking this link opens a modal where users can:
* Describe the image they want to generate
* Choose from pre-defined image prompts (if configured)
* Select the desired image size (if multiple options are provided)
3. After entering the description, selecting a template, and choosing the size, click "Generate" to create the image.
4. The generated image will be uploaded and associated with the form field.

## Advanced Features

* The package automatically checks for required dependencies and their versions, logging warnings if any are missing or outdated.
* Developers can add custom templates and prompts through the configuration file.

## Changelog

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
Expand All @@ -25,9 +185,11 @@ Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed re

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

## Security Vulnerabilities
## Security Vulnerabilities & Support

If you discover any security vulnerabilities or bugs, please let us know so we can address them promptly.

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
For support with this package or to report any issues, feel free to reach out. We are here to assist you!

## Credits

Expand All @@ -36,4 +198,4 @@ Please review [our security policy](../../security/policy) on how to report secu

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
2 changes: 1 addition & 1 deletion src/Forms/Actions/GenerateContentAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class GenerateContentAction
public function execute($field, $record, $data, array $options = [])
{
return Action::make('generateContent')
->label('Generate Content with AI')
->label('Generate with AI')
->icon('heroicon-s-sparkles')
->form([
Toggle::make('use_existing_content')
Expand Down
2 changes: 1 addition & 1 deletion src/Forms/Actions/GenerateImageAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class GenerateImageAction
public function execute($field, $record, $data, array $options = [])
{
return Action::make('generateImage')
->label('Generate Image with AI')
->label('Generate with AI')
->icon('heroicon-s-sparkles')
->form([
Textarea::make('ai_prompt')
Expand Down

0 comments on commit 7e8d0ec

Please sign in to comment.