songquanpeng / one-api

OpenAI 接口管理 & 分发系统,支持 Azure、Anthropic Claude、Google PaLM 2 & Gemini、智谱 ChatGLM、百度文心一言、讯飞星火认知、阿里通义千问、360 智脑以及腾讯混元,可用于二次分发管理 key,仅单可执行文件,已打包好 Docker 镜像,一键部署,开箱即用. OpenAI key management & redistribution system, using a single API for all LLMs, and features an English UI.
https://openai.justsong.cn/
MIT License
15.95k stars 3.69k forks source link

disabled channel when return 无可用渠道 #1549

Closed ye4293 closed 3 days ago

ye4293 commented 1 week ago

close #1548 #1494

我已确认该 PR 已自测通过,相关截图如下: (此处放上测试通过的截图,如果不涉及前端改动或从 UI 上无法看出,请放终端启动成功的截图)

ye4293 commented 6 days ago

确实,是我考虑欠妥了。确实应该注意恶意请求这个问题。

Buer @.***> 于2024年6月23日周日 17:17写道:

@.**** requested changes on this pull request.

In monitor/manage.go https://github.com/songquanpeng/one-api/pull/1549#discussion_r1650026027 :

@@ -35,6 +36,8 @@ func ShouldDisableChannel(err *model.Error, statusCode int) bool { return true } else if strings.HasPrefix(err.Message, "This organization has been disabled.") { return true

  • } else if strings.HasPrefix(err.Message, "无可用渠道") {
  1. 这个匹配不到,要用HasSuffix
  2. 模型不存在,不应该被禁用,这个不合理,有可能是不小心填写错误,如果商用,也可以被恶意请求,导致上游渠道全部被禁用。

— Reply to this email directly, view it on GitHub https://github.com/songquanpeng/one-api/pull/1549#pullrequestreview-2134225362, or unsubscribe https://github.com/notifications/unsubscribe-auth/BAVUTO6KRVRDCEX32IQMMJTZI2HCDAVCNFSM6AAAAABJVDK3MKVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDCMZUGIZDKMZWGI . You are receiving this because you authored the thread.Message ID: @.***>

ye4293 commented 5 days ago

这种确实利用错误统计会更好点,不应该直接ban掉渠道。

Buer @.***> 于2024年6月23日周日 22:19写道:

@.**** commented on this pull request.

In monitor/manage.go https://github.com/songquanpeng/one-api/pull/1549#discussion_r1650086550 :

@@ -35,6 +36,8 @@ func ShouldDisableChannel(err *model.Error, statusCode int) bool { return true } else if strings.HasPrefix(err.Message, "This organization has been disabled.") { return true

  • } else if strings.HasPrefix(err.Message, "无可用渠道") {

我看你的返回错误 是他把4o下了,这种情况还真没有啥好预防的措施。因为报错是正常报错,没有特征可以识别。 你只能自己关注,要么可以自己写一个错误统计的,某个错误一定时间内超过多少条,发消息给你,你自己手动处理。

— Reply to this email directly, view it on GitHub https://github.com/songquanpeng/one-api/pull/1549#discussion_r1650086550, or unsubscribe https://github.com/notifications/unsubscribe-auth/BAVUTO35OK4232H4OB47Y5LZI3KPFAVCNFSM6AAAAABJVDK3MKVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDCMZUGI4TCMZUGQ . You are receiving this because you authored the thread.Message ID: @.***>