nuxt-alt-generator
Version:
Nuxt module that generates alt text for images using AI
46 lines (43 loc) • 1.45 kB
text/typescript
import * as _nuxt_schema from '@nuxt/schema';
interface ModuleOptions {
/**
* Whether there will be a call to the AI API to generate alt text for images
* If `false`, the generated alt text will be a mock/example text.
*
* Will default to `false` in development mode.
*
* @default true
*/
enabled?: boolean;
/**
* Whether to automatically generate and inject alt text for images in server-rendered pages.
*
* @default false
*/
auto?: boolean;
/**
* List of allowed image src patterns to generate alt text for. This will only be checked for requests coming from the client.
*
* You can for example set the base url of your image provider so that other people can't just use your endpoint and use your AI resources.
*/
allowedSrcPatterns?: string[];
ai: {
/**
* The OpenAI API key to use for generating alt text.
*/
apiKey: string;
/**
* Override the default base URL for the OpenAI API.
*/
baseUrl?: string;
/**
* The context of the website. This will be used to generate more relevant alt text.
*
* @example "This is a website that sells shoes"
*/
context?: string;
};
}
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
export { _default as default };
export type { ModuleOptions };