UChat Official

Introduction

In modern AI-powered customer support and communication systems, delivering clear, digestible responses is crucial for a positive user experience.

Long, unbroken messages can overwhelm users, making conversations feel robotic and impersonal.

To enhance readability and engagement, it’s essential to split lengthy AI agent replies into smaller, manageable paragraphs.

This guide provides a detailed, step-by-step approach to achieve this using AI tasks, workflows, and JSON operations within a typical automation platform.

Step-by-Step Breakdown

1. Prerequisites and Setup

  • Enable Advanced Mode in AI Agent:

    • Navigate to your customer support agent settings.

    • Toggle Advanced Mode on to access more granular control.

    • Trigger a workflow to process AI responses effectively.

  • Create or Assign a Workflow:

    • Either create a new workflow or assign an existing one.

    • Use the system field last AI agent reply to pass the AI's message into the workflow.

2. Configure the AI Task for Text Splitting

  • Create an AI Task:

    • Name it, e.g., AI Agent Message Splitter.

    • Set a simple prompt:

    • Use the Output Field to generate a JSON array:

      {
        "paragraphs": []
      }
    • Enable Array Mode to handle multiple paragraphs dynamically.

  • Select the AI Model:

    • Use OpenAI GPT-4 Turbo Preview for better accuracy.

    • Load the precise preset for optimal results.

    • Save the configuration.

3. Process the AI Response

  • Input Text:

    • Use the last AI agent reply system field.

    • Run the AI task to split the message.

    • The output will be a JSON array with multiple paragraph objects, e.g.,

      {
        "paragraphs": [
          "First paragraph with up to three sentences.",
          "Second paragraph, also concise.",
          ...
        ]
      }
  • Save the Split Response:

    • Store the JSON output into a custom field, e.g., AI_agent_split_reply.

    • Ensure this field is of JSON type to facilitate further operations.

4. Count the Number of Paragraphs

  • Use JSON Operations:

    • Add a JSON Operation step.

    • Input the AI_agent_split_reply field.

    • Perform a Count Items operation on the paragraphs array.

    • Save the count into a new custom field, e.g., AI_agent_total_paragraphs.

  • Test the Count:

    • Run a test with sample data.

    • Confirm the count matches the number of paragraphs generated (e.g., 3, 4, 5).

5. Conditional Logic for Sending Paragraphs

  • Set Up Conditions:

    • Use Conditional Steps to check AI_agent_total_paragraphs.

    • For example:

      • If 1, send the single paragraph.

      • If 2, send two paragraphs.

      • Continue similarly for 3, 4, 5, etc.

  • Mapping Paragraphs:

    • For each condition, map the corresponding paragraph(s) from the JSON array.

    • Use JSON Path expressions like:

      • $.paragraphs[0] for the first paragraph.

      • $.paragraphs[1] for the second, and so on.

6. Adding Human-Like Touches

  • Insert Typing Indicators:

    • Between paragraphs, add a delay (e.g., 2-3 seconds).

    • This simulates natural typing pauses, making the conversation feel more human.

  • Add Transition Notes:

    • Insert brief notes like "Let me explain that further..." or "Here's a quick summary." to improve conversational flow.

7. Handling Multiple Paragraphs

  • Repeat for Up to 5 Paragraphs:

    • Create additional conditions for 3, 4, and 5 paragraphs.

    • For each, map the respective paragraphs and add delays or notes as needed.

    • This modular approach ensures scalability and flexibility.

8. Finalizing and Testing

  • Test the Entire Flow:

    • Input sample long responses.

    • Verify that the message is split correctly.

    • Confirm that each paragraph is sent sequentially with appropriate delays and notes.

  • Adjust as Needed:

    • Fine-tune the maximum number of paragraphs.

    • Improve the prompt for better splitting.

    • Customize transition notes for a more natural tone.

Summary

By following this structured approach, you can significantly improve the readability and user experience of your AI-powered support system.

Splitting long messages into digestible chunks not only makes conversations more engaging but also reduces cognitive load on users.

With minimal setup—leveraging AI tasks, JSON operations, and conditional logic—you can automate this process efficiently. Remember, the key is to test thoroughly and adjust parameters to match your specific needs. Implementing these steps will make your AI interactions feel more natural, responsive, and user-friendly.