Revert "improve chain click logic" (#4167)

This commit is contained in:
LawyZheng
2025-12-03 02:38:16 +08:00
committed by GitHub
parent a02ccee769
commit d86ca95f35
3 changed files with 72 additions and 13 deletions

View File

@@ -1,9 +1,15 @@
from typing import Any
import httpx
from httpx import ASGITransport
from skyvern.forge.sdk.api.llm.config_registry import LLMConfigRegistry
from skyvern.forge.sdk.api.llm.models import LLMConfig, LLMRouterConfig
def create_embedded_server(
openai_api_key: str | None,
llm_config: LLMRouterConfig | LLMConfig | None = None,
settings_overrides: dict[str, Any] | None = None,
) -> httpx.AsyncClient:
class EmbeddedServerTransport(httpx.AsyncBaseTransport):
def __init__(self) -> None:
@@ -15,8 +21,20 @@ def create_embedded_server(
settings.BROWSER_LOGS_ENABLED = False
if openai_api_key:
settings.OPENAI_API_KEY = openai_api_key
if llm_config:
LLMConfigRegistry.register_config(
"CUSTOM_LLM",
llm_config,
)
settings.LLM_KEY = "CUSTOM_LLM"
# Apply custom settings overrides
if settings_overrides:
for key, value in settings_overrides.items():
if hasattr(settings, key):
setattr(settings, key, value)
else:
raise ValueError(f"Invalid setting: {key}")
from skyvern.forge.api_app import create_api_app # noqa: PLC0415