场景管理接口

概念

intents接口用于对普通场景进行增删改查操作

URLs

基本的url:

url 说明 备注
GET /intents 获取所有场景 暂无
GET /intents/{iid} 获取单个场景 暂无
POST /intents 添加单个场景 暂无
PUT /intents/{iid} 修改单个场景 暂无
DELETE /intents/{iid} 删除场景 暂无

GET /intents

获取所有场景

GET http://api.yige.ai/v1/intents
Headers:
Authorization:您的开发者令牌

CURL示例:

curl -k -H "Authorization:164D4FEED7748EA14717994437A4BCB6" \
"http://api.yige.ai/v1/intents"

响应示例:

{
  "intents": [
    {
      "id": "C6DB0A0C-5DE5-03F3-07EC-F509E9F2935B",
      "agent_id": "83B75F47-A75C-394C-AEC4-20AC6134C12E",
      "name": "2.2-信息否认"
    },
    {
      "id": "AC9A1A3D-F449-ACA0-26E4-D750FC43C186",
      "agent_id": "83B75F47-A75C-394C-AEC4-20AC6134C12E",
      "name": "3-推荐完成"
    },
    {
      "id": "BC88911A-7BDF-68A1-32B5-76996EE68A76",
      "agent_id": "83B75F47-A75C-394C-AEC4-20AC6134C12E",
      "name": "0.3.3-介绍脚型-足外翻"
    },
    {
      "id": "59DC1A61-FC5A-7DBB-D7B1-E985065B2EC7",
      "agent_id": "83B75F47-A75C-394C-AEC4-20AC6134C12E",
      "name": "0.3.2-介绍脚型-正常内旋"
    },
    {
      "id": "240E7503-EEAE-C572-FAE2-5E2F86A0D52D",
      "agent_id": "83B75F47-A75C-394C-AEC4-20AC6134C12E",
      "name": "询问父母"
    },
    {
      "id": "4AE46DBC-3EC0-36E1-08C3-863E85B6D382",
      "agent_id": "83B75F47-A75C-394C-AEC4-20AC6134C12E",
      "name": "询问地区"
    },
    {
      "id": "4CCF9220-8FFC-226D-A73C-D866671BFD64",
      "agent_id": "83B75F47-A75C-394C-AEC4-20AC6134C12E",
      "name": "询问性别"
    },
    {
      "id": "D7C2E894-213F-C0E5-954E-6F69A5C2BAE0",
      "agent_id": "83B75F47-A75C-394C-AEC4-20AC6134C12E",
      "name": "询问年龄"
    },
    {
      "id": "7EA62983-02AE-7AD8-462B-7CE45843CA36",
      "agent_id": "83B75F47-A75C-394C-AEC4-20AC6134C12E",
      "name": "询问姓名"
    },
    {
      "id": "9DE729F2-57A9-1238-5646-1D6BE8D3F832",
      "agent_id": "83B75F47-A75C-394C-AEC4-20AC6134C12E",
      "name": "1.4-性别-修改"
    },
    {
      "id": "6968210A-A580-2344-1599-FFD0CD4615DB",
      "agent_id": "83B75F47-A75C-394C-AEC4-20AC6134C12E",
      "name": "0.4-介绍鞋型"
    },
    {
      "id": "81ED041E-D917-4347-C9BB-061442F4CD18",
      "agent_id": "83B75F47-A75C-394C-AEC4-20AC6134C12E",
      "name": "0.3.1-介绍脚型-足内翻"
    },
    {
      "id": "E1D5F876-8CF2-7B74-18D0-F2042A1B8E17",
      "agent_id": "83B75F47-A75C-394C-AEC4-20AC6134C12E",
      "name": "0.2-打招呼-否认推荐跑鞋"
    },
    {
      "id": "8B207525-69DF-A37D-35CB-378929654970",
      "agent_id": "83B75F47-A75C-394C-AEC4-20AC6134C12E",
      "name": "0.1-打招呼-确认推荐跑鞋"
    },
    {
      "id": "0B24A5EE-8DCA-1EF2-11B9-99FE30E327E6",
      "agent_id": "83B75F47-A75C-394C-AEC4-20AC6134C12E",
      "name": "0.0-打招呼"
    },
    {
      "id": "80FC29F5-E343-1DEF-0052-02432E7FE872",
      "agent_id": "83B75F47-A75C-394C-AEC4-20AC6134C12E",
      "name": "2-信息确认"
    },
    {
      "id": "93119830-524A-1819-B42F-F5DF1D8D78E8",
      "agent_id": "83B75F47-A75C-394C-AEC4-20AC6134C12E",
      "name": "1.3-价格-修改"
    },
    {
      "id": "68BC4818-1EFD-06A8-3534-E9FD72109A61",
      "agent_id": "83B75F47-A75C-394C-AEC4-20AC6134C12E",
      "name": "1.2-公里数-修改"
    },
    {
      "id": "E7C404D9-84AB-EE44-B93D-0B7092DE47A2",
      "agent_id": "83B75F47-A75C-394C-AEC4-20AC6134C12E",
      "name": "1.1-脚型-修改"
    },
    {
      "id": "A932D001-2534-16ED-8218-27CA22D2EF3B",
      "agent_id": "83B75F47-A75C-394C-AEC4-20AC6134C12E",
      "name": "1-参数-识别"
    },
    {
      "id": "073E5277-68B9-C660-1035-2A0C968387EB",
      "agent_id": "83B75F47-A75C-394C-AEC4-20AC6134C12E",
      "name": "0-跑鞋推荐"
    },
    {
      "id": "DB0A8B6E-CD8C-0642-9145-B4780F71488F",
      "agent_id": "83B75F47-A75C-394C-AEC4-20AC6134C12E",
      "name": "邮费咨询"
    }
  ],
  "status": {
    "code": 200,
    "error_msg": ""
  }
}

