Upgrade context limit (#235)

This commit is contained in:
LawyZheng
2024-04-25 09:38:39 +08:00
committed by GitHub
parent fdef12dac3
commit f000793591
2 changed files with 8 additions and 14 deletions

View File

@@ -1,5 +1,7 @@
from __future__ import annotations
import random
import structlog
from playwright.async_api import Browser, Playwright, async_playwright
@@ -52,9 +54,8 @@ class BrowserManager:
self.pages[task.task_id] = self.pages[task.workflow_run_id]
return self.pages[task.task_id]
# TODO: percentage to use new context tree, starting from 20%
# new_ctx = random.choices([False, True], weights=[0.8, 0.2], k=1)[0]
new_ctx = False
# TODO: percentage (50%) to use new context tree
new_ctx = random.choices([False, True], weights=[0.5, 0.5], k=1)[0]
LOG.info("Creating browser state for task", task_id=task.task_id, new_ctx=new_ctx)
browser_state = await self._create_browser_state(task.proxy_location, task.url, new_ctx)