From 215c3ddbf731b6d1aec05996f1cc453cc89a11b0 Mon Sep 17 00:00:00 2001 From: mudler Date: Sat, 6 Apr 2024 16:16:09 +0200 Subject: [PATCH] UI: block messages while agent is replying, visualize status --- example/webui/index.html | 3 ++- example/webui/main.go | 15 +++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/example/webui/index.html b/example/webui/index.html index c1be3ca..9077098 100644 --- a/example/webui/index.html +++ b/example/webui/index.html @@ -51,6 +51,7 @@
+
@@ -65,7 +66,7 @@
-
Loading...
diff --git a/example/webui/main.go b/example/webui/main.go index fa601b1..6131a35 100644 --- a/example/webui/main.go +++ b/example/webui/main.go @@ -193,12 +193,19 @@ func (a *App) Chat(m sse.Manager) func(w http.ResponseWriter, r *http.Request) { sse.NewMessage( chatDiv(res.Response, "red"), ).WithEvent("messages")) - result := `done` - _, _ = w.Write([]byte(result)) + m.Send( + sse.NewMessage( + "", + ).WithEvent("message_status")) + + //result := `done` + // _, _ = w.Write([]byte(result)) }() - result := `loading` - _, _ = w.Write([]byte(result)) + m.Send( + sse.NewMessage( + chatDiv("...", "red") + "", + ).WithEvent("message_status")) } }