Linux 软件免费装
Banner图

DuetG AI Connector

开发者 duetg
更新时间 2026年4月17日 22:07
PHP版本: 7.4 及以上
WordPress版本: 7.0
版权: GPL-2.0-or-later
版权网址: 版权信息

标签

ai connector openai gpt artificial-intelligence

下载

0.3.1

详情介绍:

DuetG AI Connector 让 WordPress AI Client 能够连接任意提供 OpenAI 兼容 API 的 AI 服务,例如: WordPress AI 集成 When installed together with the official WordPress AI plugin, you can use your custom API provider with WordPress's built-in AI features: 模型能力 All Models (text generation endpoint):

安装:

  1. Upload the duetg-ai-connector folder to the /wp-content/plugins/ directory
  2. 通过 WordPress 的"插件"菜单激活插件
  3. Configure your API key at Settings > Connectors
  4. Go to Settings > Custom AI to configure your Base URL and model
  5. (Optional) Go to Tools > Test AI to verify your configuration

屏幕截图:

  • 连接器界面 - 管理您的 AI 提供商的 API Key。
  • 测试 AI 界面 - 验证您的 AI 配置并测试文本/图片生成。

升级注意事项:

0.2.3 This version fixes an OutputNotEscaped error in the Test AI page. 0.2.2 This version includes code quality improvements and bug fixes from a comprehensive code audit. No configuration changes required for existing users. 0.2.1 This version adds SSRF protection for image URLs and fixes several code quality issues. If you use a local image generation model, you may need to add define('DUETGAICON_ALLOW_LOCAL_URLS', true); to wp-config.php. 0.2.0 This version adds full compatibility with WordPress AI plugin (0.6.0+). Upgrade to use AI features like Alt Text Generation, Content Summarization, Review Notes, and more.

常见问题:

如何启用调试日志?

To enable debug logging, add the following to your wp-config.php: define('DUETGAICON_DEBUG', true); When enabled, debug information will be written to your server's debug log (usually wp-content/debug.log). This includes:

  • Request/response details for AI API calls
  • Provider registration status
  • Model handler information Note: Disable debug logging in production environments to avoid performance impact and log file growth.

此插件在没有 WordPress 7.0 的情况下能用吗?

不需要。此插件需要 WordPress 7.0 或更高版本,因为它使用内置的连接器 API 来管理 API Key。

为什么建议数量和笔记数量有时不匹配?

使用评审笔记时,您可能会注意到 AI 返回的建议数量与编辑器中显示的笔记数量不完全匹配。 This is expected behavior and has two causes:

  1. Multi-category suggestions: Some AI models return a single suggestion that applies to multiple review categories (e.g., review_type: "seo, accessibility"). The plugin preserves these as-is, so one suggestion may appear under multiple note categories in WordPress AI Client.
  2. Model response format: The AI model controls the number of suggestions it returns, and WordPress AI Client determines how to display and categorize them. The plugin correctly forwards the model's response without modifying the count.
如果您需要更一致的结果,请考虑使用能可靠返回结构化 JSON(每个分类有独立建议)的模型。

如何找到我的 AI 提供商的 Base URL?

需要 API Key 吗?

部分提供商需要 API Key。对于不需要身份验证的本地安装(如 Ollama),您可以输入任意字符串(如 "not-required")作为 API Key。

为什么本地推理/思考模型有时会超时?

在 Ollama 上运行的本地推理模型(如 Gemma 4、QwQ 等)会在生成最终答案之前产生长的"思考"链。这个过程可能需要 30-60 秒或更长时间,可能触发 cURL 的低速限制超时(默认 30 秒)。 Cloud models generally work well - most cloud API providers (DeepSeek, MiniMax, Moonshot, etc.) respond quickly without timeout issues. If a cloud model frequently times out, it may have unusually long thinking chains - try switching to a different model. Recommended solutions for local models:

  1. Use non-reasoning models for local AI features. For Ollama, models like qwen2.5:7b, llama3.2:3b, or phi3 work well without the timeout issue.
  2. Configure Ollama to keep models loaded: bash export OLLAMA_KEEP_ALIVE=-1 # Keep model in memory
如果您使用的是推理模型,请注意 WordPress AI 功能可能会较慢或超时。思考行为由模型控制,不由插件控制。

如何使用本地 AI 提供商(如 Ollama 或 LM Studio)?

By default, WordPress blocks requests to localhost and private IP addresses for security (SSRF protection). If you're using a local AI provider, you can disable this protection by adding to your wp-config.php: define('DUETGAICON_ALLOW_LOCAL_URLS', true); Warning: Disabling SSRF protection allows requests to private/local IPs. Only enable this if you trust your local AI provider and your server is not directly accessible from the internet. 此设置在使用本地 AI 提供商时同时适用于文本模型和图片模型。 Tip: When DUETGAICON_ALLOW_LOCAL_URLS is enabled, a Network Connectivity Test tool appears on the Test AI page (Tools > Test AI). You can use it to verify that your WordPress server can reach your local AI provider before running actual AI feature tests. This is especially useful for debugging connection issues with local Ollama or LM Studio installations.

如何在代码中使用?

use WordPress\AiClient\AiClient; $registry = AiClient::defaultRegistry(); // Text Generation $model = $registry->getProviderModel('custom_text', 'gpt-4'); $result = $model->generateTextResult([ new \WordPress\AiClient\Messages\DTO\UserMessage([ new \WordPress\AiClient\Messages\DTO\MessagePart('Your prompt here') ]) ]); echo $result->toText(); // Image Generation $model = $registry->getProviderModel('custom_image', 'dall-e-3'); $result = $model->generateImageResult([ new \WordPress\AiClient\Messages\DTO\UserMessage([ new \WordPress\AiClient\Messages\DTO\MessagePart('Your prompt here') ]) ]); $files = $result->toImageFiles();

更新日志:

0.3.1 0.3.0 0.2.3 0.2.2 0.2.1 0.2.0 0.1.0