Skip to content

Add AI Overview feature with rate limiting and settings UI - #8

Merged
fumikito merged 8 commits into
masterfrom
feature/ai-search-2
Jan 26, 2026
Merged

Add AI Overview feature with rate limiting and settings UI#8
fumikito merged 8 commits into
masterfrom
feature/ai-search-2

Conversation

@fumikito

Copy link
Copy Markdown
Member

Summary

FAQコンテンツをベースにLLMがユーザーの質問に回答する「AI Overview」機能を追加します。

  • AI Overview ブロック: Gutenbergエディタで配置可能な検索フォーム(placeholder・ボタンテキスト・ソース表示のカスタマイズ対応)
  • テンプレート関数: hamelp_render_ai_overview() でテーマから直接呼び出し可能
  • FAQカタログ方式: 公開済みFAQをJSON形式でまとめてシステムプロンプトに渡す構成(WP-CLIコマンド wp hamelp rebuild / wp hamelp status 付き)
  • 設定画面: Settings > Hamelp にAIコンテキスト設定(サイト説明・対象ユーザー・応答トーン・注意事項)とレート制限設定を追加
  • 2層レート制限: IP別(デフォルト5回/10分)+ グローバル日次上限(デフォルト100回/日)、ログイン必須オプション付き
  • 日本語翻訳: 全文字列の翻訳完了、.mo ファイル生成済み
  • 開発環境: wp-env設定、CLAUDE.md追加

依存関係

  • wordpress/wp-ai-client (experimental) — Composer経由で同梱

Test plan

  • wp-envまたはDocker環境でプラグインを有効化
  • wp hamelp rebuild でFAQカタログを構築
  • ブロックエディタで「AI FAQ Overview」ブロックを配置し、質問して回答が表示されることを確認
  • テンプレート関数 hamelp_render_ai_overview() で同様に動作確認
  • Settings > Hamelp で各設定が保存・反映されることを確認
  • レート制限: IP制限値を小さくして超過時に429が返ることを確認
  • レート制限: ログイン必須を有効にして未ログイン時に403が返ることを確認
  • 日本語環境で翻訳が表示されることを確認

🤖 Generated with Claude Code

fumikito and others added 8 commits January 23, 2026 23:13
- Add wp-env for local development environment
- Add CLAUDE.md with project setup documentation
- Include package-lock.json for consistent builds
- Keep composer.lock ignored for multi-PHP testing

closes #4

Co-authored-by: Claude <noreply@anthropic.com>
- Add AiOverview hook for wp-ai-client initialization and REST API
- Add FaqSearchService with RAG-based FAQ search (keyword extraction + fallback)
- Add ai-overview Gutenberg block with markdown parsing
- Update package.json scripts to include blocks in lint and build
- Add block registration in hamelp.php

Co-authored-by: Claude <noreply@anthropic.com>
- Add FaqCatalogBuilder: persistent catalog stored in wp_options with cron-based async rebuild
- Refactor FaqSearchService: single LLM call with full catalog context, JSON structured output
- Add WP-CLI command: wp hamelp rebuild / status
- Add Settings page: AI site context field on Settings > Reading
- Add cache invalidation hooks scoped to FAQ post type and taxonomy
- Frontend: convert [ID:xxx] references to linked source indices in answer text

Co-authored-by: Claude <noreply@anthropic.com>
…cription, target users, response tone, notes) and integrate with system prompt

Co-authored-by: Claude <noreply@anthropic.com>
…r AI Overview endpoint

Co-authored-by: Claude <noreply@anthropic.com>
…render_ai_overview()

Co-authored-by: Claude <noreply@anthropic.com>
…e .mo file

Co-authored-by: Claude <noreply@anthropic.com>
@fumikito fumikito linked an issue Jan 26, 2026 that may be closed by this pull request
@fumikito
fumikito merged commit c87dfbb into master Jan 26, 2026
9 checks passed
@fumikito
fumikito deleted the feature/ai-search-2 branch January 26, 2026 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AI Overview機能

1 participant