Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 26 additions & 21 deletions app/src/pages/Conversations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,8 @@ const Conversations = () => {
<div className="flex-shrink-0 border-t border-stone-200 px-4 py-3">
{teamUsage &&
(teamUsage.remainingUsd <= 0 ||
(teamUsage.fiveHourCapUsd > 0 &&
(!teamUsage.bypassRateLimit &&
teamUsage.fiveHourCapUsd > 0 &&
teamUsage.fiveHourSpendUsd >= teamUsage.fiveHourCapUsd)) && (
<div className="mb-3 p-3 rounded-xl bg-coral-50 border border-coral-200 flex items-center justify-between gap-3">
<div className="flex items-center gap-2 min-w-0">
Expand Down Expand Up @@ -1188,14 +1189,16 @@ const Conversations = () => {
<div className="relative group">
{teamUsage ? (
<div className="flex items-center gap-2">
<LimitPill
label="10h"
usedPct={
teamUsage.fiveHourCapUsd > 0
? Math.min(1, teamUsage.fiveHourSpendUsd / teamUsage.fiveHourCapUsd)
: 0
}
/>
{!teamUsage.bypassRateLimit && (
<LimitPill
label="5h"
usedPct={
teamUsage.fiveHourCapUsd > 0
? Math.min(1, teamUsage.fiveHourSpendUsd / teamUsage.fiveHourCapUsd)
: 0
}
/>
)}
<LimitPill
label="7d"
usedPct={
Expand All @@ -1215,18 +1218,20 @@ const Conversations = () => {
{teamUsage && (
<div className="absolute bottom-full right-0 mb-2 hidden group-hover:block z-50">
<div className="bg-stone-900 text-white text-[10px] rounded-lg px-3 py-2 shadow-lg whitespace-nowrap space-y-1.5">
<div className="flex items-center justify-between gap-4">
<span className="text-stone-400">10-hour limit</span>
<span>
${teamUsage.fiveHourSpendUsd.toFixed(2)} / $
{teamUsage.fiveHourCapUsd.toFixed(2)}
{teamUsage.fiveHourResetsAt && (
<span className="text-stone-400 ml-1">
— resets {formatResetTime(teamUsage.fiveHourResetsAt)}
</span>
)}
</span>
</div>
{!teamUsage.bypassRateLimit && (
<div className="flex items-center justify-between gap-4">
<span className="text-stone-400">5-hour limit</span>
<span>
${teamUsage.fiveHourSpendUsd.toFixed(2)} / $
{teamUsage.fiveHourCapUsd.toFixed(2)}
{teamUsage.fiveHourResetsAt && (
<span className="text-stone-400 ml-1">
— resets {formatResetTime(teamUsage.fiveHourResetsAt)}
</span>
)}
</span>
</div>
)}
Comment on lines +1221 to +1234

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check InferenceBudget.tsx for bypassRateLimit usage
rg -n "bypassRateLimit" app/src/components/settings/panels/billing/InferenceBudget.tsx

# Show the current 10-hour cap display logic
rg -n -C3 "10-hour cap" app/src/components/settings/panels/billing/

Repository: tinyhumansai/openhuman

Length of output: 1840


LGTM on Conversations.tsx changes; confirm fix to InferenceBudget.tsx for consistency.

The tooltip guard in Conversations.tsx (lines 1221-1234) correctly hides the 5-hour limit section when bypassRateLimit is true. However, app/src/components/settings/panels/billing/InferenceBudget.tsx displays the 10-hour cap metrics without checking bypassRateLimit, creating inconsistency. For users with rate limit bypass enabled, this component would still show rate limit cap information that is correctly hidden in Conversations.tsx. Apply the same !teamUsage.bypassRateLimit guard to the 10-hour cap display in InferenceBudget.tsx.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/src/pages/Conversations.tsx` around lines 1221 - 1234,
InferenceBudget.tsx currently renders the 10-hour cap UI even when
teamUsage.bypassRateLimit is true; wrap the JSX block that shows the 10-hour
metrics (the elements using teamUsage.tenHourSpendUsd, teamUsage.tenHourCapUsd
and teamUsage.tenHourResetsAt and formatResetTime) with the same guard used in
Conversations.tsx—i.e., render it only when !teamUsage.bypassRateLimit—so the
10-hour cap is hidden for teams that bypass rate limits.

<div className="flex items-center justify-between gap-4">
<span className="text-stone-400">Weekly limit</span>
<span>
Expand Down
2 changes: 2 additions & 0 deletions app/src/services/api/creditsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export interface TeamUsage {
cycleStartDate: string;
/** ISO timestamp when the current weekly cycle ends */
cycleEndsAt: string;
/** When true, the 10-hour rolling window rate limit is not enforced for this user (test/internal accounts) */
bypassRateLimit?: boolean;
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}

export interface TopUpResult {
Expand Down
Loading