-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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 Moonshot AI #1232
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
👍 @arvinxx Thank you for raising your pull request and contributing to our Community |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1232 +/- ##
==========================================
- Coverage 86.86% 86.37% -0.50%
==========================================
Files 212 214 +2
Lines 10395 10540 +145
Branches 1134 1140 +6
==========================================
+ Hits 9030 9104 +74
- Misses 1365 1436 +71 ☔ View full report in Codecov by Sentry. |
7689e4a
to
bf06b84
Compare
❤️ Great PR @arvinxx ❤️ 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.124.0](v0.123.4...v0.124.0) <sup>Released on **2024-02-06**</sup> #### ✨ Features - **misc**: Support Moonshot AI Provider. <br/> <details> <summary><kbd>Improvements and Fixes</kbd></summary> #### What's improved * **misc**: Support Moonshot AI Provider, closes [#1232](#1232) ([a6de202](a6de202)) </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.124.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
* ✨ feat: support moonshot * 📝 docs: update documents * 🎨 chore: clean code
## [Version 0.124.0](lobehub/lobe-chat@v0.123.4...v0.124.0) <sup>Released on **2024-02-06**</sup> #### ✨ Features - **misc**: Support Moonshot AI Provider. <br/> <details> <summary><kbd>Improvements and Fixes</kbd></summary> #### What's improved * **misc**: Support Moonshot AI Provider, closes [lobehub#1232](lobehub#1232) ([a6de202](lobehub@a6de202)) </details> <div align="right"> [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top) </div>
## [Version 1.6.0](v1.5.3...v1.6.0) <sup>Released on **2024-02-06**</sup> #### ✨ Features - **misc**: Support Moonshot AI Provider. #### 🐛 Bug Fixes - **misc**: Fix non-https `crypto.subtile` missing error, fix rename. #### 💄 Styles - **misc**: Add moonshot i18n, improve clear topic tips, improve direction UX. <br/> <details> <summary><kbd>Improvements and Fixes</kbd></summary> #### What's improved * **misc**: Support Moonshot AI Provider, closes [lobehub#1232](https://github.com/bentwnghk/lobe-chat/issues/1232) ([a6de202](a6de202)) #### What's fixed * **misc**: Fix non-https `crypto.subtile` missing error, closes [lobehub#1238](https://github.com/bentwnghk/lobe-chat/issues/1238) ([1750d0b](1750d0b)) * **misc**: Fix rename ([c94391e](c94391e)) #### Styles * **misc**: Add moonshot i18n, closes [lobehub#1251](https://github.com/bentwnghk/lobe-chat/issues/1251) ([4b6663b](4b6663b)) * **misc**: Improve clear topic tips, closes [lobehub#1247](https://github.com/bentwnghk/lobe-chat/issues/1247) ([2d133e9](2d133e9)) * **misc**: Improve direction UX, closes [lobehub#1169](https://github.com/bentwnghk/lobe-chat/issues/1169) ([e3929dc](e3929dc)) </details> <div align="right"> [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top) </div>
## [Version 0.124.0](lobehub/lobe-chat@v0.123.4...v0.124.0) <sup>Released on **2024-02-06**</sup> #### ✨ Features - **misc**: Support Moonshot AI Provider. <br/> <details> <summary><kbd>Improvements and Fixes</kbd></summary> #### What's improved * **misc**: Support Moonshot AI Provider, closes [#1232](lobehub/lobe-chat#1232) ([a6de202](lobehub/lobe-chat@a6de202)) </details> <div align="right"> [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top) </div>
💻 变更类型 | Change Type
🔀 变更说明 | Description of Change
Moonshot 今天发布 API 开放平台,尝试了下 1 小时完成接入:
📝 补充信息 | Additional Information
以此为示例,验证一下现有的链路,接入一个新 Provider 大致的流程和步骤。
服务端:
config/server/provider.ts
新增 MOONSHOT_API_KEY 等环境变量;libs/agent-runtime
新增 LobeMoonshotAI ,init
和chat
两个方法;InvalidMoonshotAPIKey
和MoonshotBizError
两个错误状态api/chat/[provider]/agentRuntime.ts
新增 moonshotRuntime 初始化逻辑(客户端key 与 环境变量)api/config/route.ts
定义 Provider 默认开启逻辑api/errorResponse.ts
定义MoonshotBizError
状态码客户端:
config/modelProviders
),补充完善相应的模型元信息types/settings/modelProvider
定义MoonshotConfig
,在const/settings
设定默认值;store/global/slices/settings/selector/modelProvider.ts
补充取数 selector (enableMoonshot、 moonshotAPIKey)services/_auth
补充获取 apiKey 相关逻辑;components/ModelProviderIcon
更新components/ModelIcon
更新components/ModelTag
更新features/Conversation/Error
新增一种对应的 APIKeyFormapp/settings/llm
新增一个配置组件(可以拷贝复用 Zhipu )