Class IncludesHandler

java.lang.Object
sk.iway.iwcm.components.ai.providers.IncludesHandler

public class IncludesHandler extends Object
Provides logic to hnalde INCLUDES in strings. To replace them with placeholders, then swap them back. Even when output is parse to line.
  • Constructor Details

    • IncludesHandler

      public IncludesHandler(Map<Integer,String> replacedIncludes)
      Parameters:
      replacedIncludes -
    • IncludesHandler

      public IncludesHandler(Map<Integer,String> replacedIncludes, Integer milliSleep)
      Parameters:
      replacedIncludes -
      milliSleep - - in milliseconds how long wait between flush
  • Method Details

    • handleLine

      public void handleLine(String line, BufferedWriter writer) throws IOException
      USing logic with buffer, method is trying find placeholder __LOCK_X__, swap them with includes and without waiting for whole text etite/flush parts.
      Parameters:
      line -
      writer -
      Throws:
      IOException
    • replaceIncludesWithPlaceholders

      public static Map<Integer,String> replaceIncludesWithPlaceholders(InputDataDTO inputData)
    • addProtectedTokenInstructionRule

      public static final String addProtectedTokenInstructionRule(String instructions)
    • returnIncludesToPlaceholders

      public static final String returnIncludesToPlaceholders(String responseText, Map<Integer,String> replacedIncludes)