TestRuleV4 - 测试规则(新版质检)

对应前端功能位置:质检规则配置-测试。专有云URL:ip:port/api/client/TestRule.json。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

授权信息

当前API暂无授权信息透出。

请求参数

名称类型必填描述示例值
IsSchemeDatainteger

是否为新版质检,0:旧版质检;1:新版质检。默认为 1

1
TestJsonstring

测试规则请求参数 JSON,详情见请求参数补充说明。

{"ruleList":[9771],"dialogues":[{"begin":0,"end":760,"hourMinSec":"00:00","role":"客户","identity":"客户","words":"123"},{"begin":21004,"end":21494,"hourMinSec":"00:21","role":"客服","identity":"客服","words":"123"}]}

返回参数

名称类型描述示例值
object

PlainResult

Dataobject

完整返回内容。

HitRuleReviewInfoListobject []

命中检测项信息。

Ridlong

检测项 ID

451
Lambdastring

Lambda 表达式:例如:a&&b

a&&b
ConditionHitInfoListobject []

命中的条件信息。

Cidarray

条件 ID。

string

条件 ID。

1
Phraseobject

当前命中检测项的句子详情。

Rolestring

本句的角色,取值:客服、客户。

客服
Identitystring

角色标识,离线语音场景下角色只有客服/客户,离线文本质检场景下,显示的是上传数据时传入的 identity。

客服
Wordsstring

对话内容。

你好,请问有什么可以帮您
Beginlong

这句话的开始时间相对对话整体开始时间的偏移量,毫秒级,例如录音总时长为 2 分 10 秒,客户的某一句话是在 1 分 12 秒时开始讲的,1 分 20 秒时讲完,则 begin 的值为 72000,end 的值为 80000。

72000
Endlong

这句话的开始时间相对对话整体开始时间的偏移量,毫秒级,例如录音总时长为 2 分 10 秒,客户的某一句话是在 1 分 12 秒时开始讲的,1 分 20 秒时讲完,则 begin 的值为 72000,end 的值为 80000。

80000
BeginTimestring

这句话的开始时间,示例值:2019-11-25 15:37:16。

2019-11-25 15:37:16
HourMinSecstring

这句话的时分秒格式的开始时间,格式:hh:mm:ss

10:00:00
EmotionValueinteger

情绪能量值,取值为音量分贝值/10。取值范围:[1,10]。值越高情绪越强烈。

7
EmotionFineGrainedValueinteger

内部使用,忽略。

忽略
SilenceDurationinteger

静音时长,单位毫秒

1000
SpeechRateinteger

本句的平均语速,单位:字数/分钟。

100
ChannelIdinteger

频道 ID。

0
Pidinteger

当前句子在所有句子中的下标值,即当前句子是请求参数中 dialogue 数组中的第几个,从 0 开始。

3
RenterIdlong

内部用,忽略。

Uuidstring

内部用,忽略。

HitStatusinteger

命中状态。取值:

  • 0:没有命中
  • 1:命中
1
Sidlong

内部用,忽略。

KeyWordsobject []

命中的关键信息,在复核页面上高亮展示的信息,例如关键词检查算子命中的关键词、客服模型检查算子命中的具体类别信息等。

OperatorKeystring

算子命中的关键信息。

Valstring

算子命中的关键信息,详见下方返回参数说明中的关键信息 Val 详解

你好
Pidinteger

当前句子在所有句子中的下标值,即当前句子是请求参数中 dialogue 数组中的第几个,从 0 开始。

13
Frominteger

需要高亮展示的关键字从第几个字符开始,取值范围从 0 开始,最大值为当句话字符总数减 1。高亮的字包含 from。

1
Tointeger

需要高亮展示的关键字到第几个字符结束,最大值为当句话字符总数减 1。高亮的字不包含 to,例如一句话为“不可能给你退货的”,from=0,to=3,那么需要高亮的关键字就是“不可能”三个字。

3
Tidstring

内部用,忽略。

Oidstring

算子的 ID

123
Uuidstring

内部用,忽略。

SimilarPhrasestring

相似句

您好
Cidstring

条件 id。

4
CustomizeCodestring

内部字段,请忽略。

ConditionInfoListarray

条件列表

ConditionBasicInfo

条件信息

BranchHitIdlong

命中分支 ID。

1
BranchInfoListobject []

分支信息列表

Indexinteger

索引号

1
Namestring

节点名称

节点A
NextNodeIdlong

下一个流程节点 ID

2
SituationNextNodeSituations

流程节点条件

Lambdastring

Lambda 表达式

a&&b
CheckTypeinteger

检测项类型

0
Triggersarray

触发 ID 列表

string

触发 ID。

a
RuleScoreTypeinteger

是否计分:1 不计分;3 计分。

1
TaskFlowIdlong

流程 ID

1
ScoreNumTypeinteger

计分类型,可能值:0(命中后加减分);1(命中后一次性得分)

1
Matchedboolean

是否命中

true
NodeTypestring

节点类型。

0
JudgeNodeNamestring

判断节点名称

判断节点A
RuleNamestring

规则名称。

规则A
HitTaskFlowListobject []

命中高级流程节点列表

GraphFlowTaskGraphFlow

图流程画布

TaskFlowTypeinteger

流程图类型-已废弃-默认-1

Ridlong

规则 ID

1
UnhitRuleReviewInfoListobject []

未命中规则信息

Ridlong

命中的规则 ID。

2
ConditionInfoListarray

条件列表

ConditionBasicInfo

条件信息

Matchedboolean

是否命中

true
TaskFlowTypeinteger

流程图类型-已废弃-默认-1

忽略
RequestIdstring

请求 ID。

96138D8D-XXXX-4E41-XXXX-77AED1088BBD
Successboolean

请求是否成功,调用方可根据此字段来判断请求是否成功:true 表示成功;false/null 表示失败。

true
Codestring

结果代码,200 表示成功,若为别的值则表示失败,调用方可根据此字段判断失败原因。

200
Messagestring

出错时表示出错详情,成功时为 successful。

successful
HttpStatusCodeinteger

HTTP 状态码。

200

示例

正常返回示例

JSON格式

{
  "Data": {
    "HitRuleReviewInfoList": [
      {
        "Rid": 451,
        "Lambda": "a&&b",
        "ConditionHitInfoList": [
          {
            "Cid": [
              "1"
            ],
            "Phrase": {
              "Role": "客服",
              "Identity": "客服",
              "Words": "你好,请问有什么可以帮您",
              "Begin": 72000,
              "End": 80000,
              "BeginTime": "2019-11-25 15:37:16",
              "HourMinSec": "10:00:00",
              "EmotionValue": 7,
              "EmotionFineGrainedValue": 0,
              "SilenceDuration": 1000,
              "SpeechRate": 100,
              "ChannelId": 0,
              "Pid": 3,
              "RenterId": 0,
              "Uuid": "无",
              "HitStatus": 1,
              "Sid": 0
            },
            "KeyWords": [
              {
                "OperatorKey": "无",
                "Val": "你好",
                "Pid": 13,
                "From": 1,
                "To": 3,
                "Tid": "无",
                "Oid": "123",
                "Uuid": "无",
                "SimilarPhrase": "您好",
                "Cid": "4",
                "CustomizeCode": "无"
              }
            ]
          }
        ],
        "ConditionInfoList": [
          {
            "Cid": "a",
            "Id": 1,
            "Rid": "1",
            "Check_range": {
              "RoleId": 1,
              "Role": "客服",
              "Anchor": {
                "Cid": "a",
                "Location": "BEFORE",
                "Hit_time": 1
              },
              "Range": {
                "From": 1,
                "To": 2
              },
              "Absolute": true,
              "AllSentencesSatisfy": true
            },
            "Operators": [
              {
                "Oid": "a",
                "Id": 1,
                "Type": "HIT_ANY_KEYWORDS",
                "Param": {
                  "CustomerParam": {
                    "Field": "remark1",
                    "FieldType": 1,
                    "DataType": 1,
                    "Symbol": 1,
                    "Value": "xxx",
                    "ActualValue": "xx"
                  },
                  "Keywords": [
                    "你好"
                  ],
                  "Regex": "质疑.*",
                  "NotRegex": "优秀.*",
                  "Phrase": "你好,请问",
                  "References": [
                    "你好.{0,10}"
                  ],
                  "Interval": 1,
                  "IntervalEnd": 2,
                  "Threshold": 90,
                  "In_sentence": true,
                  "Target": 1,
                  "From_end": true,
                  "Different_role": true,
                  "Target_role": "客服",
                  "RoleId": 1,
                  "Velocity": 111,
                  "VelocityInMint": 1,
                  "KeywordExtension": 1,
                  "Synonyms": {
                    "key": [
                      "售卖"
                    ]
                  },
                  "Case_sensitive": true,
                  "Near_dialogue": true,
                  "MinWordSize": 1,
                  "Hit_time": 2,
                  "Excludes": [
                    "负向"
                  ],
                  "From": 0,
                  "CheckFirstSentence": true,
                  "Average": true,
                  "BeginType": "1",
                  "EndType": "2",
                  "CompareOperator": "gt",
                  "Pkey": "xx",
                  "Poutput_type": 1,
                  "SimilarlySentences": [
                    "我要购买"
                  ],
                  "LgfSentences": [
                    "你好{1}"
                  ],
                  "Score": 70,
                  "ContextChatMatch": true,
                  "KeywordMatchSize": 1,
                  "MaxEmotionChangeValue": 3,
                  "CheckType": 1,
                  "KnowledgeTargetId": "1",
                  "CategoryPathCode": "xx",
                  "KnowledgeTargetType": 1,
                  "KnowledgeTargetName": "订单",
                  "QuestionThreshold": "90",
                  "AnswerThreshold": "90",
                  "KnowledgeSentenceNum": 1,
                  "KnowledgeInfo": "下单",
                  "BotId": "chatbot-cn-xxx",
                  "UseEasAlgorithm": true,
                  "Pvalues": [
                    ""
                  ],
                  "Similarity_threshold": 90,
                  "AntModelInfo": {
                    "key": "xxx"
                  },
                  "DelayTime": 10
                },
                "Name": "a",
                "UserGroup": "xxx",
                "QualityCheckType": 0
              }
            ],
            "Lambda": "a",
            "Exclusion": 0,
            "Name": "xx",
            "UserGroup": "xxxx"
          }
        ],
        "BranchHitId": 1,
        "BranchInfoList": [
          {
            "Index": 1,
            "Name": "节点A",
            "NextNodeId": 2,
            "Situation": {
              "ConditionGroup": [
                {
                  "Conditions": [
                    {
                      "Field": "remark1",
                      "FieldType": 1,
                      "DataType": 1,
                      "Symbol": 1,
                      "Value": "xxx",
                      "ActualValue": "xx"
                    }
                  ],
                  "Type": "1"
                }
              ],
              "Type": "1"
            },
            "Lambda": "a&&b",
            "CheckType": 0,
            "Triggers": [
              "a"
            ]
          }
        ],
        "RuleScoreType": 1,
        "TaskFlowId": 1,
        "ScoreNumType": 1,
        "Matched": true,
        "NodeType": "0",
        "JudgeNodeName": "判断节点A",
        "RuleName": "规则A"
      }
    ],
    "HitTaskFlowList": [
      {
        "GraphFlow": {
          "Id": 1,
          "Rid": 1,
          "RuleName": "违规",
          "SkipWhenFirstSessionNodeMiss": true,
          "FlowRuleScoreType": 1,
          "ShowProperties": "{}",
          "Nodes": [
            {
              "Id": 1,
              "Rid": 1,
              "Name": "开始节点",
              "NodeType": "startNode",
              "Index": 1,
              "Content": "{}",
              "Properties": {
                "Type": "xx",
                "Role": "客户",
                "SayType": "",
                "RuleScoreType": 1,
                "ScoreNum": 1,
                "ScoreType": 1,
                "ScoreRuleHitType": 0,
                "AutoReview": 1,
                "ScoreNumType": 1,
                "Lambda": "a",
                "CheckType": 1,
                "Triggers": [
                  "a"
                ],
                "BranchJudge": true,
                "CheckMoreSize": 1
              },
              "Conditions": [
                {
                  "Cid": "a",
                  "Id": 1,
                  "Rid": "1",
                  "Check_range": {
                    "RoleId": 1,
                    "Role": "客服",
                    "Anchor": {
                      "Cid": "a",
                      "Location": "BEFORE",
                      "Hit_time": 1
                    },
                    "Range": {
                      "From": 1,
                      "To": 2
                    },
                    "Absolute": true,
                    "AllSentencesSatisfy": true
                  },
                  "Operators": [
                    {
                      "Oid": "a",
                      "Id": 1,
                      "Type": "HIT_ANY_KEYWORDS",
                      "Param": {
                        "CustomerParam": {
                          "Field": "remark1",
                          "FieldType": 1,
                          "DataType": 1,
                          "Symbol": 1,
                          "Value": "xxx",
                          "ActualValue": "xx"
                        },
                        "Keywords": [
                          "你好"
                        ],
                        "Regex": "质疑.*",
                        "NotRegex": "优秀.*",
                        "Phrase": "你好,请问",
                        "References": [
                          "你好.{0,10}"
                        ],
                        "Interval": 1,
                        "IntervalEnd": 2,
                        "Threshold": 90,
                        "In_sentence": true,
                        "Target": 1,
                        "From_end": true,
                        "Different_role": true,
                        "Target_role": "客服",
                        "RoleId": 1,
                        "Velocity": 111,
                        "VelocityInMint": 1,
                        "KeywordExtension": 1,
                        "Synonyms": {
                          "key": [
                            "售卖"
                          ]
                        },
                        "Case_sensitive": true,
                        "Near_dialogue": true,
                        "MinWordSize": 1,
                        "Hit_time": 2,
                        "Excludes": [
                          "负向"
                        ],
                        "From": 0,
                        "CheckFirstSentence": true,
                        "Average": true,
                        "BeginType": "1",
                        "EndType": "2",
                        "CompareOperator": "gt",
                        "Pkey": "xx",
                        "Poutput_type": 1,
                        "SimilarlySentences": [
                          "我要购买"
                        ],
                        "LgfSentences": [
                          "你好{1}"
                        ],
                        "Score": 70,
                        "ContextChatMatch": true,
                        "KeywordMatchSize": 1,
                        "MaxEmotionChangeValue": 3,
                        "CheckType": 1,
                        "KnowledgeTargetId": "1",
                        "CategoryPathCode": "xx",
                        "KnowledgeTargetType": 1,
                        "KnowledgeTargetName": "订单",
                        "QuestionThreshold": "90",
                        "AnswerThreshold": "90",
                        "KnowledgeSentenceNum": 1,
                        "KnowledgeInfo": "下单",
                        "BotId": "chatbot-cn-xxx",
                        "UseEasAlgorithm": true,
                        "Pvalues": [
                          ""
                        ],
                        "Similarity_threshold": 90,
                        "AntModelInfo": {
                          "key": "xxx"
                        },
                        "DelayTime": 10
                      },
                      "Name": "a",
                      "UserGroup": "xxx",
                      "QualityCheckType": 0
                    }
                  ],
                  "Lambda": "a",
                  "Exclusion": 0,
                  "Name": "xx",
                  "UserGroup": "xxxx"
                }
              ],
              "NextNodes": [
                {
                  "Index": 1,
                  "Name": "a",
                  "NextNodeId": 31533,
                  "Lambda": "a",
                  "CheckType": 1,
                  "Triggers": [
                    "a"
                  ]
                }
              ],
              "UseConditions": true
            }
          ]
        },
        "TaskFlowType": 0,
        "Rid": 1
      }
    ],
    "UnhitRuleReviewInfoList": [
      {
        "Rid": 2,
        "ConditionInfoList": [
          {
            "Cid": "a",
            "Id": 1,
            "Rid": "1",
            "Check_range": {
              "RoleId": 1,
              "Role": "客服",
              "Anchor": {
                "Cid": "a",
                "Location": "BEFORE",
                "Hit_time": 1
              },
              "Range": {
                "From": 1,
                "To": 2
              },
              "Absolute": true,
              "AllSentencesSatisfy": true
            },
            "Operators": [
              {
                "Oid": "a",
                "Id": 1,
                "Type": "HIT_ANY_KEYWORDS",
                "Param": {
                  "Keywords": [
                    "你好"
                  ],
                  "Regex": "质疑.*",
                  "NotRegex": "优秀.*",
                  "Phrase": "你好,请问",
                  "References": [
                    "你好.{0,10}"
                  ],
                  "Interval": 1,
                  "IntervalEnd": 2,
                  "Threshold": 90,
                  "In_sentence": true,
                  "Target": 1,
                  "From_end": true,
                  "Different_role": true,
                  "Target_role": "客服",
                  "RoleId": 1,
                  "Velocity": 111,
                  "VelocityInMint": 1,
                  "KeywordExtension": 1,
                  "Synonyms": {
                    "key": [
                      "售卖"
                    ]
                  },
                  "Case_sensitive": true,
                  "Near_dialogue": true,
                  "MinWordSize": 1,
                  "Hit_time": 2,
                  "Excludes": [
                    "负向"
                  ],
                  "From": 0,
                  "CheckFirstSentence": true,
                  "Average": true,
                  "BeginType": "1",
                  "EndType": "2",
                  "CompareOperator": "gt",
                  "Pkey": "xx",
                  "Poutput_type": 1,
                  "SimilarlySentences": [
                    "我要购买"
                  ],
                  "LgfSentences": [
                    "你好{1}"
                  ],
                  "Score": 70,
                  "ContextChatMatch": true,
                  "KeywordMatchSize": 1,
                  "MaxEmotionChangeValue": 3,
                  "CheckType": 1,
                  "KnowledgeTargetId": "1",
                  "CategoryPathCode": "xx",
                  "KnowledgeTargetType": 1,
                  "KnowledgeTargetName": "订单",
                  "QuestionThreshold": "90",
                  "AnswerThreshold": "90",
                  "KnowledgeSentenceNum": 1,
                  "KnowledgeInfo": "下单",
                  "BotId": "chatbot-cn-xxx",
                  "UseEasAlgorithm": true,
                  "Pvalues": [
                    ""
                  ],
                  "Similarity_threshold": 90,
                  "AntModelInfo": {
                    "key": "xxx"
                  },
                  "DelayTime": 10
                },
                "Name": "a",
                "UserGroup": "xxx",
                "QualityCheckType": 0
              }
            ],
            "Lambda": "a",
            "Exclusion": 0,
            "Name": "xx",
            "UserGroup": "xxxx"
          }
        ],
        "Matched": true,
        "TaskFlowType": 0
      }
    ]
  },
  "RequestId": "96138D8D-XXXX-4E41-XXXX-77AED1088BBD",
  "Success": true,
  "Code": "200",
  "Message": "successful",
  "HttpStatusCode": 200
}

错误码

访问错误中心查看更多错误码。

变更历史

变更时间变更内容概要操作
2024-03-12API 内部配置变更,不影响调用看变更集
变更项变更内容
API 内部配置变更,不影响调用