Skip to content

Commit d988bf1

Browse files
committed
revert changes
1 parent dab1693 commit d988bf1

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

webui.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ async def run_custom_agent(
199199
controller = CustomController()
200200
playwright = None
201201
browser_context_ = None
202-
browser = None # Initialize browser to None
203202
try:
204203
if use_own_browser:
205204
playwright = await async_playwright().start()
@@ -279,17 +278,15 @@ async def run_custom_agent(
279278
model_actions = ""
280279
model_thoughts = ""
281280
finally:
282-
# Close persistent context if it was initialized
281+
# 显式关闭持久化上下文
283282
if browser_context_:
284283
await browser_context_.close()
285284

286-
# Stop Playwright if it was started
285+
# 关闭 Playwright 对象
287286
if playwright:
288287
await playwright.stop()
288+
await browser.close()
289289

290-
# Close the browser if it was initialized
291-
if browser:
292-
await browser.close()
293290

294291
return final_result, errors, model_actions, model_thoughts
295292

0 commit comments

Comments
 (0)