fix: multiple issues
1. Script warning in layout.tsx - Use Next.js Script component instead of plain <script> 2. QUOTA_EXCEEDED bug for chart suggestions - Add 'suggest_charts' to VALID_FEATURES - Add 'suggest_charts' to TIER_LIMITS for all tiers - Fix route to use 'suggest_charts' instead of invalid 'ai' feature This fixes the issue where users with valid credit were getting QUOTA_EXCEEDED errors because 'ai' was not a valid feature name. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -44,7 +44,7 @@ export async function POST(req: Request) {
|
|||||||
const sysConfigEarly = await getSystemConfig()
|
const sysConfigEarly = await getSystemConfig()
|
||||||
const { usedByok: willUseByok } = await willUseByokForLane('suggest-charts', sysConfigEarly, userId)
|
const { usedByok: willUseByok } = await willUseByokForLane('suggest-charts', sysConfigEarly, userId)
|
||||||
if (!willUseByok) {
|
if (!willUseByok) {
|
||||||
await checkEntitlementOrThrow(userId, 'ai')
|
await checkEntitlementOrThrow(userId, 'suggest_charts')
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err instanceof QuotaExceededError) {
|
if (err instanceof QuotaExceededError) {
|
||||||
@@ -169,7 +169,7 @@ Response format (JSON):
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Track usage
|
// Track usage
|
||||||
await trackFeatureUsage(userId, 'ai', 'suggest-charts', 1)
|
await trackFeatureUsage(userId, 'suggest_charts', 'suggest-charts', 1)
|
||||||
|
|
||||||
return Response.json(parsed satisfies SuggestChartsResponse)
|
return Response.json(parsed satisfies SuggestChartsResponse)
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,9 @@ export default async function RootLayout({
|
|||||||
>
|
>
|
||||||
<head />
|
<head />
|
||||||
<body className={`${inter.className} ${inter.variable} ${manrope.variable} ${playfair.variable} ${jetbrainsMono.variable}`}>
|
<body className={`${inter.className} ${inter.variable} ${manrope.variable} ${playfair.variable} ${jetbrainsMono.variable}`}>
|
||||||
<script
|
<Script
|
||||||
|
id="theme-init"
|
||||||
|
strategy="beforeInteractive"
|
||||||
dangerouslySetInnerHTML={{ __html: getThemeScript(userSettings.theme, userSettings.accentColor) }}
|
dangerouslySetInnerHTML={{ __html: getThemeScript(userSettings.theme, userSettings.accentColor) }}
|
||||||
/>
|
/>
|
||||||
<Script
|
<Script
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ const TIER_LIMITS: Record<SubscriptionTier, Record<string, number | 'unlimited'>
|
|||||||
brainstorm_create: 1,
|
brainstorm_create: 1,
|
||||||
brainstorm_expand: 10,
|
brainstorm_expand: 10,
|
||||||
brainstorm_enrich: 20,
|
brainstorm_enrich: 20,
|
||||||
|
suggest_charts: 5,
|
||||||
},
|
},
|
||||||
PRO: {
|
PRO: {
|
||||||
semantic_search: 100,
|
semantic_search: 100,
|
||||||
@@ -88,6 +89,7 @@ const TIER_LIMITS: Record<SubscriptionTier, Record<string, number | 'unlimited'>
|
|||||||
brainstorm_create: 30,
|
brainstorm_create: 30,
|
||||||
brainstorm_expand: 100,
|
brainstorm_expand: 100,
|
||||||
brainstorm_enrich: 200,
|
brainstorm_enrich: 200,
|
||||||
|
suggest_charts: 50,
|
||||||
},
|
},
|
||||||
BUSINESS: {
|
BUSINESS: {
|
||||||
semantic_search: 1000,
|
semantic_search: 1000,
|
||||||
@@ -98,6 +100,7 @@ const TIER_LIMITS: Record<SubscriptionTier, Record<string, number | 'unlimited'>
|
|||||||
brainstorm_create: 200,
|
brainstorm_create: 200,
|
||||||
brainstorm_expand: 500,
|
brainstorm_expand: 500,
|
||||||
brainstorm_enrich: 1000,
|
brainstorm_enrich: 1000,
|
||||||
|
suggest_charts: 200,
|
||||||
},
|
},
|
||||||
ENTERPRISE: {
|
ENTERPRISE: {
|
||||||
semantic_search: 'unlimited',
|
semantic_search: 'unlimited',
|
||||||
@@ -108,6 +111,7 @@ const TIER_LIMITS: Record<SubscriptionTier, Record<string, number | 'unlimited'>
|
|||||||
brainstorm_create: 'unlimited',
|
brainstorm_create: 'unlimited',
|
||||||
brainstorm_expand: 'unlimited',
|
brainstorm_expand: 'unlimited',
|
||||||
brainstorm_enrich: 'unlimited',
|
brainstorm_enrich: 'unlimited',
|
||||||
|
suggest_charts: 'unlimited',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ export const VALID_FEATURES = [
|
|||||||
'brainstorm_create',
|
'brainstorm_create',
|
||||||
'brainstorm_expand',
|
'brainstorm_expand',
|
||||||
'brainstorm_enrich',
|
'brainstorm_enrich',
|
||||||
|
'suggest_charts',
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export type FeatureName = (typeof VALID_FEATURES)[number];
|
export type FeatureName = (typeof VALID_FEATURES)[number];
|
||||||
|
|||||||
Reference in New Issue
Block a user