Simplify SkyvernPage _decorate_call (#3959)
This commit is contained in:
committed by
GitHub
parent
16c11025da
commit
37fa441463
@@ -122,7 +122,6 @@ class ScriptSkyvernPage(SkyvernPage):
|
|||||||
fn: Callable,
|
fn: Callable,
|
||||||
action: ActionType,
|
action: ActionType,
|
||||||
*args: Any,
|
*args: Any,
|
||||||
prompt: str = "",
|
|
||||||
**kwargs: Any,
|
**kwargs: Any,
|
||||||
) -> Any:
|
) -> Any:
|
||||||
"""
|
"""
|
||||||
@@ -147,6 +146,8 @@ class ScriptSkyvernPage(SkyvernPage):
|
|||||||
ActionType.TERMINATE: "🛑",
|
ActionType.TERMINATE: "🛑",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prompt = kwargs.get("prompt", "")
|
||||||
|
|
||||||
# Backward compatibility: use intention if provided and prompt is empty
|
# Backward compatibility: use intention if provided and prompt is empty
|
||||||
intention = kwargs.get("intention", None)
|
intention = kwargs.get("intention", None)
|
||||||
if intention and not prompt:
|
if intention and not prompt:
|
||||||
|
|||||||
@@ -71,10 +71,9 @@ class SkyvernPage(Page):
|
|||||||
fn: Callable,
|
fn: Callable,
|
||||||
action: ActionType,
|
action: ActionType,
|
||||||
*args: Any,
|
*args: Any,
|
||||||
prompt: str = "",
|
|
||||||
**kwargs: Any,
|
**kwargs: Any,
|
||||||
) -> Any:
|
) -> Any:
|
||||||
return await fn(self, *args, prompt=prompt, **kwargs)
|
return await fn(self, *args, **kwargs)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def action_wrap(
|
def action_wrap(
|
||||||
@@ -84,10 +83,9 @@ class SkyvernPage(Page):
|
|||||||
async def wrapper(
|
async def wrapper(
|
||||||
skyvern_page: SkyvernPage,
|
skyvern_page: SkyvernPage,
|
||||||
*args: Any,
|
*args: Any,
|
||||||
prompt: str = "",
|
|
||||||
**kwargs: Any,
|
**kwargs: Any,
|
||||||
) -> Any:
|
) -> Any:
|
||||||
return await skyvern_page._decorate_call(fn, action, *args, prompt=prompt, **kwargs)
|
return await skyvern_page._decorate_call(fn, action, *args, **kwargs)
|
||||||
|
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user