文档

规则对象说明

更新时间:

本文说明规则对象的结构。

重要

推荐先在前端页面进行操作并用浏览器提供开发人员工具获取请求参数,以此为模板构建您希望的对象结构。

规则种类

规则分为两类,普通质检规则和流程质检规则,为方便说明,用规则代指普通质检规则,用流程代指流程质检规则,下面会分开介绍。

普通质检规则

普通质检规则体系分为规则条件算子三级,具体含义参考名词解释。

一个规则包含多个条件,一个条件对应一个算子。

流程质检规则

新版智能对话分析新增的类型,具体含义参考名词解释。

由于节点分三种,开始节点(特殊忽略)、对话节点和判断节点。体系可以分为:

  1. 流程对话节点条件算子

  2. 流程判断节点判断条件

一个流程对应多个节点,一个对话节点对应一个条件,一个条件对应一个算子。一个判断节点对应多个判断条件。

RulesInfo

规则集合信息,getRuleById等接口会涉及该结构

规则

说明

data 属性说明:

属性

值类型

示例值

说明

conditions

Array

[]

所有条件的配置信息,详见下方conditions属性说明

rules

Array

[]

所有规则的配置信息,详见下方rules属性说明

conditions属性说明:

属性

值类型

示例值

说明

cid

String

"a"

字母格式的条件ID,用于页面显示。

id

Long

1233

条件id。

rid

String

"232"

规则id

check_range

Struct

具体内容参见下方的

条件检查范围CheckRange描述

条件的检查范围。

operators

List

具体内容参见下方的

条件所包含算子OperatorBasicInfo描述

条件包含的算子。

lambda

String

"1222"

条件中算子的逻辑关系。

条件检查范围CheckRange描述:

属性

值类型

示例值

描述

role

String

客服

适用角色,可能值:“客服”;“客户”;“所有

”。

anchor

Anchor

具体内容参见下方的

前置条件Anchor描述

前置条件详细信息。

range

String

{"from": 1, "to": 3}

检测范围

前置条件Anchor描述:

属性

值类型

示例值

描述

cid

String

"a"

前置条件的条件id(cid),用于确定anchor的条件。

location

String

AROUND

用来指定前置条件命中时,当前条件检测前置条件命中句子的之前XX句、之后XX句、前后部分句子、当前句,可能值:BEFORE(前置条件命中句子之前)、AROUND(前置条件命中位置前后)、AFTER(前置条件命中句子之后)、CURRENT(前置条件命中的当前句)。通过该字段限定一个范围,然后配合上面的range中的from、to来指定具体的句子。

hit_time

Integer

3

前置条件的命中次数,返回值有以下三种情况:1. 正整数1~N代表前置条件第一(N)次命中; 2. 0代表前置条件每次命中; 3. -1代表前置条件任意一次命中。

条件所包含算子OperatorBasicInfo描述:

属性

值类型

示例值

描述

oid

String

"1222"

算子的ID

name

String

我是算子名称

算子名称、描述。

type

String

INCLUDE_KEYWORDS

算子类型,详见新增规则。

param

Param

算子表达式具体内容,详见新增规则。

rules属性说明:

属性

值类型

示例值

描述

rid

String

1

规则的ID

lambda

String

a&&b&&c

规则中条件的逻辑关系

business

List

具体内容参见下方的

规则所属业务字段BusinessCategoryBasicInfo描述

规则的适用业务。

type

Integer

1

规则的类型

triggers

List

["a","b","c"]

规则中需要返回内容的条件ID(cid)。

name

String

"用户可能要投诉"

规则名称。

scoreSubId

Integer

3678

规则绑定的评分项子项的id

ruleScoreType

Integer

3

该规则所绑定的评分项是否进行计分(1:不计分 3:计分)。

level

Integer

2

重要程度:

0(重度违规);1(中度违规);2(轻度违规)

fullCycle

Integer

1

设置规则的生效时间的类型:

0(特定周期生效,特定的时间范围内生效);1(全周期生效,始终生效)

effectiveStartTime

Date

1640620800000

规则生效时间为特定周期生效时的生效开始时间。

effectiveEndTime

Date

1640620800000

规则生效时间为特定周期生效时的生效结束时间。

autoReview

Integer

1

是否自动审核,可能值:1(否);3(是)

comments

String

检测是否出现了禁用语

规则的备注信息。

qualityCheckType

