PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 4.9.3
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v4.9.3
4.9.3 4.9.2 4.9.1 4.9.0 4.8.2 4.8.1 4.8.0 4.7.0 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 4.5.1 4.5.0 4.4.1 4.4.0 3.3.4 3.4.0 3.4.1 3.4.2 3.5.0 All 201 releases
← All changes | includes/REST/DocsAISuite.php +7 -1 4.7.0 → 4.9.3 View file →
@@ -4,8 +4,9 @@
4 4
5 5 use WP_REST_Request;
6 6 use WPDeveloper\BetterDocs\Core\BaseAPI;
7 7 use WPDeveloper\BetterDocs\Utils\AIHelper;
8 +use WPDeveloper\BetterDocs\Utils\AIUsage;
8 9
9 10 /**
10 11 * REST endpoints powering the BetterDocs "Enhance Docs with AI" editor actions
11 12 * for the `docs` post type: AI-suggested taxonomy terms (doc_category / doc_tag)
@@ -71,9 +72,9 @@
71 72 }
72 73
73 74 public function permission_check() {
74 75 // Gate on edit_others_posts to match the sibling FAQ/Glossary AI endpoints
75 - // (AIFaq/AIGlossary) and keep Author-role users from spending the OpenAI budget.
76 + // (AIFaq/AIGlossary) and keep Author-role users from spending the AI budget.
76 77 return current_user_can( 'edit_others_posts' );
77 78 }
78 79
79 80 /**
@@ -217,8 +218,13 @@
217 218 'term_id' => $term ? (int) $term->term_id : null,
218 219 'is_new' => $term ? false : true
219 220 );
220 221 }
222 +
223 + // Usage telemetry: a successful AI suggestion run, bucketed by taxonomy
224 + // (doc_category/doc_tag/glossaries). An empty result is still a use of the
225 + // feature, so record on any successful upstream response.
226 + AIUsage::record( 'ai_suggest_terms', $post_id, $taxonomy );
221 227
222 228 return $this->success( array(
223 229 'taxonomy' => $taxonomy,
224 230 'suggestions' => $suggestions,