mirror of
https://github.com/linux-do/new-api.git
synced 2025-11-13 01:23:41 +08:00
merge upstream
Signed-off-by: wozulong <>
This commit is contained in:
@@ -29,7 +29,7 @@ func MidjourneyErrorWithStatusCodeWrapper(code int, desc string, statusCode int)
|
||||
func OpenAIErrorWrapper(err error, code string, statusCode int) *dto.OpenAIErrorWithStatusCode {
|
||||
text := err.Error()
|
||||
// 定义一个正则表达式匹配URL
|
||||
if strings.Contains(text, "Post") {
|
||||
if strings.Contains(text, "Post") || strings.Contains(text, "dial") {
|
||||
common.SysLog(fmt.Sprintf("error: %s", text))
|
||||
text = "请求上游地址失败"
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ func CountTokenInput(input any, model string, check bool) (int, error, bool) {
|
||||
}
|
||||
return CountTokenText(text, model, check)
|
||||
}
|
||||
return 0, errors.New("unsupported input type"), false
|
||||
return CountTokenInput(fmt.Sprintf("%v", input), model, check)
|
||||
}
|
||||
|
||||
func CountAudioToken(text string, model string, check bool) (int, error, bool) {
|
||||
|
||||
Reference in New Issue
Block a user