| 开发者 |
glay
glayguo |
|---|---|
| 更新时间 | 2026年9月15日 00:28 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
[ai_chat_bedrock] shortcode or the chat blockwp-config.php constants, encrypted WordPress settings, environment variables, an ECS or EKS task role, then an EC2 instance role using IMDSv2. The last three let a site on AWS run with no long-lived keys in WordPress at all. Role credentials are cached encrypted and refreshed before expiry, role lookups can be disabled with the ai_chat_bedrock_use_role_credentials filter, and the active source is shown in the settings without revealing secrets.
Security and cost defaults
edit_posts.wp ai-chat-bedrock index builds the semantic index without keeping a browser tab open, with --batch, --max and --force. index-status reports coverage, diagnose runs the same checks as the admin screen with an optional --live Bedrock request, and usage prints requests and tokens per day or per model. Useful in a deploy step or a cron job.
Managed prompts
Point the chat at a prompt in Amazon Bedrock Prompt Management and its text replaces the local system prompt, so one prompt can be reviewed and versioned in AWS and reused by every site. Pin a version for stability or follow the draft to pick up edits. {{site_name}}, {{site_description}}, {{site_url}} and {{current_date}} are filled in; anything else is sent exactly as written. The prompt must live in the same region as the chat, the text is cached briefly, and if it cannot be read the local system prompt is used instead rather than sending an empty one.
Semantic search
Keyword search only finds passages that share words with the question, so "when will my parcel arrive" misses a page titled "Getting parcels to you". Choose an embedding model and the plugin indexes published content, then matches questions by meaning. Indexing runs in small batches from the settings screen, or unattended through WP-Cron, or with wp ai-chat-bedrock index on a large site. Editing a post marks it for re-indexing, and keyword search still runs when nothing relevant is found. Questions your site does not cover return no context rather than an unrelated passage.
Fallback model
Model access is the most common reason a Bedrock chat stops answering: a model is not enabled, a request is throttled, or the service is briefly unreachable. Choose a fallback model and those requests are retried once on it, and the reply states which model answered. An identifier Bedrock does not recognize is treated the same way. Requests rejected for any other reason, including an invalid payload, missing credentials or the daily limit, are never retried. A stream is retried only before anything reaches the browser, so text is never duplicated.
Chat experience
The chat is a self-contained, responsive interface with message bubbles, a typing indicator, a live streaming caret, tool activity status and per-answer token counts. Answers can be copied, failed requests can be retried, and every message carries a timestamp. It follows dark-mode and reduced-motion preferences and keeps focus styles and screen-reader labels intact.
Add up to four suggested questions and they appear as buttons above the input, disappear once the conversation starts and return when the chat is cleared. When the conversation log is enabled, each answer also gets a discreet Was this helpful? control; only the rating is stored, never anything about the visitor.
Floating chat
Any chat can render as a floating button instead of an inline panel:
[ai_chat_bedrock mode="popup" launcher="Ask us" profile="support"]
A site-wide floating chat can be enabled in the settings with its own profile. Pages that already contain the chat block or shortcode are left unchanged, so the chat is never duplicated. The launcher is keyboard accessible, closes with Escape, stays open while a visitor browses other pages in the same tab, and adapts to small screens.
Multiple chats with profiles
One installation can serve several chats. Each profile has its own key and can override the model, system prompt, title, welcome message, suggested questions, token limit, temperature, request limit, guest access, grounding and passage count. Anything left empty inherits the main settings.
[ai_chat_bedrock profile="support"]
Profile keys arriving from a page, block or chat request are validated against the stored profiles, so an unknown or crafted key falls back to the main settings and can never unlock guest access. Requests are rate limited per profile, and up to ten profiles can be stored.
Content tools
All content tools are optional, require the capability to edit the item, and are rate limited.
wp_ai_client_prompt() reaches it from any plugin that knows nothing about AWS.
Those calls use this plugin's request path, so the guardrail, model, region, token ceiling,
daily limit and usage accounting configured here apply to them.
On 7.1 it also joins the connector registry, declared as storing no credential: Bedrock signs
with IAM, not a key this site must keep. The Settings > Connectors screen lists only
connectors with a credential to manage, so Bedrock is absent there.
Connect AI clients to this site
The plugin exposes this WordPress site as an MCP server, so clients such as Claude Code, Cursor, VS Code or an agent framework can read it.
https://example.com/wp-json/ai-chat-bedrock/v1/mcpserver/discover, tools/list and tools/call. Clients on 2025-11-25 and 2025-06-18 are still answered/.well-known/oauth-authorization-server and /.well-known/oauth-protected-resource, client registration is dynamic, PKCE with S256 is mandatory, redirect targets must be HTTPS or loopback, authorization codes are single use, access tokens last an hour, and refresh tokens rotate so reusing one revokes the connection. Tokens are stored only as hashes. Each connection inherits the approving account's permissions and can be revoked at any time.
Anonymous access and OAuth are both disabled by default. If the endpoint returns 404, open Settings > Permalinks and save once so WordPress registers pretty REST routes.
Connecting an MCP server or Amazon Bedrock AgentCore Gateway
External servers are called with JSON-RPC over Streamable HTTP with a declared protocol version. Three authentication modes are available:
bedrock-agentcore and the region falls back to the Bedrock region.edit_posts, reads require the capability configured for MCP tools, and the feature is disabled by default.
Stored data and privacy
No custom database table is created. The conversation log is optional and off by default; when enabled it holds the 200 most recent exchanges in a WordPress option, with retention from 1 to 90 days, and can be searched, filtered, exported to CSV and deleted per user or in full.
The Privacy Policy section below sets out what is sent where, what is stored and what administrators are responsible for disclosing.
[ai_chat_bedrock] to a page or post, or insert the chat block.REGION and MODEL_ID with your own values. Inference profiles and some model types use different resource ARNs; follow the AWS documentation for the model you select.
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "bedrock:InvokeModel", "Resource": "arn:aws:bedrock:REGION::foundation-model/MODEL_ID" } ] }
Keeping credentials out of the database
For stronger isolation, define credentials in wp-config.php instead of saving them in the WordPress database:
define( 'AI_CHAT_BEDROCK_AWS_ACCESS_KEY', 'replace-with-access-key' );
define( 'AI_CHAT_BEDROCK_AWS_SECRET_KEY', 'replace-with-secret-key' );
define( 'AI_CHAT_BEDROCK_AWS_SESSION_TOKEN', 'replace-with-session-token' ); // Optional.
Credentials saved through the settings screen are encrypted with authenticated encryption derived from the site's WordPress authentication salts, and saved secrets are never rendered back into the form.No. Model requests use Amazon Bedrock and your AWS credentials. Availability, model access, pricing, and data handling are governed by your AWS account and Region.
Version 1.1.0 includes request and response formats for Anthropic Claude, Amazon Nova and Titan, Meta Llama, Mistral, and DeepSeek model families. A specific model may still require model access, a supported Region, the correct model or inference-profile ID, and suitable IAM permissions.
Confirm that the model is available and enabled in the configured AWS Region, the model ID is correct, and the IAM identity can call bedrock:InvokeModel for the required resource. Some models use inference profiles with different IDs and IAM resources.
Version 1.1.0 defaults to signed-in users to reduce the risk of anonymous scripts generating unbounded AWS charges. An administrator can explicitly enable guest access and configure a request limit.
Newly saved credentials are encrypted with authenticated encryption derived from WordPress salts. Existing plaintext credentials are migrated when an administrator opens the dashboard. wp-config.php constants remain the preferred production option.
Yes. Configure the access key, secret key, and session token together, or define all three constants in wp-config.php.
Yes. Streaming is the default and uses an authenticated POST request with Server-Sent Events. The removed 1.0.x implementation was unsafe because it used a GET EventSource that placed conversation data in URLs and issued duplicate Bedrock requests. If the PHP cURL extension is missing or a proxy buffers the stream, the chat falls back to one buffered request automatically.
Yes. Leave the key fields empty and keep IAM role credentials enabled. The plugin then uses server environment variables, an ECS or EKS task role, or the EC2 instance role through IMDSv2.
HTTPS and WordPress safe HTTP validation reduce server-side request forgery risk and protect tool inputs in transit. Private, loopback, link-local, credential-bearing, and unsafe redirect targets are rejected.
It is read-only and returns published content only. WordPress authentication is required by default. Administrators may explicitly expose it publicly; public requests are then rate limited.
Yes. The model can call tools, read the results, and continue reasoning for up to the configured number of rounds, defaulting to 3. The last round is answered without tools so the conversation always terminates. Tool output is always framed as untrusted data.
Not by default. The built-in WordPress MCP endpoint is read-only. For external MCP servers, any tool that looks like it changes data is blocked until an administrator allows it, and those tools stay restricted to administrators.
No. This plugin does not send plugin-usage telemetry to the plugin author. Requests are sent only to services the administrator configures, as described in the Data flow and privacy section.
No. Amazon Bedrock and AWS are trademarks of Amazon.com, Inc. or its affiliates. This is an independent open-source WordPress plugin.
wp_get_connectors() sees it, but it does not appear on the Settings > Connectors screen: that screen renders only connectors with a credential to manage, and Bedrock has none to store. Confirmed by registering two connectors of the same shape, one declaring an API key and one declaring none; only the first was shown. Making the card appear would mean claiming a credential method Bedrock does not use.wp_ai_client_prompt() reaches it from any plugin. Those calls go through this plugin's request path, so the guardrail, model, region, token ceiling, daily limit and usage accounting a site has already configured apply to them as well.initialize with protocol-version negotiation, tools/list, tools/call, ping, batch requests and notification handling.wp-config.php credential constants.ai-chat-for-amazon-bedrock text domain.