Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
disable svg css agent by default (#3269)
LawyZhengb78fff647ad5
diff --git a/skyvern/forge/agent_functions.py b/skyvern/forge/agent_functions.pyindex 25aba383c..d77ddd583 100644--- a/skyvern/forge/agent_functions.py+++ b/skyvern/forge/agent_functions.py@@ -232,7 +232,9 @@ async def _convert_svg_to_string(for retry in range(SVG_SHAPE_CONVERTION_ATTEMPTS):try:async with asyncio.timeout(_LLM_CALL_TIMEOUT_SECONDS):- json_response = await app.SECONDARY_LLM_API_HANDLER(+ if app.SVG_CSS_CONVERTER_LLM_API_HANDLER is None:+ raise Exception("To enable svg shape conversion, please set the Secondary LLM key")+ json_response = await app.SVG_CSS_CONVERTER_LLM_API_HANDLER(prompt=svg_convert_prompt, step=step, prompt_name="svg-convert")svg_shape = json_response.get("shape", "")@@ -390,7 +392,9 @@ async def _convert_css_shape_to_string(for retry in range(CSS_SHAPE_CONVERTION_ATTEMPTS):try:async with asyncio.timeout(_LLM_CALL_TIMEOUT_SECONDS):- json_response = await app.SECONDARY_LLM_API_HANDLER(+ if app.SVG_CSS_CONVERTER_LLM_API_HANDLER is None:+ raise Exception("To enable css shape conversion, please set the Secondary LLM key")+ json_response = await app.SVG_CSS_CONVERTER_LLM_API_HANDLER(prompt=prompt, screenshots=[screenshot], step=step, prompt_name="css-shape-convert")css_shape = json_response.get("shape", "")@@ -569,7 +573,9 @@ class AgentFunction:LOG.warning(f"Element reached max count {MAX_ELEMENT_CNT}, will stop converting svg and css element.")- element_exceeded = element_cnt > MAX_ELEMENT_CNT+ disable_conversion = element_cnt > MAX_ELEMENT_CNT+ if app.SVG_CSS_CONVERTER_LLM_API_HANDLER is None:+ disable_conversion = Trueif queue_ele.get("frame_index") != current_frame_index:new_frame = next(@@ -581,10 +587,10 @@ class AgentFunction:_remove_rect(queue_ele)# Check SVG eligibility and store for later conversion- if await _check_svg_eligibility(skyvern_frame, queue_ele, task, step, always_drop=element_exceeded):+ if await _check_svg_eligibility(skyvern_frame, queue_ele, task, step, always_drop=disable_conversion):eligible_svgs.append((queue_ele, skyvern_frame))- if not element_exceeded and _should_css_shape_convert(element=queue_ele):+ if not disable_conversion and _should_css_shape_convert(element=queue_ele):await _convert_css_shape_to_string(skyvern_frame=skyvern_frame,element=queue_ele,diff --git a/skyvern/forge/app.py b/skyvern/forge/app.pyindex 6d2cb3b6d..b3037577d 100644--- a/skyvern/forge/app.py+++ b/skyvern/forge/app.py@@ -79,6 +79,8 @@ EXTRACTION_LLM_API_HANDLER = (if SETTINGS_MANAGER.EXTRACTION_LLM_KEYelse LLM_API_HANDLER)+SVG_CSS_CONVERTER_LLM_API_HANDLER = SECONDARY_LLM_API_HANDLER if SETTINGS_MANAGER.SECONDARY_LLM_KEY else None+WORKFLOW_CONTEXT_MANAGER = WorkflowContextManager()WORKFLOW_SERVICE = WorkflowService()AGENT_FUNCTION = AgentFunction()