mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-05 13:52:38 +02:00
Merge pull request #194 from flyi/config-api-key
fix exception when using Anthropic_API_KEY rather than OPENAI_API_KEY
This commit is contained in:
commit
625342199a
1 changed files with 4 additions and 2 deletions
|
|
@ -44,8 +44,10 @@ class Config(metaclass=Singleton):
|
|||
logger.info("Config loading done.")
|
||||
self.global_proxy = self._get("GLOBAL_PROXY")
|
||||
self.openai_api_key = self._get("OPENAI_API_KEY")
|
||||
if not self.openai_api_key or "YOUR_API_KEY" == self.openai_api_key:
|
||||
raise NotConfiguredException("Set OPENAI_API_KEY first")
|
||||
self.anthropic_api_key = self._get("Anthropic_API_KEY")
|
||||
if (not self.openai_api_key or "YOUR_API_KEY" == self.openai_api_key) \
|
||||
and (not self.anthropic_api_key or "YOUR_API_KEY" == self.anthropic_api_key):
|
||||
raise NotConfiguredException("Set OPENAI_API_KEY or Anthropic_API_KEY first")
|
||||
self.openai_api_base = self._get("OPENAI_API_BASE")
|
||||
if not self.openai_api_base or "YOUR_API_BASE" == self.openai_api_base:
|
||||
openai_proxy = self._get("OPENAI_PROXY") or self.global_proxy
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue