xuan
Published on 2024-11-25 / 145 Visits
0

User API Interface

用户API接口 - Little Beauty AI

Server address: https://txapi-usa.lbai.ai

✅1. The stock analysis interface

Interface description

Look up the closing price of the stock and analyze the reasons for the rise and fall. Returns the last closing price of the previous trading day.

Interface address

POST /ai-api/v1/stock/info

Request Head

Authorization:Bearer user-xxxxxxxxxxxxxxxxxxxxxx (user token)Or Bearer cpn-xxxxxxxxxxxxxxxxxxxxxx (enterprise token)
Content-Type: application/json

Request parameters

Parameter name

Required

Type

Description

stocks_code

yes

String

Stock Code

stocks_name

no

String

Name of the stock

minimum_value

no

Decimal

Drop (for example, drop of 5% passes 0.05)

maximum_value

no

Decimal

Increase (for example, increase by 5% and pass by 0.05)

Sample request

curl /ai-api/v1/stock/info \
  -H "Content-Type: application/json" \
  -H "Authorization: xxxxx"   \
 -d '{
    "stocks_name": "Ping An Bank",
    "stocks_code":"000001",
    "maximum_value": "0.05",
    "minimum_value": "0.02"
  }'

Returns results

{
    "data": {
        "answer": "### Stocks: Ping An Banknn**Overview of Change Data:**n- **Stock Change of the Day:** 1.00%n- **Industry Change of the Day:** 0.43%n- **Shanghai Composite Index Change of the Day:** -0.44%nn### News Analysisnn### 1. **The impact of Fed rate cut expectations**nThe news mentions a possible Fed rate cut, which is usually bad for the banking sector. A rate cut will compress banks' net interest margins, leading to lower bank earnings. However, Ping An Bank is up 1.00% today, while the industry as a whole is up 0.43%. This suggests that despite the expectation of a rate cut, the impact may no be fully felt in the near term, or that the market may react more strongly to other positive news. nn#### 2. **Science and Technology Innovation Loans**nThe news mentioned that the accelerated implementation of science and technology innovation loans has completed the first batch of launches, which is good news for commercial banks participating in these projects such as Ping An Bank, as it will increase loan business and profit opportunities. This may be one reason for Ping An Bank's gains today. Technology and innovation loans no only bring business growth to banks, but also may enhance the overall market image and customer stickiness of banks. nn#### 3. **Market Liquidity Improvement**nReferring to the first anniversary of the launch of the "Dual Counter Model" for Hong Kong stocks, liquidity has improved, which is good news. Increased liquidity in international markets has helped to boost bank-related revenues, especially for cross-border business. This is a positive signal for Ping An Bank as a bank with close ties with the international capital market. nn#### 4. **Increased activity in the real estate market**nThe increase in market activity brought about by the new real estate market policy is also good news, especially for banks with large real estate loan business. Ping An Bank is more likely to benefit from this, which could also contribute to today's share price rally.",
        "model": "gpt-4o",
        "crystalStone":100
        "requestId": "ce25fa0c316f4f39a7f41e80e8663510"
    },
    "errorCode": 0,
    "line": null,
    "message": "succeed",
    "success": true
}

✅2. list of conversations

Description of the interface

Conversation list, including AI partners, create your own Mini Programs and official Mini Programs.

Interface address

GET /ai-api/v1/chat/list

Request header

Authorization:Bearer user-xxxxxxxxxxxxxxxxxxxxxx (user token)

Request parameters

Parameter name

Required

Type

Description

session_type

yes

int

0: check all; 1: AI Partner; 2: Official Mini Program; 3: Created Mini Program 4 Shared Mini Program

Sample request

curl /ai-api/v1/chta/list?session_type= \
 -H "Authorization: xxxxx"   

Reply parameters

Parameter name

Type

Description

session_id

String

command_session_id

String

session_type=3 return

nick_name

String

nickname

header_url

String

avatar

session_type

int

1: AI Partner; 2: Official Mini Program; 3: Created Mini Program 4 Shared Mini Program

Example of a reponse

{
    "data": [{
      "session_id":"999992",
      "command_session_id":"",
      "nick_name":"jack",
      "header_url":"https://xxx.com/xx.jpg"
      "session_type":1
    },{
      "session_id":"99999",
       "command_session_id":"22222",
      "nick_name":"jack2",
      "header_url":"https://xxx.com/xx.jpg"
      "session_type":3
    }],
    "errorCode": 0,
    "message": "succeed",
    "success": true
}

3. AI Partner

3.1 The user talks to the AI partner

Description of the interface

The user talks to the agent. Send texts, documents and pictures. Default with memory, context. Only the current round of messages will be sent. If the interface is slow, it is recommended to adjust the timeout period to 2 minutes.

Note: The file image uploaded during the conversation or the AI-generated file image will expire after 3 months from the URL of the Chinese image in the dialog box. Cloud space for long-term preservation.

Interface address

POST /ai-api/v1/chat/completions

Request header

