AI Engine Shortcodes

Below, you’ll find a detailed guide on how to add the Ai Engine Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Ai Engine Plugin shortcodes not to show or not to work correctly.

Before starting, here is an overview of the Ai Engine Plugin and the shortcodes it provides:

Plugin Icon
AI Engine: Chatbots, Generators, Assistants, GPT 4 and more!

"AI Engine is a dynamic WordPress plugin that integrates chatbots, content generators, virtual assistants, and cutting-edge GPT 4 technology. It elevates website interaction and user engagement."

★★★★☆ (440) Active Installs: 40000+ Tested with: 6.3.2 PHP Version: 7.4
Included Shortcodes:
  • [mwai_chatbot_v2]
  • [mwai_discussions]
  • [mwai_chat]
  • [mwai_imagesbot]

AI Engine [mwai_chatbot_v2] Shortcode

The MWAI Chatbot V2 shortcode is designed to integrate an AI chatbot into your WordPress site. It allows users to customize chatbot parameters, resolve bot info, and handle both server and client-side operations. The shortcode applies filters to chatbot parameters, resolves bot info such as botId and customId, and handles errors. It also converts atts keys into camelCase to match the internal params system. It further prepares server parameters and front parameters, cleans these parameters, and sets transient for server-side operations. For client-side, it prepares JSON for front params, system params, and theme. To use it, simply add [mwai_chatbot_v2] to your post or page.

Shortcode: [mwai_chatbot_v2]

Parameters

Here is a list of all possible mwai_chatbot_v2 shortcode parameters and attributes:

  • chatbot – specifies the chatbot to be used
  • botId – unique identifier of the chatbot
  • customId – custom identifier for the chatbot
  • localMemory – enables or disables local memory of chatbot
  • themeId – identifier for the theme to be applied to the chatbot

Examples and Usage

Basic example – Display a chatbot on your page using the ‘mwai_chatbot_v2’ shortcode without any parameters

[mwai_chatbot_v2 /]

Advanced examples

Customize the chatbot by using the ‘themeId’ parameter. This allows you to apply a specific theme to the chatbot. Replace ‘themeId’ with your desired theme ID.

[mwai_chatbot_v2 themeId=1 /]

Use the ‘localMemory’ parameter to enable or disable local memory for the chatbot. This allows the chatbot to remember the previous conversation with a user. Replace ‘true’ with ‘false’ to disable this feature.

[mwai_chatbot_v2 localMemory=true /]

Combine multiple parameters to fully customize the chatbot. In this example, we’re applying a specific theme and enabling local memory.

[mwai_chatbot_v2 themeId=1 localMemory=true /]

PHP Function Code

In case you have difficulties debugging what causing issues with [mwai_chatbot_v2] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'mwai_chatbot_v2', array( $this, 'chat_shortcode' ) );

Shortcode PHP function:

Code file location:

ai-engine/ai-engine/classes/modules/chatbot.php

AI Engine [mwai_discussions] Shortcode

The ‘mwai_discussions’ shortcode is a function in the AI-engine plugin that generates a chatbot interface. It resolves bot info, prepares parameters, and builds a chatbot container. This function takes attributes, converts them to camelCase, and merges them. It then sets front and server parameters. The function also cleans up these parameters, retrieves the theme, and encodes them into JSON format. Finally, it returns a div container with the chatbot interface, including the parameters, system, and theme data.

Shortcode: [mwai_discussions]

Parameters

Here is a list of all possible mwai_discussions shortcode parameters and attributes:

  • botId – Identifies the specific bot being used
  • customId – Custom identifier for additional bot customization
  • themeId – Specifies the theme used for displaying the chatbot
  • MWAI_DISCUSSIONS_FRONT_PARAMS – Parameters for front-end configuration
  • MWAI_DISCUSSIONS_SERVER_PARAMS – Parameters for server-side configuration

Examples and Usage

Basic example – Displaying a chat discussion using the default bot parameters

[mwai_discussions /]

Advanced examples:

Displaying a chat discussion with custom parameters. In this case, we’re specifying a custom bot ID and theme ID for the chat discussion.

[mwai_discussions bot_id="123" theme_id="456" /]

Using the shortcode to display a chat discussion with a specific custom ID and setting a custom parameter (e.g., ‘param1’).

[mwai_discussions custom_id="789" param1="value1" /]

Using the shortcode to display a chat discussion with multiple custom parameters. The parameters ‘param1’, ‘param2’, and ‘param3’ are set to ‘value1’, ‘value2’, and ‘value3’, respectively.

[mwai_discussions param1="value1" param2="value2" param3="value3" /]

Using the shortcode to display a chat discussion with a custom bot ID, custom ID, and theme ID, along with multiple custom parameters.

[mwai_discussions bot_id="123" custom_id="789" theme_id="456" param1="value1" param2="value2" param3="value3" /]

PHP Function Code

In case you have difficulties debugging what causing issues with [mwai_discussions] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'mwai_discussions', [ $this, 'shortcode_chat_discussions' ] );

Shortcode PHP function:

Code file location:

ai-engine/ai-engine/classes/modules/chatbot.php

AI Engine [mwai_chat] Shortcode

The ‘mwai_chat’ shortcode is used to integrate a chatbot in a WordPress website. It creates a chat interface where users can interact with the AI. It handles various parameters like user and AI names, chat context, and UI parameters like text input placeholder and compliance text. It also manages chatbot system parameters like session IDs and OpenAI parameters like model and temperature. This shortcode is highly customizable and adaptable to various chatbot needs.

