Skip to content

Commit

Permalink
fix: prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
pmelab committed Dec 2, 2024
1 parent 9570fed commit fed77e5
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 17 deletions.
15 changes: 9 additions & 6 deletions packages/composer/amazeelabs/silverback_ai/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,22 @@ Base AI functionality for Silverback.

## INSTALLATION

Install as you would normally install a contributed Drupal module.
See: <https://www.drupal.org/node/895232> for further information.
Install as you would normally install a contributed Drupal module. See:
<https://www.drupal.org/node/895232> for further information.

## CONFIGURATION

- Open AI credentials can be set on: `/admin/config/system/silverback-ai-settings`.
It is recommended though to add the Open AI Api key as environment variable (`OPEN_AI_API_KEY`).
- Open AI credentials can be set on:
`/admin/config/system/silverback-ai-settings`. It is recommended though to add
the Open AI Api key as environment variable (`OPEN_AI_API_KEY`).

## USAGE TRACKING

The Silverback AI module tracks OpenAI API token usage for monitoring and cost management purposes:
The Silverback AI module tracks OpenAI API token usage for monitoring and cost
management purposes:

- All Silverback AI submodules automatically report their token usage through the `TokenUsage` service
- All Silverback AI submodules automatically report their token usage through
the `TokenUsage` service
- Usage statistics can be viewed at `/admin/reports/silverback-ai-usage`
- The report shows:
- Total tokens used per module
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
## INTRODUCTION

The Silverback Image AI module provides AI-powered functionality for image management in Drupal. Its main features include:
The Silverback Image AI module provides AI-powered functionality for image
management in Drupal. Its main features include:

- Automatic generation of alt text for images using AI
- Intelligent image analysis and description
- Accessibility improvements through better image descriptions
- Integration with OpenAI's vision models for image processing

The module aims to enhance the accessibility and SEO of your Drupal site by ensuring all images have meaningful alternative text.
The module aims to enhance the accessibility and SEO of your Drupal site by
ensuring all images have meaningful alternative text.

## REQUIREMENTS

- Silveback AI module

## INSTALLATION

Install as you would normally install a contributed Drupal module.
See: <https://www.drupal.org/node/895232> for further information.
Install as you would normally install a contributed Drupal module. See:
<https://www.drupal.org/node/895232> for further information.

## CONFIGURATION

Expand All @@ -26,7 +28,8 @@ See: <https://www.drupal.org/node/895232> for further information.

### ImageAiUtilities Service

The `ImageAiUtilities` service provides core functionality for AI-powered image processing. It handles:
The `ImageAiUtilities` service provides core functionality for AI-powered image
processing. It handles:

- Generation of ALT text for images using OpenAI's vision models
- Processing of image files and media entities
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ open_ai_base_uri: 'https://api.openai.com/v1/'
open_ai_key: ''
ai_model: ''
words_length: 30
alt_ai_context: 'Silverback is a PHP and Javascript framework to generate decoupled web sites.'
alt_ai_context:
'Silverback is a PHP and Javascript framework to generate decoupled web sites.'
debug_mode: 0
alt_disclaimer: 'The alternative text is generated by artificial intelligence. Verify for accuracy before publishing.'
alt_disclaimer:
'The alternative text is generated by artificial intelligence. Verify for
accuracy before publishing.'
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ id: media_alt_ai_update_action
label: 'Alt text update (imaged only)'
type: media
plugin: entity:alt_ai_update_action:media
configuration: { }
configuration: {}
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
services:
silverback_image_ai.commands:
class: \Drupal\silverback_image_ai\Drush\Commands\SilverbackImageAiCommands
arguments: ['@entity_type.manager', '@silverback_image_ai.batch.updater', '@silverback_image_ai.utilities']
arguments:
[
'@entity_type.manager',
'@silverback_image_ai.batch.updater',
'@silverback_image_ai.utilities',
]
tags:
- { name: drush.command }
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
services:
silverback_image_ai.utilities:
class: Drupal\silverback_image_ai\ImageAiUtilities
arguments: ['@logger.factory','@config.factory', '@http_client', '@silverback_ai.token.usage', '@silverback_ai.openai_http_client', '@entity_type.manager']
arguments:
[
'@logger.factory',
'@config.factory',
'@http_client',
'@silverback_ai.token.usage',
'@silverback_ai.openai_http_client',
'@entity_type.manager',
]
silverback_image_ai.batch.updater:
class: 'Drupal\silverback_image_ai\MediaUpdaterBatch'
arguments:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
services:
silverback_ai.token.usage:
class: Drupal\silverback_ai\TokenUsage
arguments: ['@database', '@current_user', '@logger.factory', '@config.factory', '@entity_type.manager']
arguments:
[
'@database',
'@current_user',
'@logger.factory',
'@config.factory',
'@entity_type.manager',
]
silverback_ai.openai_http_client:
class: Drupal\silverback_ai\HttpClient\OpenAiHttpClient
arguments: ['@http_client_factory', '@config.factory']

0 comments on commit fed77e5

Please sign in to comment.