Authorization:Bearer user-xxxxxxxxxxxxxxxxxxxxxx (user token)
Content-Type: application/json

Request parameters

Parameter name

Required

Type

Description

session_id

no

String

Dialog window ID for continuous dialogue (AI partners will be automatically created after the user registers successfully)

user_question

yes

Object

User input questions.

type

yes

int

Incoming Type: 0: text; 1: Voice

content

yes

String

The user enters a text or voice file_id

mark_type

no

int

The AI partner can perform the task according to semantics. Parameters can be passed to perform tasks more accurately.

file_attachs

no

Array<Object>

file_id

String

Documents, pictures, voice IDs are obtained by uploading1: File ID, support pdf, doc, docx, ppt, pptx, csv, xlsx, wps.2: Image ID "7.1 File image upload" to obtain (up to 6 images) A single image is less than 30MB

url

String

File URL "7.1 File image upload" to get

file_type

Int

File Type 1: File, 2: Image 3 Voice

mark_type

Parameter description

Return format

1

Brain map

Mind Map

2

flow chart

mermaid

3

State diagrams

mermaid

4

Entity relationship diagram

mermaid

5

User journey maps

mermaid

6

Gantt chart

mermaid

7

Pie chart

mermaid

9

Timeline diagram

mermaid

900

Stock analysis

Markdown

901

Stock backtesting

Markdown

Sample request

curl /ai-api/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: xxxxx"   \
 -d '{ 
      "session_id":"1681207028381696108"
      "user_question":  {
          "type": 0,
          "content": "Why do the stars twinkle and twinkle." 
      },
      "mark_type": 2,
      "file_attachs": [
          {"file_id":"1753399182701993984","url":"http://xxx.xx.png","file_type":"1"},
          {"file_id":"1753399182701993985","url":"http://xxx.xx.png","file_type":"2"}
      ]
      
    }'

Reply parameters

Parameter name

Type

Description

id

Reply to the message ID

create_time

String

Response time

message

AI assistant replies to content.

text

String

Text response, format: Makden, Mead, Middle-Map

text_type

String

Fixed parameters: Memed, Middlemapou; When returning to Nar, use Makden to parse.

file_attachs

Array<Object>

Files and images are included

url

String

The URL of the image or document and the link have an expiration time.

size

String

Document size, image field is empty

title

String

The name of the document and the image field are blank

file_type

int

File types: 1: File, 2: Image, 3: Voice

url_invalid

int

File Status: 0: Link Available; 1: The link is invalid;

file_id

String

File ID

Example of a reponse

{
  "data": {
    "id": "123456789123",
    "create_time": "2024-01-01 01:11:11",
    "message": {
      "text": "After analysis, the company's operating conditions are excellent.......",
      "text_type": null,
      "file_attachs": [
        {
          "url": "https:// xxx.xx.xx/xx/xx.pdf",
          "size": "244KB",
          "file_id": "888888",
          "title": "2020 Corporate Planning Report",
          "file_type": 1,
          "file_id": "1753399195393957888",
          "url_invalid": 0
        },
        {
          "url": "https:// xxx.xx.xx/xx/xx.jpg",
          "size": null,
          "file_id": "8888882",
          "title": "Screenshot 1",
          "file_type": 2,
          "file_id": "1753399195393957889",
          "url_invalid": 0
        },
        {
          "url": "https:// xxx.xx.xx/xx/xx.mp3",
          "file_id": "1753399195393957890",
          "file_type": 3,
          "url_invalid": 0
        }
      ]
    }
  },
  "errorCode": 0,
  "message": "succeed",
  "success": true
}

3.2 Text-to-speech

Description of the interface

Convert text to speech. Support Chinese and English. It can be used in scenarios where the user requests a return language. This interface needs to be polled. Text-to-speech takes time. According to the length of the text, it takes time no to use it, and it is no converted well and returns empty.

Interface address

POST /ai-api/v1/tts

Request header

Authorization:Bearer user-xxxxxxxxxxxxxxxxxxxxxx (user token)
Content-Type: application/json

Request parameters

Parameter name

Required

Type

Description

message

yes

String

Text that needs to be converted into speech.

Sample request

curl /ai-api/v1/ \
  -H "Content-Type: application/json" \
  -H "Authorization: xxxxx"   \
  -d '{
     "message":"Hello, I am little beauty AI, how can I help you."
     }'

Reply parameters

Parameter name

Type

Description

Example of a reponse

{
    "data": {
      "url":"https://xxx.com/xx.mp3"
    },
    "errorCode": 0,
    "message": "succeed",
    "success": true
}

✅3.3 Query history chats

Description of the interface

Query historical chat history. Contains AI partners, applets.

Interface address

GET /ai-api/v1/chat/msgList

Request header

Authorization:Bearer user-xxxxxxxxxxxxxxxxxxxxxx (user token)

Request parameters

Parameter name

Required

Type

Description

session_id

yes

String

session_id or command_session_id

page_size

yes

int

Default is 10

page_num

yes

int

Default is 1

Sample request

