PluginProbe
AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI / 6.0.3
AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI v6.0.3
6.0.3 6.0.2 6.0.1 6.0.0 5.8.6 5.8.5 5.8.4 5.8.3 5.8.2 5.8.1 5.8.0 5.7.9.2 5.7.9.1 5.7.8 5.7.9 5.7.6 5.7.7 5.7.5 5.7.4 5.7.3 5.7.2 5.7.1 trunk 5.6.0 5.6.1 All 34 releases
automatorwp / modules / ai-assistant / includes / abilities.php

abilities.php in AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI 6.0.3, at modules/ai-assistant/includes/abilities.php

87 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Abilities
4 *
5 * @package AutomatorWP\AI_Assistant\Abilities
6 * @since 1.0.0
7 * @version 1.0.0
8 */
9 // Exit if accessed directly
10 if ( ! defined( 'ABSPATH' ) ) exit;
11
12 /**
13 * Get the system instructions
14 *
15 * @since 1.0.0
16 */
17 function automatorwp_ai_assistant_get_system_instructions() {
18
19 $system_instructions = array(
20 "You are an AI assistant for AutomatorWP.",
21 "Be helpful, precise, and professional.",
22 "You have strict catalog restrictions due to ability parameters.",
23 "Do not guess slugs for triggers or actions.",
24 "Always use the listed abilities to perform tasks instead of guessing or pretending.",
25 "Do not generate a text response after using abilities. They already return one.",
26 );
27
28 /**
29 * Filter to override the system instructions
30 *
31 * @since 1.0.0
32 *
33 * @param string $system_instructions
34 *
35 * @return string
36 */
37 return apply_filters( 'automatorwp_ai_assistant_get_system_instructions', implode( "\n", $system_instructions ) );
38 }
39
40 /**
41 * Register abilities category
42 *
43 * @since 1.0.0
44 */
45 function automatorwp_ai_assistant_register_category() {
46 if ( ! function_exists( 'wp_register_ability_category' ) ) return;
47
48 wp_register_ability_category( 'automatorwp', array(
49 'label' => __( 'AutomatorWP', 'automatorwp' ),
50 'description' => __( 'Ability to manage, create and design AutomatorWP elements such as points, achievements and ranks using AI.', 'automatorwp' ),
51 ) );
52
53 }
54 add_action( 'wp_abilities_api_categories_init', 'automatorwp_ai_assistant_register_category' );
55
56 /**
57 * Get abilities
58 *
59 * @since 1.0.0
60 *
61 * @return array
62 */
63 function automatorwp_ai_assistant_get_abilities() {
64
65 $registered = wp_get_abilities();
66 $categories = array();
67
68 foreach( $registered as $ability => $object ) {
69 if( strpos( $ability, 'automatorwp' ) !== false ) {
70 $categories[$ability] = $object;
71 }
72 }
73
74 return $categories;
75 }
76
77 /**
78 * Get abilities slugs
79 *
80 * @since 1.0.0
81 *
82 * @return array
83 */
84 function automatorwp_ai_assistant_get_abilities_slugs() {
85 return array_keys( automatorwp_ai_assistant_get_abilities() );
86 }
87