Integer

0

是否为实时质检规则,可能值:0(否);1(是)

businessCategoryBasicInfoList属性说明:

属性

值类型

示例值

说明

bid

Long

574599480

适用业务id

name

String

售前业务

使用业务名称

例子-规则

{
    "data": {
        "conditions": [
            {
                "check_range": {},
                "cid": "a",
                "id": 92495,
                "lambda": "93289",
                "operators": [
                    {
                        "id": 93289,
                        "oid": "93289",
                        "param": {
                            "contextChatMatch": false,
                            "in_sentence": false,
                            "keywordMatchSize": 1,
                            "keywords": [
                                "你好"
                            ],
                            "near_dialogue": false,
                            "useEasAlgorithm": false
                        },
                        "type": "HIT_ANY_KEYWORDS"
                    }
                ],
                "rid": "30526"
            },
            {
                "check_range": {},
                "cid": "b",
                "id": 92496,
                "lambda": "93290",
                "operators": [
                    {
                        "id": 93290,
                        "oid": "93290",
                        "param": {
                            "average": false,
                            "minWordSize": 4,
                            "near_dialogue": false,
                            "useEasAlgorithm": false,
                            "velocity": 0.005,
                            "velocityInMint": 300
                        },
                        "type": "SPEECH_SPEED_CHECK"
                    }
                ],
                "rid": "30526"
            }
        ],
        "count": 1,
        "rules": [
            {
                "autoReview": 1,
                "comments": "这是一个规则Demo!",
                "configType": 1,
                "createEmpid": "374915893923532146",
                "createTime": 1663654165000,
                "expectedScore": 0.7,
                "fullCycle": 1,
                "isDelete": 0,
                "isOnline": 0,
                "lambda": "a&&b",
                "lastUpdateEmpid": "374915893923532146",
                "lastUpdateTime": 1663654165000,
                "level": 2,
                "meet": 1,
                "name": "规则Demo",
                "qualityCheckType": 0,
                "rid": "30526",
                "ridLong": 30526,
                "ruleCategoryName": "服务规范",
                "ruleScoreType": 3,
                "ruleType": 1,
                "scoreNum": 10,
                "scoreNumType": 0,
                "scoreRuleHitType": 0,
                "scoreType": 3,
                "status": 0,
                "targetType": 10,
                "taskFlowId": -1,
                "triggers": [
                    "a",
                    "b"
                ],
                "type": 1
            }
        ]
    }
}

流程

说明

data 属性说明:

属性

值类型

示例值

说明

conditions

Array

[]

对于流程是空数组。

rules

Array

[]

所有规则的配置信息,详见下方rules属性说明

rules 属性说明:

属性

值类型

示例值

说明

graphFlow

Object

510

流程信息,详见下方graphFlow属性说明

...

...

...

其他同规则说明。

graphFlow 属性说明:

属性

值类型

示例值

说明

id

Integer

510

流程id

showProperties

Json

保存流程图的显示参数

skipWhenFirstSessionNodeMiss

Boolean

false

当首个会话节点未命中时是否跳出,默认为false

nodes

Array[]

[]

节点信息,详见下方nodes属性说明

nodes 属性说明:

属性

值类型

示例值

说明

id

Integer

30527

节点id

rid

Integer

30527

同id

index

Integer

1

索引id

name

String

开始

节点名称

nextNodes

Array

下个节点,详见下方nextNode属性说明

nodeType

String

startNode

节点类型

startNode(开始节点)

judgmentNode(判断节点)

conditionNode(对话节点)

content

Json

内部用,忽略

properties

Object

对话节点用,记录条件信息,详见下方properties属性说明

conditions

Object

对话节点用,记录条件信息,结构同规则

nextNode 属性说明:

属性

值类型

示例值

说明

nextNodeId

Integer

30528

下一个节点的节点Id

name

String

判断节点用,条件分支

situation

Object

判断节点用,记录判断条件

situation.conditionGroup

Array

条件组,详见下方conditions属性说明

situation.type

String

or

各个条件组之间的关系,“or”或者“and”

conditions 属性说明:

属性

值类型

示例值

说明

dataType

Integer

30527

节点id

field

String

system.customerServiceName

判断字段Id

fieldType

Integer

1

字段数据来源类型:

1:系统预定义字段 2:传参质检字段

symbol

Integer

逻辑表达式

value

String

匹配值

