mirror of
https://github.com/j93es/browser-use-oauth.git
synced 2026-06-04 05:31:51 +09:00
feat: .env.example에 HEADLESS 옵션 추가
This commit is contained in:
parent
3199a53a44
commit
8cfb6488d1
2 changed files with 44 additions and 4 deletions
37
.env.example
Normal file
37
.env.example
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
ANONYMIZED_TELEMETRY=false
|
||||||
|
|
||||||
|
# ========== LLM ==========
|
||||||
|
|
||||||
|
GOOGLE_API_KEY=
|
||||||
|
# 권장 (다른 모델로 교체 가능) [다른 모델로 교체시 성능 보장 불가]
|
||||||
|
GOOGLE_MODEL=gemini-2.5-flash
|
||||||
|
#GOOGLE_PLANNER_MODEL=gemini-2.5-flash # 왜 비활성화 되었나요? // Planner 모델이 오히려 문제를 일으키는 경우가 있어 비활성화했습니다. 필요시 활성화하세요.
|
||||||
|
|
||||||
|
# min(INITIAL_BACKOFF * (2 ** try_cnt), MAX_BACKOFF)만큼 API가 실패시 대기합니다.
|
||||||
|
INITIAL_BACKOFF=60
|
||||||
|
MAX_BACKOFF=600
|
||||||
|
|
||||||
|
#ENABLE_PLANNER_MODEL_OAUTH_LOGIN=true # OAuth 로그인 시 Planner 모델을 활성화합니다.
|
||||||
|
#ENABLE_PLANNER_MODEL_OAUTH_LIST=true # OAuth List를 찾을 때 Planner 모델을 활성화합니다.
|
||||||
|
|
||||||
|
# ========== Monitoring ==========
|
||||||
|
|
||||||
|
# 선택
|
||||||
|
PROXY_HOST=127.0.0.1
|
||||||
|
PROXY_PORT=11080
|
||||||
|
BACKEND_URL=http://localhost:11081
|
||||||
|
|
||||||
|
# https://docs.browser-use.com/development/observability - 선택
|
||||||
|
# Lmnr 계정이 필요합니다.
|
||||||
|
# https://lmnr.ai/
|
||||||
|
LMNR_PROJECT_API_KEY=
|
||||||
|
|
||||||
|
# 브라우저 언어 설정
|
||||||
|
LANG=en_US
|
||||||
|
HEADLESS=False # 브라우저를 헤드리스 모드로 실행할지 여부. True로 설정하면 브라우저가 보이지 않습니다.
|
||||||
|
|
||||||
|
# ========= Account ==========
|
||||||
|
|
||||||
|
# 필수 뒤에 있는 이메일 주소는 Google 계정의 로그인 힌트로 사용됩니다.
|
||||||
|
# 이메일의 전체를 입력해주세요
|
||||||
|
GOOGLE_ID=whs.imnya.ng@gmail.com
|
||||||
|
|
@ -8,7 +8,9 @@ from typing import Any, Dict, Optional
|
||||||
from browser_use import Agent, BrowserSession, Controller
|
from browser_use import Agent, BrowserSession, Controller
|
||||||
from patchright.async_api import async_playwright as async_patchright
|
from patchright.async_api import async_playwright as async_patchright
|
||||||
|
|
||||||
from lib.browser_use import GetProfile, GetSensitiveData, clean_resources
|
from lib.browser_use.clean_resources import clean_resources
|
||||||
|
from lib.browser_use.init_profile import GetProfile
|
||||||
|
from lib.browser_use.sensitive_data import GetSensitiveData
|
||||||
from lib.llm import CreateChatGoogle, get_prompt
|
from lib.llm import CreateChatGoogle, get_prompt
|
||||||
from lib.utils import config, logger
|
from lib.utils import config, logger
|
||||||
|
|
||||||
|
|
@ -141,12 +143,13 @@ async def _run_agent_with_retry(agent_config):
|
||||||
session = None
|
session = None
|
||||||
try_cnt = 0
|
try_cnt = 0
|
||||||
url = agent_config["url"]
|
url = agent_config["url"]
|
||||||
|
headless = os.getenv("HEADLESS", "False").lower() == "true"
|
||||||
|
|
||||||
while try_cnt < 3:
|
while try_cnt < 3:
|
||||||
try:
|
try:
|
||||||
session = BrowserSession(
|
session = BrowserSession(
|
||||||
playwright=(await async_patchright().start()),
|
playwright=(await async_patchright().start()),
|
||||||
browser_profile=await GetProfile(),
|
browser_profile=await GetProfile(headless=headless),
|
||||||
)
|
)
|
||||||
|
|
||||||
agent = Agent(browser_session=session, **agent_config["agent_params"])
|
agent = Agent(browser_session=session, **agent_config["agent_params"])
|
||||||
|
|
@ -208,7 +211,7 @@ async def _extract_oauth_list_internal(url: str):
|
||||||
"url": target_url,
|
"url": target_url,
|
||||||
"log_context": "OAuth 리스트 추출",
|
"log_context": "OAuth 리스트 추출",
|
||||||
"agent_params": {
|
"agent_params": {
|
||||||
"initial_actions": [{"open_tab": {"url": target_url}}],
|
"initial_actions": [{"go_to_url": {"url": target_url, 'new_tab': False}}],
|
||||||
"sensitive_data": GetSensitiveData(),
|
"sensitive_data": GetSensitiveData(),
|
||||||
"task": (
|
"task": (
|
||||||
"Navigate to the login page and identify all OAuth provider buttons (excluding Passkey). "
|
"Navigate to the login page and identify all OAuth provider buttons (excluding Passkey). "
|
||||||
|
|
@ -301,7 +304,7 @@ async def _test_oauth_login_internal(url: str, oauth_provider: str):
|
||||||
"url": target_url,
|
"url": target_url,
|
||||||
"log_context": f"{oauth_provider} 로그인",
|
"log_context": f"{oauth_provider} 로그인",
|
||||||
"agent_params": {
|
"agent_params": {
|
||||||
"initial_actions": [{"open_tab": {"url": target_url}}],
|
"initial_actions": [{"go_to_url": {"url": target_url, 'new_tab': False}}],
|
||||||
"sensitive_data": GetSensitiveData(),
|
"sensitive_data": GetSensitiveData(),
|
||||||
"task": (
|
"task": (
|
||||||
f"Navigate to the login page, find and click the {oauth_provider} OAuth button, "
|
f"Navigate to the login page, find and click the {oauth_provider} OAuth button, "
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue