small fixups
This commit is contained in:
@@ -28,12 +28,12 @@
|
||||
<div class="chat-container bg-white shadow-lg rounded-lg" hx-ext="sse" sse-connect="/sse">
|
||||
<!-- Chat Header -->
|
||||
<div class="border-b border-gray-200 p-4">
|
||||
<h1 class="text-lg font-semibold">Talk to Smart Agent</h1>
|
||||
<h1 class="text-lg font-semibold">Talk to '{{.Character.Name}}'</h1>
|
||||
</div>
|
||||
|
||||
<!-- Chat Messages -->
|
||||
<div class="chat-messages p-4">
|
||||
<!-- Agent Status Box -->
|
||||
<!-- Client Box -->
|
||||
<div class="bg-gray-100 p-4">
|
||||
<h2 class="text-sm font-semibold">Clients:</h2>
|
||||
<div id="clients" class="text-sm text-gray-700">
|
||||
@@ -41,6 +41,7 @@
|
||||
<div sse-swap="clients" ></div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- HUD Box -->
|
||||
<div class="bg-gray-100 p-4">
|
||||
<h2 class="text-sm font-semibold">Status:</h2>
|
||||
<div id="hud" class="text-sm text-gray-700">
|
||||
@@ -55,7 +56,7 @@
|
||||
|
||||
<!-- Agent Status Box -->
|
||||
<div class="bg-gray-100 p-4">
|
||||
<h2 class="text-sm font-semibold">Agent is currently:</h2>
|
||||
<h2 class="text-sm font-semibold">Agent:</h2>
|
||||
<div id="agentStatus" class="text-sm text-gray-700" >
|
||||
<!-- Status updates dynamically here -->
|
||||
<div sse-swap="status" ></div>
|
||||
|
||||
@@ -115,7 +115,7 @@ func main() {
|
||||
|
||||
mux := http.NewServeMux()
|
||||
|
||||
mux.Handle("GET /", http.HandlerFunc(app.Home))
|
||||
mux.Handle("GET /", http.HandlerFunc(app.Home(agent)))
|
||||
|
||||
// External notifications (e.g. webhook)
|
||||
mux.Handle("POST /notify", http.HandlerFunc(app.Notify))
|
||||
@@ -131,14 +131,21 @@ func main() {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
func (a *App) Home(w http.ResponseWriter, r *http.Request) {
|
||||
tmpl, err := template.ParseFiles("index.html")
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
func (a *App) Home(agent *Agent) func(w http.ResponseWriter, r *http.Request) {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
tmpl, err := template.ParseFiles("index.html")
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
tmpl.Execute(w, nil)
|
||||
tmpl.Execute(w,
|
||||
struct {
|
||||
Character Character
|
||||
}{
|
||||
Character: agent.Character,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (a *App) SSE(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
Reference in New Issue
Block a user