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

♻️ refactor: Remove redundant payload remapping in client-fetch #5267

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

Conversation

cy948
Copy link
Contributor

@cy948 cy948 commented Jan 2, 2025

💻 变更类型 | Change Type

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

🔀 变更说明 | Description of Change

  • 🧪 src/services/__tests__/_auth.test.ts: 补充针对客户端请求的Auth payload检查。
  • ♻️ src/services/_auth.ts: 针对客户端请求的Auth payload映射。
  • ♻️ src/services/chat.ts: 移除冗余的客户端请求Auth payload重映射。

📝 补充信息 | Additional Information

pnpm vitest --run src/services/__tests__/chat.test.ts src/services/__tests__/_auth.test.ts
  • 重构相关测试用例,使其能测试传入参数。

Copy link

vercel bot commented Jan 2, 2025

@cy948 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

👍 @cy948

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

gru-agent bot commented Jan 2, 2025

TestGru Assignment

Summary

Link CommitId Status Reason
Detail 427c449 ✅ Finished

Files

File Pull Request
src/services/chat.ts ❌ Failure (I failed to write the unit tests for the file.)

Tip

You can @gru-agent and leave your feedback. TestGru will make adjustments based on your input

Copy link

codecov bot commented Jan 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.19%. Comparing base (641420b) to head (22d08a6).
Report is 11 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5267      +/-   ##
==========================================
+ Coverage   92.13%   92.19%   +0.05%     
==========================================
  Files         570      570              
  Lines       43600    43755     +155     
  Branches     4057     2712    -1345     
==========================================
+ Hits        40172    40340     +168     
+ Misses       3428     3415      -13     
Flag Coverage Δ
app 92.19% <100.00%> (+0.05%) ⬆️
server 97.66% <ø> (ø)

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.

case ModelProvider.Azure: {
providerOptions = {
apiKey: providerAuthPayload?.apiKey,
apiVersion: providerAuthPayload?.azureApiVersion,
Copy link
Contributor

Choose a reason for hiding this comment

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

apiVersion 应该也要透传吧

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改 b4ab60c

case ModelProvider.Cloudflare: {
providerOptions = {
apikey: providerAuthPayload?.apiKey,
baseURLOrAccountID: providerAuthPayload?.cloudflareBaseURLOrAccountID,
Copy link
Contributor

Choose a reason for hiding this comment

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

还有 baseURLOrAccountID

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改 b4ab60c

@cy948 cy948 marked this pull request as ready for review January 3, 2025 07:06
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jan 3, 2025
@cy948 cy948 changed the title ♻️ refactor: Pass auth payload directly in client-fetch ♻️ refactor: Remove redundant payload remapping in client-fetch Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants