Synth error handling (#1502)

* Synth error handling

* Revert "Synth error handling"

This reverts commit fd6a0a12b4.

* Simplify overage messaging
This commit was merged in pull request #1502.
This commit is contained in:
Josh Pigford
2024-11-26 07:45:00 -06:00
committed by GitHub
parent 955f211fe0
commit a9b61a655b
2 changed files with 9 additions and 0 deletions

View File

@@ -153,6 +153,10 @@ class Family < ApplicationRecord
self.class.synth_provider&.usage
end
def synth_overage?
self.class.synth_provider && self.class.synth_provider.usage.utilization >= 1
end
def subscribed?
stripe_subscription_status == "active"
end

View File

@@ -1,4 +1,9 @@
<div class="space-y-4">
<% if self_hosted? && Current.family&.synth_overage? %>
<div class="bg-yellow-100 border border-yellow-400 text-yellow-700 px-4 py-3 rounded relative" role="alert">
Your Synth API credit limit has been exceeded. Please visit your <a href="https://dashboard.synthfinance.com/settings" class="font-medium underline hover:text-yellow-900">Synth billing settings</a> to upgrade your plan or wait for your credits to reset.
</div>
<% end %>
<header class="flex items-center justify-between">
<div>
<h1 class="sr-only"><%= t(".title") %></h1>