{"id":18561172,"url":"https://github.com/apostrophecms/ai-helper","last_synced_at":"2025-08-27T15:14:04.337Z","repository":{"id":152183576,"uuid":"609607406","full_name":"apostrophecms/ai-helper","owner":"apostrophecms","description":"AI helpers for content creation","archived":false,"fork":false,"pushed_at":"2025-04-02T09:13:28.000Z","size":134,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-02T09:29:55.015Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apostrophecms.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-04T17:33:31.000Z","updated_at":"2024-09-05T21:03:01.000Z","dependencies_parsed_at":"2024-06-18T15:03:11.023Z","dependency_job_id":"e409b2d5-f92e-44ce-bf60-8629a5adfc98","html_url":"https://github.com/apostrophecms/ai-helper","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostrophecms%2Fai-helper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostrophecms%2Fai-helper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostrophecms%2Fai-helper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostrophecms%2Fai-helper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apostrophecms","download_url":"https://codeload.github.com/apostrophecms/ai-helper/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248144203,"owners_count":21054884,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T22:06:01.647Z","updated_at":"2025-04-10T02:31:22.611Z","avatar_url":"https://github.com/apostrophecms.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ai-helper: AI for content creation in Apostrophe 3\n\n## Purpose\n\nThis module enhances Apostrophe with AI-driven helpers. Currently this module offers:\n\n* A button to generate an image from a text prompt via OpenAI.\n* An insert menu option to generate rich text from a prompt via OpenAI.\n\nYou will need to [obtain your own API key from OpenAI](https://openai.com/product). As of this writing you can also\n[obtain a free API key for limited usage](https://platform.openai.com/account/api-keys).\n\n## Caveats\n\nThis is a beta module where we are experimenting with simple ways to integrate generative AI in the\ncontent creation process. AI systems can generate surprising and sometimes inappropriate results.\nThe OpenAI API itself is subject to change.\n\n## Install\n\n```bash\nnpm install @apostrophecms/ai-helper\n```\n\n```javascript\n// in app.js\nmodules: {\n  '@apostrophecms/ai-helper': {\n    // Optional: specify a particular GPT model name.\n    // This is the default:\n    textModel: 'gpt-4o',\n    // Optional: specify a particular Dall-E image\n    // generation model name. This is the default.\n    // Note: dall-e-3 currently lacks features needed\n    // by this module\n    imageModel: 'dall-e-2',\n    // Optional: override the maximum number of tokens,\n    // up to GPT's limit for the model. This is the default:\n    textMaxTokens: 1000\n  }\n}\n```\n\n```javascript\n// Anywhere you have a rich text widget that should support\n// AI-generated rich text\nsomeAreaName: {\n  widgets: {\n    '@apostrophecms/rich-text': {\n      toolbar: [\n        'styles',\n        'bold'\n      ],\n      insert: [\n        'ai'\n      ],\n      // Generated text includes headings if asked for\n      styles: [\n        {\n          name: 'Heading',\n          tag: 'h2'\n        },\n        {\n          name: 'Subheading',\n          tag: 'h3'\n        },\n        {\n          name: 'Paragraph',\n          tag: 'p'\n        }\n      ]\n    }\n  }\n}\n```\n\n\n```javascript\n// in modules/@apostrophecms/security-headers/index.js,\n// only if you are using that module in your project\nmodule.exports = {\n  options: {\n    policies: {\n      ai: {\n        // Images served by OpenAI, for editing purposes only\n        'img-src': '*.blob.core.windows.net'\n      }\n    }\n  }\n};\n```\n\n## Run\n\n```bash\nexport APOS_OPENAI_KEY=get-your-own-key-from-openai\nnode app\n```\n\n## Usage\n\n### Image Generation\n\nAdd an image widget to the page. Click the edit pencil, then \"Browse\" as you normally would.\n\nWhen the media manager appears, click the \"🤖\" (robot) button in the upper right corner.\n\nWhen the \"Generate Image\" dialog appears, follow the instructions to enter a plain English\ndescription of the image you want. Then click \"Generate.\" After a pause, four images\nwill appear. You can do this as many times as you wish.\n\nWhen you are happy with the results, click on the best of the four images to review it\nand click \"Select\" to bring it into the media library, \"Variants\" to generate\nvariants of it, or \"Delete\" to discard it.\n\nThe image helper generates 1024x1024 images. This is the maximum size supported by OpenAI.\nAs of this writing, smaller images are not much cheaper, and are unlikely to look good\nin various placements on a website.\n\nNote that generated images not selected for use in the media library after one hour will\nbe discarded by OpenAI. Those you select are permanently imported to the media library.\n\n### Text Generation\n\nConfigure a rich text widget with the `insert` subproperty configured as shown above.\n\nNow press the \"/\" (slash) key at the start of any line to bring up the insert menu.\nChoose \"Generate Text\" to generate text.\n\nEnter a prompt as suggested and click \"Generate.\" After a pause, the generated text\nis inserted into the rich text widget.\n\nNote that the generated text can include headings and links if you so request.\nIt is also a good idea to specify a word count. You can make your request using\nordinary conversational language.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapostrophecms%2Fai-helper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapostrophecms%2Fai-helper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapostrophecms%2Fai-helper/lists"}