curl /ai-api/v1/chat/msgList?session_id=88888&page_size=10&page_num=2 \
  -H "Content-Type: application/json" \
  -H "Authorization: xxxxx"   \

Reply parameters

Parameter name

Type

Description

id

String

Message ID

user_type

Integer

Whether it's the AI reply, or the user; Optional values: AI , human;

header_url

String

Avatar (agent)

message

AI assistant replies to content.

text

String

Text response, format: Makden, Mead, Middle-Map

text_type

String

Fixed parameters: Memed, Middlemapou; When returning to Nar, use Makden to parse.

file_attachs

Array(Object)

Files and images are included

url

String

The URL of the image or document and the link have an expiration time.

size

String

Document size, image field is empty

title

String

The name of the document and the image field are blank

file_type

String

File Type: 1: File, 2: Image 3: Voice

url_invalid

int

File Status: 0: Link Available; 1: The link is invalid;

file_id

String

File ID

Example of a reponse

{
  "data": {
    "isMore": 0,
    "items": [
      {
        "id": "1753398356134699008",
        "header_url": "https://xxx.com/x.jpg",
        "message": {
          "text": "After analysis, the company's operating conditions are excellent.......",
          "text_type": null,
          "file_attachs": [
            {
              "url": "https:// xxx.xx.xx/xx/xx.pdf",
              "size": "244KB",
              "file_id": "888888",
              "title": "2020 Corporate Planning Report",
              "file_type": 1,
              "url_invalid": 0
            },
            {
              "url": "https:// xxx.xx.xx/xx/xx.jpg",
              "size": null,
              "file_id": "8888882",
              "title": "Screenshot 1",
              "file_type": 2,
              "url_invalid": 0
            },
            {
              "url": "https:// xxx.xx.xx/xx/xx.mp3",
              "file_type": 3,
              "url_invalid": 0
            }
          ]
        },
        "create_time": "2024-01-01 01:11:11",
        "user_type": "human"
      },
      {
        "id": "1753398356134699009",
        "header_url": "https://xxx.com/x.jpg",
        "message": {
          "text": "After analysis, the company's operating conditions are excellent.......",
          "text_type": null,
          "file_attachs": [
            {
              "url": "https:// xxx.xx.xx/xx/xx.pdf",
              "size": "244KB",
              "file_id": "888888",
              "title": "2020 Corporate Planning Report",
              "file_type": 1,
              "url_invalid": 0
            },
            {
              "url": "https:// xxx.xx.xx/xx/xx.jpg",
              "size": null,
              "file_id": "8888882",
              "title": null,
              "file_type": 2,
              "url_invalid": 0
            }
          ]
        },
        "create_time": "2024-01-01 01:11:11",
        "user_type": "AI"
      }
    ],
    "pageNum": 1,
    "pageSize": 10,
    "startIndex": 0,
    "totalCount": 2,
    "totalPage": 1
  },
  "errorCode": 0,
  "message": "succeed",
  "success": true
}

4. Personalized Token Generation

AI performs multiple rounds of diffusion and in-depth mining of the input text, which plays a role in drawing inferences from one case to another, so as to improve the ability of AI partners.

✅4.1 Upload File for Personalized Token Generation

Description of the interface

Add File for Personalized Token Generation.

Interface address

POST /ai-api/v1/aiTrainingGround/add

Request header

Authorization:Bearer user-xxxxxxxxxxxxxxxxxxxxxx (user token)
Content-Type: application/form-data

Request parameters

Parameter name

Required

Type

Description

multipartFile

yes

file

Files required for training f, support: pdf, doc, docx, ppt, pptx, csv, wps. (The training is mainly text-based, and the training of all-digital documents is ineffective.)

Sample request

 curl /ai-api/v1/aiTrainingGround/add \
  -H "Authorization: xxxxx"   \
  -F 'multipartFile=@/path/to/your/file'

Reply parameters

parameter name

Required

description

Example of a reponse

{
    "data": null,
    "errorCode": 0,
    "message": "succeed",
    "success": true
}

✅4.2 List of Personalized Token Generation

Description of the interface

This list displays the status of personalized token generation for text.

Interface address

GET /ai-api/v1/aiTrainingGround/list

Request header

Authorization:Bearer user-xxxxxxxxxxxxxxxxxxxxxx (user token)

Request parameters

Parameter name

Required

Type

Description

pageSize

yes

Integer

pageNum

yes

Integer

type

yes

Integer

1 - Training management 2 - Training results

Sample request

curl /ai-api/v1/aiTrainingGround/list?pageSize=10&pageNum=1 \
  -H "Authorization: xxxxx"   

Reply parameters

Parameter name

Type

Description

fileId

String

The ID of the training task

fileName

String

filename

beBeingTrainedTime

String

The time when the task was created

trainedStatus

Integer

0: To be trained 1: Under training; 2: Successful training; 3. Training failure;

fileUrl

String

File address

Example of a reponse

{
     "data": {
        "isMore": 0,
        "items": [
            {
            "fileId":"33333333",
            "fileName":"Encyclopedia of Science.doc",
            "beBeingTrainedTime": "2024-01-01 01:11:11",
            "trainedStatus": 1
            },
            {
            "fileId":"4444444",
            "fileName":"Encyclopedia of Science.doc",
            "beBeingTrainedTime": "2024-01-01 01:11:11",
            "trainedStatus": 1
            }
        ],
        "pageNum": 1,
        "pageSize": 10,
        "startIndex": 0,
        "totalCount": 2,
        "totalPage": 1
    },
    "errorCode": 0,
    "message": "succeed",
    "success": true
}

✅4.3 Restart Tasks with Failed Personalized Token Generation

Description of the interface Restart Failed Tasks for Personalized Token Generation. Can only be triggered when in a failed generation state.

Interface address

GET /ai-api/v1/aiTrainingGround/retry

Request header

Authorization:Bearer user-xxxxxxxxxxxxxxxxxxxxxx (user token)

Request parameters

Parameter name

Required

Type

Description

fileId

yes

String

ID of the failed task that needs to be retrained.

Sample request

curl /ai-api/v1/trainingSpace/retry?fileId= \
  -H "Authorization: xxxxx"   

Reply parameters

Parameter name

Type

Description

Example of a reponse

{
    "data": null,
    "errorCode": 0,
    "message": "succeed",
    "success": true
}

5. Meeting Assistant

The meeting recording file is parsed to generate the original text of the meeting, and then the AI collates and outputs the collated version.

5.1 Create a meeting

Description of the interface

Create a meeting.

Interface address

POST /ai-api/v1/meetingAssistant/create

Request header

Authorization:Bearer user-xxxxxxxxxxxxxxxxxxxxxx (user token)
Content-Type: application/json

Request parameters

Parameter name

Required

Type

Description

language

no

String

Select the language. The default is Chinese and English.Supported Languages:

auto_organize

no

Integer

Whether to automatically generate AI collation manuscripts. 0: no collated; 1: Finishing

meeting_name

no

String

The name of the meeting. The default date is "2024-11-1 11:11:11"

Sample request

curl /ai-api/v1/meetingAssistant/create \
  -H "Content-Type: application/json" \
  -H "Authorization: xxxxx"   \
  -d '{
     "language":null,
     "auto_organize": 1,
     "meeting_name": "Weekly meeting of the technical department",
     "":
     }'

Reply parameters

Parameter name

Type

Description

meeting_id

String

Meeting ID

Example of a reponse

{
    "data": {
      "meeting_id": "99999"
    },
    "errorCode": 0,
    "message": "succeed",
    "success": true
}

5.2 Upload the meeting voice/end the meeting

Description of the interface

You can upload audio continuously while the meeting is in progress. When 'is_end=true', the meeting closes and no longer receives new audio input. At this point, the asynchronous generation of the original and collated drafts of the meeting begins.

File uploads are currently limited to 25 MB and the following input file types are supported: mp3,mp4,mpeg,mpga,m4a,wav,webm

Interface address

POST /ai-api/v1/meetingAssistant/upload

Request header

Authorization:Bearer user-xxxxxxxxxxxxxxxxxxxxxx (user token)
Content-Type: application/json

Request parameters

Parameter name

Required

Type

Description

voice_file_ids

no

List<String>

Audio file ID, please sort in order of priority.7.2 Voice upload

meeting_id

yes

String

Meeting ID

is_end

no

Boolean

Whether it was the last recording. Default false.More than 60 minutes without uploading will automatically end and finish.

Sample request

curl /ai-api/v1/ \
  -H "Content-Type: application/json" \
  -H "Authorization: xxxxx"   \
  -d '{
         "meeting_id":"88488",
         "is_end":null,
         "voice_file_ids":["111111","111111"
         ]
     }'

Reply parameters

Parameter name

Type

Description

Example of a reponse

{
    "data": null,
    "errorCode": 0,
    "message": "succeed",
    "success": true
}

5.3 Review the meeting documents

Description of the interface

View the original and collated transcripts of the meeting.

Interface address

POST /ai-api/v1/meetingAssistant/show

Request header

Authorization:Bearer user-xxxxxxxxxxxxxxxxxxxxxx (user token)
Content-Type: application/json

Request parameters

Parameter name

Required

Type

Description

meeting_id

yes

String

forced_shutdown

no

Bollean

true: checks whether the meeting is closed, and will force it to close. (Default)false: The meeting status is no checked.

doc_type

yes

Integer

0: the original manuscript of the meeting; 1: AI Finishing Draft.

Sample request

curl /ai-api/v1/meetingAssistant/show \
  -H "Content-Type: application/json" \
  -H "Authorization: xxxxx"   \
  -d '{
     "meeting_id":"999999",
     "doc_type":0
     }'

Reply parameters

Parameter name

Type

Description

doc

String

The content of the meeting draft.

state

Integer

0: The meeting is in progress; 1: The manuscript is being organized; 2: Done; 3: Sorting failed

Example of a reponse

