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

💄 style: support to reset fetched models #4260

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

vual
Copy link
Contributor

@vual vual commented Oct 5, 2024

💻 变更类型 | Change Type

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

🔀 变更说明 | Description of Change

增加【清除获取的模型】的功能,主要是用于在获取模型列表后,不想要了,需要恢复系统自带的模型。
image

📝 补充信息 | Additional Information

Copy link

vercel bot commented Oct 5, 2024

@vual is attempting to deploy a commit to the LobeChat Community Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. 🌠 Feature Request New feature or request | 特性与建议 labels Oct 5, 2024
@lobehubbot
Copy link
Member

👍 @vual

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

Copy link

codecov bot commented Oct 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.52%. Comparing base (6af7b52) to head (517db81).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4260      +/-   ##
==========================================
- Coverage   92.53%   92.52%   -0.02%     
==========================================
  Files         522      522              
  Lines       37340    37363      +23     
  Branches     3665     3668       +3     
==========================================
+ Hits        34552    34569      +17     
- Misses       2788     2794       +6     
Flag Coverage Δ
app 92.52% <ø> (-0.02%) ⬇️
server 97.26% <ø> (ø)

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.

@arvinxx
Copy link
Contributor

arvinxx commented Oct 28, 2024

image

建议放在我画圈的位置,用 ActionIcon 组件 (默认不展示文本只放图标,hover 才显示 title)。放你现在那个位置很容易出现多点一次重置模型的情况,即 CLS 会有问题。详见:https://web.dev/articles/cls?hl=zh-cn

@arvinxx arvinxx changed the title 增加【清除获取的模型】的功能,主要是用于在获取模型列表后,不想要了,需要恢复系统自带的模型。 💄 style: support to reset fetched models Oct 28, 2024
@vual
Copy link
Contributor Author

vual commented Oct 28, 2024

image 建议放在我画圈的位置,用 ActionIcon 组件 (默认不展示文本只放图标,hover 才显示 title)。放你现在那个位置很容易出现多点一次重置模型的情况,即 CLS 会有问题。详见:https://web.dev/articles/cls?hl=zh-cn

image
已更新。

Copy link

vercel bot commented Oct 31, 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 Nov 5, 2024 6:12pm

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.

功能没问题了,把这个细节实现再修一下~

另外可以跑下 npm run i18n 自动生成 locale

