Skip to content

Commit

Permalink
feat(yocsef): add error if nowOutput is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
JingYiJun committed Jun 2, 2024
1 parent 2956a9a commit 47102a3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion service/yocsef.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ func InferYocsef(
if err != nil {
return
}
defer res.Body.Close()
defer func(Body io.ReadCloser) {
_ = Body.Close()
}(res.Body)

if res.StatusCode != http.StatusOK {
return nil, errors.New("yocsef 推理模型暂不可用")
Expand Down Expand Up @@ -135,6 +137,10 @@ func InferYocsef(
})
}

if nowOutput == "" {
return nil, errors.New("yocsef 推理模型暂不可用")
}

if ctx.Err() != nil {
return nil, ctx.Err()
}
Expand Down

0 comments on commit 47102a3

Please sign in to comment.