WP Suite AI-Kit:WordPress 全站聊天机器人与语义搜索插件开源
smartcloudsol/ai-kit
WP Suite AI-Kit 是 WordPress 插件,通过全站聊天机器人和可嵌入的语义搜索帮访客从已索引内容中找答案,聊天机器人还可调用经批准的只读 REST/MCP 工具和选定网页来源。
WP Suite AI-Kit
AI-Kit helps visitors find answers through a site-wide chatbot and embeddable semantic search, using your indexed WordPress content and a configured Pro backend. The chatbot can also retrieve information from approved read-only REST/MCP tools and selected web sources. Free on-device editor and Media Library tools remain available where supported.
This repository contains the source code and frontend modules for the free / OSS parts of the AI-Kit WordPress plugin.
Premium builds are published on npm:
@smart-cloud/ai-kit-core@smart-cloud/ai-kit-ui- (shared dependency)
@smart-cloud/wpsuite-core
Documentation
You can find the plugin’s continuously expanding documentation at:
https://wpsuite.io/docs/
Machine-readable resources
- AI plugin manifest: https://wpsuite.io/.well-known/ai-plugin.json
- OpenAPI spec: https://wpsuite.io/.well-known/openapi.yaml
What AI-Kit does
Visitor answers and search (Pro)
- Site-wide chatbot: answer questions from indexed content, with configurable role, tone, scope and evidence requirements.
- DocSearch: embed broad semantic knowledge search, an AI summary and source results using the Gutenberg block or
[smartcloud-ai-kit-doc-search]shortcode. Category/tag narrowing follows explicit visitor choices; the chatbot can use inferred taxonomy filters for targeted answers. This distinction requires the corresponding backend update. - Connected information: configure approved read-only REST/MCP tools for the chatbot to retrieve shop or service data; allow selected HTTPS pages for web grounding. Connections are explicit, and external data-changing actions are not enabled.
- Page summaries: use the AI-Kit Feature Gutenberg block or
[smartcloud-ai-kit-feature]shortcode to help visitors understand longer content. - Knowledge Sync: deliver approved public WordPress content through the configured server-side transport and inspect delivery and ingestion status.
These features require an active Pro subscription on the connected site and the appropriate compatible backend configuration. Backend deployment, protected-API authentication and external integrations are separate setup steps; AWS and external-service usage costs are separate.
Authoring tools (Free)
Supported Chrome on-device AI can generate image/post metadata and assist with writing, rewriting, translation and proofreading in Gutenberg and the Media Library. Availability depends on browser/device support. A WP Suite subscription is not needed for these local tools. Pro adds configured backend processing for supported features.
Frontend language controls and the shared translation catalog are configured under SmartCloud → Platform Settings → Translations.
Interactive frontend/admin features call their configured API from the browser. Knowledge Sync separately sends approved source content and metadata from WordPress to the backend; the browser-only architecture statement does not apply to synchronization.
AWS Backend (optional, Pro-ready)
AI-Kit can integrate with a production backend packaged as an AWS Serverless Application Repository (SAR) deployment.
It is published as wpsuite-ai-kit and can be deployed into your own AWS account.
Public SAR page:
https://serverlessrepo.aws.amazon.com/applications/us-east-1/637423296378/wpsuite-ai-kit
Tip: SAR opens in the AWS region last used in your browser.
If you want another region, switch it in the top-right region selector before deploying.
For full backend installation and parameters, follow the SAR documentation from the application page.
Project Structure
-
core/
Shared JavaScript modules and feature logic.
Premium build:@smart-cloud/ai-kit-core -
ui/
Shared UI kit (Mantine components, modals, editors, onboarding assets, etc.).
Premium build:@smart-cloud/ai-kit-ui -
main/
Base runtime JavaScript and CSS features loaded where needed (plugin “main” entry point); build here and copy the generated assets frommain/dist/into the final plugin layout. -
admin/
WordPress admin interface (settings, diagnostics, onboarding UI, etc.); build here and copy the generated assets fromadmin/dist/andadmin/php/into the final plugin layout. -
blocks/
Gutenberg integrations (sidebar, toolbar tools, inspector panels, Pro feature block integration); build here and copy the generated assets fromblocks/dist/into the final plugin layout. -
wpsuite-main/(in the Hub repository)
Shared frontend bundle copied intosmartcloud-wpsuite/; itsdist/output provides the script loaded on every page to initialize WPSuite reCAPTCHA v3 when needed. -
wpsuite-admin/(in the Hub repository)
Shared WP Suite admin interface used across WP Suite plugins. -
wpsuite-*-vendor/(in the Hub repository)
Shared vendor bundles whosedist/outputs are copied intosmartcloud-wpsuite/assets/js/andsmartcloud-wpsuite/assets/css/. -
assets/
Static plugin assets. -
dist/folders undermain/,admin/, andblocks/
Compiled and minified frontend output used by the WordPress plugin. -
Plugin PHP code and metadata (e.g.
ai-kit.php,readme.txt) are located in the project root.
⚠️ Note:
wpsuite-core is published on npm as @smart-cloud/wpsuite-core.
If you also work on the Hub codebase, you may build and link a local version instead. Shared Hub assets such as wpsuite-admin/, wpsuite-main/, and wpsuite-*-vendor/ also live in that separate repository.
Source of Shared WPSuite Hub Code
The shared WordPress Hub code lives in the wpsuite-admin/, wpsuite-main/, and wpsuite-*-vendor/ directories of the SmartCloud WP Suite repository.
That repository hosts the shared administrative interface, site-wide localization catalog, global frontend assets, and vendor bundles used across WP Suite plugins, including Gatey, AI-Kit, and Flow.
Installation and Build Guide
Prerequisites
- Node.js (>= 16.x)
- Yarn or npm
- PHP >= 8.1
- Git
1) Clone the repositories
You typically want AI-Kit and the Hub repository (for wpsuite-core, wpsuite-admin, wpsuite-main, and the shared vendor bundles) side-by-side:
git clone https://github.com/smartcloudsol/smartcloud-wpsuite.git git clone https://github.com/smartcloudsol/ai-kit.git
Suggested structure:
/projects/
smartcloud-wpsuite/
wpsuite-core/
wpsuite-admin/
wpsuite-main/
wpsuite-amplify-vendor/
wpsuite-mantine-vendor/
wpsuite-webcrypto-vendor/
ai-kit/
core/
ui/
main/
admin/
blocks/
2) Install JavaScript dependencies
# Hub repo cd smartcloud-wpsuite/wpsuite-core yarn install cd ../wpsuite-admin yarn install cd ../wpsuite-main yarn install cd ../wpsuite-amplify-vendor yarn install cd ../wpsuite-mantine-vendor yarn install cd ../wpsuite-webcrypto-vendor yarn install # AI-Kit repo cd ../../ai-kit/core yarn install cd ../ui yarn install cd ../main yarn install cd ../admin yarn install cd ../blocks yarn install
3) Choose your dependency mode
Option A — Use published packages from npm (recommended)
Install the premium packages where needed:
npm install @smart-cloud/ai-kit-core @smart-cloud/ai-kit-ui @smart-cloud/wpsuite-core
(Which workspace needs what depends on your local setup; typically admin/blocks/main depend on core/ui.)
Option B — Local linking (development)
Useful if you actively modify wpsuite-core, ai-kit-core, or ai-kit-ui.
Build/link wpsuite-core from the Hub repo:
cd ../smartcloud-wpsuite/wpsuite-core
yarn run build
npm linkBuild/link ai-kit-core (depends on wpsuite-core):
cd ../../ai-kit/core
yarn run build
npm link @smart-cloud/wpsuite-core
npm linkBuild/link ai-kit-ui (often depends on ai-kit-core + wpsuite-core):
cd ../ui
yarn run build
npm link @smart-cloud/wpsuite-core
npm link @smart-cloud/ai-kit-core
npm linkThen link the packages into other AI-Kit projects:
# e.g. admin / blocks / main
npm link @smart-cloud/ai-kit-core
npm link @smart-cloud/ai-kit-ui4) Build frontend modules for WordPress
Each module that ships WordPress bundles should build into its own dist/ folder:
cd main yarn run build-wp dist cd ../admin yarn run build-wp dist cd ../blocks yarn run build-wp dist
After building main/, admin/, and blocks/, copy the generated assets from each module's dist/ directory into the matching plugin directory. For admin/, copy the PHP files from admin/php/ as well.
If you build shared Hub assets locally, run yarn run build-wp dist in smartcloud-wpsuite/wpsuite-main and smartcloud-wpsuite/wpsuite-admin, and run yarn run build in any touched smartcloud-wpsuite/wpsuite-*-vendor workspace before packaging.
5) Development workflow
- Rebuild
core/andui/after shared package changes (yarn run build), and rebuildmain/,admin/, orblocks/withyarn run build-wp distafter WordPress bundle changes. - If you changed
wpsuite-core,wpsuite-main,wpsuite-admin, or anywpsuite-*-vendorworkspace in the Hub repo, rebuild those outputs before local testing or packaging. - If you changed
ai-kit-coreorai-kit-ui, re-build and re-link as needed. - PHP changes are loaded by WordPress immediately.
Packaging for Deployment
Ensure the built assets are copied into the simplified plugin layout:
main/dist/*→main/blocks/dist/*→blocks/admin/php/*andadmin/dist/*→admin/
If you rebuild the shared Hub assets in the separate Hub repository, copy the following outputs into the plugin's smartcloud-wpsuite/ directory according to that repository's instructions:
wpsuite-main/dist/*→smartcloud-wpsuite/wpsuite-admin/php/*andwpsuite-admin/dist/*→smartcloud-wpsuite/wpsuite-*-vendor/dist/*.js→smartcloud-wpsuite/assets/js/wpsuite-*-vendor/dist/*.css→smartcloud-wpsuite/assets/css/
The wpsuite-main/dist/ bundle provides the script that loads on every page and initializes the reCAPTCHA v3 flow used by WPSuite plugins whenever it is needed.
Once the structure matches the layout above, create the distributable ZIP:
git archive --format zip -o ai-kit.zip HEAD
This uses rules defined in .gitattributes to include only required dist content and production PHP code.
External Services
Depending on configuration and edition:
- Google reCAPTCHA v3 (optional): browser requests to Google to retrieve a token.
- Customer-configured backend endpoint (Pro): browser fetch requests to the configured API URL (typically an AWS API deployed to the customer’s AWS account).
- Amazon Cognito (optional; when used via Gatey-protected APIs): browser flows that call Cognito Identity / Cognito IDP to acquire tokens.
License
MIT License
If you encounter issues or want to contribute, feel free to open an issue or pull request.
来源:GitHub · github.com