Baghwa

外掛說明

Baghwa adds an AI button next to eligible text fields and text editors. It opens a prompt popup, generates content from your configured AI provider, and inserts text into the selected field only.

Features:

  • Works in wp-admin and front-end visual editors (including Elementor, Divi, Gutenberg, and other editors that use input, textarea, contenteditable, and same-origin iframe fields).
  • Excludes email and password fields.
  • Prompt options: language, character count, and emotion.
  • If field already has text, Baghwa pre-fills prompt with:
    • line 1: enhance this writing:
    • line 2: character count
    • line 3+: current field content
  • Auto language detection for existing text.
  • Retry logic for temporary provider errors, with retry counter and cooldown button.
  • Multiple provider support:
    • OpenRouter
    • OpenAI
    • Anthropic
    • Google Gemini
    • Qwen (DashScope)
    • Ollama (local)
    • LM Studio (local)
    • Custom OpenAI-compatible endpoint
  • Settings UI supports model refresh and model search.

External services

Baghwa sends data to the selected AI provider only when an authorized user clicks Generate Text or when an admin clicks Refresh Models on the settings page.

Data sent during generation:

  • user prompt text
  • selected language, emotion, and character target
  • selected model id
  • provider authentication key configured by the admin

Data sent during model refresh:

  • provider authentication key (if required by that provider)
  • selected region or base URL when applicable

OpenRouter requests also include your site URL and site title headers (HTTP-Referer and X-Title) because OpenRouter supports app identification.

Possible provider endpoints:

  • OpenRouter API: https://openrouter.ai/api/v1
  • OpenAI API: https://api.openai.com/v1
  • Anthropic API: https://api.anthropic.com/v1
  • Google Gemini API: https://generativelanguage.googleapis.com/v1beta
  • Qwen DashScope API: https://dashscope-intl.aliyuncs.com/compatible-mode/v1
  • LM Studio local endpoint (example): http://127.0.0.1:1234/v1
  • Ollama local endpoint (example): http://127.0.0.1:11434
  • Custom endpoint defined by site administrator

Provider terms and privacy:

  • OpenRouter: https://openrouter.ai/terms | https://openrouter.ai/privacy
  • OpenAI: https://openai.com/policies/terms-of-use | https://openai.com/policies/privacy-policy
  • Anthropic: https://www.anthropic.com/legal/consumer-terms | https://www.anthropic.com/legal/privacy
  • Google Gemini (Google): https://policies.google.com/terms | https://policies.google.com/privacy
  • Alibaba Cloud DashScope (Qwen): https://www.alibabacloud.com/help/en/legal/latest/alibaba-cloud-international-website-product-terms-of-service | https://www.alibabacloud.com/help/en/legal/latest/alibaba-cloud-international-website-privacy-policy

For local providers (Ollama/LM Studio), data stays within your infrastructure unless your local setup forwards requests externally.
For custom providers, terms and privacy links depend on the endpoint chosen by the site administrator and must be reviewed by the site owner before use.

螢幕擷圖

  • Baghwa AI trigger button beside an editable field.
  • Baghwa Settings page with provider configuration and model controls.
  • Baghwa AI Text Assistant popup with prompt, language, character, and emotion options.
  • Generated text preview and apply workflow inside the assistant popup.

安裝方式

  1. Upload the baghwa folder to /wp-content/plugins/.
  2. Activate Baghwa from the WordPress Plugins screen.
  3. Go to Settings > Baghwa.
  4. Select your active provider.
  5. Add provider credentials (API key or local endpoint details).
  6. Refresh models and select a model.
  7. Assign extra users if needed (admins are always allowed).
  8. Start editing content and click the Baghwa AI button on eligible fields.

常見問題集

Why do I not see Baghwa in editor fields?

Make sure:

  • Your user is admin or assigned in Baghwa settings.
  • The field is an eligible text field (not email/password).
  • The editor context is same-origin (cross-origin iframes cannot be accessed by browser security rules).
  • You hard-refresh the editor page after plugin updates.

Why does generation fail with provider errors?

Common causes:

  • Invalid API key or blocked account.
  • Selected model not available to your account.
  • Free endpoint capacity issues (Baghwa retries automatically up to 5 times).
  • Local provider URL/model is incorrect or service is not running.

How do I use local AI with Docker WordPress?

For WordPress running in Docker:

  • Ollama base URL: http://host.docker.internal:11434
  • LM Studio base URL: http://host.docker.internal:1234/v1

使用者評論

這個外掛目前沒有任何使用者評論。

參與者及開發者

以下人員參與了開源軟體〈Baghwa〉的開發相關工作。

參與者

將〈Baghwa〉外掛本地化為台灣繁體中文版

對開發相關資訊感興趣?

任何人均可瀏覽程式碼、查看 SVN 存放庫,或透過 RSS 訂閱開發記錄

變更記錄

1.4.2

  • Added Baghwa icon before the Settings page title.
  • Added Baghwa icon before the “Baghwa AI Text Assistant” popup title.
  • Updated plugin screenshots for the latest UI.

1.4.1

  • Improved external service disclosure with clearer data flow details.
  • Updated settings registration to use explicit sanitize callback options.
  • Adjusted API key handling to avoid altering secret/token values.
  • Fixed wording typo in pre-fill prompt example.

1.4.0

  • Added universal editor support for wp-admin and front-end visual editors.
  • Added robust handling for contenteditable regions, nested iframes, and shadow DOM contexts.
  • Improved publishing metadata and privacy policy integration.

1.3.0

  • Added local provider support: Ollama and LM Studio.
  • Added provider model search and refresh workflow.
  • Added retry and cooldown handling for temporary generation failures.

1.2.0

  • Added multilingual dropdown options and language detection improvements.
  • Added prefill behavior for existing field content.

1.1.0

  • Added provider/model configuration enhancements and retry messaging.

1.0.0

  • Initial release.