From d01ae816d26b7346a83a667edc01190bb806bddf Mon Sep 17 00:00:00 2001 From: Alex Mickelson Date: Tue, 10 Mar 2026 09:23:22 -0600 Subject: [PATCH] fewer statefulset --- assets/js/app.js | 3 +++ kubernetes/statefulset.yml | 4 ++-- lib/elixir_ai_web/live/chat_live.ex | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/assets/js/app.js b/assets/js/app.js index a664839..b0b94ba 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -77,6 +77,9 @@ Hooks.ScrollBottom = { if (this.isNearBottom()) this.scrollToBottom() }) this.observer.observe(this.el, {childList: true, subtree: true}) + this.handleEvent("scroll_to_bottom", () => { + this.scrollToBottom() + }) }, updated() { if (this.isNearBottom()) this.scrollToBottom() diff --git a/kubernetes/statefulset.yml b/kubernetes/statefulset.yml index c1836c2..3b4c26e 100644 --- a/kubernetes/statefulset.yml +++ b/kubernetes/statefulset.yml @@ -5,12 +5,12 @@ metadata: namespace: ai-ha-elixir spec: serviceName: ai-ha-elixir-headless - replicas: 3 + replicas: 2 podManagementPolicy: Parallel updateStrategy: type: RollingUpdate rollingUpdate: - maxUnavailable: 2 + maxUnavailable: 1 selector: matchLabels: app: ai-ha-elixir diff --git a/lib/elixir_ai_web/live/chat_live.ex b/lib/elixir_ai_web/live/chat_live.ex index 950382f..15a1a08 100644 --- a/lib/elixir_ai_web/live/chat_live.ex +++ b/lib/elixir_ai_web/live/chat_live.ex @@ -104,7 +104,10 @@ defmodule ElixirAiWeb.ChatLive do end def handle_info({:user_chat_message, message}, socket) do - {:noreply, update(socket, :messages, &(&1 ++ [message]))} + {:noreply, + socket + |> update(:messages, &(&1 ++ [message])) + |> push_event("scroll_to_bottom", %{})} end def handle_info(