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

fix: correct the model list on the model provider's page #5043

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lc-soft
Copy link
Contributor

@lc-soft lc-soft commented Dec 16, 2024

💻 变更类型 | Change Type

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

🔀 变更说明 | Description of Change

模型列表去重时是以 / 后的名称作为唯一键的:
When deduplicating model lists, the name after the / is used as the unique key:

image

以 Qwen/Qwen2-7B-Instruct 为例,Gitee AI 中记录的模型 id 是 Qwen2-7B-Instruct,其它提供商的模型 id 是 Qwen/Qwen2-7B-Instruct,这种情况下,靠判断 item.identifier === id 是找不到 Gitee AI 的 Qwen2-7B-Instruct 模型详细的。

Using Qwen/Qwen2-7B-Instruct as an example, the model ID recorded in Gitee AI is Qwen2-7B-Instruct, while the model ID for other providers is Qwen/Qwen2-7B-Instruct. In this case, it is not possible to find detailed information about the Gitee AI's Qwen2-7B-Instruct model by determining that item.identifier === id.

因此,改成与 getModelList() 中相同的方式获取 id 再进行判断。
Therefore, it is changed to obtain the id in the same way as in getModelList() and then make a judgment.

📝 补充信息 | Additional Information

Before:

The total number of models is 4 +2

model-list-before

After:

The total number of models is 4 +10

model-list-after

Copy link

vercel bot commented Dec 16, 2024

@lc-soft is attempting to deploy a commit to the LobeHub Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Dec 16, 2024
@lobehubbot
Copy link
Member

👍 @lc-soft

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.
非常感谢您提出拉取请求并为我们的社区做出贡献,请确保您已经遵循了我们的贡献指南,我们会尽快审查它。
如果您遇到任何问题,请随时与我们联系。

@dosubot dosubot bot added the 🐛 Bug Something isn't working | 缺陷 label Dec 16, 2024
@lc-soft lc-soft force-pushed the lc/fix-provider-model-list branch from 5859ddd to 0ef6ce7 Compare December 16, 2024 11:55
Copy link

codecov bot commented Dec 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.14%. Comparing base (99026bb) to head (1a492ec).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5043      +/-   ##
==========================================
+ Coverage   91.96%   98.14%   +6.17%     
==========================================
  Files         548       12     -536     
  Lines       41463     2913   -38550     
  Branches     2517      154    -2363     
==========================================
- Hits        38132     2859   -35273     
+ Misses       3331       54    -3277     
Flag Coverage Δ
app ?
server 98.14% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link

vercel bot commented Dec 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lobe-chat-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 16, 2024 3:15pm

@canisminor1990
Copy link
Member

@lc-soft 影响到了其他 Provider ,尝试改成这样试试?

如:https://lobe-chat-preview-git-fork-lc-soft-l-50c801-lobe-chat-community.vercel.app/discover/provider/openrouter

let model = list.find((item) => {
      const ids = item.identifier.split('/');
      return ids[1] === id  || item.identifier === id;
});

@lc-soft lc-soft force-pushed the lc/fix-provider-model-list branch from 0ef6ce7 to 1a492ec Compare December 19, 2024 02:55
@lc-soft
Copy link
Contributor Author

lc-soft commented Dec 19, 2024

@lc-soft 影响到了其他 Provider ,尝试改成这样试试?

如:https://lobe-chat-preview-git-fork-lc-soft-l-50c801-lobe-chat-community.vercel.app/discover/provider/openrouter

let model = list.find((item) => {
      const ids = item.identifier.split('/');
      return ids[1] === id  || item.identifier === id;
});

改了。

我测试时看到有些 id 包含多个斜杆 /,这种 id 的模型可能仍然存在找不到的情况。

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working | 缺陷 size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants