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 68 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

@canisminor1990
Copy link
Member

้‚ฃๆ”นๆˆincludeๅ‘ข

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. ๐Ÿ‘ฏ๐Ÿ‘ญ๐Ÿป๐Ÿง‘โ€๐Ÿคโ€๐Ÿง‘๐Ÿ‘ซ๐Ÿง‘๐Ÿฟโ€๐Ÿคโ€๐Ÿง‘๐Ÿป๐Ÿ‘ฉ๐Ÿพโ€๐Ÿคโ€๐Ÿ‘จ๐Ÿฟ๐Ÿ‘ฌ๐Ÿฟ


What about changing it to include?

@canisminor1990 canisminor1990 changed the title fix: correct the model list on the model provider's page ๐Ÿ› fix: correct the model list on the model provider's page Dec 26, 2024
@lc-soft
Copy link
Contributor Author

lc-soft commented Dec 26, 2024

้‚ฃๆ”นๆˆincludeๅ‘ข

ไฟฎๆ”น getModelList() ้‡Œ็š„ uniqBy()๏ผŒๆ€Žๆ ท๏ผŸ

return uniqBy(list, (item) => item.identifier.split('/').pop());

ๆŸฅๆ‰พ็”จ includes()๏ผš

const name = id.split('/').pop();
let model = list.find((item) => item.identifier.includes(name));

ไพ‹ๅฆ‚๏ผš

[
  { identifier: '@cf/qwen/qwen1.5-14-b-chat-awq' },
  { identifier: 'qwen1.5-14-b-chat-awq' }
]

ๅŽป้‡ๅŽ๏ผš

[
  { identifier: '@cf/qwen/qwen1.5-14-b-chat-awq' },
]

ๆŸฅๆ‰พ็ป“ๆžœ๏ผš

@cf/qwen/qwen1.5-14-b-chat-awq -> { identifier: '@cf/qwen/qwen1.5-14-b-chat-awq' }
qwen1.5-14-b-chat-awq -> { identifier: '@cf/qwen/qwen1.5-14-b-chat-awq' }

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. ๐Ÿ‘ฏ๐Ÿ‘ญ๐Ÿป๐Ÿง‘โ€๐Ÿคโ€๐Ÿง‘๐Ÿ‘ซ๐Ÿง‘๐Ÿฟโ€๐Ÿคโ€๐Ÿง‘๐Ÿป๐Ÿ‘ฉ๐Ÿพโ€๐Ÿคโ€๐Ÿ‘จ๐Ÿฟ๐Ÿ‘ฌ๐Ÿฟ


What about changing it to include?

How about modifying uniqBy() in getModelList()?

return uniqBy(list, (item) => item.identifier.split('/').pop());

Find using includes():

const name = id.split('/').pop();
let model = list.find((item) => item.identifier.includes(name));

For example:

[
  { identifier: '@cf/qwen/qwen1.5-14-b-chat-awq' },
  { identifier: 'qwen1.5-14-b-chat-awq' }
]

After deduplication:

[
  { identifier: '@cf/qwen/qwen1.5-14-b-chat-awq' },
]

Find results:

@cf/qwen/qwen1.5-14-b-chat-awq -> { identifier: '@cf/qwen/qwen1.5-14-b-chat-awq' }
qwen1.5-14-b-chat-awq -> { identifier: '@cf/qwen/qwen1.5-14-b-chat-awq' }

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