feat(workers): 添加调试打印语句并优化GetHisMsg函数返回逻辑
This commit is contained in:
parent
9b2c187566
commit
c8b6c5ea20
2 changed files with 15 additions and 4 deletions
|
@ -88,6 +88,7 @@ func (a *AI) GetMsg() string {
|
|||
if len(matches) > 0 {
|
||||
|
||||
msgId = matches[1]
|
||||
println("msgId:", msgId)
|
||||
} else {
|
||||
msgId = ""
|
||||
log.Println("未找到回复消息")
|
||||
|
|
|
@ -139,7 +139,12 @@ func (s *StdAns) GetHisMsg(id string) string {
|
|||
}
|
||||
|
||||
// fmt.Println("响应返回:", body)
|
||||
return data["data"].(map[string]interface{})["raw_message"].(string)
|
||||
raw_message, ok := data["data"].(map[string]interface{})["raw_message"].(string)
|
||||
if !ok {
|
||||
return ""
|
||||
} else {
|
||||
return raw_message
|
||||
}
|
||||
|
||||
}
|
||||
func (s *StdAns) SendMsg(msg string) bool {
|
||||
|
@ -203,8 +208,13 @@ func (s *StdAns) GetImage(file string) string {
|
|||
fmt.Println("解析JSON失败:", err)
|
||||
return ""
|
||||
}
|
||||
path := data["data"].(map[string]interface{})["file"].(string)
|
||||
fmt.Println("url:", url)
|
||||
path, ok := data["data"].(map[string]interface{})["file"].(string)
|
||||
if !ok {
|
||||
return ""
|
||||
} else {
|
||||
// fmt.Println("响应返回:", body)
|
||||
return path
|
||||
}
|
||||
|
||||
// fmt.Println("响应返回:", body)
|
||||
return path
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue