ai-agent-book 精选快照(<2MB 代码与文档,来自 github.com/bojieli/ai-agent-book)
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
# coding: utf-8
|
||||
# Copyright (c) 2025 inclusionAI.
|
||||
import atexit
|
||||
import os
|
||||
|
||||
try:
|
||||
from aworld.utils.import_package import import_package
|
||||
|
||||
import_package("dotenv", install_name="python-dotenv")
|
||||
from dotenv import load_dotenv
|
||||
|
||||
sucess = load_dotenv()
|
||||
if not sucess:
|
||||
load_dotenv(os.path.join(os.getcwd(), ".env"))
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
|
||||
def cleanup():
|
||||
import re
|
||||
|
||||
try:
|
||||
value = os.environ.get("LOCAL_TOOLS_ENV_VAR", '')
|
||||
if value:
|
||||
for action_file in value.split(";"):
|
||||
v = re.split(r"\w{6}__tmp", action_file)[0]
|
||||
if v == action_file:
|
||||
continue
|
||||
tool_file = action_file.replace("_action.py", ".py")
|
||||
try:
|
||||
os.remove(action_file)
|
||||
os.remove(tool_file)
|
||||
except:
|
||||
pass
|
||||
except:
|
||||
pass
|
||||
os.environ["LOCAL_TOOLS_ENV_VAR"] = ''
|
||||
|
||||
|
||||
atexit.register(cleanup, )
|
||||
Reference in New Issue
Block a user