|
|
@@ -41,7 +41,7 @@ from agent.utils import setup_logging
|
|
|
from agent.tools.builtin.browser.baseClass import init_browser_session, kill_browser_session
|
|
|
|
|
|
# 导入项目配置
|
|
|
-from config import RUN_CONFIG, SKILLS_DIR, TRACE_STORE_PATH, DEBUG, LOG_LEVEL, LOG_FILE, BROWSER_TYPE, HEADLESS, INPUT_DIR, OUTPUT_ID
|
|
|
+from config import RUN_CONFIG, SKILLS_DIR, TRACE_STORE_PATH, DEBUG, LOG_LEVEL, LOG_FILE, BROWSER_TYPE, HEADLESS, INPUT_DIR, OUTPUT_DIR
|
|
|
|
|
|
|
|
|
async def main():
|
|
|
@@ -57,8 +57,8 @@ async def main():
|
|
|
base_dir = Path(__file__).parent
|
|
|
project_root = base_dir.parent.parent
|
|
|
prompt_path = base_dir / "requirement.prompt"
|
|
|
- output_dir = base_dir / "output"
|
|
|
- output_dir.mkdir(exist_ok=True)
|
|
|
+ output_dir = Path(OUTPUT_DIR)
|
|
|
+ output_dir.mkdir(parents=True, exist_ok=True)
|
|
|
|
|
|
# 1. 配置日志
|
|
|
setup_logging(level=LOG_LEVEL, file=LOG_FILE)
|
|
|
@@ -80,8 +80,8 @@ async def main():
|
|
|
# 4. 构建任务消息
|
|
|
print("4. 构建任务消息...")
|
|
|
print(f" - 输入目录: {INPUT_DIR}")
|
|
|
- print(f" - 输出 ID: {OUTPUT_ID}")
|
|
|
- messages = prompt.build_messages(input_dir=INPUT_DIR, output_id=OUTPUT_ID)
|
|
|
+ print(f" - 输出目录: {OUTPUT_DIR}")
|
|
|
+ messages = prompt.build_messages(input_dir=INPUT_DIR, output_dir=OUTPUT_DIR)
|
|
|
|
|
|
# 5. 初始化浏览器
|
|
|
import platform
|
|
|
@@ -90,12 +90,14 @@ async def main():
|
|
|
actual_browser_type = "cloud"
|
|
|
print("⚠️ Windows 平台检测到本地浏览器配置,自动切换为云浏览器模式")
|
|
|
|
|
|
- browser_mode_name = "云浏览器" if actual_browser_type == "cloud" else "本地浏览器"
|
|
|
+ browser_mode_names = {"cloud": "云浏览器", "local": "本地浏览器", "container": "容器浏览器"}
|
|
|
+ browser_mode_name = browser_mode_names.get(actual_browser_type, actual_browser_type)
|
|
|
print(f"5. 正在初始化{browser_mode_name}...")
|
|
|
await init_browser_session(
|
|
|
browser_type=actual_browser_type,
|
|
|
headless=HEADLESS,
|
|
|
- url="about:blank"
|
|
|
+ url="https://www.google.com/",
|
|
|
+ profile_name=""
|
|
|
)
|
|
|
print(f" ✅ {browser_mode_name}初始化完成\n")
|
|
|
|