feat: preliminary work on assistant

This commit is contained in:
2026-04-26 09:48:53 +02:00
parent 50d8e88ce8
commit 8e8a2e2cd2
10 changed files with 313 additions and 13 deletions

View File

@@ -177,6 +177,32 @@ defmodule BDS.Desktop.ShellLiveTest do
assert html =~ ">7<"
end
test "assistant sidebar exposes context, prompt, and offline-gated transcript" do
{:ok, view, _html} = live_isolated(build_conn(), BDS.Desktop.ShellLive)
html =
view
|> element("[data-testid='toggle-assistant']")
|> render_click()
assert html =~ ~s(data-testid="assistant-shell")
assert html =~ ~s(data-testid="assistant-context")
assert html =~ ~s(data-testid="assistant-prompt-form")
assert html =~ ~s(data-testid="assistant-prompt-input")
assert html =~ ~s(data-testid="assistant-start-button")
assert html =~ ~s(>Dashboard<)
html =
render_submit(view, "submit_assistant_prompt", %{
"assistant" => %{"prompt" => "Summarize the current project"}
})
assert html =~ ~s(data-testid="assistant-message-user")
assert html =~ ~s(data-testid="assistant-message-assistant")
assert html =~ "Summarize the current project"
assert html =~ "Automatic AI actions stay gated by airplane mode."
end
test "sidebar open supports preview and pin intents for entity tabs" do
{:ok, view, _html} = live_isolated(build_conn(), BDS.Desktop.ShellLive)

View File

@@ -160,4 +160,19 @@ defmodule BDS.UI.ShellTest do
assert template =~ "tab-actions"
assert template =~ "tab-dirty-indicator"
end
test "desktop shell assets keep the assistant sidebar chat surface contract" do
css = File.read!("/Users/gb/Projects/bDS2/priv/ui/app.css")
template = File.read!("/Users/gb/Projects/bDS2/lib/bds/desktop/shell_live/index.html.heex")
assert css =~ ".assistant-sidebar-context"
assert css =~ ".assistant-sidebar-prompt"
assert css =~ ".assistant-sidebar-start-button"
assert css =~ ".assistant-sidebar-message"
assert template =~ "data-testid=\"assistant-context\""
assert template =~ "data-testid=\"assistant-prompt-form\""
assert template =~ "data-testid=\"assistant-prompt-input\""
assert template =~ "data-testid=\"assistant-start-button\""
assert template =~ "assistant-sidebar-transcript"
end
end