limit auto completion trigger (#1223)

This commit is contained in:
LawyZheng
2024-11-20 10:32:24 +08:00
committed by GitHub
parent e4c1cf65af
commit c777e3d891

View File

@@ -551,34 +551,35 @@ async def handle_input_text_action(
if len(text) == 0: if len(text) == 0:
return [ActionSuccess()] return [ActionSuccess()]
# parse the input context to help executing input action if not await skyvern_element.is_raw_input():
prompt = prompt_engine.load_prompt( # parse the input context to help executing input action
"parse-input-or-select-context", prompt = prompt_engine.load_prompt(
element_id=action.element_id, "parse-input-or-select-context",
action_reasoning=action.reasoning, element_id=action.element_id,
elements=dom.scraped_page.build_element_tree(ElementTreeFormat.HTML), action_reasoning=action.reasoning,
) elements=dom.scraped_page.build_element_tree(ElementTreeFormat.HTML),
)
json_response = await app.SECONDARY_LLM_API_HANDLER(prompt=prompt, step=step) json_response = await app.SECONDARY_LLM_API_HANDLER(prompt=prompt, step=step)
input_or_select_context = InputOrSelectContext.model_validate(json_response) input_or_select_context = InputOrSelectContext.model_validate(json_response)
LOG.info( LOG.info(
"Parsed input/select context", "Parsed input/select context",
context=input_or_select_context, context=input_or_select_context,
task_id=task.task_id, task_id=task.task_id,
step_id=step.step_id, step_id=step.step_id,
) )
if await skyvern_element.is_auto_completion_input() or input_or_select_context.is_location_input: if await skyvern_element.is_auto_completion_input() or input_or_select_context.is_location_input:
if result := await input_or_auto_complete_input( if result := await input_or_auto_complete_input(
input_or_select_context=input_or_select_context, input_or_select_context=input_or_select_context,
page=page, page=page,
dom=dom, dom=dom,
text=text, text=text,
skyvern_element=skyvern_element, skyvern_element=skyvern_element,
step=step, step=step,
task=task, task=task,
): ):
return [result] return [result]
await incremental_scraped.start_listen_dom_increment() await incremental_scraped.start_listen_dom_increment()