2.6.1-Document File Knowledge Upload

1. Overview

  • Interface name: File knowledge import

  • Version number: v1.0.0

2. Information

Note: The request is in form, application/form-data

  • Request method: POST

  • Request URL: https://DOMAIN/openapi/v1/knowledge/file/

  • Domain: Refer to "Service address description"

3. Request parameters

Request header http header field:

Parameter name
Type
Required
Description

cybertron-robot-key

string

Yes

Robot key

cybertron-robot-token

string

Yes

Robot token

Request body field:

Parameter name
Type
Required
Description

username

string

Yes

User account

file

file

Yes

Use Q&A in the file, press-%@#&*&#@%-Dividing rows

knowledge_base_id

string

Yes

Knowledge Base id

folder_id

string

No

Folder id needs to be imported

split_method

string

No

Exampleintelligence

split_method_meta

string

No

Example{"length":300}

file_name

string

No

Examplecontent_article.txt

4. Response field description

HTTP status code: 200 OK

Response field description:

Field Name
Type
Description

code

string

"000000" is normal, other exceptions

message

string

Status description

data

object

message body

id

int

File knowledge id

5. Example

Request Example:

curl 'https://_DOMAIN_/openapi/v1/knowledge/file/' \
-H 'cybertron-robot-key: l8ia2IOc************Z724%2BU%3D' \
-H 'cybertron-robot-token: MTc0Mzk5************************************************cGRCUTg9' \
-X POST \
-F 'username=me@host.com' \
-F 'file=@path/to/knowledge.txt' \
-F 'knowledge_base_id=324' \
-F 'folder_id=2936' \
-F 'split_method=intelligence' \
-F 'split_method_meta={"length":300}' \
-F 'file_name=content_article.txt'

Response example:

{
    "code": "000000",
    "message": "The file upload was successful! Learning...",
    "data": {
        "id": 3026,
        "emb_status": 1
    }
}