添加了从 os.environ 读取空值环境变量的逻辑
This commit is contained in:
parent
3c01f9c245
commit
a3f944450f
@ -1842,6 +1842,13 @@ async def get_bot_settings(bot_uuid: str, authorization: Optional[str] = Header(
|
|||||||
# 清理不在 skill 所需变量中且值为空的环境变量
|
# 清理不在 skill 所需变量中且值为空的环境变量
|
||||||
shell_env = {k: v for k, v in shell_env.items() if v or k in required_keys}
|
shell_env = {k: v for k, v in shell_env.items() if v or k in required_keys}
|
||||||
|
|
||||||
|
# 对于值为空的环境变量,尝试从系统环境变量中读取
|
||||||
|
for k, v in shell_env.items():
|
||||||
|
if not v:
|
||||||
|
env_val = os.environ.get(k, '')
|
||||||
|
if env_val:
|
||||||
|
shell_env[k] = env_val
|
||||||
|
|
||||||
return BotSettingsResponse(
|
return BotSettingsResponse(
|
||||||
bot_id=str(bot_id),
|
bot_id=str(bot_id),
|
||||||
name=bot_name,
|
name=bot_name,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user