You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
545 B
27 lines
545 B
package third_part
|
|
|
|
import (
|
|
"WechatGateWay/utils"
|
|
"encoding/json"
|
|
"log"
|
|
"strings"
|
|
)
|
|
|
|
type qingyunkeRes struct {
|
|
Result int `json:"result"`
|
|
Content string `json:"content"`
|
|
}
|
|
|
|
func AiChat(msg string) string {
|
|
log.Println("分析关键词:", msg)
|
|
url := "http://api.qingyunke.com/api.php?key=free&appid=0&msg=" + msg
|
|
ansByte := utils.HTTPGet(url)
|
|
if ansByte == nil {
|
|
return "没听懂"
|
|
}
|
|
var ansRes qingyunkeRes
|
|
json.Unmarshal(ansByte, &ansRes)
|
|
//{br}替换成换行
|
|
return strings.Replace(ansRes.Content, "{br}", "\n", -1)
|
|
}
|