From 5c4c49b90a3314e43a00d4d110e3883322180915 Mon Sep 17 00:00:00 2001 From: PaoloRollo Date: Thu, 5 Jun 2025 18:55:15 +0000 Subject: [PATCH] [Dashboard] Fix: Handle ping event (#7287) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR adds a simple `ping` case in the `promptNebula` function to avoid `console.warn` logs in the browser console. --- ## PR-Codex overview This PR adds support for a new event type, `"ping"`, in the `ChatStreamedEvent` type definition and handles the `"ping"` event case in the event processing logic. ### Detailed summary - Added a new case for `"ping"` in the event handling switch statement. - Introduced a new type definition for the `"ping"` event in the `ChatStreamedEvent` type, including a `data` field of type `string`. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` ## Summary by CodeRabbit - **New Features** - Improved chat event handling with support for a new "ping" event type, enhancing the stability of real-time chat updates. --- apps/dashboard/src/app/nebula-app/(app)/api/chat.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apps/dashboard/src/app/nebula-app/(app)/api/chat.ts b/apps/dashboard/src/app/nebula-app/(app)/api/chat.ts index e7dba4b98d2..e30ef7591e3 100644 --- a/apps/dashboard/src/app/nebula-app/(app)/api/chat.ts +++ b/apps/dashboard/src/app/nebula-app/(app)/api/chat.ts @@ -202,6 +202,10 @@ export async function promptNebula(params: { break; } + case "ping": { + break; + } + default: { console.warn("unhandled event", event); } @@ -298,4 +302,8 @@ type ChatStreamedEvent = | { event: "error"; data: string; + } + | { + event: "ping"; + data: string; };