{
    "data": {
      "doc": "I'm a manuscript xxxxxxxxx",
      "state": 3
    },
    "errorCode": 0,
    "message": "succeed",
    "success": true
}

5.4 List of meetings

Description of the interface

List presentation meeting.

Interface address

GET /ai-api/v1/meetingAssistant/list

Request header

Authorization:Bearer user-xxxxxxxxxxxxxxxxxxxxxx (user token)

Request parameters

Parameter name

Required

Type

Description

page_size

yes

Integer

page_num

yes

Integer

Sample request

curl /ai-api/v1/aiTrainingGround/list?page_size=10&page_num=1 \
  -H "Authorization: xxxxx"   

Reply parameters

Parameter name

Type

Description

meeting_id

String

Meeting ID

meeting_name

String

The name of the meeting

create_time

String

Creation time

state

Integer

0: The meeting is in progress; 1: The manuscript is being organized; 2: Done; 3: Sorting failed

meeting_duration

String

Duration, "00:21:33"

Example of a reponse

{
    "data": {​
        "isMore": 0,​
        "items": [​
        ​    {
                "meeting_id":"33333333",
                "meeting_name":"The first meeting of the Technical Department",
                "create_time": "2024-01-01 01:11:11",
                "meeting_duration":"00:21:33",
                "state": 1
            },
            {
                "meeting_id":"33333333",
                "meeting_name":"The second meeting of the technical department",
                "create_time": "2024-01-01 01:11:11",
                "meeting_duration":"00:21:33",
                "state": 1
            }
        ],​
        "pageNum": 1,​
        "pageSize": 10,​
        "startIndex": 0,​
        "totalCount": 2,​
        "totalPage": 1​
        },
    "errorCode": 0,
    "message": "succeed",
    "success": true
}

6. Mini Programs

The Mini Program is more powerful, can customize prompts, integrates the python sandbox environment, and can plug in files to complete specified complex tasks. Mini Programs can be created through dialog boxes, or you can directly edit the Mini Program configuration.

Calling logic:

  1. Call '6.1 Create Mini Program session_id 'Generate' session_id' and 'command_session_id'

  2. Call the '6.2 Conversation Settings Mini Program' interface and put forward the requirements for building the Mini Program.

  3. Call the '6.5 Mini Program Dialogue' interface to use the Mini Program, whether it meets the requirements.

  4. If you want to modify the Mini Program, you can go through two ways:

    • Continue to '6.2 Conversation Settings applet'

    • Call '6.4 Save and update the applet settings' to directly modify the Mini Program configuration items.

✅6.1 Create a Mini Program session_id

Description of the interface

Create 'Configure Applet Dialog' and 'Applet Dialog'.

Interface address

GET /ai-api/v1/miniProgram/getsessionid

Request header

Authorization:Bearer user-xxxxxxxxxxxxxxxxxxxxxx (user token)

Request parameters

Parameter name

Required

Type

Description

nick_name

yes

String

nickname

header_url

no

String

avatar

Sample request

curl /ai-api/v1/miniProgram/getsessionid?nick_name= \
  -H "Authorization: xxxxx"   

Reply parameters

Parameter name

Type

Description

session_id

String

Applet dialog session_id (7.5 use).

command_session_id

Command dialog box session_id (7.2, 7.3, 7.4) for building the applet; The window is a conversation to help users create applets.

Example of a reponse

{
    "data": {
        "session_id":"8888888",
        "command_session_id":"99999" 
    },
    "errorCode": 0,
    "message": "succeed",
    "success": true
}

✅6.2 Conversation Settings applet

Description of the interface

Create applets through conversations.

Interface address

POST /ai-api/v1/miniProgram/create

Request header

Authorization:Bearer user-xxxxxxxxxxxxxxxxxxxxxx (user token)
Content-Type: application/json

Request parameters

Parameter name

Required

Type

Description

command_session_id

yes

String

Create a Mini Program window ID to achieve continuous dialogue ("7.1" returns command_session_id)

user_question

yes

Object

The user enters the demand for the Mini Program.

type

yes

int

Incoming Type: 0: text; 1: Voice

content

yes

String

The user enters a text or voice file_id

Sample request

curl /ai-api/v1/miniProgram/create \
  -H "Content-Type: application/json" \
  -H "Authorization: xxxxx"   \
  -d '{ 
      "command_session_id":"",
      "user_question":  {
          "type": 0,
          "content": "Why do the stars twinkle and twinkle?" //Or a voice file id "1813497918504092978"
      }
    }'

Reply parameters

Parameter name

Type

Description

id

String

Message ID

create_time

String

Response time

message

Object

text

String

Reply to the content

Example of a reponse

{
    "data": {
        "id":"",
          "create_time": "2024-01-01 01:11:11",
          "message": {
            "text": "After analysis, the company's operating conditions are excellent......."
          }
    },
    "errorCode": 0,
    "message": "succeed",
    "success": true
}

✅6.3 Query the Mini Program settings

Description of the interface

Change the applet prompt, and you can also mount the file. Only the parameters that need to be modified are specified.

Interface address

GET /ai-api/v1/miniProgram/getSetting

Request header

Authorization:Bearer user-xxxxxxxxxxxxxxxxxxxxxx (user token)

Request parameters

Parameter name

Type

Description

command_session_id

String

Sample request

curl /ai-api/v1/miniProgram/getsessionid?command_session_id=1 \
  -H "Authorization: xxxxx"   

Reply parameters

Parameter name

Required

Type

Description

mini_program_name

no

String

The name of the applet

mini_program_icon

no

String

Mini Program avatar

mini_program_introduction

no

String

Introduction to Mini Programs

mini_program_instructions

no

String

Instructions for using the Mini Program

mini_program_setting

no

String

Mini Program settings

Example of a reponse

 {
    "data": {
        "mini_program_instructions": "**Background B:**n- Theme: Random Song Writing Assistantn- Target Users: Users who want to get creative inspiration or complete songs, music lovers and professional musiciansn- User characteristics: Interested in music creation and want to get help through AIn**Role R (Role):**n- You are an expert in the field of music, and you are able to generate lyrics and melodies based on the information provided by users, such as style, theme, emotion, etc. At the same time, you are also a patient and creative partner who can inspire users to create. n**Objective O (Objective):**n- Help users complete their musical compositions by understanding their creative needs and providing personalized lyrics and melody suggestions. n- Intelligently judge the content of the conversation, and reply to the conversation that is not related to the current topic according to the user's question. n**Key Result KR (Key Result):**n1. Based on the information provided by the user, the lyrics and melodies that meet the requirements are generated. n2. A variety of styles and themes are available, allowing users to freely choose and combine them into a complete work. n3. By engaging with users, the generated content is constantly adjusted and optimized to make it more relevant to the needs of users. n4. It can also answer customer questions that are not relevant to the current topic and allow for normal content interactions. n**Step S (Steps):**n1. Communicate with users and gather their creative needs, including style, theme, emotion, and other information. n2. Based on the information gathered, analysis is performed and preliminary lyrics and melodic fragments are generated. n3. Show the generated content to the user and adjust and optimize based on the feedback。",
        "mini_program_name": "Inspired Writer",
        "mini_program_icon": "https://prod-aipic.jxjia.net/ai/npc_avatar/create_mini/v3_02a8_7323186e-27ef-406c-95d2-13a100f06abg21.png"
        },
    "errorCode": 0,
    "message": "succeed",
    "success": true
}

✅6.4 Save and update the applet settings

Description of the interface

Change the applet prompt, and you can also mount the file. Only the parameters that need to be modified are specified.

Interface address

POST /ai-api/v1/miniProgram/saveUpdate

Request header

Authorization:Bearer user-xxxxxxxxxxxxxxxxxxxxxx (user token)
Content-Type: application/json

Request parameters

Parameter name

Required

Type

Description

command_session_id

yes

String

mini_program_name

no

String

The name of the applet

mini_program_icon

no

String

Mini Program avatar

mini_program_introduction

yes

String

Introduction to Mini Programs

mini_program_instructions

yes

String

Instructions for using the Mini Program

mini_program_setting

yes

String

Mini Program settings

knowledge_base

no

Object

Attach the file ID of the cloud space (you can check the documents and images in the cloud space, and the collated draft (except Excel)

Sample request

curl /ai-api/v1/ \
  -H "Content-Type: application/json" \
  -H "Authorization: xxxxx"   \
  -d '{
          "command_session_id": "",
          "mini_program_name": "",
          "mini_program_icon": "",
          "mini_program_introduction": "",
          "mini_program_instructions": "",
          "mini_program_setting": "",
          "knowledge_base": {
            "fileIds": [
              "1802643330484416514"
            ]
          }
        }'

Reply parameters

Parameter name

Type

Description

Example of a reponse

{
    "data": null,
    "errorCode": 0,
    "message": "succeed",
    "success": true
}

✅6.5 Mini Program conversations

Description of the interface

The user talks to the agent. Send texts, documents and pictures. Default with memory, context.

Interface address

POST /ai-api/v1/miniProgram/chat

Request header

Authorization:Bearer user-xxxxxxxxxxxxxxxxxxxxxx (user token) Content-Type: application/json

Request parameters

Parameter name

Required

Type

Description

session_id

yes

String

Dialog window ID, which can realize continuous dialogue (7.1, 7.7 return or list fetching)

user_question

yes

Object

User input questions. or voice file_id

type

yes

int

Incoming Type: 0: text; 1: Voice

content

yes

String

The user enters a text or voice file_id

mark_type

no

String

The AI partner can perform the task according to semantics. Parameters can be passed to perform tasks more accurately.

file_attachs

no

Array<Object>

file_id

String

Documents, Pictures, Voice File IDs are obtained by uploading1: File ID, support pdf, doc, docx, ppt, pptx, csv, xlsx, wps.2: Image ID "7.1 File image upload" to obtain (up to 6 images) A single image is less than 30MB

url

String

"7.1 File image upload" to get

