程序包 com.sh.ai

类 AIUtil

java.lang.Object
com.sh.ai.AIUtil

public class AIUtil extends Object
AI工具类
  • 字段详细资料

  • 构造器详细资料

    • AIUtil

      public AIUtil()
  • 方法详细资料

    • addRunning

      public static void addRunning(String aiType, String sessionId, AIRunning aiRunning)
      添加一个正在运行的作业
      参数:
      sessionId -
      aiRunning -
    • stopRunning

      public static boolean stopRunning(String aiType, String sessionId)
      停止一个正在运行的作业
      参数:
      sessionId -
      返回:
    • removeRunning

      public static void removeRunning(String aiType, String sessionId)
      移出监听正在运行的作业,也有可能是已经正常执行完
      参数:
      sessionId -
    • convertJSONArrayToMD

      public static String convertJSONArrayToMD(String str)
      将JSONArray转换为Markdown格式的表格
      参数:
      str - JSONArray字符串
      返回:
      String
    • convertJSONArrayToMD

      public static String convertJSONArrayToMD(JSONArray jsonArray)
    • removeThinkContent

      public static String removeThinkContent(String content)
      将AI返回的消息中忽略思考部分
      参数:
      content -
      返回:
      String
    • checkResponseContent

      public static String checkResponseContent(String str)
      将内容进行转义处理
      参数:
      str - String
      返回:
      String
    • isMaxTokenError

      public static boolean isMaxTokenError(Exception e)
      是否提示token超最大值
      参数:
      e -
      返回:
      boolean
    • formatMsTime

      public static String formatMsTime(long ms)
      将毫秒时间格式化
      参数:
      ms -
      返回:
      String