feat(adaptor): refactor response handlers to return usage first and improve error handling

This commit is contained in:
CaIon
2025-07-12 21:12:46 +08:00
parent 20607b0b5c
commit 52a5e58f0c
5 changed files with 28 additions and 28 deletions

View File

@@ -98,9 +98,9 @@ func (a *Adaptor) DoRequest(c *gin.Context, info *common.RelayInfo, requestBody
// DoResponse implements channel.Adaptor.
func (a *Adaptor) DoResponse(c *gin.Context, resp *http.Response, info *common.RelayInfo) (usage any, err *types.NewAPIError) {
if info.IsStream {
err, usage = cozeChatStreamHandler(c, info, resp)
usage, err = cozeChatStreamHandler(c, info, resp)
} else {
err, usage = cozeChatHandler(c, info, resp)
usage, err = cozeChatHandler(c, info, resp)
}
return
}