Parse ANSI codes in output before SSE broadcast
This commit is contained in:
parent
3f226996e7
commit
11e72b1025
1 changed files with 3 additions and 2 deletions
|
|
@ -1,6 +1,7 @@
|
|||
// Core server: HTTP + WebSocket + SSE
|
||||
|
||||
import type { ServerWebSocket } from "bun";
|
||||
import { ansiToHtml } from "./ansi";
|
||||
import {
|
||||
appendOutput,
|
||||
createPrompt,
|
||||
|
|
@ -420,11 +421,11 @@ const server = Bun.serve<SessionData>({
|
|||
|
||||
// Handle output message
|
||||
if (msg.type === "output") {
|
||||
appendOutput(ws.data.sessionId, msg.data);
|
||||
appendOutput(ws.data.sessionId, msg.data); // Store raw ANSI
|
||||
broadcastSSE({
|
||||
type: "output",
|
||||
session_id: ws.data.sessionId,
|
||||
data: msg.data,
|
||||
data: ansiToHtml(msg.data), // Parse for display
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue