Documentation
¶
Index ¶
- type Aligenie
- type Application
- type Intent
- type Request
- type RequestSkillSession
- type RequestSlotEntitie
- type Response
- func (T *Response) Ask(reply string, askedInfos []string)
- func (T *Response) Askf(reply string, askedInfos []string, args ...interface{})
- func (T *Response) Confirm(reply string)
- func (T *Response) Confirmf(reply string, args ...interface{})
- func (T *Response) Error(errStr, code string)
- func (T *Response) Result(reply string)
- func (T *Response) Resultf(reply string, args ...interface{})
- func (T *Response) WriteTo(w io.Writer) (n int64, err error)
- type ResponseConfirmParaInfo
- type ResponseGwCommands
- type ResponseValue
- type ResponseValueAction
- type ResponseValueAskedInfo
- type ResponseWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Aligenie ¶
type Aligenie struct {
AppIdAttr string // 属性id
// contains filtered or unexported fields
}
aligenie
func (*Aligenie) ServeHTTP ¶
func (T *Aligenie) ServeHTTP(w http.ResponseWriter, r *http.Request)
服务处理
w http.ResponseWriter http响应 r *http.Request http请求
func (*Aligenie) SetApp ¶
func (T *Aligenie) SetApp(id string, app *Application)
设置APP
id string id名称 app *Application app配置
type Application ¶
type Application struct {
HandleFunc http.HandlerFunc // 处理函数
ValidReqTimestamp int // 有效时间,秒为单位
}
程序
type Intent ¶
type Intent struct {
Response *Response // 响应
Request *Request // 请求
App *Application // app
}
意图
type Request ¶
type Request struct {
SessionId string `json:"sessionId"` //1,会话ID,session内的对话此ID相同
BotId int64 `json:"botId"` //1,应用ID,来自于创建的应用或者技能
Utterance string `json:"utterance"` //1,用户输入语句
SkillId int64 `json:"skillId"` //1,技能ID
SkillName string `json:"skillName"` //1,技能名称
IntentName string `json:"intentName"` //1,意图名称
Token string `json:"token"` //0,技能鉴权token,可以不需要,如果有安全需求需要配置
RequestData map[string]string `json:"requestData"` //0,业务请求附带参数,来自于设备调用语义理解服务额外携带的信息,只做透传
SlotEntities []RequestSlotEntitie `json:"slotEntities"` //1,从用户语句中抽取出的slot参数信息
DomainId int64 `json:"domainId"` //1,领域ID
IntentId int64 `json:"intentId"` //1,意图ID
RequestId string `json:"requestId"` //1,请求Id
ConfirmStatus string `json:"confirmStatus"` //0,用于用户回复确认。"CONFIRMED"表示确认。"DENIED"表示否认
SkillSession RequestSkillSession `json:"skillSession"` //1,技能粒度的session信息
}
type RequestSkillSession ¶
type RequestSlotEntitie ¶
type RequestSlotEntitie struct {
IntentParameterId int64 `json:"intentParameterId"` //1,意图参数ID
IntentParameterName string `json:"intentParameterName"` //1,意图参数名
OriginalValue string `json:"originalValue"` //1,原始句子中抽取出来的未做处理的slot值
StandardValue string `json:"standardValue"` //1,原始slot归一化后的值
LiveTime int64 `json:"liveTime"` //1,该slot已生存时间(会话轮数)
CreateTimeStamp int64 `json:"createTimeStamp"` //1,该slot产生的时间点
SlotName string `json:"slotName"` //1,slot名称
SlotValue string `json:"slotValue"` //1,slot值
}
type Response ¶
type Response struct {
ReturnCode string `json:"returnCode"` //1,“0”默认表示成功,其他不成功的字段自己可以确定
ReturnErrorSolution string `json:"returnErrorSolution,omitempty"` //0,出错时解决办法的描述信息
ReturnMessage string `json:"returnMessage,omitempty"` //0,返回执行成功的描述信息
ReturnValue ResponseValue `json:"returnValue"` //1,意图理解后的执行结果
// contains filtered or unexported fields
}
,omitempty
type ResponseConfirmParaInfo ¶
type ResponseConfirmParaInfo struct {
ConfirmParameterName string `json:"confirmParameterName"` //1,用户表达匹配到此参数,表示"确定"意思
DenyParameterName string `json:"denyParameterName"` //1,用户表达匹配到此参数,表示"否定"意思
}
确认信息,ResultType需在设置为"CONFIRM"
type ResponseGwCommands ¶
type ResponseGwCommands struct {
CommandDomain string `json:"commandDomain"` //1,指令命名空间
CommandName string `json:"commandName"` //1,指令名称
Payload map[string]interface{} `json:"payload"` //1,指令数据
}
gwCommands 字段是 V3.0 SDK 中一个特殊的字段,在响应数据中携带了gwCommands 后,原 reply、actions 字段会被忽略。 自定义技能中使用 TPL 模板,需要在响应数据中 gwCommands 字段里携带页面展示需要的数据
type ResponseValue ¶
type ResponseValue struct {
Reply string `json:"reply"` //1,回复播报语句
ResultType string `json:"resultType"` //1,回复时的状态标识(ASK_INF:信息获取,例如“请问从哪个城市出发”,在此状态下,用户说的下一句话优先进入本意图进行有效信息抽取 RESULT:正常完成交互的阶段并给出回复 CONFIRM:期待确认)
Properties map[string]string `json:"properties,omitempty"` //0,生成回复语句时携带的额外信息
AskedInfos []ResponseValueAskedInfo `json:"askedInfos,omitempty"` //0,在ASK_INF状态下,必须设置本次追问的具体参数名(开发者平台意图参数下配置的参数信息) 在ASK_INF状态下必须
Actions []ResponseValueAction `json:"actions,omitempty"` //0,播控类信息,支持播放音频素材和 TTS 文本
GwCommands []ResponseGwCommands `json:"gwCommands,omitempty"` //0,最新版响应协议定义的command结构
ConfirmParaInfo ResponseConfirmParaInfo `json:"confirmParaInfo,omitempty"` //0,resultType: CONFIRM状态下可以携带的匹配用户[肯定]和[否定]回答的参数名称。
ExecuteCode string `json:"executeCode"` //1,“SUCCESS”代表执行成功;“PARAMS_ERROR”代表接收到的请求参数出错;“EXECUTE_ERROR”代表自身代码有异常;“REPLY_ERROR”代表回复结果生成出错
}
type ResponseValueAction ¶
type ResponseValueAction struct {
Name string `json:"name"` //1,Action名,该名字必须设置为“audioPlayGenieSource”
Properties map[string]string `json:"properties"` //1,Action中的信息字段,“audioGenieId”的key必须设置,标示播放的开放平台存储的音频ID
}
根据音频素材id播放音频素材
type ResponseValueAskedInfo ¶
type ResponseValueAskedInfo struct {
ParameterName string `json:"parameterName"` //1,询问的参数名(非实体名)
IntentId int64 `json:"intentId"` //1,意图ID,从请求参数中可以获得
}
追问的意图名称和ID,ResultType需在设置为"ASK_INF"
type ResponseWriter ¶
type ResponseWriter interface {
Ask(reply string, askedInfos []string)
Askf(reply string, askedInfos []string, args ...interface{})
Confirm(reply string)
Confirmf(reply string, args ...interface{})
Result(reply string)
Resultf(reply string, args ...interface{})
Error(errStr, code string)
WriteTo(w io.Writer) (n int64, err error)
}
Click to show internal directories.
Click to hide internal directories.