Skip to main content

IBot

The Functional Agent Framework provides the IBot interface. By implementing a class that satisfies the IBot interface, developers can deploy the corresponding service.

The complete method definitions of IBot` and the corresponding services are as follows:

Provided ServicesIBot Method NameDescription
POST /v1/aibot/bots/:botId/send-messagesendMessageConverse with the AI agent
GET /v1/aibot/bots/:botId/recordsgetChatRecordsQuery historical conversation records of the AI agent
POST /v1/aibot/bots/:botId/recommend-questionsgetRecommendQuestionsGet recommended questions
POST /v1/aibot/bots/:botId/feedbacksendFeedbackSubmit user feedback
GET /v1/aibot/bots/:botId/feedbackgetFeedbackQuery user feedback

Using the BotCore base class enables faster implementation of the IBot interface.

Methods

sendMessage()

sendMessage(input): Promise\<void>

sendMessage - POST /v1/aibot/bots/:botId/send-message

Implement the Q&A dialogue interface with the Agent. This interface does not return a value. Within the interface, it is required to send Server-Sent Events to the client via this.sseSender.

The corresponding interface for the WeChat Basic Library wx.cloud.extend.AI.bot.sendMessage API https://developers.weixin.qq.com/miniprogram/dev/wxcloudservice/wxcloud/reference-sdk-api/extend/ai.html#AI-bot-sendMessage

Parameters

input

SendMessageInput

Input for sending a message

Returns

Promise\<void>


getChatRecords()?

optional getChatRecords(input): Promise\<GetChatRecordOutput>

getChatRecords - GET /v1/aibot/bots/:botId/records

Implements the interface for querying Agent historical conversation information and returns historical conversation records.

Note: The sendMessage interface must implement recording conversation information, and this interface should query and return the conversation information.

The corresponding interface for the WeChat Basic Library wx.cloud.extend.AI.bot.getChatRecords API https://developers.weixin.qq.com/miniprogram/dev/wxcloudservice/wxcloud/reference-sdk-api/extend/ai.html#AI-bot-getChatRecords

Parameters

input

GetChatRecordInput

Returns

Promise\<GetChatRecordOutput>

Corresponding HTTP API

https://docs.cloudbase.net/http-api/ai-bot/get-chat-history


getFeedback()?

optional getFeedback(input): Promise\<GetFeedbackOutput>

getFeedback - GET /v1/aibot/bots/:botId/feedback

Implements the interface for obtaining user feedback and returns a list of user feedback.

The corresponding interface for the WeChat Basic Library wx.cloud.extend.AI.bot.getFeedBack API https://developers.weixin.qq.com/miniprogram/dev/wxcloudservice/wxcloud/reference-sdk-api/extend/ai.html#AI-bot-getFeedBack

Parameters

input

GetFeedbackInput

Returns

Promise\<GetFeedbackOutput>

Corresponding HTTP API

https://docs.cloudbase.net/http-api/ai-bot/get-feedback


getRecommendQuestions()?

optional getRecommendQuestions(input): Promise\<void>

getRecommendQuestions - POST /v1/aibot/bots/:botId/recommend-questions

Implements the interface for obtaining recommended questions and returns a list of recommended questions.

The corresponding interface for the WeChat Basic Library wx.cloud.extend.AI.bot.getRecommendQuestions API https://developers.weixin.qq.com/miniprogram/dev/wxcloudservice/wxcloud/reference-sdk-api/extend/ai.html#AI-bot-getRecommendQuestions

Parameters

input

GetRecommendQuestionsInput

Returns

Promise\<void>

Corresponding HTTP API

https://docs.cloudbase.net/http-api/ai-bot/get-recommend-questions


sendFeedback()?

optional sendFeedback(input): Promise\<SendFeedbackOutput>

sendFeedback - POST /v1/aibot/bots/:botId/feedback

Implements the interface for sending user feedback and returns the result of the operation.

The corresponding interface for the WeChat Basic Library wx.cloud.extend.AI.bot.sendFeedback API https://developers.weixin.qq.com/miniprogram/dev/wxcloudservice/wxcloud/reference-sdk-api/extend/ai.html#AI-bot-sendFeedback

Parameters

input

SendFeedbackInput

Returns

Promise\<SendFeedbackOutput>

Corresponding HTTP API

sss


Types

GetChatRecordInput

Properties

pageNumber

pageNumber: number

pageSize

pageSize: number

sort

sort: string


GetChatRecordOutput

Properties

recordList

recordList: object[]

botId?

optional botId: string

content?

optional content: string

conversation?

optional conversation: string

createTime?

optional createTime: string

image?

optional image: string

recordId?

optional recordId: string

reply?

optional reply: string

replyTo?

optional replyTo: string

role?

optional role: string

triggerSrc?

optional triggerSrc: string

type?

optional type: string

total

total: number


GetFeedbackInput

Properties

from

from: number

maxRating

maxRating: number

minRating

minRating: number

pageNumber

pageNumber: number

pageSize

pageSize: number

sender

sender: string

senderFilter

senderFilter: string

to

to: number

type

type: string


GetFeedbackOutput

Properties

feedbackList

feedbackList: object[]

aiAnswer

aiAnswer: string

botId

botId: string

comment

comment: string

createTime

createTime: string

input

input: string

rating

rating: number

sender

sender: string

tags

tags: string[]

type

type: string

total

total: number


GetRecommendQuestionsInput

Properties

agentSetting

agentSetting: string

history

history: object[]

content

content: string

role

role: string

introduction

introduction: string

msg

msg: string

name

name: string


SendFeedbackInput

Properties

aiAnswer

aiAnswer: string

comment

comment: string

input

input: string

rating

rating: number

recordId

recordId: string

tags

tags: string[]

type

type: string


SendFeedbackOutput

Properties

status

status: "success"


SendMessageInput

Properties

history?

optional history: object[]

content

content: string

role

role: "user" | "assistant"

msg

msg: string