Skip to content
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 openrouter custom models env #1647

Merged
merged 2 commits into from
Mar 25, 2024

Conversation

danielglh
Copy link
Contributor

💻 变更类型 | Change Type

  • ✨ feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 🔨 chore
  • ⚡️ perf
  • 📝 docs

🔀 变更说明 | Description of Change

Allow OPENROUTER_CUSTOM_MODELS env var to define custom models for OpenRouter provider, together with its provider setting. It works similarly to the CUSTOM_MODELS env var for OpenAI:

image

Fixed issue #1624.

📝 补充信息 | Additional Information

N/A

Copy link

vercel bot commented Mar 19, 2024

@danielglh is attempting to deploy a commit to the LobeHub Team on Vercel.

A member of the Team first needs to authorize it.

@lobehubbot
Copy link
Member

👍 @danielglh

Thank you for raising your pull request and contributing to our Community
Please make sure you have followed our contributing guidelines. We will review it as soon as possible.
If you encounter any problems, please feel free to connect with us.
非常感谢您提出拉取请求并为我们的社区做出贡献,请确保您已经遵循了我们的贡献指南,我们会尽快审查它。
如果您遇到任何问题,请随时与我们联系。

@danielglh danielglh force-pushed the feat-openrouter-custom-models branch from 619cd5b to 8979665 Compare March 19, 2024 14:46
@arvinxx
Copy link
Contributor

arvinxx commented Mar 22, 2024

The implement is LGTM. Could you please add a test for the modelSelectList selector to cover openrouter env logic?

@danielglh danielglh force-pushed the feat-openrouter-custom-models branch from bc6d4ee to 82188ae Compare March 22, 2024 02:22
@danielglh
Copy link
Contributor Author

The implement is LGTM. Could you please add a test for the modelSelectList selector to cover openrouter env logic?

@arvinxx I checked the test cases and I found that the core logic has already been covered by existing test cases. Openrouter reuses the customModelName property to introduce custom models in env and reuses parseModelString to parse it, and this flow has been well covered already. There was nothing special about Openrouter. Can yoy be more specific on the additional test coverage you have in mind?

@arvinxx
Copy link
Contributor

arvinxx commented Mar 22, 2024

@danielglh I mean if there is an openrouter?.customModelName field, and the result should be snapshot.

Copy link

codecov bot commented Mar 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.14%. Comparing base (04d8e53) to head (19c2c4b).
Report is 28 commits behind head on main.

❗ Current head 19c2c4b differs from pull request most recent head ed320c1. Consider uploading reports for the commit ed320c1 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1647      +/-   ##
==========================================
- Coverage   92.57%   90.14%   -2.44%     
==========================================
  Files         239      245       +6     
  Lines       13066    13878     +812     
  Branches     1562     1583      +21     
==========================================
+ Hits        12096    12510     +414     
- Misses        970     1368     +398     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@danielglh danielglh force-pushed the feat-openrouter-custom-models branch from 82188ae to 19c2c4b Compare March 25, 2024 13:41
@danielglh
Copy link
Contributor Author

@danielglh I mean if there is an openrouter?.customModelName field, and the result should be snapshot.

@arvinxx test case added

@danielglh danielglh force-pushed the feat-openrouter-custom-models branch from 19c2c4b to ed320c1 Compare March 25, 2024 14:29
@arvinxx arvinxx changed the title ✨ feat: add openrouter custom models env ✨ feat: support openrouter custom models env Mar 25, 2024
Copy link
Contributor

@arvinxx arvinxx left a 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. Thanks for your contribution!

@arvinxx arvinxx merged commit 78baa16 into lobehub:main Mar 25, 2024
2 of 3 checks passed
@lobehubbot
Copy link
Member

❤️ Great PR @danielglh ❤️

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.
项目的成长离不开用户反馈和贡献,感谢您的贡献! 如果您对 LobeHub 开发者社区感兴趣,请加入我们的 discord,然后私信 @arvinxx@canisminor1990。他们会邀请您加入我们的私密开发者频道。我们将会讨论关于 Lobe Chat 的开发,分享和讨论全球范围内的 AI 消息。

github-actions bot pushed a commit that referenced this pull request Mar 25, 2024
### [Version 0.142.2](v0.142.1...v0.142.2)
<sup>Released on **2024-03-25**</sup>

#### 🐛 Bug Fixes

- **misc**: Support openrouter custom models env.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### What's fixed

* **misc**: Support openrouter custom models env, closes [#1647](#1647) ([78baa16](78baa16))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>
@lobehubbot
Copy link
Member

🎉 This PR is included in version 0.142.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

github-actions bot pushed a commit to bentwnghk/lobe-chat that referenced this pull request Mar 25, 2024
### [Version&nbsp;1.22.2](v1.22.1...v1.22.2)
<sup>Released on **2024-03-25**</sup>

#### 🐛 Bug Fixes

- **misc**: Support openrouter custom models env.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### What's fixed

* **misc**: Support openrouter custom models env, closes [lobehub#1647](https://github.com/bentwnghk/lobe-chat/issues/1647) ([78baa16](78baa16))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>
jjcruise pushed a commit to jjcruise/lobe-chat that referenced this pull request Mar 26, 2024
* ✨ feat: add openrouter custom models env

* ✅ add OPENROUTER_CUSTOM_MODELS env var test case
jjcruise pushed a commit to jjcruise/lobe-chat that referenced this pull request Mar 26, 2024
### [Version&nbsp;0.142.2](lobehub/lobe-chat@v0.142.1...v0.142.2)
<sup>Released on **2024-03-25**</sup>

#### 🐛 Bug Fixes

- **misc**: Support openrouter custom models env.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### What's fixed

* **misc**: Support openrouter custom models env, closes [lobehub#1647](lobehub#1647) ([78baa16](lobehub@78baa16))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>
miroshar-success added a commit to miroshar-success/OpenAI_Integraion_platform that referenced this pull request Apr 5, 2024
### [Version&nbsp;0.142.2](lobehub/lobe-chat@v0.142.1...v0.142.2)
<sup>Released on **2024-03-25**</sup>

#### 🐛 Bug Fixes

- **misc**: Support openrouter custom models env.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### What's fixed

* **misc**: Support openrouter custom models env, closes [#1647](lobehub/lobe-chat#1647) ([78baa16](lobehub/lobe-chat@78baa16))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants