From 525d25101090956e738c5520b719befc53e19f2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=9D=E5=A4=95?= Date: Mon, 27 Apr 2026 10:27:44 +0800 Subject: [PATCH] Feat/dashboard clean monitor upload 1334918525438687015 (#38) * feat: Clean up dashboard UI, shift workflow WS to SSE, and add file upload support - Removed Monitoring view and associated `/ws/state` cluster websocket route. - Modified workflow tracing from WebSocket (`/api/v1/workflow/ws/{trace_id}`) to Server-Sent Events (`/api/v1/workflow/sse/{trace_id}`) for unidirectional pushes, introducing a new `/api/v1/workflow/reply/{trace_id}` POST route to handle incoming client replies. - Cleaned up dummy data and unneeded links in the chat layout (LeftPanel, ChatPanel). - Implemented file upload functionality: added a `/api/v1/adapter/client/upload` endpoint to the backend which saves files to a local `uploads` directory, and added an integrated file input triggered via the `+` button in the frontend chat interface to facilitate uploading with an automated chat message confirmation. Co-authored-by: zhaoxi826 <198742034+zhaoxi826@users.noreply.github.com> * fix: prevent global_state_machine actor from being garbage collected Added `lifetime="detached"` and kept a local reference to the `GlobalStateMachine` actor in `main.py` so that it doesn't get cleaned up by Ray due to going out of scope, which was causing `ray.get_actor('global_state_machine')` calls to fail in API route handlers (resulting in 500 errors). Co-authored-by: zhaoxi826 <198742034+zhaoxi826@users.noreply.github.com> * fix: resolve named actor addressing failure across Ray processes via explicit namespace The `ray.get_actor` calls in API routes executing within a Ray Serve worker were failing to resolve the actors created by the main process because the implicit random namespace of `ray.init()` did not match the namespace of the Ray Serve application scope. Instead of overriding garbage collection via `lifetime="detached"` (which can lead to actor leakage), this assigns an explicit `namespace="pretor"` when initializing Ray in the main process, and uses the identical namespace in `ray_hook.py` when looking up named actors. Also retains the local variable assignments in `main.py` to prevent them from being eliminated as unused variables. Co-authored-by: zhaoxi826 <198742034+zhaoxi826@users.noreply.github.com> --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: zhaoxi826 <198742034+zhaoxi826@users.noreply.github.com> --- main.py | 1 + pretor/utils/ray_hook.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 2bf97a0..7936ca8 100644 --- a/main.py +++ b/main.py @@ -25,6 +25,7 @@ async def start_system(): } ray.init(ignore_reinit_error=True, + namespace="pretor", dashboard_host="0.0.0.0", dashboard_port=8265, runtime_env={"env_vars": env_vars}) diff --git a/pretor/utils/ray_hook.py b/pretor/utils/ray_hook.py index e836e00..90cdac9 100644 --- a/pretor/utils/ray_hook.py +++ b/pretor/utils/ray_hook.py @@ -35,7 +35,7 @@ class ActorList: @lru_cache(maxsize=128) def _get_cached_actor_handle(actor_name: str): """缓存接口""" - return ray.get_actor(actor_name) + return ray.get_actor(actor_name, namespace="pretor") def clear_actor_cache(): """清理接口"""