mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-07 12:33:36 +09:00
## Description Using ChatGPT, this scripts generates descriptions for CSS properties and declarations (property-value). It uses `keywordValues` from [`src/__generated__/keyword-values.ts`](https://github.com/webstudio-is/webstudio-builder/blob/css-data-descriptions/packages/css-data/src/__generated__/keyword-values.ts) to get a list of all the properties and values. The result is a TS module located at `./src/__generated__/property-value-descriptions.ts` which exports: - properties - declarations By default it generates descriptions only for new properties/values, however you can use the `--forceRegenerate` flag to regenerate everything. When it comes to generating descriptions for declarations whose value is a color eg. `background-color: orange` we generate a description for a generic `property: {color}` declaration (e.g. `background-color: {color}`) and GPT will generate a description template with a placeholder `{color}`. The script then repeats the template for every color value, replacing `{color}`. This is to avoid generating a ton of similar description and wasting GPT tokens. The script needs two env variables: - process.env.OPENAI_KEY - Your OpenAI API key https://platform.openai.com/account/api-keys - process.env.OPENAI_ORG - Your OpenAI Org ID https://platform.openai.com/account/org-settings ## Steps for reproduction Run it ``` OPENAI_KEY=your-key OPENAI_ORG=your-org pnpm build:descriptions ``` ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - review sample descriptions ## Before merging - [x] Get approval on sample descriptions - [x] Generate all the descriptions - [ ] if any new env variables are added, added them to `.env.example` and the `builder/env-check.js` if mandatory --------- Co-authored-by: Giuseppe Gurgone <ggurgone@users.noreply.github.com> Co-authored-by: Oleg Isonen <oleg008@gmail.com>