diff --git a/workers/ai.go b/workers/ai.go index 4f5c505..994a10f 100644 --- a/workers/ai.go +++ b/workers/ai.go @@ -92,10 +92,10 @@ func handleModelRequest(OPENAI_API_KEY, OPENAI_BaseURL string) string { choices := responseBody["data"].([]interface{}) // var models []interface{} if len(choices) > 0 { - msg := "支持的模型列表:\\n" + msg := "支持的模型列表:\n" for _, choice := range choices { model := choice.(map[string]interface{})["id"] - msg += fmt.Sprintf("%s\\n", model) + msg += fmt.Sprintf("%s\n", model) } return msg } else { @@ -138,7 +138,7 @@ func handleChatRequest(OPENAI_API_KEY, OPENAI_BaseURL, MODEL, rawMsg, UID string log.Println(errs) return "请求失败" } - + println(resp.StatusCode) if resp.StatusCode == 200 { var responseBody map[string]interface{} if err := json.Unmarshal([]byte(body), &responseBody); err != nil { @@ -155,6 +155,6 @@ func handleChatRequest(OPENAI_API_KEY, OPENAI_BaseURL, MODEL, rawMsg, UID string return "api解析失败" } } else { - return "请求失败" + return "请求失败: " + string(resp.StatusCode) } } diff --git a/workers/pkg.go b/workers/pkg.go index 01dd8fe..92d18a8 100644 --- a/workers/pkg.go +++ b/workers/pkg.go @@ -38,7 +38,7 @@ func (a *Pkg) GetMsg() string { url += "&repo=" + strings.ToUpper(parms[2][:1]) + parms[2][1:] } // 输出请求地址 - fmt.Println("pkg url:", url) + // fmt.Println("pkg url:", url) request := gorequest.New() _, body, errs := request.Get(url).End() if len(errs) > 0 { @@ -61,7 +61,7 @@ func (a *Pkg) GetMsg() string { fmt.Println(errs) } - fmt.Println("aur suggest url:", url) + // fmt.Println("aur suggest url:", url) // fmt.Println(string(re)) var suggestions []string @@ -98,7 +98,7 @@ func (a *Pkg) GetMsg() string { searchResult = resultMap } } - fmt.Println(len(searchResult)) + // fmt.Println(len(searchResult)) } else if len(searchResults) == 1 { searchResult = searchResults[0].(map[string]interface{}) } @@ -106,7 +106,7 @@ func (a *Pkg) GetMsg() string { if !ok { maintainer = "孤儿包" } - println("maintainer:", maintainer) + // println("maintainer:", maintainer) // last_update := '' last_update := time.Unix(int64(searchResult["LastModified"].(float64)), 0).Format("2006-01-02 15:04:05") @@ -123,7 +123,7 @@ func (a *Pkg) GetMsg() string { msg += "上游:" + upstream + "\n" msg += "更新时间:" + last_update - fmt.Println(msg) + // fmt.Println(msg) return msg }