mirror of
https://github.com/we-promise/sure.git
synced 2026-04-08 14:54:49 +00:00
* Password reset back button also after confirmation Signed-off-by: Juan José Mata <juanjo.mata@gmail.com> * Implement a filter for category (#215) - Also implement an is empty/is null condition. * Implement an LLM cost estimation page Track costs across all the cost categories: auto categorization, auto merchant detection and chat. Show warning with estimated cost when running a rule that contains AI. * Update pricing * Add google pricing and fix inferred model everywhere. * Update app/models/llm_usage.rb Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: soky srm <sokysrm@gmail.com> * FIX address review * Linter * Address review - Lowered log level - extracted the duplicated record_usage method into a shared concern * Update app/controllers/settings/llm_usages_controller.rb Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: soky srm <sokysrm@gmail.com> * Moved attr_reader out of private --------- Signed-off-by: Juan José Mata <juanjo.mata@gmail.com> Signed-off-by: soky srm <sokysrm@gmail.com> Co-authored-by: Juan José Mata <juanjo.mata@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
57 lines
2.5 KiB
Plaintext
57 lines
2.5 KiB
Plaintext
<%= render DS::Dialog.new(reload_on_close: params[:reload_on_close].present?) do |dialog| %>
|
|
<%
|
|
title = if @rule.name.present?
|
|
"Confirm changes to \"#{@rule.name}\""
|
|
else
|
|
"Confirm changes"
|
|
end
|
|
%>
|
|
<% dialog.with_header(title: title) %>
|
|
|
|
<% dialog.with_body do %>
|
|
<p class="text-secondary text-sm mb-4">
|
|
You are about to apply this rule to
|
|
<span class="text-primary font-medium"><%= @rule.affected_resource_count %> <%= @rule.resource_type.pluralize %></span>
|
|
that meet the specified rule criteria. Please confirm if you wish to proceed with this change.
|
|
</p>
|
|
|
|
<% if @rule.actions.any? { |a| a.action_type == "auto_categorize" } %>
|
|
<% affected_count = @rule.affected_resource_count %>
|
|
<div class="mb-4 p-3 bg-blue-50 border border-blue-200 rounded-lg">
|
|
<div class="flex items-start gap-2">
|
|
<%= icon "info", class: "w-4 h-4 text-blue-600 mt-0.5 flex-shrink-0" %>
|
|
<div class="text-xs">
|
|
<p class="font-medium text-blue-900 mb-1">AI Cost Estimation</p>
|
|
<% if @estimated_cost.present? %>
|
|
<p class="text-blue-700">
|
|
This will use AI to categorize <%= affected_count %> transaction<%= "s" if affected_count != 1 %>.
|
|
Estimated cost: <span class="font-semibold">~$<%= sprintf("%.4f", @estimated_cost) %></span>
|
|
</p>
|
|
<% else %>
|
|
<p class="text-blue-700">
|
|
This will use AI to categorize <%= affected_count %> transaction<%= "s" if affected_count != 1 %>.
|
|
<% if @selected_model.present? %>
|
|
<span class="font-semibold">Cost estimation unavailable for model "<%= @selected_model %>".</span>
|
|
<% else %>
|
|
<span class="font-semibold">Cost estimation unavailable (no LLM provider configured).</span>
|
|
<% end %>
|
|
You may incur costs, please check with the model provider for the most up-to-date prices.
|
|
</p>
|
|
<% end %>
|
|
<p class="text-blue-600 mt-1">
|
|
<%= link_to "View usage history", settings_llm_usage_path, class: "underline hover:text-blue-800" %>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
|
|
<%= render DS::Button.new(
|
|
text: "Confirm changes",
|
|
href: apply_rule_path(@rule),
|
|
method: :post,
|
|
full_width: true,
|
|
data: { turbo_frame: "_top" }) %>
|
|
<% end %>
|
|
<% end %>
|