tibemolde/ai-summary
最新稳定版本:1.0.0
Composer 安装命令:
composer require tibemolde/ai-summary
包简介
AI Summary field for Craft CMS using OpenAI API
README 文档
README
AI-powered content summarization field for Craft CMS. Automatically generate concise article summaries using OpenAI's GPT models with a single click, directly from your entry editor.
Features
- Custom Field Type: Dedicated AI Summary field with built-in generation button
- Smart Content Analysis: Automatically extracts and summarizes content from your entries
- Multiple Output Formats: Choose between plain text or bullet point list summaries
- Multi-language Support: Automatically generates summaries in the same language as your content
- Built-in Caching: Prevents duplicate API calls and reduces costs
- Editable Output: Review and modify AI-generated summaries before publishing
- User-Friendly Interface: Clean, intuitive interface integrated seamlessly into Craft CMS
- OpenAI Integration: Powered by GPT-4o-mini (or your preferred OpenAI model)
Requirements
- Craft CMS 4.0+ or 5.0+
- PHP 8.0+
- OpenAI API key (Get one here)
- Composer
Installation
1. Install via Composer
composer require tibemolde/ai-summary
2. Install the Plugin
Navigate to Settings → Plugins in your Craft control panel and click Install next to "AI Summary".
Alternatively, install via command line:
php craft plugin/install ai-summary
3. Configure OpenAI API
Add your OpenAI API credentials to your .env file:
# Required: Your OpenAI API key OPENAI_API_KEY=sk-your-api-key-here # Optional: Specify OpenAI model (defaults to gpt-4o-mini) OPENAI_MODEL=gpt-4o-mini
Note: The
gpt-4o-minimodel is recommended for cost-effectiveness. Other options includegpt-4,gpt-4-turbo, orgpt-3.5-turbo.
Configuration
Create an AI Summary Field
- Navigate to Settings → Fields in your Craft control panel
- Click New field
- Set the Field Type to "AI Summary"
- Configure the field settings:
- Name: e.g., "Article Summary"
- Handle: e.g.,
articleSummary - Output Format: Choose between:
- Plain Text: Single paragraph summary
- Bullet List: HTML list with key points
- Click Save
Add Field to Section
- Navigate to Settings → Sections
- Select your section (e.g., Blog, Articles, News)
- Click on your Entry Type
- Go to the Field Layout tab
- Drag the "AI Summary" field into your layout
- Click Save
Usage
Generating a Summary
- Create or edit an entry that contains content to summarize
- Ensure your entry has content in text/rich text fields
- Locate the AI Summary field in your entry
- Click the "Generate Summary" button
- Wait a few seconds while the AI processes your content
- Review the generated summary
- Edit if needed (summaries are fully editable)
- Save your entry
Output Formats
Plain Text
Generates a concise paragraph summarizing the main points:
This article discusses the benefits of AI in content management,
highlighting improved efficiency, better user experience, and cost
savings through automation.
Bullet List
Generates an HTML list with key points:
<ul> <li>AI improves content management efficiency</li> <li>Enhanced user experience through automation</li> <li>Significant cost savings in content operations</li> </ul>
Best Practices
- Content First: Add your main content before generating a summary
- Review Output: Always review AI-generated summaries for accuracy
- Language Consistency: The plugin automatically matches your content's language
- Cache Awareness: Identical content produces cached results (updates require content changes)
Displaying Summaries in Templates
Plain Text Summary
{% if entry.articleSummary %}
<div class="article-summary">
{{ entry.articleSummary }}
</div>
{% endif %}
Bullet List Summary
{% if entry.articleSummary %}
<div class="article-summary">
{{ entry.articleSummary|raw }}
</div>
{% endif %}
Note: Use the
|rawfilter for bullet list format to render HTML properly.
Meta Description
Use AI summaries for SEO meta descriptions:
{% set metaDescription = entry.articleSummary|striptags|slice(0, 160) %}
<meta name="description" content="{{ metaDescription }}">
Troubleshooting
"Failed to generate summary"
Possible causes:
- Invalid or missing OpenAI API key
- No content available to summarize
- OpenAI API rate limit exceeded
- Network connectivity issues
Solutions:
- Verify
OPENAI_API_KEYin your.envfile - Ensure your entry has content in text fields
- Check your OpenAI API usage limits
- Review Craft logs:
storage/logs/web.log
"No content found to summarize"
Solution: Add content to your entry's text/rich text fields before clicking "Generate Summary".
Cache Issues
If you're not seeing updated summaries after changing content:
Solution: Clear Craft's cache:
php craft clear-caches/all
Or use a different content variation to trigger a new summary generation.
Support
- Issues: Report bugs or request features via GitHub Issues
- Developer: TIBE Molde
License
Proprietary - All rights reserved
Credits
Developed by TIBE Molde
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2026-01-06