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: fix bedrock show by default #2634

Merged
merged 5 commits into from
May 25, 2024
Merged

๐Ÿ› fix: fix bedrock show by default #2634

merged 5 commits into from
May 25, 2024

Conversation

arvinxx
Copy link
Contributor

@arvinxx arvinxx commented May 24, 2024

๐Ÿ’ป ๅ˜ๆ›ด็ฑปๅž‹ | Change Type

  • โœจ feat
  • ๐Ÿ› fix
  • โ™ป๏ธ refactor
  • ๐Ÿ’„ style
  • ๐Ÿ”จ chore
  • โšก๏ธ perf
  • ๐Ÿ“ docs

๐Ÿ”€ ๅ˜ๆ›ด่ฏดๆ˜Ž | Description of Change

๐Ÿ“ ่กฅๅ……ไฟกๆฏ | Additional Information

Summary by CodeRabbit

  • Refactor
    • Improved configuration management by directly using environment variables for various API keys and settings.
    • Added deprecation warning for CUSTOM_MODELS.
    • Adjusted logic for handling regions and deprecated configurations.

Copy link

vercel bot commented May 24, 2024

The latest updates on your projects. Learn more about Vercel for Git โ†—๏ธŽ

Name Status Preview Comments Updated (UTC)
lobe-chat-community โœ… Ready (Inspect) Visit Preview ๐Ÿ’ฌ Add feedback May 25, 2024 1:41am

@lobehubbot
Copy link
Member

๐Ÿ‘ @arvinxx

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

coderabbitai bot commented May 24, 2024

Walkthrough

The getLLMConfig function in src/config/llm.ts has been refactored to directly use process.env variables for API keys and configurations, eliminating the use of intermediate constants. This update simplifies the codebase, ensuring that configuration values are retrieved directly from the environment. Additionally, adjustments have been made to how regions are managed and deprecated configurations are handled, enhancing clarity and maintainability.

Changes

File Path Change Summary
src/config/llm.ts Refactored to access environment variables directly for API keys and configurations, removed intermediate constants, adjusted region handling, and added deprecation warnings for CUSTOM_MODELS.
docs/self-hosting/environment-variables/model-provider.mdx Introduced ENABLED_AWS_BEDROCK environment variable to enable AWS Bedrock as a model provider with default value 0.
docs/self-hosting/environment-variables/model-provider.zh-CN.mdx Added ENABLED_AWS_BEDROCK for AWS Bedrock service in LobeChat deployment, allowing activation by setting to 1.

๐Ÿ‡โœจ In the code where constants lay,
Now process.env holds sway.
Keys and configs, direct and clear,
Simpler paths, no need to fear.
Regions set and models told,
A streamlined script, behold!
๐ŸŽ‰๐Ÿš€

Tip

New Features and Improvements

Review Settings

Introduced new personality profiles for code reviews. Users can now select between "Chill" and "Assertive" review tones to tailor feedback styles according to their preferences. The "Assertive" profile posts more comments and nitpicks the code more aggressively, while the "Chill" profile is more relaxed and posts fewer comments.

AST-based Instructions

CodeRabbit offers customizing reviews based on the Abstract Syntax Tree (AST) pattern matching. Read more about AST-based instructions in the documentation.

Community-driven AST-based Rules

We are kicking off a community-driven initiative to create and share AST-based rules. Users can now contribute their AST-based rules to detect security vulnerabilities, code smells, and anti-patterns. Please see the ast-grep-essentials repository for more information.

New Static Analysis Tools

We are continually expanding our support for static analysis tools. We have added support for biome, hadolint, and ast-grep. Update the settings in your .coderabbit.yaml file or head over to the settings page to enable or disable the tools you want to use.

Tone Settings

Users can now customize CodeRabbit to review code in the style of their favorite characters or personalities. Here are some of our favorite examples:

  • Mr. T: "You must talk like Mr. T in all your code reviews. I pity the fool who doesn't!"
  • Pirate: "Arr, matey! Ye must talk like a pirate in all yer code reviews. Yarrr!"
  • Snarky: "You must be snarky in all your code reviews. Snark, snark, snark!"

Revamped Settings Page

We have redesigned the settings page for a more intuitive layout, enabling users to find and adjust settings quickly. This change was long overdue; it not only improves the user experience but also allows our development team to add more settings in the future with ease. Going forward, the changes to .coderabbit.yaml will be reflected in the settings page, and vice versa.

Miscellaneous

  • Turn off free summarization: You can switch off free summarization of PRs opened by users not on a paid plan using the enable_free_tier setting.
  • Knowledge-base scope: You can now set the scope of the knowledge base to either the repository (local) or the organization (global) level using the knowledge_base setting. In addition, you can specify Jira project keys and Linear team keys to limit the knowledge base scope for those integrations.
  • High-level summary placement: You can now customize the location of the high-level summary in the PR description using the high_level_summary_placeholder setting (default @coderabbitai summary).
  • Revamped request changes workflow: You can now configure CodeRabbit to auto-approve or request changes on PRs based on the review feedback using the request_changes_workflow setting.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented May 24, 2024

Codecov Report

All modified and coverable lines are covered by tests โœ…

Project coverage is 93.66%. Comparing base (12726c2) to head (5623dce).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2634      +/-   ##
==========================================
- Coverage   93.67%   93.66%   -0.01%     
==========================================
  Files         349      349              
  Lines       20402    20378      -24     
  Branches     2445     1563     -882     
==========================================
- Hits        19112    19088      -24     
  Misses       1290     1290              

โ˜” View full report in Codecov by Sentry.
๐Ÿ“ข Have feedback on the report? Share it here.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 73989e7 and 6f27cd3.
Files selected for processing (1)
  • src/config/llm.ts (3 hunks)
Additional Context Used
Biome (1)
src/config/llm.ts (1)

125-125: Unexpected any. Specify a different type.

Comment on lines +44 to +48
// region format: iad1,sfo1
let regions: string[] = [];
if (process.env.OPENAI_FUNCTION_REGIONS) {
regions = process.env.OPENAI_FUNCTION_REGIONS.split(',');
}
Copy link

Choose a reason for hiding this comment

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

Refactor the handling of regions to improve readability and robustness.

- let regions: string[] = [];
- if (process.env.OPENAI_FUNCTION_REGIONS) {
-   regions = process.env.OPENAI_FUNCTION_REGIONS.split(',');
- }
+ const regions = process.env.OPENAI_FUNCTION_REGIONS ? process.env.OPENAI_FUNCTION_REGIONS.split(',') : [];

Committable suggestion

โ€ผ๏ธ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
// region format: iad1,sfo1
let regions: string[] = [];
if (process.env.OPENAI_FUNCTION_REGIONS) {
regions = process.env.OPENAI_FUNCTION_REGIONS.split(',');
}
// region format: iad1,sfo1
const regions = process.env.OPENAI_FUNCTION_REGIONS ? process.env.OPENAI_FUNCTION_REGIONS.split(',') : [];

Comment on lines 127 to 180
ENABLED_AZURE_OPENAI: !!process.env.AZURE_API_KEY,
AZURE_API_KEY: process.env.AZURE_API_KEY,
AZURE_API_VERSION: process.env.AZURE_API_VERSION,
AZURE_ENDPOINT: process.env.AZURE_ENDPOINT,
AZURE_MODEL_LIST: process.env.AZURE_MODEL_LIST,

ENABLED_ZHIPU: !!ZHIPU_API_KEY,
ZHIPU_API_KEY,
ENABLED_ZHIPU: !!process.env.ZHIPU_API_KEY,
ZHIPU_API_KEY: process.env.ZHIPU_API_KEY,

ENABLED_DEEPSEEK: !!DEEPSEEK_API_KEY,
DEEPSEEK_API_KEY,
ENABLED_DEEPSEEK: !!process.env.DEEPSEEK_API_KEY,
DEEPSEEK_API_KEY: process.env.DEEPSEEK_API_KEY,

ENABLED_GOOGLE: !!GOOGLE_API_KEY,
GOOGLE_API_KEY,
ENABLED_GOOGLE: !!process.env.GOOGLE_API_KEY,
GOOGLE_API_KEY: process.env.GOOGLE_API_KEY,
GOOGLE_PROXY_URL: process.env.GOOGLE_PROXY_URL,

