Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nicholasgriffintn/storybook-ai

Investigation into using AI inside of Storybook to describe components
https://github.com/nicholasgriffintn/storybook-ai

Last synced: about 1 month ago
JSON representation

Investigation into using AI inside of Storybook to describe components

Awesome Lists containing this project

README

        

# Storybook AI

Storybook AI is an addon that can be used with Storybook to provide a way to generate stories from your React components and ask questions about them, right from Storybook.

At the moment, this is enitrely for investigational purposes and is not intended to be used in production, please do not use this without the expectation of issues.

Alongside that, this is a personal project and is only shared for the purpose of code sharing and learning, please don't expect any support or updates.

Also, to note: One of the biggest issues with this package is that it will leak your API key to the client, so please be careful with that.

## Installation

Install the package:

```sh
pnpm add -D storybook-ai
```

Then, register it as an addon in `.storybook/main.js`.

```js
// .storybook/main.ts

// Replace your-framework with the framework you are using (e.g., react-webpack5, vue3-vite)
import type { StorybookConfig } from '@storybook/your-framework';

const config: StorybookConfig = {
// ...rest of config
addons: [
'@storybook/addon-essentials'
'storybook-ai', // 👈 register the addon here
],
};

export default config;
```

Then in your `.storybook/preview.js` file, add the following:

```js
const parameters = {
... // other parameters
ai: {
provider: 'openai',
apiKey: process.env.OPENAI_API_KEY,
},
};
```