Skip to content

Commit 8ec5b4a

Browse files
committed
Ishosted check
1 parent 91e4456 commit 8ec5b4a

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

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

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useState } from 'react'
44
import { Loader2 } from 'lucide-react'
55
import { Button } from '@/components/emcn'
66
import { canEditUsageLimit } from '@/lib/billing/subscriptions/utils'
7+
import { isHosted } from '@/lib/core/config/feature-flags'
78
import { useSubscriptionData, useUpdateUsageLimit } from '@/hooks/queries/subscription'
89
import { useCopilotStore } from '@/stores/panel/copilot/store'
910

@@ -54,25 +55,27 @@ export function UsageLimitActions() {
5455
}
5556

5657
const handleNavigateToUpgrade = () => {
57-
window.dispatchEvent(new CustomEvent('open-settings', { detail: { tab: 'subscription' } }))
58+
if (isHosted) {
59+
window.dispatchEvent(new CustomEvent('open-settings', { detail: { tab: 'subscription' } }))
60+
} else {
61+
window.open('https://www.sim.ai', '_blank')
62+
}
5863
}
5964

6065
if (isHidden) {
6166
return null
6267
}
6368

64-
if (!canEdit) {
69+
if (!isHosted || !canEdit) {
6570
return (
66-
<div className='mt-[12px] flex gap-[6px]'>
67-
<Button onClick={handleNavigateToUpgrade} variant='default'>
68-
Upgrade Plan
69-
</Button>
70-
</div>
71+
<Button onClick={handleNavigateToUpgrade} variant='default'>
72+
Upgrade
73+
</Button>
7174
)
7275
}
7376

7477
return (
75-
<div className='mt-[12px] flex gap-[6px]'>
78+
<>
7679
{limitOptions.map((limit) => {
7780
const isLoading = updateUsageLimitMutation.isPending && selectedAmount === limit
7881
const isDisabled = updateUsageLimitMutation.isPending
@@ -88,6 +91,6 @@ export function UsageLimitActions() {
8891
</Button>
8992
)
9093
})}
91-
</div>
94+
</>
9295
)
9396
}

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

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

462-
{message.errorType === 'usage_limit' && <UsageLimitActions />}
462+
{message.errorType === 'usage_limit' && (
463+
<div className='mt-3 flex gap-1.5'>
464+
<UsageLimitActions />
465+
</div>
466+
)}
463467

464468
{/* Action buttons for completed messages */}
465469
{!isStreaming && cleanTextContent && (

0 commit comments

Comments
 (0)