file_type

int

File type 1: File, 2: Image

mark_type

Parameter description

Return format

1

Brain map

Mind Map

2

flow chart

mermaid

3

State diagrams

mermaid

4

Entity relationship diagram

mermaid

5

User journey maps

mermaid

6

Gantt chart

mermaid

7

Pie chart

mermaid

9

Timeline diagram

mermaid

900

Stock analysis

Markdown

901

Stock backtesting

Markdown

Sample request

curl /ai-api/v1/miniProgram/chat \
  -H "Content-Type: application/json" \
  -H "Authorization: xxxxx"   \
 -d '{ 
      "session_id":"1681206985633349739",
      "user_question": {
          "type": 0,
          "content": "Why do the stars twinkle and twinkle." 
      },
      "mark_type": 2,
      "file_attachs": [
          {"file_id":"1753399182701993984","url":"http://xxx.xx.doc","file_type":1},
          {"file_id":"1753399182701993985","url":"http://xxx.xx.png","file_type":2}
      ]
    }'

Reply parameters

Parameter name

Type

Description

id

String

Message ID

create_time

String

Response time

message

String

AI assistant replies to content.

text

String

Text response, format: Makden, Mead, Middle-Map

text_type

String

Fixed parameters: Memed, Middlemapou; When returning to Nar, use Makden to parse.

file_attachs

Array<Object>

Contains files, voices, and pictures

url

String

The URL of the image or document and the link have an expiration time.

size

String

Document size, image field is empty

title

String

The name of the document and the image field are blank

file_type

int

File types: 1: File, 2: Image, 3: Voice

url_invalid

int

File Status: 0: Link Available; 1: The link is invalid;

file_id

String

File ID

Example of a reponse

{
  "data": {
    "id": "123456789123",
    "create_time": "2024-01-01 01:11:11",
    "message": {
      "text": "After analysis, the company's operating conditions are excellent.......",
      "text_type": null,
      "file_attachs": [
        {
          "url": "https:// xxx.xx.xx/xx/xx.pdf",
          "size": "244KB",
          "file_id": "888888",
          "title": "2020 Corporate Planning Report",
          "file_type": 1,
          "file_id": "1753399195393957888",
          "url_invalid": 0
        },
        {
          "url": "https:// xxx.xx.xx/xx/xx.jpg",
          "size": null,
          "file_id": "8888882",
          "title": "Screenshot 1",
          "file_type": 2,
          "file_id": "1753399195393957889",
          "url_invalid": 0
        },
        {
          "url": "https:// xxx.xx.xx/xx/xx.mp3",
          "file_id": "1753399195393957890",
          "file_type": 3,
          "url_invalid": 0
        }
      ]
    }
  },
  "errorCode": 0,
  "message": "succeed",
  "success": true
}

✅6.6 Query the chat history

Same as the '3.3 Query History' interface.

✅6.7 Get the sharing applet

Description of the interface

Add a mini program shared by others, "2. list of conversations" session_type=3 can be shared,

Only under the same enterprise and the same groupID can you get the sharing applet.

Interface address

GET /ai-api/v1/miniProgram/share/sessionid

Request header

Authorization:Bearer user-xxxxxxxxxxxxxxxxxxxxxx (user token)

Request parameters

Parameter name

Required

Type

Description

session_id

yes

String

("2. list of conversations" session_type=3)

Sample request

curl /ai-api/v1/miniProgram/getsessionid?session_id= \
  -H "Authorization: xxxxx"   

Reply parameters

Parameter name

Type

Description

session_id

String

Chat session_id (6.5 Mini Program Conversation Usage)

Example of a reponse

{
    "data": {
        "session_id":"8888888"
    },
    "errorCode": 0,
    "message": "succeed",
    "success": true
}

✅6.8 Mini Program knowledge base

Description of the interface

Mini Program knowledge base binding file. When a user talks to the Mini Program, the selected document content will be brought into each conversation.

Interface address

POST /ai-api/v1/miniProgram/mount/file

Request header

Authorization:Bearer user-xxxxxxxxxxxxxxxxxxxxxx (user token)
Content-Type: application/json

Request parameters

Parameter name

Required

Type

Description

session_id

yes

String

("2. list of conversations" session_type=3)

knowledge_base

yes

string

File ID (you can check the documents and images in the cloud space, and organize the draft (except Excel)

Sample request

curl /ai-api/v1/miniProgram/mount/file \
 -H "Content-Type: application/json" \
 -H "Authorization: xxxxx"   \
 -d '{
      "session_id": "",
      "knowledge_base": {
        "fileIds": [
          "1802643330484416514"
        ]
      }
    }'

Reply parameters

Parameter name

Type

Description

Example of a reponse

{
    "data": null,
    "errorCode": 0,
    "message": "succeed",
    "success": true
}

7. Cloud Space

The cloud space stores user and AI-generated files. Files uploaded to the cloud will be parsed by default. Audio and documents will be parsed into text for storage.

✅7.1 File image upload

Description of the interface

