datocms-plugin-alt-text-ai 0.5.14 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -1,21 +1,71 @@
|
|
|
1
1
|
# Alt Text AI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Generate alt text for image assets directly from DatoCMS `file` and `gallery` fields. Choose [AltText.ai](https://alttext.ai), OpenAI, Anthropic Claude, or Google Gemini, then review the generated text in the record form before saving it.
|
|
4
|
+
|
|
5
|
+
## Supported providers
|
|
6
|
+
|
|
7
|
+
| Provider | Required settings |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| AltText.ai | [AltText.ai API key](https://alttext.ai/account/api_keys) |
|
|
10
|
+
| OpenAI | [OpenAI API key](https://platform.openai.com/api-keys) and an image-input model |
|
|
11
|
+
| Anthropic Claude | [Anthropic API key](https://console.anthropic.com/settings/keys) and an image-input model |
|
|
12
|
+
| Google Gemini | [Gemini API key](https://aistudio.google.com/apikey) and an image-input model |
|
|
13
|
+
|
|
14
|
+
For direct model providers, the plugin loads every model ID returned by the provider's model-list API after an API key is entered. It does not recommend or preselect a model. Choose one that accepts image input and returns text, or enter a model ID manually.
|
|
4
15
|
|
|
5
16
|
## Configuration
|
|
6
17
|
|
|
7
|
-
|
|
18
|
+
1. Grant the plugin the `currentUserAccessToken` permission when installing it. The plugin needs this permission to retrieve the selected asset from the current DatoCMS environment.
|
|
19
|
+
2. Open the plugin settings and choose an alt text provider.
|
|
20
|
+
3. Enter that provider's API key.
|
|
21
|
+
4. For OpenAI, Anthropic, or Gemini, select or enter a vision-capable model and review the prompt template.
|
|
22
|
+
5. Save the settings.
|
|
23
|
+
|
|
24
|
+
The prompt template for direct model providers supports these placeholders:
|
|
8
25
|
|
|
9
|
-
|
|
26
|
+
- `{locale}`: the active locale in the record editor.
|
|
27
|
+
- `{filename}`: the asset filename, supplied as supporting context.
|
|
28
|
+
|
|
29
|
+
Keep an instruction in the prompt that asks the provider to return only the alt text. AltText.ai uses its own generation configuration rather than this prompt template.
|
|
30
|
+
|
|
31
|
+
### Existing installations
|
|
32
|
+
|
|
33
|
+
Existing installations are migrated automatically. A previously saved `apiKey` remains associated with AltText.ai, and AltText.ai remains the selected provider until you choose another one.
|
|
10
34
|
|
|
11
35
|
## Usage
|
|
12
36
|
|
|
13
|
-
|
|
37
|
+
The plugin adds two actions to the dropdown menu of every populated `file` and `gallery` field:
|
|
38
|
+
|
|
39
|
+
- **Generate missing alt texts** fills assets whose alt text is empty and leaves existing alt text unchanged.
|
|
40
|
+
- **Regenerate all alt texts** generates alt text for every asset in the field and overwrites existing values.
|
|
41
|
+
|
|
42
|
+
Generated values update the current record form; they are not saved automatically. Review the output, make any necessary edits, and save the record.
|
|
43
|
+
|
|
44
|
+
For localized fields, the plugin reads and updates only the field value for the active locale. Run the action separately in each locale that needs alt text. It does not update asset metadata globally or change other fields and records that reference the same upload.
|
|
45
|
+
|
|
46
|
+
## Security and privacy
|
|
47
|
+
|
|
48
|
+
Provider API keys are stored in the plugin parameters and used by client-side requests from the DatoCMS editor. Anyone who can run or inspect the plugin in that project may be able to retrieve those keys. Use dedicated keys with the narrowest available permissions, quotas, billing limits, and origin or API restrictions, and rotate them regularly. If your organization's policy prohibits browser-exposed credentials, do not configure a direct provider key.
|
|
49
|
+
|
|
50
|
+
The data sent depends on the selected provider. AltText.ai receives a transformed public image URL, the active locale, and a stable identifier derived from the DatoCMS upload ID. OpenAI and Anthropic receive the transformed public image URL plus the expanded prompt. Gemini receives the image bytes plus the expanded prompt. The expanded prompt contains the locale or filename only when its template includes the corresponding placeholder. Review the selected provider's data-handling terms before processing sensitive assets.
|
|
51
|
+
|
|
52
|
+
The editor's DatoCMS current-user access token is used only to retrieve upload information through the Content Management API for the current environment. It is never sent to AltText.ai, OpenAI, Anthropic, or Google.
|
|
53
|
+
|
|
54
|
+
## Limitations and accessibility notes
|
|
55
|
+
|
|
56
|
+
- The plugin is intended for image assets. Other file types are not supported and may produce a provider error.
|
|
57
|
+
- Direct providers require a model that accepts image input and returns text. Model availability, pricing, rate limits, and output quality depend on the provider account.
|
|
58
|
+
- Each asset-generation request times out after 60 seconds without changing that asset's alt text.
|
|
59
|
+
- AI-generated descriptions can be inaccurate. Always review them in the context where the image appears.
|
|
60
|
+
- Empty alt text can be intentional for decorative images. **Generate missing alt texts** cannot distinguish an intentional empty value from a missing one, so review decorative images before saving.
|
|
61
|
+
- A single asset can need different alt text in different contexts. The plugin updates the current field occurrence rather than every reference to the upload.
|
|
14
62
|
|
|
15
|
-
|
|
16
|
-
- **Generate Alt Texts**: regenerates alt text for every asset in the field, overwriting any existing values.
|
|
63
|
+
## Development
|
|
17
64
|
|
|
18
|
-
|
|
65
|
+
Run commands from this directory:
|
|
19
66
|
|
|
20
|
-
- `npm run dev`:
|
|
21
|
-
- `npm run build`:
|
|
67
|
+
- `npm run dev`: start the local Vite development server.
|
|
68
|
+
- `npm run build`: type-check the project and build production assets into `dist/`.
|
|
69
|
+
- `npm run test`: run the test suite once.
|
|
70
|
+
- `npm run test:watch`: run tests in watch mode.
|
|
71
|
+
- `npm run preview`: preview the production build locally.
|