browser sessions v2 - backend (#4515)
Signed-off-by: Benji Visser <benji@093b.org>
This commit is contained in:
@@ -5,8 +5,10 @@ Provides WS endpoints for streaming messages to/from our frontend application.
|
||||
import structlog
|
||||
from fastapi import WebSocket
|
||||
|
||||
from skyvern.config import settings
|
||||
from skyvern.forge.sdk.routes.routers import base_router, legacy_base_router
|
||||
from skyvern.forge.sdk.routes.streaming.auth import auth
|
||||
from skyvern.forge.sdk.routes.streaming.auth import _auth as local_auth
|
||||
from skyvern.forge.sdk.routes.streaming.auth import auth as real_auth
|
||||
from skyvern.forge.sdk.routes.streaming.channels.message import (
|
||||
Loops,
|
||||
MessageChannel,
|
||||
@@ -60,6 +62,7 @@ async def messages(
|
||||
client_id: str | None = None,
|
||||
token: str | None = None,
|
||||
) -> None:
|
||||
auth = local_auth if settings.ENV == "local" else real_auth
|
||||
organization_id = await auth(apikey=apikey, token=token, websocket=websocket)
|
||||
|
||||
if not organization_id:
|
||||
@@ -98,7 +101,7 @@ async def messages(
|
||||
)
|
||||
else:
|
||||
LOG.error(
|
||||
"Message channel: no browser_session_id or workflow_run_id provided.",
|
||||
"[WS] messages: no browser_session_id or workflow_run_id provided",
|
||||
client_id=client_id,
|
||||
organization_id=organization_id,
|
||||
)
|
||||
@@ -139,5 +142,4 @@ async def messages(
|
||||
workflow_run_id=workflow_run_id,
|
||||
organization_id=organization_id,
|
||||
)
|
||||
|
||||
await message_channel.close(reason="message-stream-closed")
|
||||
|
||||
Reference in New Issue
Block a user