Add .env file support for easier configuration#1
Open
RC-CHN wants to merge 1 commit intohe-yufeng:mainfrom
Open
Add .env file support for easier configuration#1RC-CHN wants to merge 1 commit intohe-yufeng:mainfrom
RC-CHN wants to merge 1 commit intohe-yufeng:mainfrom
Conversation
…nvironment configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation / 动机
Using command-line arguments to pass API keys and model settings can be inconvenient during testing and daily use. This PR adds support for reading configuration from
.envfiles, making it easier to manage settings without repeatedly setting environment variables.在测试和日常使用中,通过命令行参数传入 API 密钥和模型设置略有不便。本 PR 添加了从
.env文件读取配置的功能,无需重复设置环境变量即可轻松管理配置。Changes / 变更内容
python-dotenvdependency inpyproject.tomlnanocoder/config.pyto auto-load.envfiles (with graceful fallback if dotenv not installed).env.examplewith bilingual comments (Chinese/English)README.mdandREADME_CN.mdwith.envusage instructionsUsage / 使用方法
cp .env.example .env # Edit .env with your API key and model settings nanocoder