mirror of
https://github.com/we-promise/sure.git
synced 2026-05-29 23:39:03 +00:00
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).
This commit is contained in:
@@ -174,7 +174,16 @@ class Settings::HostingsController < ApplicationController
|
||||
end
|
||||
|
||||
if hosting_params.key?(:anthropic_base_url)
|
||||
Setting.anthropic_base_url = hosting_params[:anthropic_base_url].presence
|
||||
raw_base_url = hosting_params[:anthropic_base_url].to_s.strip
|
||||
if raw_base_url.blank?
|
||||
Setting.anthropic_base_url = nil
|
||||
else
|
||||
parsed = URI.parse(raw_base_url) rescue nil
|
||||
unless parsed.is_a?(URI::HTTP)
|
||||
raise Setting::ValidationError, t(".invalid_anthropic_base_url")
|
||||
end
|
||||
Setting.anthropic_base_url = raw_base_url
|
||||
end
|
||||
end
|
||||
|
||||
if hosting_params.key?(:anthropic_model)
|
||||
|
||||
Reference in New Issue
Block a user