properties 属性说明:

属性

值类型

示例值

说明

lambda

String

a

条件的lambda表达式

role

String

agent

角色

ruleScoreType

Integer

1

是否计分:

1(不计分);3(计分)

scoreNum

Integer

计分值

scoreNumType

Integer

计分类型:

0(加减分);1(一次性得分);

scoreRuleHitType

Integer

命中计分类型:

0:(命中计分);1(不命中计分)

scoreType

Integer

加减分:1(加分);3(减分)默认为1

triggers

Array<String>

涉及的算子

autoReview

Integer

自动审核:

1(不自动);3(自动)

checkMoreSize

Integer

最多检测N句

例子-流程

{
    "data": {
        "conditions": [],
        "count": 1,
        "rules": [
            {
                "autoReview": 1,
                "configType": 1,
                "createEmpid": "374915893923532146",
                "createTime": 1663656667000,
                "expectedScore": 0.7,
                "fullCycle": 1,
                "graphFlow": {
                    "id": 510,
                    "nodes": [
                        {
                            "id": 30527,
                            "index": 1,
                            "name": "开始",
                            "nextNodes": [
                                {
                                    "nextNodeId": 30528
                                }
                            ],
                            "nodeType": "startNode",
                            "rid": 30527
                        },
                        {
                            "content": "{\"nodeId\":\"b58a11db-dda4-4567-91fb-f0704f83d6ce\"}",
                            "id": 30528,
                            "index": 3,
                            "name": "判断节点A",
                            "nextNodes": [
                                {
                                    "name": "条件分支A",
                                    "nextNodeId": 30529,
                                    "situation": {
                                        "conditionGroup": [
                                            {
                                                "conditions": [
                                                    {
                                                        "dataType": 2,
                                                        "field": "system.customerServiceName",
                                                        "fieldType": 1,
                                                        "symbol": 1,
                                                        "value": "[\"ServiceA\"]"
                                                    }
                                                ],
                                                "type": "and"
                                            },
                                            {
                                                "conditions": [
                                                    {
                                                        "dataType": 2,
                                                        "field": "system.customerServiceName",
                                                        "fieldType": 1,
                                                        "symbol": 1,
                                                        "value": "[\"1\"]"
                                                    }
                                                ],
                                                "type": "and"
                                            }
                                        ],
                                        "type": "or"
                                    }
                                },
                                {
                                    "name": "不满足以上所有条件",
                                    "nextNodeId": 30530
                                }
                            ],
                            "nodeType": "judgmentNode",
                            "rid": 30528
                        },
                        {
                            "conditions": [
                                {
                                    "check_range": {
                                        "role": "客服"
                                    },
                                    "cid": "a",
                                    "id": 92497,
                                    "lambda": "93291",
                                    "operators": [
                                        {
                                            "id": 93291,
                                            "oid": "93291",
                                            "param": {
                                                "contextChatMatch": false,
                                                "in_sentence": false,
                                                "keywordMatchSize": 1,
                                                "keywords": [
                                                    "你好"
                                                ],
                                                "near_dialogue": false,
                                                "useEasAlgorithm": false
                                            },
                                            "type": "HIT_ANY_KEYWORDS"
                                        }
                                    ],
                                    "rid": "30529"
                                }
                            ],
                            "content": "{\"nodeId\":\"783ac141-23cf-45b3-a5b0-3864f9e6ddff\"}",
                            "id": 30529,
                            "index": 5,
                            "name": "你好",
                            "nextNodes": [],
                            "nodeType": "conditionNode",
                            "properties": {
                                "lambda": "a",
                                "role": "agent",
                                "ruleScoreType": 1,
                                "scoreNum": 0,
                                "scoreNumType": 0,
                                "scoreRuleHitType": 0,
                                "scoreType": 1,
                                "triggers": [
                                    "a"
                                ]
                            },
                            "rid": 30529
                        },
                        {
                            "conditions": [
                                {
                                    "check_range": {
                                        "role": "客服"
                                    },
                                    "cid": "a",
                                    "id": 92498,
                                    "lambda": "93292",
                                    "operators": [
                                        {
                                            "id": 93292,
                                            "oid": "93292",
                                            "param": {
                                                "contextChatMatch": false,
                                                "in_sentence": false,
                                                "keywordMatchSize": 1,
                                                "keywords": [
                                                    "再见"
                                                ],
                                                "near_dialogue": false,
                                                "useEasAlgorithm": false
                                            },
                                            "type": "HIT_ANY_KEYWORDS"
                                        }
                                    ],
                                    "rid": "30530"
                                }
                            ],
                            "content": "{\"nodeId\":\"749ac2d3-c418-4672-a018-673c4e51123d\"}",
                            "id": 30530,
                            "index": 6,
                            "name": "再见",
                            "nextNodes": [],
                            "nodeType": "conditionNode",
                            "properties": {
                                "lambda": "a",
                                "role": "agent",
                                "ruleScoreType": 1,
                                "scoreNum": 0,
                                "scoreNumType": 0,
                                "scoreRuleHitType": 0,
                                "scoreType": 1,
                                "triggers": [
                                    "a"
                                ]
                            },
                            "rid": 30530
                        }
                    ],
                    "showProperties": "{\"cells\":[{\"shape\":\"dag-edge\",\"attrs\":{\"line\":{\"strokeDasharray\":\"\"}},\"id\":\"6d7796a9-f6e1-4e53-a384-16a738581c54\",\"zIndex\":-1,\"source\":{\"cell\":\"b58a11db-dda4-4567-91fb-f0704f83d6ce\",\"port\":\"f3707b26-9674-4411-8744-0687bf4a1a4e\"},\"target\":{\"cell\":\"783ac141-23cf-45b3-a5b0-3864f9e6ddff\",\"port\":\"488a2b51-45ef-4a7f-a100-8a174553c0d7\"}},{\"shape\":\"dag-edge\",\"attrs\":{\"line\":{\"strokeDasharray\":\"\"}},\"id\":\"9afc6a87-c47f-497c-beef-c7e940603102\",\"zIndex\":-1,\"source\":{\"cell\":\"b58a11db-dda4-4567-91fb-f0704f83d6ce\",\"port\":\"fac0e53a-fef8-42b2-b986-99154da6f3c4\"},\"target\":{\"cell\":\"749ac2d3-c418-4672-a018-673c4e51123d\",\"port\":\"4928272d-45d5-403c-a50d-11e7c9dbc322\"}},{\"shape\":\"dag-edge\",\"attrs\":{\"line\":{\"strokeDasharray\":\"\"}},\"id\":\"413ab17d-7287-4123-9147-108898965a87\",\"zIndex\":-1,\"source\":{\"cell\":\"0c2bdcf2-99a6-430a-b31c-1eb87d7e9801\",\"port\":\"f16c4469-535c-40b5-91a5-e18dbd62300e\"},\"target\":{\"cell\":\"b58a11db-dda4-4567-91fb-f0704f83d6ce\",\"port\":\"1c06a9c9-1cc3-4c36-826b-5e334df1b09c\"}},{\"position\":{\"x\":90,\"y\":230},\"size\":{\"width\":90,\"height\":36},\"attrs\":{\"text\":{\"text\":\"开始\"},\"body\":{\"rx\":4,\"ry\":4,\"strokeWidth\":0,\"fill\":\"#5C7AAA\"},\"label\":{\"fill\":\"#fff\",\"fontSize\":12}},\"visible\":true,\"shape\":\"rect\",\"id\":\"0c2bdcf2-99a6-430a-b31c-1eb87d7e9801\",\"data\":{\"nodeType\":\"startNode\"},\"ports\":{\"groups\":{\"out\":{\"position\":{\"name\":\"right\"},\"attrs\":{\"circle\":{\"r\":4,\"magnet\":true,\"stroke\":\"#5F95FF\",\"strokeWidth\":1,\"fill\":\"#fff\",\"style\":{\"visibility\":\"visible\"}}}}},\"items\":[{\"group\":\"out\",\"id\":\"f16c4469-535c-40b5-91a5-e18dbd62300e\"}]},\"zIndex\":1},{\"position\":{\"x\":262,\"y\":182},\"size\":{\"width\":160,\"height\":132},\"view\":\"react-shape-view\",\"shape\":\"judge-node\",\"component\":{\"key\":null,\"ref\":null,\"props\":{\"hitSopRids\":[],\"isReadOnly\":[]},\"_owner\":null},\"ports\":{\"groups\":{\"in\":{\"position\":\"left\",\"attrs\":{\"circle\":{\"r\":4,\"magnet\":\"passive\",\"stroke\":\"#C2C8D5\",\"strokeWidth\":1,\"fill\":\"#fff\"}}},\"out\":{\"position\":\"absolute\",\"attrs\":{\"circle\":{\"r\":4,\"magnet\":true,\"stroke\":\"#C2C8D5\",\"strokeWidth\":1,\"fill\":\"#fff\"}}}},\"items\":[{\"group\":\"in\",\"id\":\"1c06a9c9-1cc3-4c36-826b-5e334df1b09c\"},{\"group\":\"out\",\"args\":{\"x\":152,\"y\":66,\"index\":0},\"id\":\"f3707b26-9674-4411-8744-0687bf4a1a4e\"},{\"group\":\"out\",\"args\":{\"x\":152,\"y\":106,\"index\":1},\"id\":\"fac0e53a-fef8-42b2-b986-99154da6f3c4\"}]},\"id\":\"b58a11db-dda4-4567-91fb-f0704f83d6ce\",\"data\":{\"nodeType\":\"judgmentNode\"},\"zIndex\":3},{\"position\":{\"x\":500,\"y\":150},\"size\":{\"width\":160,\"height\":60},\"view\":\"react-shape-view\",\"shape\":\"dialogue-node\",\"component\":{\"key\":null,\"ref\":null,\"props\":{\"hitSopRids\":[],\"isReadOnly\":[]},\"_owner\":null},\"ports\":{\"groups\":{\"in\":{\"position\":\"left\",\"attrs\":{\"circle\":{\"r\":4,\"magnet\":\"passive\",\"stroke\":\"#C2C8D5\",\"strokeWidth\":1,\"fill\":\"#fff\"}}},\"out\":{\"position\":\"right\",\"attrs\":{\"circle\":{\"r\":4,\"magnet\":true,\"stroke\":\"#C2C8D5\",\"strokeWidth\":1,\"fill\":\"#fff\"}}}},\"items\":[{\"group\":\"in\",\"id\":\"488a2b51-45ef-4a7f-a100-8a174553c0d7\"},{\"group\":\"out\",\"id\":\"959754b9-61bf-4538-876c-b71e395f7ea2\"}]},\"id\":\"783ac141-23cf-45b3-a5b0-3864f9e6ddff\",\"data\":{\"nodeType\":\"conditionNode\"},\"zIndex\":5},{\"position\":{\"x\":500,\"y\":314},\"size\":{\"width\":160,\"height\":60},\"view\":\"react-shape-view\",\"shape\":\"dialogue-node\",\"component\":{\"key\":null,\"ref\":null,\"props\":{\"hitSopRids\":[],\"isReadOnly\":[]},\"_owner\":null},\"ports\":{\"groups\":{\"in\":{\"position\":\"left\",\"attrs\":{\"circle\":{\"r\":4,\"magnet\":\"passive\",\"stroke\":\"#C2C8D5\",\"strokeWidth\":1,\"fill\":\"#fff\"}}},\"out\":{\"position\":\"right\",\"attrs\":{\"circle\":{\"r\":4,\"magnet\":true,\"stroke\":\"#C2C8D5\",\"strokeWidth\":1,\"fill\":\"#fff\"}}}},\"items\":[{\"group\":\"in\",\"id\":\"4928272d-45d5-403c-a50d-11e7c9dbc322\"},{\"group\":\"out\",\"id\":\"2c5cd64a-f96f-4400-ae3a-ec080d69d742\"}]},\"id\":\"749ac2d3-c418-4672-a018-673c4e51123d\",\"data\":{\"nodeType\":\"conditionNode\"},\"zIndex\":6}]}",
                    "skipWhenFirstSessionNodeMiss": false
                },
                "isDelete": 0,
                "isOnline": 0,
                "lambda": "\"\"",
                "lastUpdateEmpid": "374915893923532146",
                "lastUpdateTime": 1663656667000,
                "level": 2,
                "meet": 1,
                "name": "流程质检规则Demo",
                "qualityCheckType": 0,
                "rid": "30531",
                "ridLong": 30531,
                "ruleScoreType": 1,
                "ruleType": 1,
                "scoreNum": 0,
                "scoreNumType": 0,
                "scoreRuleHitType": 0,
                "scoreType": 1,
                "status": 0,
                "targetType": 11,
                "taskFlowId": 510,
                "taskFlowType": 1,
                "type": -1
            }
        ]
    }
}

  • 本页导读 (0)
文档反馈