Shortcode: [mwai_chat]

Parameters

Here is a list of all possible mwai_chat shortcode parameters and attributes:

  • ai_name – Specifies the name of the AI bot.
  • user_name – Sets the name of the user in the chat.
  • guest_name – Defines the name for a guest user.
  • sys_name – Sets the system name in the chat.
  • context – Sets the context for the chat conversation.
  • text_send – Customizes the text for the send button.
  • text_clear – Customizes the text for the clear button.
  • text_input_maxlength – Defines the maximum length of the text input.
  • text_input_placeholder – Sets the placeholder text for the input field.
  • text_compliance – Sets the compliance text for the chatbot.
  • start_sentence – Defines the starting sentence for the chatbot.
  • window – Determines if the chatbot appears in a separate window.
  • copy_button – Enables or disables the copy button in the chat.
  • fullscreen – Enables or disables fullscreen mode for the chat window.
  • icon – Sets a custom icon for the chatbot.
  • icon_text – Sets the text for the chatbot’s icon.
  • icon_alt – Sets the alt text for the chatbot’s icon.
  • icon_position – Determines the position of the chatbot’s icon.
  • style – Sets the style for the chatbot interface.
  • id – Unique identifier for the chatbot.
  • mode – Sets the mode of operation for the chatbot.
  • max_results – Sets the maximum number of results to display from the chatbot.
  • max_messages – Sets the maximum number of messages to display in the chat.
  • casually_fine_tuned – Toggles the casually fine-tuned mode.
  • embeddings_index – Sets the embeddings index for the chatbot.
  • prompt_ending – Sets the ending prompt for the chatbot.
  • completion_ending – Sets the ending completion for the chatbot.
  • model – Sets the AI model used by the chatbot.
  • temperature – Sets the temperature for the AI model.
  • max_tokens – Sets the maximum number of tokens for the AI model.
  • service – Defines the service used by the chatbot.
  • api_key – Sets the API key for the chatbot service.

Examples and Usage

Basic example – Displaying a chatbot on your website.

[mwai_chat]

Advanced examples

Displaying a chatbot with a specific AI name, user name and guest name. The AI name is the name that will be displayed for the AI in the chat interface, the user name is the name that will be displayed for the user in the chat interface, and the guest name is the name that will be used when the user has not specified a name.

[mwai_chat ai_name="Chatbot" user_name="User" guest_name="Guest"]

Displaying a chatbot with a specific context. The context is a string that will be added at the beginning of the conversation to provide some context to the AI.

[mwai_chat context="Welcome to our website. How can we assist you today?"]

Displaying a chatbot with a specific starting sentence. The starting sentence is the first sentence that the AI will say when the chat is opened.

[mwai_chat start_sentence="Hello, how can I assist you today?"]

Displaying a chatbot with a specific text for the send button and the clear button. The text_send is the text that will be displayed on the send button, and the text_clear is the text that will be displayed on the clear button.

[mwai_chat text_send="Send" text_clear="Clear"]

Displaying a chatbot with a specific maximum length for the input text. The text_input_maxlength is the maximum number of characters that the user can input in the chat.

[mwai_chat text_input_maxlength="200"]

Displaying a chatbot with a specific placeholder for the input text. The text_input_placeholder is the text that will be displayed in the input field when it is empty.

[mwai_chat text_input_placeholder="Type your message here..."]

Displaying a chatbot with a specific compliance text. The text_compliance is the text that will be displayed to inform the user about any compliance or legal information related to the chat.

[mwai_chat text_compliance="Your conversation will be stored for quality and training purposes."]

PHP Function Code

In case you have difficulties debugging what causing issues with [mwai_chat] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'mwai_chat', array( $this, 'chat' ) );

Shortcode PHP function:

Code file location:

ai-engine/ai-engine/classes/modules/chatbot_legacy.php

AI Engine [mwai_imagesbot] Shortcode

The ‘mwai_imagesbot’ shortcode is a part of the AI-engine plugin which facilitates image-based chat. This shortcode activates the ‘imageschat’ function, setting the mode to ‘images’. This allows the chat feature to handle and display image content.

Shortcode: [mwai_imagesbot]

Examples and Usage

Basic example – A simple usage of the ‘mwai_imagesbot’ shortcode to invoke the imageschat function without passing any specific parameters.

[mwai_imagesbot /]

Advanced examples

Passing the ‘mode’ parameter explicitly. Even though the ‘mode’ is set to ‘images’ by default in the imageschat function, this example demonstrates how you can pass it explicitly if needed.

[mwai_imagesbot mode="images" /]

Passing multiple parameters to the shortcode. This example demonstrates how you can pass more than one parameter to the shortcode. The ‘mode’ parameter is set to ‘images’, and an additional parameter ‘style’ is set to ‘gallery’. This could be useful if your imageschat function is designed to handle additional parameters to control its behavior.

[mwai_imagesbot mode="images" style="gallery" /]

Note: The actual effect of these parameters will depend on how the imageschat function is implemented. The examples above are for illustrative purposes and may not reflect the actual behavior of your specific implementation.

PHP Function Code

In case you have difficulties debugging what causing issues with [mwai_imagesbot] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'mwai_imagesbot', array( $this, 'imageschat' ) );

Shortcode PHP function:

Code file location:

ai-engine/ai-engine/classes/modules/chatbot_legacy.php

Conclusion

Now that you’ve learned how to embed the Ai Engine Plugin shortcodes, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *