Skip to content

Add option --openai_key_file for loading API keys from text file#47

Open
ShenTengTu wants to merge 1 commit intoyihong0618:mainfrom
ShenTengTu:feature/api_key_file
Open

Add option --openai_key_file for loading API keys from text file#47
ShenTengTu wants to merge 1 commit intoyihong0618:mainfrom
ShenTengTu:feature/api_key_file

Conversation

@ShenTengTu
Copy link

增加一個option --openai_key_file, 從檔案中載入多個API key, 每一行為一個API key。

test/.keys

sk-xxx
sk-yyy
...

命令

python make_book.py --book_name test_books/animal_farm.epub --openai_key_file test/.keys --test

Comment on lines 324 to 329
OPENAI_API_KEY = options.openai_key or env.get("OPENAI_API_KEY")
OPENAI_KEY_FILE = options.openai_key_file
if not OPENAI_API_KEY:
if OPENAI_KEY_FILE:
OPENAI_API_KEY = load_key_file(OPENAI_KEY_FILE)
RESUME = options.resume
Copy link
Owner

Choose a reason for hiding this comment

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

Let's decide which is the higher priority key arg or key-file?

@yihong0618
Copy link
Owner

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants