对应前端功能位置:质检规则配置-测试。专有云URL:ip:port/api/client/TestRule.json。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
授权信息
下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:
- 操作:是指具体的权限点。
 - 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。
 - 资源类型:是指操作中支持授权的资源类型。具体说明如下:
- 对于必选的资源类型,用前面加 * 表示。
 - 对于不支持资源级授权的操作,用
全部资源表示。 
 - 条件关键字:是指云产品自身定义的条件关键字。
 - 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。
 
| 操作 | 访问级别 | 资源类型 | 条件关键字 | 关联操作 | 
|---|---|---|---|---|
| sca:TestRuleV4 | *全部资源 * | 
  | 无 | 
请求参数
| 名称 | 类型 | 必填 | 描述 | 示例值 | 
|---|---|---|---|---|
| IsSchemeData | integer | 否 | 是否为新版质检,0:旧版质检;1:新版质检。默认为 1  | 1 | 
| TestJson | string | 是 | 测试规则请求参数 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"}]} | 
请求入参示例
{
    "ruleList": [
        50298
    ],
    "dialogues": [
        {
            "role": "客服",
            "identity": "客服",
            "words": "你好,这里是 xx",
            "hourMinSec": "00:00",
            "begin": 0
        },
        {
            "words": "我要买毛巾",
            "begin": 1000,
            "role": "客户",
            "identity": "客户",
            "hourMinSec": "00:01"
        }
    ]
}
请求代码示例
import com.alibaba.fastjson.JSONObject;
import com.aliyun.qualitycheck20190115.Client;
import com.aliyun.qualitycheck20190115.models.*;
import com.aliyun.teaopenapi.models.Config;
public class sca {
    private static String ak = "YOUR_ACCESS_KEY_ID";
    private static String sk = "YOUR_ACCESS_KEY_SECRET";
    private static void testRuleV4() throws Exception {
        String json="{\"ruleList\":[50298],\"dialogues\":[{\"role\":\"客服\",\"identity\":\"客服\",\"words\":\"你好,这里是 xx\",\"hourMinSec\":\"00:00\",\"begin\":0},{\"words\":\"我要买毛巾\",\"begin\":1000,\"role\":\"客户\",\"identity\":\"客户\",\"hourMinSec\":\"00:01\"}]}";
        Config config = new Config();
        config.setAccessKeyId(ak).setAccessKeySecret(sk)
                .setEndpoint("qualitycheck.cn-hangzhou.aliyuncs.com")
                .setRegionId("cn-hangzhou").setProtocol("HTTPS");
        Client client = new Client(config);
        TestRuleV4Request result = new TestRuleV4Request();
        result.setTestJson(json);
        TestRuleV4Response response = client.testRuleV4(result);
        System.out.println(JSONObject.toJSONString(response));
    }
    public static void main(String[] args) throws Exception {
        testRuleV4();
    }
}
返回参数
示例
正常返回示例
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-12 | API 内部配置变更,不影响调用 | 查看变更详情 | 
