Skip to content

Commit e1675d6

Browse files
committed
Remove comments
1 parent 8f43e3d commit e1675d6

File tree

2 files changed

+1
-17
lines changed

2 files changed

+1
-17
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/copilot-message/components/usage-limit-actions.tsx

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,49 +16,37 @@ export function UsageLimitActions() {
1616
const { data: subscriptionData } = useSubscriptionData()
1717
const updateUsageLimitMutation = useUpdateUsageLimit()
1818

19-
// The billing API returns { success, context, data }, where data contains plan/status
2019
const subscription = subscriptionData?.data
2120
const canEdit = subscription ? canEditUsageLimit(subscription) : false
2221

2322
const [selectedAmount, setSelectedAmount] = useState<number | null>(null)
2423
const [isHidden, setIsHidden] = useState(false)
2524

26-
// Fixed limit options
2725
const limitOptions = [50, 100, 150]
2826

2927
const handleUpdateLimit = async (newLimit: number) => {
3028
setSelectedAmount(newLimit)
3129
try {
3230
await updateUsageLimitMutation.mutateAsync({ limit: newLimit })
3331

34-
// Hide the buttons immediately
3532
setIsHidden(true)
3633

37-
// Get the store state and retry the last user message
3834
const { messages, sendMessage } = useCopilotStore.getState()
39-
40-
// Find the last user message (before the error)
4135
const lastUserMessage = [...messages].reverse().find((m) => m.role === 'user')
4236

4337
if (lastUserMessage) {
44-
// Remove the error message (assistant message with usage_limit error)
4538
const filteredMessages = messages.filter(
4639
(m) => !(m.role === 'assistant' && m.errorType === 'usage_limit')
4740
)
48-
49-
// Update messages to remove the error message
5041
useCopilotStore.setState({ messages: filteredMessages })
5142

52-
// Retry the original query by passing the same messageId
53-
// This replaces from that point instead of duplicating
5443
await sendMessage(lastUserMessage.content, {
5544
fileAttachments: lastUserMessage.fileAttachments,
5645
contexts: lastUserMessage.contexts,
5746
messageId: lastUserMessage.id,
5847
})
5948
}
60-
} catch (error) {
61-
// Error is handled by the mutation
49+
} catch {
6250
setIsHidden(false)
6351
} finally {
6452
setSelectedAmount(null)
@@ -69,13 +57,11 @@ export function UsageLimitActions() {
6957
window.dispatchEvent(new CustomEvent('open-settings', { detail: { tab: 'subscription' } }))
7058
}
7159

72-
// Hide if already processed
7360
if (isHidden) {
7461
return null
7562
}
7663

7764
if (!canEdit) {
78-
// Show upgrade button for users who can't edit (free/enterprise)
7965
return (
8066
<div className='mt-[12px] flex gap-[6px]'>
8167
<Button onClick={handleNavigateToUpgrade} variant='default'>
@@ -85,7 +71,6 @@ export function UsageLimitActions() {
8571
)
8672
}
8773

88-
// Show button options for users who can edit their limit
8974
return (
9075
<div className='mt-[12px] flex gap-[6px]'>
9176
{limitOptions.map((limit) => {

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/copilot-message/copilot-message.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,6 @@ const CopilotMessage: FC<CopilotMessageProps> = memo(
459459
<StreamingIndicator />
460460
)}
461461

462-
{/* Usage limit actions for 402 errors */}
463462
{message.errorType === 'usage_limit' && <UsageLimitActions />}
464463

465464
{/* Action buttons for completed messages */}

0 commit comments

Comments
 (0)