Files
elixirAI/lib/elixir_ai/chat_runner/conversation_calls.ex
Alex Mickelson d5cd472bf5
Some checks failed
CI/CD Pipeline / build (push) Failing after 4s
runner code refactor, frontend papercuts
2026-03-23 13:13:55 -06:00

30 lines
944 B
Elixir

defmodule ElixirAi.ChatRunner.ConversationCalls do
import ElixirAi.ChatRunner.OutboundHelpers
def handle_cast({:user_message, text_content, tool_choice_override}, state) do
effective_tool_choice = tool_choice_override || state.tool_choice
new_message = %{role: :user, content: text_content, tool_choice: tool_choice_override}
broadcast_ui(state.name, {:user_chat_message, new_message})
store_message(state.name, new_message)
new_state = %{state | messages: state.messages ++ [new_message]}
ElixirAi.ChatUtils.request_ai_response(
self(),
new_state.messages,
state.server_tools ++ state.liveview_tools,
state.provider,
effective_tool_choice
)
{:noreply, new_state}
end
def handle_call(:get_conversation, _from, state) do
{:reply, state, state}
end
def handle_call(:get_streaming_response, _from, state) do
{:reply, state.streaming_response, state}
end
end