fix: A2UI now behaves better
This commit is contained in:
@@ -36,7 +36,7 @@ defmodule BDS.AI.OpenAICompatibleRuntime do
|
||||
"messages" => request.messages,
|
||||
"max_tokens" => request.max_output_tokens
|
||||
}
|
||||
|> maybe_put_tools(request.tools)
|
||||
|> maybe_put_tools(Map.get(request, :tools, []))
|
||||
|
||||
with {:ok, response} <- HttpClient.post(url, headers, Jason.encode!(payload)),
|
||||
200 <- response.status do
|
||||
|
||||
@@ -352,7 +352,7 @@ defmodule BDS.Desktop.ShellLive.ChatEditor do
|
||||
@spec chat_surface(term()) :: term()
|
||||
def chat_surface(assigns) do
|
||||
~H"""
|
||||
<details id={@surface.id} class={["chat-inline-surface", "chat-inline-surface-#{@surface.type}"]} data-testid="chat-inline-surface" data-expanded={Map.get(@surface, :expanded?, false)} open={Map.get(@surface, :expanded?, false)}>
|
||||
<details id={@surface.id} class={["chat-inline-surface", "chat-inline-surface-#{@surface.type}"]} data-testid="chat-inline-surface" data-expanded={surface_expanded_attr(@surface)} open={Map.get(@surface, :expanded?, false)}>
|
||||
<summary class="chat-inline-surface-header">
|
||||
<span class="chat-inline-surface-icon"><%= surface_icon(@surface.type) %></span>
|
||||
<span class="chat-inline-surface-title"><%= surface_title(@surface) %></span>
|
||||
@@ -566,6 +566,10 @@ defmodule BDS.Desktop.ShellLive.ChatEditor do
|
||||
defp surface_icon("tabs"), do: "▧"
|
||||
defp surface_icon(_type), do: "■"
|
||||
|
||||
defp surface_expanded_attr(surface) do
|
||||
if Map.get(surface, :expanded?, false), do: "true", else: "false"
|
||||
end
|
||||
|
||||
defp surface_title(surface) do
|
||||
cond do
|
||||
present?(Map.get(surface, :title)) -> Map.get(surface, :title)
|
||||
|
||||
@@ -99,16 +99,15 @@
|
||||
|
||||
<%= if message.role == :assistant do %>
|
||||
<div class="chat-message-text"><%= markdown_html(message.content || "") %></div>
|
||||
<%= for surface <- message.inline_surfaces do %>
|
||||
<.chat_surface surface={surface} />
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="chat-message-text chat-user-message-text" data-testid="chat-user-message-text"><%= message.content || "" %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= for surface <- message.inline_surfaces do %>
|
||||
<.chat_surface surface={surface} />
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
|
||||
<%= if @chat_editor.is_streaming and (@chat_editor.streaming_content != "" or @chat_editor.streaming_tool_markers != []) do %>
|
||||
@@ -124,12 +123,11 @@
|
||||
<%= if @chat_editor.streaming_content != "" do %>
|
||||
<div class="chat-message-text"><%= markdown_html(@chat_editor.streaming_content) %></div>
|
||||
<% end %>
|
||||
<%= for surface <- @chat_editor.streaming_inline_surfaces do %>
|
||||
<.chat_surface surface={surface} />
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= for surface <- @chat_editor.streaming_inline_surfaces do %>
|
||||
<.chat_surface surface={surface} />
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= if @chat_editor.is_streaming and @chat_editor.streaming_content == "" and @chat_editor.streaming_tool_markers == [] do %>
|
||||
|
||||
Reference in New Issue
Block a user