Files
sure/app/views/settings/hostings/_llm_provider_selector.html.erb
Guillem Arias e7d4a00f73 fix(ai): valid Tailwind token + base_url URL validation
- Data-handling block in _llm_provider_selector swaps the invalid
  bg-surface-secondary token for bg-container-inset, matching the
  inset-card pattern used elsewhere in sure-design-system/components.css.
  bg-surface-secondary is not defined anywhere in the design system —
  Tailwind treated it as a no-op, so the block rendered with no
  background contrast.
- Settings::HostingsController validates anthropic_base_url as a
  URI::HTTP (catches https too) and raises Setting::ValidationError
  with a localized message when the input is not parseable.
  Previously any string was persisted, surfacing as an opaque
  connection error at request time instead of an immediate UX failure.
- Blank base_url now clears the setting (was already the case but
  exercised explicitly in tests now).
2026-05-29 14:51:12 +02:00

39 lines
1.5 KiB
Plaintext

<div class="space-y-3">
<div>
<h2 class="font-medium mb-1"><%= t(".title") %></h2>
<% if ENV["LLM_PROVIDER"].present? %>
<p class="text-sm text-secondary"><%= t(".env_configured_message") %></p>
<% else %>
<p class="text-secondary text-sm"><%= t(".description") %></p>
<% end %>
</div>
<%= styled_form_with model: Setting.new,
url: settings_hosting_path,
method: :patch,
class: "space-y-3",
data: {
controller: "auto-submit-form",
"auto-submit-form-trigger-event-value": "change"
} do |form| %>
<%= form.select :llm_provider,
options_for_select(
[
[ t(".provider_openai"), "openai" ],
[ t(".provider_anthropic"), "anthropic" ]
],
Setting.llm_provider
),
{ label: t(".provider_label") },
{ disabled: ENV["LLM_PROVIDER"].present?,
data: { "auto-submit-form-target": "auto" } } %>
<p class="text-xs text-secondary"><%= t(".provider_help") %></p>
<% end %>
<div class="rounded-md border border-secondary p-3 bg-container-inset text-xs text-secondary space-y-2">
<p class="font-medium text-primary"><%= t(".data_retention_heading") %></p>
<p><%= t(".data_retention_openai") %></p>
<p><%= t(".data_retention_anthropic") %></p>
</div>
</div>