refactor(workers): 优化AI和LSP工作者的错误处理和日志输出

This commit is contained in:
liyp 2024-06-30 23:36:17 +08:00
parent be83757074
commit 21296b7878
2 changed files with 5 additions and 2 deletions

View file

@ -83,7 +83,7 @@ func (a *AI) GetMsg() string {
log.Println("PROMRT 未配置")
PROMPT = ""
}
println("PROMPT:", PROMPT)
// println("PROMPT:", PROMPT)
requestBody := map[string]interface{}{
"model": MODEL,
"messages": []map[string]string{{

View file

@ -18,10 +18,13 @@ func (a *Lsp) GetMsg() string {
url := "https://api.lolicon.app/setu/v2?r18=0&size=small"
resp, err := http.Get(url)
if err != nil {
return "获取失败"
return "请求图片失败"
}
defer resp.Body.Close()
budy, err := io.ReadAll(resp.Body)
if err != nil {
return "读取失败"
}
var res map[string]interface{}
err = json.Unmarshal(budy, &res)
if err != nil {