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

Refactor: abusing goroutines and channel #1561

Open zijiren233 opened 3 days ago

zijiren233 commented 3 days ago
image
MartialBE commented 2 days ago

可以写明一下具体更改了什么以及解决了什么问题吗。

zijiren233 commented 2 days ago

重写没必要使用goroutine和channel的地方,从而提高性能

Laisky commented 2 days ago

之前的写法确实问题很大,但是这次改动这么大,最好能提供更多模型的测试案例,而且响应最好能稍微长一点,至少要超过一次 stream event 的长度。

zijiren233 commented 2 days ago

这是SSE请求界面,一个接收消息就是一个event 目前测试了google, openai, cloudflare, 百度,腾讯,阿里

image image image image image image image
Laisky commented 2 days ago

@zijiren233 参照 CI 改一下 commit 的格式吧。 另外那个 coverage 挂了,得等 owner 来修。

zijiren233 commented 2 days ago

已修复commit message