Skip to content

Commit

Permalink
refactor(hitl): pass playwright context to web interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
idiotWu committed Jan 26, 2025
1 parent 75d8449 commit dd909be
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions npiai/core/__test__/captcha_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import Literal

from npiai import BrowserTool, HITL
from npiai.core import PlaywrightContext
from npiai.utils.test_utils import DebugContext


Expand Down Expand Up @@ -40,6 +41,7 @@ async def web_interaction(
message: str,
url: str,
action: Literal["captcha", "login"],
playwright: PlaywrightContext,
) -> str:
print(f"[HITL] web_interaction: {message=}, {url=}, {action=}")
return "web_interaction"
Expand Down
2 changes: 2 additions & 0 deletions npiai/core/hitl.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import List, Literal

from npiai.context import Context
from npiai.core import PlaywrightContext


class HITL(ABC):
Expand Down Expand Up @@ -42,4 +43,5 @@ async def web_interaction(
message: str,
url: str,
action: Literal["captcha", "login"],
playwright: PlaywrightContext,
) -> str: ...
2 changes: 2 additions & 0 deletions npiai/tools/scrapers/web/__test__/interactive.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import asyncio
from typing import Literal

from npiai.core import PlaywrightContext
from npiai.utils.test_utils import DebugContext

# from npiai import Context
Expand Down Expand Up @@ -44,6 +45,7 @@ async def web_interaction(
message: str,
url: str,
action: Literal["captcha", "login"],
playwright: PlaywrightContext,
) -> str:
print(f"[HITL] web_interaction: {message=}, {url=}, {action=}")
return "web_interaction"
Expand Down

0 comments on commit dd909be

Please sign in to comment.