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

test: add unit test for src/config/llm.ts #5734

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

Conversation

gru-agent[bot]
Copy link

@gru-agent gru-agent bot commented Feb 4, 2025

Trigger Info

Trigger Type Triggered By Source Pull Request Assignment
PR Created hezhijie0327 5729 Detail

Summary

This PR introduces unit tests for the getLLMConfig function to ensure proper configuration handling for various LLM providers based on environment variables. Key highlights include:

  • Default Configuration: Verifies default values when no environment variables are set.

  • Provider Enablement: Tests enabling OpenAI, Azure, Anthropic, AWS Bedrock, Cloudflare, and Wenxin based on the presence of respective API keys or explicit flags.

  • Provider Disablement: Ensures providers are disabled when explicitly set to 0 or when required environment variables are missing.

  • Cloudflare Validation: Confirms that both API key and account ID are required for enabling Cloudflare.

  • Environment Cleanup: Ensures environment variables are reset after each test to avoid cross-test contamination.

These tests improve the reliability and maintainability of the configuration logic for LLM integrations.

Tip

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

Tip

You can @gru-agent rebase to rebase the PR.

Tip

You can @gru-agent redo to reset or rebase before redoing the PR.

Tip

To modify the test code yourself, click here Edit Test Code

@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Feb 4, 2025
Copy link

vercel bot commented Feb 4, 2025

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

Name Status Preview Comments Updated (UTC)
lobe-chat-database ✅ Ready (Inspect) Visit Preview Feb 4, 2025 1:52pm
lobe-chat-preview 🛑 Canceled (Inspect) Feb 4, 2025 1:52pm

@lobehubbot
Copy link
Member

👍 @gru-agent[bot]

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 Feb 4, 2025

Codecov Report

Attention: Patch coverage is 93.47826% with 3 lines in your changes missing coverage. Please review.

Project coverage is 92.25%. Comparing base (53f3595) to head (97eef89).
Report is 21 commits behind head on main.

Files with missing lines Patch % Lines
src/libs/agent-runtime/AgentRuntime.ts 57.14% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5734      +/-   ##
==========================================
+ Coverage   92.08%   92.25%   +0.16%     
==========================================
  Files         647      645       -2     
  Lines       57897    57715     -182     
  Branches     2909     4266    +1357     
==========================================
- Hits        53317    53243      -74     
+ Misses       4580     4472     -108     
Flag Coverage Δ
app 92.25% <93.47%> (+0.16%) ⬆️
server 98.01% <ø> (ø)

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:XL This PR changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants