From f6368d12a34314f38a6c81018dde66bdfebd768c Mon Sep 17 00:00:00 2001 From: imnyang Date: Sat, 14 Jun 2025 18:08:39 +0900 Subject: [PATCH] =?UTF-8?q?[Enhancement]=20README=20=EB=B0=8F=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=EC=97=90=EC=84=9C=20Playwright=20=EC=9D=98=EC=A1=B4?= =?UTF-8?q?=EC=84=B1=20=EB=B0=8F=20SSO=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=ED=9D=90=EB=A6=84=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 9 ++++----- lib/prompt/__init__.py | 5 ++--- lib/prompt/session.py | 16 +++++++++++----- pyproject.toml | 1 + uv.lock | 6 +++++- 5 files changed, 23 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 76fc07f..7cbd443 100644 --- a/README.md +++ b/README.md @@ -31,11 +31,10 @@ uv sync venv와 패키지가 설치가 됩니다. -browser_use가 Playwright에 대한 의존성이 있어 브라우저 설치가 필요합니다 +~~browser_use가 Playwright에 대한 의존성이 있어 브라우저 설치가 필요합니다~~ + +스텔스 기능 때문에 Chrome이 필요합니다. -```sh -uv run playwright install -``` 다음과 같은 명령어로 실행합니다. @@ -50,7 +49,7 @@ Environment는 .env.example에 따라 설정되어야합니다. # 쿠키와 로컬 스토리지 설정 방법 ```sh -playwright open https://google.com/ --save-storage=./data/storage_state.json +uv run playwright open https://google.com/ --save-storage=./data/storage_state.json ``` # 실행 diff --git a/lib/prompt/__init__.py b/lib/prompt/__init__.py index faed89b..82c50e8 100644 --- a/lib/prompt/__init__.py +++ b/lib/prompt/__init__.py @@ -1,13 +1,12 @@ from dotenv import load_dotenv import os -from lib.prompt import session -from lib.prompt import llm_login - load_dotenv(override=True) def extend_planner_system_message(): if os.getenv("PROVIDOR_CREDENTIALS_IN_LLM", "False").lower() == "true": + from lib.prompt import llm_login return llm_login.extend_planner_system_message else: + from lib.prompt import session return session.extend_planner_system_message \ No newline at end of file diff --git a/lib/prompt/session.py b/lib/prompt/session.py index a90d180..bad6176 100644 --- a/lib/prompt/session.py +++ b/lib/prompt/session.py @@ -1,5 +1,10 @@ +import os +from dotenv import load_dotenv + +load_dotenv(override=True) + # Extended planner prompt -extend_planner_system_message = """ +extend_planner_system_message = f""" 🎯 목적: 웹 자동화를 위한 **SSO 로그인 리디렉션 URL 수집** 📌 주의사항 (전제 조건) @@ -22,10 +27,10 @@ extend_planner_system_message = """ ```json [ - { + {{ "provider": "Blocked", "oauth_uri": "-" - } + }} ] ```` @@ -67,6 +72,7 @@ extend_planner_system_message = """ → 예: `https://accounts.google.com/o/oauth2/auth?...` 3. ✅ 로그인 진행: - 세션 및 쿠키에 따라 이미 로그인된 상태로 간주하고 진행 + - Google OAuth인 경우 URL에 `&login_hint={str(os.getenv('GOOGLE_ID'))}` 추가 - **로그인 완료 후 authorize 등 버튼이 있으면 클릭** - GitHub같은 경우 Authorize 버튼이 뜨는데 오래걸릴 수 있음, 기다려야 할 수도 있음 - 만약 버튼을 눌러도 반응이 없을 경우 새로고침을 한번 해주세요. @@ -81,10 +87,10 @@ extend_planner_system_message = """ ```json [ - { + {{ "provider": "Google", "oauth_uri": "https://example.com/auth/google?client_id=..." - } + }} ] ```` diff --git a/pyproject.toml b/pyproject.toml index 9e21e6e..3969d79 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,4 +6,5 @@ readme = "README.md" requires-python = ">=3.13" dependencies = [ "browser-use[memory]>=0.2.6", + "patchright>=1.52.5", ] diff --git a/uv.lock b/uv.lock index f8148b3..acf776e 100644 --- a/uv.lock +++ b/uv.lock @@ -150,10 +150,14 @@ version = "0.1.0" source = { virtual = "." } dependencies = [ { name = "browser-use", extra = ["memory"] }, + { name = "patchright" }, ] [package.metadata] -requires-dist = [{ name = "browser-use", extras = ["memory"], specifier = ">=0.2.6" }] +requires-dist = [ + { name = "browser-use", extras = ["memory"], specifier = ">=0.2.6" }, + { name = "patchright", specifier = ">=1.52.5" }, +] [[package]] name = "cachetools"