跳至主要内容

新增文件知識

新增網頁或文章知識。

請求

POST https://apichat.twt.com/openapi/zhishi/create_doc

Header 參數

參數名類型必填說明
x-chat-signaturestringHMAC-SHA256 簽名
Acceptstring默認值:application/json
Content-Typestringapplication/json

Body 參數

參數名類型必填說明
appidstring應用標識
timestampinteger請求時間戳
ranstrstring隨機字串
lxinteger1 表示網頁,2 表示文章
urlstring[]網頁必填待解析的網頁地址,最多 10 條
mcstring文章必填文章標題,1 至 255 個字元
nrstring文章必填文章內容,1 至 2000 個字元

請求示例

{
"appid": "your-appid",
"timestamp": 1735689600,
"ranstr": "random-string",
"lx": 2,
"mc": "使用入門",
"nr": "歡迎使用本產品。"
}

返回響應

200 成功

參數名類型必填說明
codeinteger1 正常,-1 失敗
msgstring響應信息
data.idinteger本次新增的主要知識庫 ID
data.idsinteger[]本次實際建立的全部 ID;多個網頁地址可能建立多條知識
{
"code": 1,
"msg": "ok",
"data": {
"id": 1002,
"ids": [1002]
}
}

錯誤示例

{
"code": -1,
"msg": "參數錯誤",
"data": ""
}