@@ -52,19 +53,28 @@ const ModelFetcher = memo<ModelFetcherProps>(({ provider }) => {
(s) => modelProviderSelectors.getModelCardsById(provider)(s).length,
);

const remoteModels = useUserStore((s) =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import isEqual from 'fast-deep-equal';

const remoteModels = useUserStore(modelProviderSelectors.remoteProviderModelCards(provider), isEqual
  );

remoteModels 是一个数组,因此需要这么写来避免 rerender

@vual
Copy link
Contributor Author

vual commented Nov 1, 2024

npm run i18n

image
执行npm run i18n的时候env.local里配的openaikey和proxyurl不会生效吗?

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


npm run i18n

image
Will the openaikey and proxyurl configured in env.local not take effect when executing npm run i18n?

@arvinxx
Copy link
Contributor

arvinxx commented Nov 1, 2024

@vual 配到 .env 里

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@vual allocated to .env

@vual
Copy link
Contributor Author

vual commented Nov 1, 2024

@vual 配到 .env 里

可以了。

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@vual allocated to .env

That's it.

@arvinxx
Copy link
Contributor

arvinxx commented Nov 4, 2024

rebase 下 main

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


rebase under main

# Conflicts:
#	locales/ko-KR/models.json
#	locales/pt-BR/models.json
#	locales/ru-RU/models.json
#	locales/zh-CN/models.json
@vual
Copy link
Contributor Author

vual commented Nov 5, 2024

rebase 下 main

可以了。

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


rebase under main

That's it.

@arvinxx
Copy link
Contributor

arvinxx commented Nov 5, 2024

有问题哈,locale 这边不应该有回车的,你需要跑一下 git commit 前的 lint 自动格式化掉。

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


There is a problem. There should not be a carriage return in the locale. You need to run lint before git commit to automatically format it.

@vual
Copy link
Contributor Author

vual commented Nov 6, 2024

有问题哈,locale 这边不应该有回车的,你需要跑一下 git commit 前的 lint 自动格式化掉。

重新pnpm run i18n了,应该可以了。

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


There is a problem. There should not be a carriage return in the locale. You need to run lint before git commit to automatically format it.

Re-pnpm run i18n, it should be OK.

@arvinxx
Copy link
Contributor

arvinxx commented Nov 12, 2024

rebase 下main? 另外 locale 的更新不应该每个都加回车的,你是不是提交前没跑下 lint 和 format?

功能代码上没问题了, locale 的部分处理下

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Rebase under main? In addition, every locale update should not include a carriage return. Did you not run lint and format before submitting? There is no problem with the function code

@vual
Copy link
Contributor Author

vual commented Nov 12, 2024

rebase 下main? 另外 locale 的更新不应该每个都加回车的,你是不是提交前没跑下 lint 和 format?

功能代码上没问题了, locale 的部分处理下

很奇怪,我并没有加回车,我只是重跑了npm run i18n

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Rebase under main? In addition, every locale update should not include a carriage return. Did you not run lint and format before submitting?

There is no problem with the function code. Let’s deal with the locale part.

It's strange, I didn't add the carriage return, I just reran npm run i18n

@arvinxx
Copy link
Contributor

arvinxx commented Nov 12, 2024

很奇怪,我并没有加回车,我只是重跑了npm run i18n

重跑以后正常提交会做一次格式化,会自动把回车去掉的,你是不是跳过 commit 时候的hook了?

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


It's strange, I didn't add the carriage return, I just reran npm run i18n

After re-running, normal submission will be formatted and the carriage return will be automatically removed. Did you skip the hook during commit?

@vual
Copy link
Contributor Author

vual commented Nov 12, 2024

很奇怪,我并没有加回车,我只是重跑了npm run i18n

重跑以后正常提交会做一次格式化,会自动把回车去掉的,你是不是跳过 commit 时候的hook了?

有可能,我重新弄下

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


It's strange, I didn't add the carriage return, I just reran npm run i18n

After re-running, normal submission will be formatted and the carriage return will be automatically removed. Did you skip the hook during commit?

It's possible, I'll do it again

# Conflicts:
#	locales/ar/models.json
#	locales/ar/providers.json
#	locales/ar/setting.json
#	locales/bg-BG/models.json
#	locales/bg-BG/providers.json
#	locales/bg-BG/setting.json
#	locales/de-DE/models.json
#	locales/de-DE/providers.json
#	locales/en-US/models.json
#	locales/en-US/providers.json
#	locales/en-US/setting.json
#	locales/es-ES/models.json
#	locales/es-ES/providers.json
#	locales/fa-IR/modelProvider.json
#	locales/fa-IR/models.json
#	locales/fa-IR/providers.json
#	locales/fa-IR/setting.json
#	locales/fr-FR/models.json
#	locales/fr-FR/providers.json
#	locales/fr-FR/setting.json
#	locales/it-IT/models.json
#	locales/it-IT/providers.json
#	locales/it-IT/setting.json
#	locales/ja-JP/models.json
#	locales/ja-JP/providers.json
#	locales/ko-KR/models.json
#	locales/ko-KR/providers.json
#	locales/ko-KR/setting.json
#	locales/nl-NL/models.json
#	locales/nl-NL/providers.json
#	locales/nl-NL/setting.json
#	locales/pl-PL/models.json
#	locales/pl-PL/providers.json
#	locales/pt-BR/models.json
#	locales/pt-BR/providers.json
#	locales/ru-RU/models.json
#	locales/ru-RU/providers.json
#	locales/tr-TR/models.json
#	locales/tr-TR/providers.json
#	locales/vi-VN/models.json
#	locales/vi-VN/providers.json
#	locales/vi-VN/setting.json
#	locales/zh-TW/models.json
#	src/app/(main)/settings/llm/components/ProviderModelList/ModelFetcher.tsx
@vual
Copy link
Contributor Author

vual commented Nov 12, 2024

很奇怪,我并没有加回车,我只是重跑了npm run i18n

重跑以后正常提交会做一次格式化,会自动把回车去掉的,你是不是跳过 commit 时候的hook了?

弄好了,你再检查看看

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


It's strange, I didn't add the carriage return, I just reran npm run i18n

After re-running, normal submission will be formatted and the carriage return will be automatically removed. Did you skip the hook during commit?

It's done, check again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌠 Feature Request New feature or request | 特性与建议 size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants