Beispiel #1
0
// @Title Get
// @Description ai chat
// @Param	chat		path 	string	true		"Please input chat"
// @Success 200 {ai} models.AI
// @Failure 403 :chat is empty
// @router /:chat [get]
func (o *AIController) Say() {
	chat := o.GetString(":chat")

	var ai models.AI
	ai.Say(chat)

	o.Data["json"] = ai
	o.ServeJson()
}
Beispiel #2
0
// @Title createUser
// @Description get webchat content
// @Param	body		body 	models.WebChat	true		"body for webchat content"
// @Success 200 {int} models.WebChat.Id
// @Failure 403 body is empty
// @router / [post]
func (wc *WebChatController) Post() {
	fmt.Println("WebChat_Post")
	fmt.Println(string(wc.Ctx.Input.RequestBody))

	var receiver models.WebChatTextReceiver
	var returner models.WebChatTextReturner

	err := xml.Unmarshal(wc.Ctx.Input.RequestBody, &receiver)
	if err == nil {
		var ai models.AI
		ai.Say(receiver.Content)

		returner = receiver.Return(ai)
	} else {
		fmt.Println(err)
	}

	wc.Data["xml"] = returner
	wc.ServeXml()
}