-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #373 from AmazeeLabs/feature/SLB-489-image-ai-dev-…
…update chore(slb-489): latest image ai module
- Loading branch information
Showing
20 changed files
with
180 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
_core: | ||
default_config_hash: 8qXodhEeMW6xT3pFpm_DCF6p4VYbb3dPEC7sMgHEpTs | ||
open_ai_base_uri: 'https://api.openai.com/v1/' | ||
open_ai_key: '' | ||
ai_model: '' | ||
words_length: 40 | ||
alt_prefix: Silverback | ||
alt_suffix: '' | ||
ai_context: '' | ||
debug_mode: 1 | ||
words_length: 30 | ||
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.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,29 @@ | ||
## INTRODUCTION | ||
[TDB] | ||
|
||
The Silverback AI module is a base module | ||
|
||
## REQUIREMENTS | ||
[TBD] | ||
|
||
- Webform (using some webform elements on reporting) | ||
|
||
## INSTALLATION | ||
|
||
Install as you would normally install a contributed Drupal module. | ||
See: https://www.drupal.org/node/895232 for further information. | ||
See: <https://www.drupal.org/node/895232> for further information. | ||
|
||
## CONFIGURATION | ||
[TBD] | ||
|
||
- 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: | ||
|
||
- 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 | ||
- Cost estimates based on current OpenAI pricing | ||
- Usage breakdown by time period | ||
- Details of individual API calls |
32 changes: 19 additions & 13 deletions
32
packages/drupal/silverback_ai/modules/silverback_image_ai/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,35 @@ | ||
## INTRODUCTION | ||
|
||
The Silveback Alt AI module is a DESCRIBE_THE_MODULE_HERE. | ||
The Silverback Image AI module provides AI-powered functionality for image management in Drupal. Its main features include: | ||
|
||
The primary use case for this module is: | ||
- 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 | ||
|
||
- Use case #1 | ||
- Use case #2 | ||
- Use case #3 | ||
The module aims to enhance the accessibility and SEO of your Drupal site by ensuring all images have meaningful alternative text. | ||
|
||
## REQUIREMENTS | ||
|
||
DESCRIBE_MODULE_DEPENDENCIES_HERE | ||
- Silveback AI module | ||
|
||
## INSTALLATION | ||
|
||
Install as you would normally install a contributed Drupal module. | ||
See: https://www.drupal.org/node/895232 for further information. | ||
See: <https://www.drupal.org/node/895232> for further information. | ||
|
||
## CONFIGURATION | ||
- Configuration step #1 | ||
- Configuration step #2 | ||
- Configuration step #3 | ||
|
||
## MAINTAINERS | ||
- Base settings form: `/admin/config/system/silverback/image-ai-settings`. | ||
|
||
Current maintainers for Drupal 10: | ||
## SERVICES | ||
|
||
### ImageAiUtilities Service | ||
|
||
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 | ||
- Integration with OpenAI's API for image analysis | ||
- Token usage tracking and logging | ||
|
||
- FIRST_NAME LAST_NAME (NICKNAME) - https://www.drupal.org/u/NICKNAME |
13 changes: 7 additions & 6 deletions
13
...silverback_ai/modules/silverback_image_ai/config/install/silverback_image_ai.settings.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
ai_model: 'gpt-4o-mini' | ||
debug_mode: false | ||
words_length: '40' | ||
alt_prefix: '' | ||
alt_suffix: '' | ||
ai_context: '' | ||
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.' | ||
debug_mode: 0 | ||
alt_disclaimer: 'The alternative text is generated by artificial intelligence. Verify for accuracy before publishing.' |
19 changes: 19 additions & 0 deletions
19
...al/silverback_ai/modules/silverback_image_ai/config/schema/silverback_image_ai.schema.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
silverback_image_ai.settings: | ||
type: config_object | ||
label: 'Silverback Image AI settings' | ||
mapping: | ||
ai_model: | ||
label: 'Model' | ||
type: string | ||
words_length: | ||
label: 'Number of ALT text words to generate' | ||
type: integer | ||
alt_ai_context: | ||
label: 'Context' | ||
type: text | ||
debug_mode: | ||
label: 'Debug mode' | ||
type: boolean | ||
alt_disclaimer: | ||
label: 'Disclaimer text' | ||
type: text |
5 changes: 5 additions & 0 deletions
5
...upal/silverback_ai/modules/silverback_image_ai/silverback_image_ai.config_translation.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
silverback_image_ai.config: | ||
title: 'Silverback Image AI settings' | ||
base_route_name: silverback_image_ai.settings | ||
names: | ||
- silverback_image_ai.settings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
packages/drupal/silverback_ai/modules/silverback_image_ai/silverback_image_ai.links.task.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
silverback_image_ai.settings: | ||
title: 'Settings' | ||
weight: 0 | ||
route_name: silverback_image_ai.settings | ||
base_route: silverback_image_ai.settings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/drupal/silverback_ai/modules/silverback_image_ai/silverback_image_ai.routing.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
silverback_image_ai.settings: | ||
path: '/admin/config/system/silverback/image-ai-settings' | ||
defaults: | ||
_title: 'Silverback Alt AI Settings' | ||
_title: 'Silverback Image AI Settings' | ||
_form: 'Drupal\silverback_image_ai\Form\ImageAiSettingsForm' | ||
requirements: | ||
_permission: 'administer site configuration' | ||
|
||
silverback_image_ai.image_ai_batch_update: | ||
path: '/admin/silverback-ai/update/image' | ||
defaults: | ||
_title: 'Image Ai Batch Update' | ||
_title: 'Image AI Batch Update' | ||
_form: 'Drupal\silverback_image_ai\Form\ImageAiBatchUpdateForm' | ||
requirements: | ||
_permission: 'access content' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.