ENABLED_PERPLEXITY: !!PERPLEXITY_API_KEY,
PERPLEXITY_API_KEY,
ENABLED_PERPLEXITY: !!process.env.PERPLEXITY_API_KEY,
PERPLEXITY_API_KEY: process.env.PERPLEXITY_API_KEY,
PERPLEXITY_PROXY_URL: process.env.PERPLEXITY_PROXY_URL,

ENABLED_ANTHROPIC: !!ANTHROPIC_API_KEY,
ANTHROPIC_API_KEY,
ENABLED_ANTHROPIC: !!process.env.ANTHROPIC_API_KEY,
ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY,
ANTHROPIC_PROXY_URL: process.env.ANTHROPIC_PROXY_URL,

ENABLED_MINIMAX: !!MINIMAX_API_KEY,
MINIMAX_API_KEY,
ENABLED_MINIMAX: !!process.env.MINIMAX_API_KEY,
MINIMAX_API_KEY: process.env.MINIMAX_API_KEY,

ENABLED_MISTRAL: !!MISTRAL_API_KEY,
MISTRAL_API_KEY,
ENABLED_MISTRAL: !!process.env.MISTRAL_API_KEY,
MISTRAL_API_KEY: process.env.MISTRAL_API_KEY,

ENABLED_OPENROUTER: !!OPENROUTER_API_KEY,
OPENROUTER_API_KEY,
ENABLED_OPENROUTER: !!process.env.OPENROUTER_API_KEY,
OPENROUTER_API_KEY: process.env.OPENROUTER_API_KEY,
OPENROUTER_MODEL_LIST:
process.env.OPENROUTER_MODEL_LIST || process.env.OPENROUTER_CUSTOM_MODELS,

ENABLED_TOGETHERAI: !!TOGETHERAI_API_KEY,
TOGETHERAI_API_KEY,
ENABLED_TOGETHERAI: !!process.env.TOGETHERAI_API_KEY,
TOGETHERAI_API_KEY: process.env.TOGETHERAI_API_KEY,
TOGETHERAI_MODEL_LIST: process.env.TOGETHERAI_MODEL_LIST,

ENABLED_MOONSHOT: !!MOONSHOT_API_KEY,
MOONSHOT_API_KEY,
ENABLED_MOONSHOT: !!process.env.MOONSHOT_API_KEY,
MOONSHOT_API_KEY: process.env.MOONSHOT_API_KEY,
MOONSHOT_PROXY_URL: process.env.MOONSHOT_PROXY_URL,

ENABLED_GROQ: !!GROQ_API_KEY,
ENABLED_GROQ: !!process.env.GROQ_API_KEY,
GROQ_API_KEY: process.env.GROQ_API_KEY,
GROQ_PROXY_URL: process.env.GROQ_PROXY_URL,
GROQ_API_KEY,

ENABLED_ZEROONE: !!ZEROONE_API_KEY,
ZEROONE_API_KEY,
ENABLED_ZEROONE: !!process.env.ZEROONE_API_KEY,
ZEROONE_API_KEY: process.env.ZEROONE_API_KEY,

ENABLED_AWS_BEDROCK: !!AWS_ACCESS_KEY_ID,
ENABLED_AWS_BEDROCK: !!process.env.AWS_ACCESS_KEY_ID,
AWS_REGION: process.env.AWS_REGION,
AWS_ACCESS_KEY_ID: AWS_ACCESS_KEY_ID,
AWS_SECRET_ACCESS_KEY: process.env.AWS_SECRET_ACCESS_KEY || '',
AWS_ACCESS_KEY_ID: process.env.AWS_ACCESS_KEY_ID,
AWS_SECRET_ACCESS_KEY: process.env.AWS_SECRET_ACCESS_KEY,
Copy link

Choose a reason for hiding this comment

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

Ensure consistent handling of boolean environment variables.

- ENABLED_AZURE_OPENAI: !!process.env.AZURE_API_KEY,
+ ENABLED_AZURE_OPENAI: process.env.AZURE_API_KEY !== '0',
- ENABLED_ZHIPU: !!process.env.ZHIPU_API_KEY,
+ ENABLED_ZHIPU: process.env.ZHIPU_API_KEY !== '0',
- ENABLED_DEEPSEEK: !!process.env.DEEPSEEK_API_KEY,
+ ENABLED_DEEPSEEK: process.env.DEEPSEEK_API_KEY !== '0',
- ENABLED_GOOGLE: !!process.env.GOOGLE_API_KEY,
+ ENABLED_GOOGLE: process.env.GOOGLE_API_KEY !== '0',
- ENABLED_PERPLEXITY: !!process.env.PERPLEXITY_API_KEY,
+ ENABLED_PERPLEXITY: process.env.PERPLEXITY_API_KEY !== '0',
- ENABLED_ANTHROPIC: !!process.env.ANTHROPIC_API_KEY,
+ ENABLED_ANTHROPIC: process.env.ANTHROPIC_API_KEY !== '0',
- ENABLED_MINIMAX: !!process.env.MINIMAX_API_KEY,
+ ENABLED_MINIMAX: process.env.MINIMAX_API_KEY !== '0',
- ENABLED_MISTRAL: !!process.env.MISTRAL_API_KEY,
+ ENABLED_MISTRAL: process.env.MISTRAL_API_KEY !== '0',
- ENABLED_OPENROUTER: !!process.env.OPENROUTER_API_KEY,
+ ENABLED_OPENROUTER: process.env.OPENROUTER_API_KEY !== '0',
- ENABLED_TOGETHERAI: !!process.env.TOGETHERAI_API_KEY,
+ ENABLED_TOGETHERAI: process.env.TOGETHERAI_API_KEY !== '0',
- ENABLED_MOONSHOT: !!process.env.MOONSHOT_API_KEY,
+ ENABLED_MOONSHOT: process.env.MOONSHOT_API_KEY !== '0',
- ENABLED_GROQ: !!process.env.GROQ_API_KEY,
+ ENABLED_GROQ: process.env.GROQ_API_KEY !== '0',
- ENABLED_ZEROONE: !!process.env.ZEROONE_API_KEY,
+ ENABLED_ZEROONE: process.env.ZEROONE_API_KEY !== '0',
- ENABLED_AWS_BEDROCK: !!process.env.AWS_ACCESS_KEY_ID,
+ ENABLED_AWS_BEDROCK: process.env.AWS_ACCESS_KEY_ID !== '0',

Committable suggestion

โ€ผ๏ธ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
ENABLED_AZURE_OPENAI: !!process.env.AZURE_API_KEY,
AZURE_API_KEY: process.env.AZURE_API_KEY,
AZURE_API_VERSION: process.env.AZURE_API_VERSION,
AZURE_ENDPOINT: process.env.AZURE_ENDPOINT,
AZURE_MODEL_LIST: process.env.AZURE_MODEL_LIST,
ENABLED_ZHIPU: !!ZHIPU_API_KEY,
ZHIPU_API_KEY,
ENABLED_ZHIPU: !!process.env.ZHIPU_API_KEY,
ZHIPU_API_KEY: process.env.ZHIPU_API_KEY,
ENABLED_DEEPSEEK: !!DEEPSEEK_API_KEY,
DEEPSEEK_API_KEY,
ENABLED_DEEPSEEK: !!process.env.DEEPSEEK_API_KEY,
DEEPSEEK_API_KEY: process.env.DEEPSEEK_API_KEY,
ENABLED_GOOGLE: !!GOOGLE_API_KEY,
GOOGLE_API_KEY,
ENABLED_GOOGLE: !!process.env.GOOGLE_API_KEY,
GOOGLE_API_KEY: process.env.GOOGLE_API_KEY,
GOOGLE_PROXY_URL: process.env.GOOGLE_PROXY_URL,
ENABLED_PERPLEXITY: !!PERPLEXITY_API_KEY,
PERPLEXITY_API_KEY,
ENABLED_PERPLEXITY: !!process.env.PERPLEXITY_API_KEY,
PERPLEXITY_API_KEY: process.env.PERPLEXITY_API_KEY,
PERPLEXITY_PROXY_URL: process.env.PERPLEXITY_PROXY_URL,
ENABLED_ANTHROPIC: !!ANTHROPIC_API_KEY,
ANTHROPIC_API_KEY,
ENABLED_ANTHROPIC: !!process.env.ANTHROPIC_API_KEY,
ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY,
ANTHROPIC_PROXY_URL: process.env.ANTHROPIC_PROXY_URL,
ENABLED_MINIMAX: !!MINIMAX_API_KEY,
MINIMAX_API_KEY,
ENABLED_MINIMAX: !!process.env.MINIMAX_API_KEY,
MINIMAX_API_KEY: process.env.MINIMAX_API_KEY,
ENABLED_MISTRAL: !!MISTRAL_API_KEY,
MISTRAL_API_KEY,
ENABLED_MISTRAL: !!process.env.MISTRAL_API_KEY,
MISTRAL_API_KEY: process.env.MISTRAL_API_KEY,
ENABLED_OPENROUTER: !!OPENROUTER_API_KEY,
OPENROUTER_API_KEY,
ENABLED_OPENROUTER: !!process.env.OPENROUTER_API_KEY,
OPENROUTER_API_KEY: process.env.OPENROUTER_API_KEY,
OPENROUTER_MODEL_LIST:
process.env.OPENROUTER_MODEL_LIST || process.env.OPENROUTER_CUSTOM_MODELS,
ENABLED_TOGETHERAI: !!TOGETHERAI_API_KEY,
TOGETHERAI_API_KEY,
ENABLED_TOGETHERAI: !!process.env.TOGETHERAI_API_KEY,
TOGETHERAI_API_KEY: process.env.TOGETHERAI_API_KEY,
TOGETHERAI_MODEL_LIST: process.env.TOGETHERAI_MODEL_LIST,
ENABLED_MOONSHOT: !!MOONSHOT_API_KEY,
MOONSHOT_API_KEY,
ENABLED_MOONSHOT: !!process.env.MOONSHOT_API_KEY,
MOONSHOT_API_KEY: process.env.MOONSHOT_API_KEY,
MOONSHOT_PROXY_URL: process.env.MOONSHOT_PROXY_URL,
ENABLED_GROQ: !!GROQ_API_KEY,
ENABLED_GROQ: !!process.env.GROQ_API_KEY,
GROQ_API_KEY: process.env.GROQ_API_KEY,
GROQ_PROXY_URL: process.env.GROQ_PROXY_URL,
GROQ_API_KEY,
ENABLED_ZEROONE: !!ZEROONE_API_KEY,
ZEROONE_API_KEY,
ENABLED_ZEROONE: !!process.env.ZEROONE_API_KEY,
ZEROONE_API_KEY: process.env.ZEROONE_API_KEY,
ENABLED_AWS_BEDROCK: !!AWS_ACCESS_KEY_ID,
ENABLED_AWS_BEDROCK: !!process.env.AWS_ACCESS_KEY_ID,
AWS_REGION: process.env.AWS_REGION,
AWS_ACCESS_KEY_ID: AWS_ACCESS_KEY_ID,
AWS_SECRET_ACCESS_KEY: process.env.AWS_SECRET_ACCESS_KEY || '',
AWS_ACCESS_KEY_ID: process.env.AWS_ACCESS_KEY_ID,
AWS_SECRET_ACCESS_KEY: process.env.AWS_SECRET_ACCESS_KEY,
ENABLED_AZURE_OPENAI: process.env.AZURE_API_KEY !== '0',
AZURE_API_KEY: process.env.AZURE_API_KEY,
AZURE_API_VERSION: process.env.AZURE_API_VERSION,
AZURE_ENDPOINT: process.env.AZURE_ENDPOINT,
AZURE_MODEL_LIST: process.env.AZURE_MODEL_LIST,
ENABLED_ZHIPU: process.env.ZHIPU_API_KEY !== '0',
ZHIPU_API_KEY: process.env.ZHIPU_API_KEY,
ENABLED_DEEPSEEK: process.env.DEEPSEEK_API_KEY !== '0',
DEEPSEEK_API_KEY: process.env.DEEPSEEK_API_KEY,
ENABLED_GOOGLE: process.env.GOOGLE_API_KEY !== '0',
GOOGLE_API_KEY: process.env.GOOGLE_API_KEY,
GOOGLE_PROXY_URL: process.env.GOOGLE_PROXY_URL,
ENABLED_PERPLEXITY: process.env.PERPLEXITY_API_KEY !== '0',
PERPLEXITY_API_KEY: process.env.PERPLEXITY_API_KEY,
PERPLEXITY_PROXY_URL: process.env.PERPLEXITY_PROXY_URL,
ENABLED_ANTHROPIC: process.env.ANTHROPIC_API_KEY !== '0',
ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY,
ANTHROPIC_PROXY_URL: process.env.ANTHROPIC_PROXY_URL,
ENABLED_MINIMAX: process.env.MINIMAX_API_KEY !== '0',
MINIMAX_API_KEY: process.env.MINIMAX_API_KEY,
ENABLED_MISTRAL: process.env.MISTRAL_API_KEY !== '0',
MISTRAL_API_KEY: process.env.MISTRAL_API_KEY,
ENABLED_OPENROUTER: process.env.OPENROUTER_API_KEY !== '0',
OPENROUTER_API_KEY: process.env.OPENROUTER_API_KEY,
OPENROUTER_MODEL_LIST:
process.env.OPENROUTER_MODEL_LIST || process.env.OPENROUTER_CUSTOM_MODELS,
ENABLED_TOGETHERAI: process.env.TOGETHERAI_API_KEY !== '0',
TOGETHERAI_API_KEY: process.env.TOGETHERAI_API_KEY,
TOGETHERAI_MODEL_LIST: process.env.TOGETHERAI_MODEL_LIST,
ENABLED_MOONSHOT: process.env.MOONSHOT_API_KEY !== '0',
MOONSHOT_API_KEY: process.env.MOONSHOT_API_KEY,
MOONSHOT_PROXY_URL: process.env.MOONSHOT_PROXY_URL,
ENABLED_GROQ: process.env.GROQ_API_KEY !== '0',
GROQ_API_KEY: process.env.GROQ_API_KEY,
GROQ_PROXY_URL: process.env.GROQ_PROXY_URL,
ENABLED_ZEROONE: process.env.ZEROONE_API_KEY !== '0',
ZEROONE_API_KEY: process.env.ZEROONE_API_KEY,
ENABLED_AWS_BEDROCK: process.env.AWS_ACCESS_KEY_ID !== '0',
AWS_REGION: process.env.AWS_REGION,
AWS_ACCESS_KEY_ID: process.env.AWS_ACCESS_KEY_ID,
AWS_SECRET_ACCESS_KEY: process.env.AWS_SECRET_ACCESS_KEY,

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 6f27cd3 and bff1dc5.
Files selected for processing (1)
  • src/config/llm.ts (3 hunks)
Additional Context Used
Biome (1)
src/config/llm.ts (1)

127-127: Unexpected any. Specify a different type.

Additional comments not posted (2)
src/config/llm.ts (2)

44-48: Refactor the handling of regions to improve readability and robustness.


129-182: Ensure consistent handling of boolean environment variables.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between bff1dc5 and 5623dce.
Files selected for processing (3)
  • docs/self-hosting/environment-variables/model-provider.mdx (1 hunks)
  • docs/self-hosting/environment-variables/model-provider.zh-CN.mdx (1 hunks)
  • src/config/llm.ts (3 hunks)
Files skipped from review due to trivial changes (1)
  • docs/self-hosting/environment-variables/model-provider.mdx
Additional Context Used
Biome (1)
src/config/llm.ts (1)

129-129: Unexpected any. Specify a different type.

Additional comments not posted (6)
docs/self-hosting/environment-variables/model-provider.zh-CN.mdx (1)

133-139: The documentation for ENABLED_AWS_BEDROCK is clear and follows the existing format. Good job on maintaining consistency with other entries.

src/config/llm.ts (5)

44-48: Refactor the handling of regions to improve readability and robustness.


131-184: Ensure consistent handling of boolean environment variables.


129-129: Specify a more appropriate type for regions.


44-48: The refactoring of the region handling is a good improvement. It simplifies the code and makes it more robust.


131-184: The handling of boolean environment variables has been improved to check explicitly against '0'. This is a more reliable method than the previous truthy/falsy check and prevents unintended behavior.

@@ -152,60 +128,60 @@ export const getLLMConfig = () => {
OPENAI_MODEL_LIST: process.env.OPENAI_MODEL_LIST || process.env.CUSTOM_MODELS,
OPENAI_FUNCTION_REGIONS: regions as any,
Copy link

Choose a reason for hiding this comment

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

The type for regions should be more specific than any. Consider using string[] to ensure type safety.

- OPENAI_FUNCTION_REGIONS: regions as any,
+ OPENAI_FUNCTION_REGIONS: regions as string[],

Committable suggestion

โ€ผ๏ธ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
OPENAI_FUNCTION_REGIONS: regions as any,
OPENAI_FUNCTION_REGIONS: regions as string[],

@arvinxx arvinxx merged commit 7ad3af2 into main May 25, 2024
10 checks passed
@arvinxx arvinxx deleted the fix/fix-llm branch May 25, 2024 01:46
@lobehubbot
Copy link
Member

โค๏ธ Great PR @arvinxx โค๏ธ

The growth of project is inseparable from user feedback and contribution, thanks for your contribution! If you are interesting with the lobehub developer community, please join our discord and then dm @arvinxx or @canisminor1990. They will invite you to our private developer channel. We are talking about the lobe-chat development or sharing ai newsletter around the world.
้กน็›ฎ็š„ๆˆ้•ฟ็ฆปไธๅผ€็”จๆˆทๅ้ฆˆๅ’Œ่ดก็Œฎ๏ผŒๆ„Ÿ่ฐขๆ‚จ็š„่ดก็Œฎ! ๅฆ‚ๆžœๆ‚จๅฏน LobeHub ๅผ€ๅ‘่€…็คพๅŒบๆ„Ÿๅ…ด่ถฃ๏ผŒ่ฏทๅŠ ๅ…ฅๆˆ‘ไปฌ็š„ discord๏ผŒ็„ถๅŽ็งไฟก @arvinxx ๆˆ– @canisminor1990ใ€‚ไป–ไปฌไผš้‚€่ฏทๆ‚จๅŠ ๅ…ฅๆˆ‘ไปฌ็š„็งๅฏ†ๅผ€ๅ‘่€…้ข‘้“ใ€‚ๆˆ‘ไปฌๅฐ†ไผš่ฎจ่ฎบๅ…ณไบŽ Lobe Chat ็š„ๅผ€ๅ‘๏ผŒๅˆ†ไบซๅ’Œ่ฎจ่ฎบๅ…จ็ƒ่Œƒๅ›ดๅ†…็š„ AI ๆถˆๆฏใ€‚

github-actions bot pushed a commit that referenced this pull request May 25, 2024
### [Version&nbsp;0.161.16](v0.161.15...v0.161.16)
<sup>Released on **2024-05-25**</sup>

#### ๐Ÿ› Bug Fixes

- **misc**: Fix bedrock show by default on vercel.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### What's fixed

* **misc**: Fix bedrock show by default on vercel, closes [#2634](#2634) ([7ad3af2](7ad3af2))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>
@lobehubbot
Copy link
Member

๐ŸŽ‰ This PR is included in version 0.161.16 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€

github-actions bot pushed a commit to bentwnghk/lobe-chat that referenced this pull request May 25, 2024
### [Version&nbsp;1.41.9](v1.41.8...v1.41.9)
<sup>Released on **2024-05-25**</sup>

#### โ™ป Code Refactoring

- **misc**: Migrate some agent config to `chatConfig`.

#### ๐Ÿ› Bug Fixes

- **misc**: Fix bedrock show by default on vercel.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### Code refactoring

* **misc**: Migrate some agent config to `chatConfig`, closes [lobehub#2646](https://github.com/bentwnghk/lobe-chat/issues/2646) ([2f311dc](2f311dc))

#### What's fixed

* **misc**: Fix bedrock show by default on vercel, closes [lobehub#2634](https://github.com/bentwnghk/lobe-chat/issues/2634) ([7ad3af2](7ad3af2))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants