mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-09-17 09:16:36 +08:00
* feat: add Replicate adaptor and integrate into channel and API types * feat: support llm chat on replicate
24 lines
479 B
Go
24 lines
479 B
Go
package openai
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/songquanpeng/one-api/common/logger"
|
|
"github.com/songquanpeng/one-api/relay/model"
|
|
)
|
|
|
|
func ErrorWrapper(err error, code string, statusCode int) *model.ErrorWithStatusCode {
|
|
logger.Error(context.TODO(), fmt.Sprintf("[%s]%+v", code, err))
|
|
|
|
Error := model.Error{
|
|
Message: err.Error(),
|
|
Type: "one_api_error",
|
|
Code: code,
|
|
}
|
|
return &model.ErrorWithStatusCode{
|
|
Error: Error,
|
|
StatusCode: statusCode,
|
|
}
|
|
}
|