-
-
Notifications
You must be signed in to change notification settings - Fork 7.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ feat: support multiple API Keys #1345
Conversation
@luoweihua7 is attempting to deploy a commit to the LobeHub Team on Vercel. A member of the Team first needs to authorize it. |
Thank you for raising your pull request and contributing to our Community |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
麻烦按照 review 优化下实现~
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1345 +/- ##
==========================================
+ Coverage 86.33% 86.39% +0.06%
==========================================
Files 217 218 +1
Lines 11059 11109 +50
Branches 1177 1186 +9
==========================================
+ Hits 9548 9598 +50
Misses 1511 1511 ☔ View full report in Codecov by Sentry. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I'll merge it. Great work~
❤️ Great PR @luoweihua7 ❤️ The growth of project is inseparable from user feedback and contribution, thanks for your contribution! If you are interesting with the lobehub developer community, please join our discord and then dm @arvinxx or @canisminor1990. They will invite you to our private developer channel. We are talking about the lobe-chat development or sharing ai newsletter around the world. |
## [Version 0.130.0](v0.129.6...v0.130.0) <sup>Released on **2024-02-27**</sup> #### ✨ Features - **misc**: Support multiple API Keys. <br/> <details> <summary><kbd>Improvements and Fixes</kbd></summary> #### What's improved * **misc**: Support multiple API Keys, closes [#1345](#1345) ([17c5da3](17c5da3)) </details> <div align="right"> [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top) </div>
🎉 This PR is included in version 0.130.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
## [Version 1.12.0](v1.11.7...v1.12.0) <sup>Released on **2024-02-27**</sup> #### ✨ Features - **misc**: Support multiple API Keys. <br/> <details> <summary><kbd>Improvements and Fixes</kbd></summary> #### What's improved * **misc**: Support multiple API Keys, closes [lobehub#1345](https://github.com/bentwnghk/lobe-chat/issues/1345) ([17c5da3](17c5da3)) </details> <div align="right"> [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top) </div>
* ✨ feat: Support multiple API keys [RFC 027] * 📝 docs: add env variable API_KEY_SELECT_MODE * 🔧 chore: Adjust the parameter API_KEY_SELECT_MODE to be optional * 🔧 fix: Adjustments made according to Code Review requirements * ✅ test: add test for ApiKeyManager * 🔧 fix: Support for multiple API Keys from user input on the client side * 🔧 chore: handle Perplexity API Key * 🔧 chore: update OpenAI or Azure API Key select * 🔧 chore: update OpenAI or Azure API Key select
## [Version 0.130.0](lobehub/lobe-chat@v0.129.6...v0.130.0) <sup>Released on **2024-02-27**</sup> #### ✨ Features - **misc**: Support multiple API Keys. <br/> <details> <summary><kbd>Improvements and Fixes</kbd></summary> #### What's improved * **misc**: Support multiple API Keys, closes [lobehub#1345](lobehub#1345) ([17c5da3](lobehub@17c5da3)) </details> <div align="right"> [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top) </div>
## [Version 0.130.0](lobehub/lobe-chat@v0.129.6...v0.130.0) <sup>Released on **2024-02-27**</sup> #### ✨ Features - **misc**: Support multiple API Keys. <br/> <details> <summary><kbd>Improvements and Fixes</kbd></summary> #### What's improved * **misc**: Support multiple API Keys, closes [#1345](lobehub/lobe-chat#1345) ([17c5da3](lobehub/lobe-chat@17c5da3)) </details> <div align="right"> [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top) </div>
💻 变更类型 | Change Type
🔀 变更说明 | Description of Change
启动时支持传入多个API Keys,通过Key之间使用英文逗号分割。接口调用时,API Keys支持随机(random)或者轮训(turn)方式获取。
增加参数
API_KEY_SELECT_MODE
,用于控制Keys的选择模式。参数说明random
随机从提供的Keys中获取一个turn
按照提供的Keys顺序轮训获取其他值
使用第一个Key(注:空字符串也属于其他值的一种)random
随机模式📝 补充信息 | Additional Information
[RFC] 027 - API Key 字段支持使用多个Key
暂不支持请求失败时,使用下一个Key重新发起请求。