定制 tibemolde/ai-summary 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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.

Craft CMS Version

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-mini model is recommended for cost-effectiveness. Other options include gpt-4, gpt-4-turbo, or gpt-3.5-turbo.

Configuration

Create an AI Summary Field

  1. Navigate to Settings → Fields in your Craft control panel
  2. Click New field
  3. Set the Field Type to "AI Summary"
  4. 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
  5. Click Save

Add Field to Section

  1. Navigate to Settings → Sections
  2. Select your section (e.g., Blog, Articles, News)
  3. Click on your Entry Type
  4. Go to the Field Layout tab
  5. Drag the "AI Summary" field into your layout
  6. Click Save

Usage

Generating a Summary

  1. Create or edit an entry that contains content to summarize
  2. Ensure your entry has content in text/rich text fields
  3. Locate the AI Summary field in your entry
  4. Click the "Generate Summary" button
  5. Wait a few seconds while the AI processes your content
  6. Review the generated summary
  7. Edit if needed (summaries are fully editable)
  8. 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 |raw filter 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:

  1. Verify OPENAI_API_KEY in your .env file
  2. Ensure your entry has content in text fields
  3. Check your OpenAI API usage limits
  4. 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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2026-01-06