GET /intents/{iid}

获取单个场景

参数说明:

{iid} 您的场景ID

GET http://api.yige.ai/v1/intents/E2E9C243-5F84-DD7A-81D8-649C2CF68C59
Headers:
Authorization:您的开发者令牌

CURL示例:

curl -k -H "Authorization:164D4FEED7748EA14717994437A4BCB6" \
"http://api.yige.ai/v1/intents/77BD137F-105A-EEB7-0891-0D92165B1DCC"

响应示例:

{
  "intents": {
    "id": "77BD137F-105A-EEB7-0891-0D92165B1DCC",
    "name": "测试问答0-1",
    "contexts_in": "[]",
    "contexts_out": "[]",
    "contexts_out_status": 1,
    "priority": 500000,
    "webhook_used": 1,
    "auto": 0,
    "action": "",
    "context_in": [],
    "context_out": [],
    "responses": {
      "reset_contexts": 0,
      "speech": [
        "坐一号地铁",
        "自己驾车"
      ],
      "parameters": [
        {
          "required": 0,
          "data_type": "yige.address",
          "name": "address01",
          "value": "${address01}",
          "default_value": "",
          "prompts": [],
          "entity_id": null
        },
        {
          "required": 0,
          "data_type": "yige.address",
          "name": "address11",
          "value": "${address11}",
          "default_value": "",
          "prompts": [],
          "entity_id": null
        }
      ]
    },
    "userSays": [
      {
        "id": "F713C470-8368-33A4-2984-EEC314DD7AA6",
        "data": [
          {
            "text": "请问去"
          },
          {
            "text": "香山",
            "alias": "yige.address",
            "meta": "address01",
            "userDefined": false
          },
          {
            "text": "怎么走?"
          }
        ],
        "is_template": 0
      },
      {
        "id": "B3B6BCAF-7E39-4427-220E-6CC36D179C87",
        "data": [
          {
            "text": "去"
          },
          {
            "text": "香山",
            "alias": "yige.address",
            "meta": "address11",
            "userDefined": false
          },
          {
            "text": "应该怎么坐车?"
          }
        ],
        "is_template": 0
      }
    ]
  },
  "status": {
    "code": 200,
    "error_msg": "查询成功"
  }
}

POST /intents

向应用中添加场景

POST http://api.yige.ai/v1/intents/
Headers:
Authorization: 你的开发者令牌
Content-Type: application/json; charset=utf-8
POST body:
{
    "name" : "测试问答",
    "question": ["请问去天安门怎么走?"],
    "answer": ["坐一号地铁"]
}

CURL示例:

curl -k \
-H "Content-Type: application/json; charset=utf-8" \
-H "Authorization:164D4FEED7748EA14717994437A4BCB6" \
--data '{
    "name" : "测试问答",
    "question": ["请问去天安门怎么走?"],
    "answer": ["坐一号地铁"]
}' "http://api.yige.ai/v1/intents"

响应示例:

{
  "status": {
    "code": 200,
    "error_msg": "保存成功",
    "data": {
      "intent_id": "DB1D5170-A814-3C10-E5B9-DE0DE006C683"
    }
  }
}

PUT /intents/{iid}

根据场景id修改场景

cUrl示例:

curl -k -X PUT \
-H "Content-Type: application/json; charset=utf-8" \
-H "Authorization:164D4FEED7748EA14717994437A4BCB6" \
-d '{
    "name" : "测试问答-修改",
    "question": ["请问去香山怎么走?","去香山应该怎么坐车?"],
    "answer": ["坐一号地铁","自己驾车"]
}' "http://api.yige.ai/v1/intents/7155114B-9886-CAA3-DFD4-C43D9691CB23"

返回值:

{
  "status": {
    "code": 200,
    "error_msg": "修改成功"
  }
}

DELETE /intents/{iid}

根据词库id删除场景

DELETE http://api.yige.ai/v1/intents/7155114B-9886-CAA3-DFD4-C43D9691CB23
Headers:
Authorization:你的开发者令牌

curl示例:

curl -k -X DELETE  \
-H "Authorization:164D4FEED7748EA14717994437A4BCB6" \
"http://api.yige.ai/v1/intents/7155114B-9886-CAA3-DFD4-C43D9691CB23"

返回值:

{
  "status": {
    "code": 200,
    "error_msg": "删除成功"
  }
}

场景对象中的场景数组

名称 类型 描述
name String 场景名称
question Array of objects 问题对象数组
answer Array of objects 答案对象数组
{
    "name" : "测试问答-修改",
    "question": ["请问去香山怎么走?","去香山应该怎么坐车?"],
    "answer": ["坐一号地铁","自己驾车"]
}

results matching ""

    No results matching ""