chatbot

package
v1.62.747 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatRequest

type ChatRequest struct {
	*requests.RpcRequest
	KnowledgeId string    `position:"Query" name:"KnowledgeId"`
	SenderId    string    `position:"Query" name:"SenderId"`
	InstanceId  string    `position:"Query" name:"InstanceId"`
	SenderNick  string    `position:"Query" name:"SenderNick"`
	Perspective *[]string `position:"Query" name:"Perspective"  type:"Repeated"`
	SessionId   string    `position:"Query" name:"SessionId"`
	Tag         string    `position:"Query" name:"Tag"`
	Utterance   string    `position:"Query" name:"Utterance"`
}

ChatRequest is the request struct for api Chat

func CreateChatRequest

func CreateChatRequest() (request *ChatRequest)

CreateChatRequest creates a request to invoke Chat API

type ChatResponse

type ChatResponse struct {
	*responses.BaseResponse
	RequestId string    `json:"RequestId" xml:"RequestId"`
	SessionId string    `json:"SessionId" xml:"SessionId"`
	MessageId string    `json:"MessageId" xml:"MessageId"`
	Tag       string    `json:"Tag" xml:"Tag"`
	Messages  []Message `json:"Messages" xml:"Messages"`
}

ChatResponse is the response struct for api Chat

func CreateChatResponse

func CreateChatResponse() (response *ChatResponse)

CreateChatResponse creates a response to parse from Chat response

type Client

type Client struct {
	sdk.Client
}

Client is the sdk client struct, each func corresponds to an OpenAPI

func NewClient

func NewClient() (client *Client, err error)

NewClient creates a sdk client with environment variables

func NewClientWithAccessKey

func NewClientWithAccessKey(regionId, accessKeyId, accessKeySecret string) (client *Client, err error)

NewClientWithAccessKey is a shortcut to create sdk client with accesskey usage: https://help.aliyun.com/document_detail/66217.html

func NewClientWithEcsRamRole

func NewClientWithEcsRamRole(regionId string, roleName string) (client *Client, err error)

NewClientWithEcsRamRole is a shortcut to create sdk client with ecs ram role usage: https://help.aliyun.com/document_detail/66223.html

func NewClientWithOptions

func NewClientWithOptions(regionId string, config *sdk.Config, credential auth.Credential) (client *Client, err error)

NewClientWithOptions creates a sdk client with regionId/sdkConfig/credential this is the common api to create a sdk client

func NewClientWithRamRoleArn

func NewClientWithRamRoleArn(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName string) (client *Client, err error)

NewClientWithRamRoleArn is a shortcut to create sdk client with ram roleArn usage: https://help.aliyun.com/document_detail/66222.html

func NewClientWithRsaKeyPair

func NewClientWithRsaKeyPair(regionId string, publicKeyId, privateKey string, sessionExpiration int) (client *Client, err error)

NewClientWithRsaKeyPair is a shortcut to create sdk client with rsa key pair attention: rsa key pair auth is only Japan regions available

func NewClientWithStsToken

func NewClientWithStsToken(regionId, stsAccessKeyId, stsAccessKeySecret, stsToken string) (client *Client, err error)

NewClientWithStsToken is a shortcut to create sdk client with sts token usage: https://help.aliyun.com/document_detail/66222.html

func (*Client) Chat

func (client *Client) Chat(request *ChatRequest) (response *ChatResponse, err error)

Chat invokes the chatbot.Chat API synchronously api document: https://help.aliyun.com/api/chatbot/chat.html

func (*Client) ChatWithCallback

func (client *Client) ChatWithCallback(request *ChatRequest, callback func(response *ChatResponse, err error)) <-chan int

ChatWithCallback invokes the chatbot.Chat API asynchronously api document: https://help.aliyun.com/api/chatbot/chat.html asynchronous document: https://help.aliyun.com/document_detail/66220.html

func (*Client) ChatWithChan

func (client *Client) ChatWithChan(request *ChatRequest) (<-chan *ChatResponse, <-chan error)

ChatWithChan invokes the chatbot.Chat API asynchronously api document: https://help.aliyun.com/api/chatbot/chat.html asynchronous document: https://help.aliyun.com/document_detail/66220.html

type Knowledge

type Knowledge struct {
	Id           string `json:"Id" xml:"Id"`
	Title        string `json:"Title" xml:"Title"`
	Summary      string `json:"Summary" xml:"Summary"`
	Content      string `json:"Content" xml:"Content"`
	AnswerSource string `json:"AnswerSource" xml:"AnswerSource"`
}

Knowledge is a nested struct in chatbot response

type Message

type Message struct {
	Type       string      `json:"Type" xml:"Type"`
	Text       Text        `json:"Text" xml:"Text"`
	Knowledge  Knowledge   `json:"Knowledge" xml:"Knowledge"`
	Recommends []Recommend `json:"Recommends" xml:"Recommends"`
}

Message is a nested struct in chatbot response

type Messages

type Messages struct {
	Message []Message `json:"Message" xml:"Message"`
}

Messages is a nested struct in chatbot response

type Recommend

type Recommend struct {
	KnowledgeId  string `json:"KnowledgeId" xml:"KnowledgeId"`
	Title        string `json:"Title" xml:"Title"`
	AnswerSource string `json:"AnswerSource" xml:"AnswerSource"`
	Summary      string `json:"Summary" xml:"Summary"`
	Content      string `json:"Content" xml:"Content"`
}

Recommend is a nested struct in chatbot response

type Recommends

type Recommends struct {
	Recommend []Recommend `json:"Recommend" xml:"Recommend"`
}

Recommends is a nested struct in chatbot response

type Text

type Text struct {
	Content      string `json:"Content" xml:"Content"`
	AnswerSource string `json:"AnswerSource" xml:"AnswerSource"`
}

Text is a nested struct in chatbot response

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL