From 9a9522ecb6ddff3aa4b44e3cde58e137895db91c Mon Sep 17 00:00:00 2001 From: Alex Mickelson Date: Wed, 18 Mar 2026 08:56:15 -0600 Subject: [PATCH] moved frontend files around --- lib/elixir_ai/chat_runner.ex | 10 +++++- lib/elixir_ai_web/{live => chat}/chat_live.ex | 18 +++------- .../{components => chat}/chat_message.ex | 0 .../chat/chat_provider_display.ex | 33 +++++++++++++++++++ lib/elixir_ai_web/{plugs => }/health_check.ex | 0 .../{live => home}/ai_providers_live.ex | 0 lib/elixir_ai_web/{live => home}/home_live.ex | 0 7 files changed, 47 insertions(+), 14 deletions(-) rename lib/elixir_ai_web/{live => chat}/chat_live.ex (96%) rename lib/elixir_ai_web/{components => chat}/chat_message.ex (100%) create mode 100644 lib/elixir_ai_web/chat/chat_provider_display.ex rename lib/elixir_ai_web/{plugs => }/health_check.ex (100%) rename lib/elixir_ai_web/{live => home}/ai_providers_live.ex (100%) rename lib/elixir_ai_web/{live => home}/home_live.ex (100%) diff --git a/lib/elixir_ai/chat_runner.ex b/lib/elixir_ai/chat_runner.ex index 2c9d8e2..82ed7b5 100644 --- a/lib/elixir_ai/chat_runner.ex +++ b/lib/elixir_ai/chat_runner.ex @@ -95,7 +95,15 @@ defmodule ElixirAi.ChatRunner do "properties" => %{ "color" => %{ "type" => "string", - "enum" => ElixirAiWeb.ChatLive.valid_background_colors() + "enum" => [ + "bg-cyan-950/30", + "bg-red-950/30", + "bg-green-950/30", + "bg-blue-950/30", + "bg-yellow-950/30", + "bg-purple-950/30", + "bg-pink-950/30" + ] } }, "required" => ["color"] diff --git a/lib/elixir_ai_web/live/chat_live.ex b/lib/elixir_ai_web/chat/chat_live.ex similarity index 96% rename from lib/elixir_ai_web/live/chat_live.ex rename to lib/elixir_ai_web/chat/chat_live.ex index 4b236d0..5bb3c84 100644 --- a/lib/elixir_ai_web/live/chat_live.ex +++ b/lib/elixir_ai_web/chat/chat_live.ex @@ -3,22 +3,11 @@ defmodule ElixirAiWeb.ChatLive do require Logger import ElixirAiWeb.Spinner import ElixirAiWeb.ChatMessage + import ElixirAiWeb.ChatProviderDisplay alias ElixirAi.ChatRunner alias ElixirAi.ConversationManager import ElixirAi.PubsubTopics - def valid_background_colors do - [ - "bg-cyan-950/30", - "bg-red-950/30", - "bg-green-950/30", - "bg-blue-950/30", - "bg-yellow-950/30", - "bg-purple-950/30", - "bg-pink-950/30" - ] - end - def mount(%{"name" => name}, _session, socket) do case ConversationManager.open_conversation(name) do {:ok, _pid} -> @@ -35,6 +24,7 @@ defmodule ElixirAiWeb.ChatLive do |> assign(messages: conversation.messages) |> assign(streaming_response: conversation.streaming_response) |> assign(background_color: "bg-cyan-950/30") + |> assign(provider: conversation.provider) |> assign(db_error: nil)} {:error, :not_found} -> @@ -50,6 +40,7 @@ defmodule ElixirAiWeb.ChatLive do |> assign(messages: []) |> assign(streaming_response: nil) |> assign(background_color: "bg-cyan-950/30") + |> assign(provider: nil) |> assign(db_error: Exception.format(:error, reason))} end end @@ -61,7 +52,8 @@ defmodule ElixirAiWeb.ChatLive do <.link navigate={~p"/"} class="text-cyan-700 hover:text-cyan-400 transition-colors"> ← - {@conversation_name} + {@conversation_name} + <.chat_provider_display provider={@provider} /> <%= if @db_error do %>