Uploading the text to the cloud will automatically trigger file parsing.

form upload file.

The file will be uploaded to the Tencent Cloud encrypted bucket and will be stored for a long time.

Usage scenarios: Chat box (including Mini Program dialog window and AI partner dialog box) file upload, cloud space file upload.

Interface address

POST /ai-api/v1/trainingSpace/addFileOrImg|

Request header

Authorization:Bearer user-xxxxxxxxxxxxxxxxxxxxxx (user token)
Content-Type: application/form-data

Request parameters

Parameter name

Required

Type

Description

multipartFile

yes

String

The url of the file to be trained supports: jpg, pdf, doc, docx, ppt, pptx, csv, wps. (The training is mainly text-based, and the training of all-digital documents is ineffective.)

auto_cloud_training

yes

int

After the file is uploaded, whether to enter the training space . 1 Do no train without entering the cloud space 2: Do no train in the cloud space (upload files in the dialog box and upload files in the cloud space, conference) 3: Enter the cloud space and train (upload files in the dialog box and upload files in the cloud space, conference);

Sample request

curl /ai-api/v1/trainingSpace/addFileOrImg \
  -H "Content-Type: application/json" \
  -H "Authorization: xxxxx"   \
  -F "multipartFile=@/path/to/your/file"

Reply parameters

Parameter name

Type

Description

fileId

String

File ID

fileUrl

String

The URL of the original file .

Example of a reponse

{
    "data": {
        "fileId":"99999",
        "fileUrl":"https://xxx.com/xx.pdf"
    },
    "errorCode": 0,
    "message": "succeed",
    "success": true
}

✅7.2 Voice upload

Interface address

Voice upload does no enter the cloud space and is no trained

form upload file.

The file will be uploaded to the Tencent Cloud encrypted bucket and will be stored for a long time.

Usage scenarios: Upload files of chat boxes (including Mini Program dialog windows and AI partner dialog boxes) and conference voice files

Interface address

POST /ai-api/v1/trainingSpace/addVoice

Request header

Authorization:Bearer user-xxxxxxxxxxxxxxxxxxxxxx (user token)
Content-Type: application/form-data

Request parameters

Parameter name

Required

Type

Description

multipartFile

yes

String

mp3 voice

voiceType

yes

Int

Voice File Type: 1: The content is no parsed 2: Voice needs to be parsed For example: dialog voice and conference voice (default)

Sample request

curl /ai-api/v1/trainingSpace/addVoice \
  -H "Content-Type: application/json" \
  -H "Authorization: xxxxx"   \
  -F "multipartFile=@/path/to/your/file"

Reply parameters

Parameter name

Type

Description

fileId

String

File ID

fileUrl

String

The URL of the file , and the text parsed from the original file is valid for a long time.

Example of a reponse

{
    "data": {
        "fileId":"99999",
        "fileUrl":"https://xxx.com/xx.pdf"
    },
    "errorCode": 0,
    "message": "succeed",
    "success": true
}

✅7.3 The list of files in the cloud space is displayed

Interface address

The list displays the list of files in a user's cloud space. It is also used as a small program to check the file.

Interface address

GET /ai-api/v1/cloudSpace/list

Request header

Authorization:Bearer user-xxxxxxxxxxxxxxxxxxxxxx (user token)

Request parameters

Parameter name

Required

Type

Description

pageSize

yes

Integer

Size per page

pageNum

yes

Integer

The current page number

format

no

Integer

1 file, 2 images

Sample request

curl /ai-api/v1/cloudSpace/list?pageSize=10&pageNum=3 \
  -H "Content-Type: application/json" \
  -H "Authorization: xxxxx"   

Reply parameters

Parameter name

Type

Description

fileId

String

File ID

fileName

String

filename

fileSize

String

file size; For example, "3.88MB", "4.0KB"

createTime

String

upload time; "2024-07-05 16:05:28"

fileUrl

String

File link

Example of a reponse

{
    "data": {​
        "isMore": 0,​
        "items": [​
        ​
        ],​
        "pageNum": 1,​
        "pageSize": 10,​
        "startIndex": 0,​
        "totalCount": 2,​
        "totalPage": 1​
     },
    "errorCode": 0,
    "message": "succeed",
    "success": true
}

✅7.4 Delete files in bulk

Interface address

Delete files in cloud space in batches to free up space. File parsing content and files in object storage will be deleted. It cannot be restored after deletion.

Interface address

POST /ai-api/v1/cloudSpace/del

Request header

Authorization:Bearer user-xxxxxxxxxxxxxxxxxxxxxx (user token)
Content-Type: application/json

Request parameters

Parameter name

Required

Type

Description

fileIds

yes

List<String>

The ID of the file to be deleted

Sample request

curl /ai-api/v1/ \
  -H "Content-Type: application/json" \
  -H "Authorization: xxxxx"   \
  -d '["44444","33333"]'

Reply parameters

Parameter name

Type

Description

Example of a reponse

 {
    "data": null
    "errorCode": 0,
    "message": "succeed",
    "success": true
}