反馈已提交

网络繁忙

您正在浏览的是 FineBI7.X 帮助文档,点击跳转至: FineBI6.X帮助文档

Chat 接口说明

  • 文档创建者:Lily.Wang
  • 历史版本:7
  • 最近更新:Lily.Wang 于 2025-08-26
  • 1. 概述

    Chat 接口是核心问答接口,接受提问作为入参,返回查询到的数据。

    2. 接口说明

    2.1 请求说明

    请求信息

    请求地址:webroot/decision/v1/ai/conversation/api/session/chat
    请求方式:POST

    请求头

    参数名
    类型是否必填说明
    AuthorizationStringBearer 单点登录返回的 token,用于身份验证
    chatSessionIdStringOpen session 返回的 session token

    请求体

    参数名
    类型是否必填说明
    sentenceIcutPost否,但 sentence 和 question 必填其一用户提问问句的此块
    questionString否,但 sentence 和 question 必填其一用户的问题

    以下为 IcutPost 的结构:

    interface ICutPost {
      subjectId: string | null; // 主题id,建议必传
      tokens: ICutProps[]; // 用户输入形成的数组
      query: string; // 用户的文本输入
      editable: boolean; // 用户有没有显式的指定模型,对切词结果较为确定,则配置为false,否则为true
      modelId: string | null; // 主题内模型id,可为null
    }

    interface ICutProps {
      // 词块的内容
      text: string;
      // 词块的内容
      fuzzMatchText: string;
      // 词块的类型
      type: CutPropsTypeEnum;
      // 这个词块是否可以被替换
      editable: boolean;
      // 表示这个分词结果还可能代表别的含义, 嵌套结构
      similarList: ICutProps[];
      // 这个词块的第一个字符在本句话中的位置
      startIndex: number;
      // 这个词块的最后一个字符在本句话中的位置
      endIndex: number;
      // 字段名称, 当type为维度、维度枚举值或者指标时,此项为必填值
      tableField?: string;
      // 表名称, 当type为维度、维度枚举值或者指标时,此项为必填值
      tableId?: string;
      // 字段id,这里是分析思路配置的时候保存的时候带上的,其他情况下没有
      fieldId?: string | null;
    }

    enum CutPropsTypeEnum {
      // 维度 门店,城市,省份 也就列名 @必要
      DIMENSION = "DIMENSION",
      // 指标  @必要
      METRIC = "METRIC",
      // 维度枚举值  @必要
      DIMENSION_ENUM = "DIMENSION_ENUM",
      // 日期维度, 如入库时间, 出库时间
      DATE_DIMENSION = "DATE_DIMENSION",
      // 表名称
      TABLE_NAME = "TABLE_NAME",
      // 日期范围, 如去年,今年, 2023年
      DATE_RANGE = "DATE_RANGE",
      // 时间单位, 每年,每月
      TIMEUNIT = "TIMEUNIT",
      // 数值
      NUMBER = "NUMBER",
      // 聚合方式, 如求和 最大值 最小值 方差
      AGGREGATE_TYPE = "AGGREGATE_TYPE",
      // 快速计算 如同比 环比 环比增长率
      SWIFT_COMPUTE_TYPE = "SWIFT_COMPUTE_TYPE",
      // 计算符 大于 小于 > <
      OPERATOR = "OPERATOR",
      // 自定义词
      SLANG = "SLANG",
      ORIGIN = "ORIGIN",
      SPACE = "SPACE",
      DELETE = "DELETE",
      // 参数
      PARAMETER = "PARAMETER",
      // 不清楚具体含义,如果不知道或者识别不出来, 就设为此值
      UNK = "UNK",
      // 不知道具体含义,但是知道是名词
      UNK_NOUN = "UNK_NOUN",
      // 不知道具体含义,但是知道是动词
      UNK_VERB = "UNK_VERB",
      // 紧跟维度的维度枚举值
      STRING_FUNCTION_VALUE = "STRING_FUNCTION_VALUE",
      // 维度值
      METRIC_VALUE = "METRIC_VALUE",
      // 指标值
      DIMENSION_VALUE = "DIMENSION_VALUE",
    }

    IcutPost 切词样例一:指标卡展示成人行李重量儿童和航班号。

    {
      "sentence": {
      "subjectId": "51eba202d6f8476f8802ad60a95371e5",
      "tokens": [
        {
          "tableField": "",
          "tableId": "",
          "text": "指标卡",
          "type": "VIS",
          "editable": true,
          "similarList": [],
          "startIndex": 0,
          "endIndex": 2,
          "fieldId": null,
          "fuzzMatchText": "",
          "fuzzMatchList": [],
          "expandedTokens": []
        },
        {
          "tableField": "",
          "tableId": "",
          "text": "展示",
          "type": "UNK_VERB",
          "editable": true,
          "similarList": [],
          "startIndex": 3,
          "endIndex": 4,
          "fieldId": null,
          "fuzzMatchText": "",
          "fuzzMatchList": [],
          "expandedTokens": []
        },
        {
          "tableField": "成人",
          "tableId": "航空运输分析数据",
          "text": "成人",
          "type": "METRIC",
          "editable": true,
          "similarList": [],
          "startIndex": 5,
          "endIndex": 6,
          "fieldId": null,
          "fuzzMatchText": "",
          "fuzzMatchList": [],
          "expandedTokens": []
        },
        {
          "tableField": "行李重量",
          "tableId": "航空运输分析数据",
          "text": "行李重量",
          "type": "METRIC",
          "editable": true,
          "similarList": [],
          "startIndex": 7,
          "endIndex": 10,
          "fieldId": null,
          "fuzzMatchText": "",
          "fuzzMatchList": [],
          "expandedTokens": []
        },
        {
          "tableField": "儿童",
          "tableId": "航空运输分析数据",
          "text": "儿童",
          "type": "METRIC",
          "editable": true,
          "similarList": [],
          "startIndex": 11,
          "endIndex": 12,
          "fieldId": null,
          "fuzzMatchText": "",
          "fuzzMatchList": [],
          "expandedTokens": []
        },
        {
          "tableField": "",
          "tableId": "",
          "text": "和",
          "type": "UNK",
          "editable": true,
          "similarList": [],
          "startIndex": 13,
          "endIndex": 13,
          "fieldId": null,
          "fuzzMatchText": "",
          "fuzzMatchList": [],
          "expandedTokens": []
        },
        {
          "tableField": "航班号",
          "tableId": "航空运输分析数据",
          "text": "航班号",
          "type": "DIMENSION",
          "editable": true,
          "similarList": [],
          "startIndex": 14,
          "endIndex": 16,
          "fieldId": null,
          "fuzzMatchText": "",
          "fuzzMatchList": [],
          "expandedTokens": []
        }
      ],
      "query": "指标卡展示成人行李重量儿童和航班号",
      "editable": true,
      "modelId": "航空运输分析数据"
    }
    }

    IcutPost 切词样例二:明细表展示成人行李重量儿童和航班号。

    {
      "sentence": {
      "subjectId": "51eba202d6f8476f8802ad60a95371e5",
      "tokens": [
        {
          "tableField": "",
          "tableId": "",
          "text": "明细表",
          "type": "UNK_NOUN",
          "editable": true,
          "similarList": [],
          "startIndex": 0,
          "endIndex": 2,
          "fieldId": null,
          "fuzzMatchText": "",
          "fuzzMatchList": [],
          "expandedTokens": []
        },
        {
          "tableField": "",
          "tableId": "",
          "text": "展示",
          "type": "UNK_VERB",
          "editable": true,
          "similarList": [],
          "startIndex": 3,
          "endIndex": 4,
          "fieldId": null,
          "fuzzMatchText": "",
          "fuzzMatchList": [],
          "expandedTokens": []
        },
        {
          "tableField": "成人",
          "tableId": "航空运输分析数据",
          "text": "成人",
          "type": "METRIC",
          "editable": true,
          "similarList": [],
          "startIndex": 5,
          "endIndex": 6,
          "fieldId": null,
          "fuzzMatchText": "",
          "fuzzMatchList": [],
          "expandedTokens": []
        },
        {
          "tableField": "行李重量",
          "tableId": "航空运输分析数据",
          "text": "行李重量",
          "type": "METRIC",
          "editable": true,
          "similarList": [],
          "startIndex": 7,
          "endIndex": 10,
          "fieldId": null,
          "fuzzMatchText": "",
          "fuzzMatchList": [],
          "expandedTokens": []
        },
        {
          "tableField": "儿童",
          "tableId": "航空运输分析数据",
          "text": "儿童",
          "type": "METRIC",
          "editable": true,
          "similarList": [],
          "startIndex": 11,
          "endIndex": 12,
          "fieldId": null,
          "fuzzMatchText": "",
          "fuzzMatchList": [],
          "expandedTokens": []
        },
        {
          "tableField": "",
          "tableId": "",
          "text": "和",
          "type": "UNK",
          "editable": true,
          "similarList": [],
          "startIndex": 13,
          "endIndex": 13,
          "fieldId": null,
          "fuzzMatchText": "",
          "fuzzMatchList": [],
          "expandedTokens": []
        },
        {
          "tableField": "航班号",
          "tableId": "航空运输分析数据",
          "text": "航班号",
          "type": "DIMENSION",
          "editable": true,
          "similarList": [],
          "startIndex": 14,
          "endIndex": 16,
          "fieldId": null,
          "fuzzMatchText": "",
          "fuzzMatchList": [],
          "expandedTokens": []
        }
      ],
      "query": "明细表展示成人行李重量儿童和航班号",
      "editable": true,
      "modelId": "航空运输分析数据"
    }
    }

    question 样例:指标卡展示成人行李重量儿童和航班号。

    {
      "question": "指标卡展示成人行李重量儿童和航班号"
    }

    2.2 响应说明

    请求成功后,服务器会返回以下参数:

    参数名
    类型说明
    answer

    ApiChatResultData

    查询到的答案

    以下是 ApiChatResultData 的结构:

    interface ApiChatResultData {
      queryId: string;      
      results: IChatReturnData[];
    }

    interface IChatReturnData {
      headers: HeaderCell[];
      items: any[][];  // 二维数组,表示返回的结果
      chartType: string;  // 帆软推荐的
      hasNext: boolean;   // 表示是否可以翻下一页
      hasPrev: boolean;   // 表示是否可以翻上一页
      pageNo: number;        // 当前页码
      pageSize: number;      // 本页数据量
      [key: string]: any;  // 后续扩展
    }

    interface HeaderCell {
      fieldId: string | null; // 字段ID
      fieldType: string | null; // 字段类型:指标/维度
      text: string; // 列名
      unit: string | null; // 单位
      did: string; // 字段did,唯一标识
      [key: string]: any; // 后续扩展一些单位相关的附加参数
    }

    样例一:指标卡展示成人行李重量儿童和航班号

    {
      "data": {
        "queryId": "728cd66a-4955-467b-b8f5-8282b8de4f72",
        "results": [
          {
            "chartType": "KPI",
            "hasNext": true,
            "hasPrev": false,
            "pageNo": 1,
            "pageSize": 20,
            "headers": [
              {
                "fieldId": "航空运输分析数据_[822a][73ed][53f7]",
                "fieldType": "Dimension",
                "text": "航班号",
                "unit": null,
                "did": "e691781d9bc1438393689d71970bebd4"
              },
              {
                "fieldId": "航空运输分析数据_[6210][4eba]",
                "fieldType": "Metric",
                "text": "成人",
                "unit": "个",
                "did": "f0731820a4924ad79a449ac9588cfa25"
              },
              {
                "fieldId": "航空运输分析数据_[884c][674e][91cd][91cf]",
                "fieldType": "Metric",
                "text": "行李重量",
                "unit": null,
                "did": "985ba6e93bff4e78aaac61dabf764da4"
              },
              {
                "fieldId": "航空运输分析数据_[513f][7ae5]",
                "fieldType": "Metric",
                "text": "儿童",
                "unit": "孩子",
                "did": "a96c0658bb74477a988dc51687270777"
              }
            ],
            "items": [
              [
                null,
                "1033",
                "1034",
                "1039",
                "1040",
                "1069",
                "1070",
                "1083",
                "1084",
                "1085",
                "1086",
                "1087",
                "1088",
                "1119",
                "1120",
                "1561",
                "1562",
                "1817",
                "1818",
                "1819"
              ],
              [
                "0",
                "236",
                "89",
                "213",
                "283",
                "184",
                "185",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "177",
                "172",
                "99",
                "161",
                "118",
                "137",
                "127"
              ],
              [
                "0",
                "1,978",
                "690",
                "2,218",
                "2,391",
                "1,620",
                "718",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "1,095",
                "1,357",
                "1,352",
                "2,211",
                "1,577",
                "1,231",
                "1,501"
              ],
              [
                "0",
                "1",
                "0",
                "4",
                "5",
                "3",
                "1",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "1",
                "3",
                "2",
                "2",
                "2",
                "5",
                "1"
              ]
            ]
          }
        ]
      }
    }

    样例二:明细表展示成人行李重量儿童和航班号

    {
      "data": {
        "queryId": "066a8445-be66-44bc-a3b9-acd40bf5e548",
        "results": [
          {
            "chartType": "DETAIL_TABLE",
            "hasNext": true,
            "hasPrev": false,
            "pageNo": 1,
            "pageSize": 100,
            "headers": [
              {
                "fieldId": "航空运输分析数据_[822a][73ed][53f7]",
                "fieldType": "Dimension",
                "text": "航班号",
                "unit": null,
                "did": "ce9dd1e03fa34a7db132504597ceeb33"
              },
              {
                "fieldId": "航空运输分析数据_[6210][4eba]",
                "fieldType": "Metric",
                "text": "成人",
                "unit": "个",
                "did": "0b5b47eea06440059d0c2588c8df9ab2"
              },
              {
                "fieldId": "航空运输分析数据_[884c][674e][91cd][91cf]",
                "fieldType": "Metric",
                "text": "行李重量",
                "unit": null,
                "did": "b12fe85cc2e8446eaf786099a8b651c6"
              },
              {
                "fieldId": "航空运输分析数据_[513f][7ae5]",
                "fieldType": "Metric",
                "text": "儿童",
                "unit": "孩子",
                "did": "484d0d0d3a194f7ba1247c6da1b1f0ce"
              }
            ],
            "items": [
              [
                "8117",
                "8118",
                "8177",
                "8178",
                "8533",
                "8533",
                "8534",
                "8534",
                "8543",
                "8544",
                "8585",
                "8586",
                "8839",
                "8839",
                "8840",
                "8840",
                "8923",
                "8924",
                "9709",
                "9709",
                "9710",
                "9710",
                "9883",
                "9884",
                null,
                "7111",
                "7111",
                "7112",
                "7112",
                "987",
                "988",
                "1033",
                "1033",
                "1034",
                "1039",
                "1039",
                "1040",
                "1040",
                "1069",
                "1070",
                "1119",
                "1120",
                "2889",
                "2890",
                "1083",
                "1084",
                "1085",
                "1086",
                "1087",
                "1087",
                "1088",
                "1561",
                "1562",
                "1817",
                "1818",
                "1819",
                "1820",
                "1847",
                "1848",
                "4505",
                "4506",
                "4557",
                "4558",
                "8365",
                "8366",
                "9005",
                "9006",
                "9007",
                "9007",
                "9008",
                "9008",
                "9015",
                "9016",
                "9017",
                "9018",
                "9023",
                "9023",
                "9024",
                "9024",
                "9028",
                "9033",
                "9034",
                "9037",
                "9038",
                "9041",
                "9042",
                "9061",
                "9061",
                "9065",
                "9069",
                "9069",
                "9070",
                "9070",
                "9075",
                "9076",
                "9076",
                "9080",
                "9080",
                "9091",
                "9092"
              ],
              [
                "150",
                "134",
                "182",
                "182",
                "49",
                "75",
                "74",
                "52",
                "156",
                "134",
                "183",
                "189",
                "96",
                "88",
                "93",
                "87",
                "141",
                "142",
                "112",
                "60",
                "93",
                "53",
                "176",
                "155",
                "0",
                "133",
                "131",
                "98",
                "104",
                "349",
                "191",
                "120",
                "116",
                "89",
                "103",
                "110",
                "138",
                "145",
                "184",
                "185",
                "177",
                "172",
                "164",
                "157",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "99",
                "161",
                "118",
                "137",
                "127",
                "118",
                "120",
                "122",
                "164",
                "156",
                "162",
                "132",
                "139",
                "128",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0"
              ],
              [
                "1312",
                "1127",
                "1417",
                "1184",
                "408",
                "474",
                "802",
                "469",
                "1199",
                "942",
                "1413",
                "1972",
                "628",
                "1123",
                "724",
                "893",
                "1083",
                "1270",
                "804",
                "293",
                "330",
                "193",
                "1108",
                "809",
                "0",
                "1338",
                "948",
                "691",
                "662",
                "6516",
                "2236",
                "748",
                "1230",
                "690",
                "1318",
                "900",
                "1456",
                "935",
                "1620",
                "718",
                "1095",
                "1357",
                "1497",
                "1198",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "1352",
                "2211",
                "1577",
                "1231",
                "1501",
                "1632",
                "696",
                "1062",
                "1059",
                "1226",
                "1390",
                "807",
                "1085",
                "638",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0"
              ],
              [
                "3",
                "0",
                "2",
                "2",
                "0",
                "2",
                "0",
                "1",
                "4",
                "0",
                "3",
                "2",
                "0",
                "0",
                "0",
                "0",
                "0",
                "3",
                "3",
                "2",
                "6",
                "0",
                "3",
                "1",
                "0",
                "0",
                "1",
                "4",
                "2",
                "21",
                "7",
                "1",
                "0",
                "0",
                "4",
                "0",
                "2",
                "3",
                "3",
                "1",
                "1",
                "3",
                "3",
                "1",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "2",
                "2",
                "2",
                "5",
                "1",
                "1",
                "1",
                "3",
                "3",
                "2",
                "3",
                "2",
                "1",
                "3",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0",
                "0"
              ]
            ]
          }
        ]
      }
    }


    附件列表


    主题: FineChatBI智能问答
    • 有帮助
    • 没帮助
    • 只是浏览
    中文(简体)

    鼠标选中内容,快速反馈问题

    鼠标选中存在疑惑的内容,即可快速反馈问题,我们将会跟进处理。

    不再提示

    10s后关闭

    联系我们
    在线支持
    获取专业技术支持,快速帮助您解决问题
    工作日9:00-12:00,13:30-17:30在线
    页面反馈
    针对当前网页的建议、问题反馈
    售前咨询
    采购需求/获取报价/预约演示
    或拨打: 400-811-8890 转1
    qr
    热线电话
    咨询/故障救援热线:400-811-8890转2
    总裁办24H投诉:17312781526
    提交页面反馈
    仅适用于当前网页的意见收集,帆软产品问题请在 问答板块提问前往服务平台 获取技术支持