|
@@ -2,6 +2,7 @@ package aiser
|
|
|
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
+ "errors"
|
|
|
"eta/eta_api/utils"
|
|
|
"io/ioutil"
|
|
|
"net/http"
|
|
@@ -23,6 +24,9 @@ func ChatAutoMsg(prompt string) (result string, err error) {
|
|
|
//提交请求
|
|
|
reqest, err := http.NewRequest("POST", chatUrl, strings.NewReader(string(postData)))
|
|
|
businessCode := utils.BusinessCode
|
|
|
+ if businessCode == "" {
|
|
|
+ return businessCode, errors.New("未获取到商户号")
|
|
|
+ }
|
|
|
nonce := utils.GetRandStringNoSpecialChar(16)
|
|
|
timestamp := time.Now().Format(utils.FormatDateTimeUnSpace)
|
|
|
signature := utils.GetSign(nonce, timestamp, utils.EtaAppid, utils.EtaSecret)
|