diff --git a/memento-note/app/api/agents/run-for-note/route.ts b/memento-note/app/api/agents/run-for-note/route.ts index 6789cb7..5da7d5e 100644 --- a/memento-note/app/api/agents/run-for-note/route.ts +++ b/memento-note/app/api/agents/run-for-note/route.ts @@ -44,9 +44,10 @@ export async function POST(req: NextRequest) { return NextResponse.json({ error: 'Paramètres invalides' }, { status: 400 }) } - // Quota check — slides/excalidraw generation counts as 'reformulate' credit + // Quota check — feature key depends on generation type + const featureKey = type === 'slide-generator' ? 'slide_generate' : 'excalidraw_generate' try { - await checkEntitlementOrThrow(userId, 'reformulate') + await checkEntitlementOrThrow(userId, featureKey) } catch (e) { if (e instanceof QuotaExceededError) { return NextResponse.json({ error: e.message }, { status: 402 }) diff --git a/memento-note/lib/ai/tools/slides.tool.ts b/memento-note/lib/ai/tools/slides.tool.ts index fb19442..845eca9 100644 --- a/memento-note/lib/ai/tools/slides.tool.ts +++ b/memento-note/lib/ai/tools/slides.tool.ts @@ -81,8 +81,8 @@ RULES: console.log('[Slides Tool] Canvas created:', canvas.id, '| Slides:', slides.length, '| Size:', Math.round(html.length / 1024), 'KB') - // Decrement reformulate quota (agent-based generation consumes credits) - incrementUsageAsync(ctx.userId, 'reformulate') + // Decrement slide_generate quota after successful canvas creation + incrementUsageAsync(ctx.userId, 'slide_generate') if (ctx.actionId) { await prisma.agentAction.update({ diff --git a/memento-note/lib/entitlements.ts b/memento-note/lib/entitlements.ts index 7e59863..7bc896b 100644 --- a/memento-note/lib/entitlements.ts +++ b/memento-note/lib/entitlements.ts @@ -79,6 +79,8 @@ const TIER_LIMITS: Record brainstorm_expand: 10, brainstorm_enrich: 20, suggest_charts: 5, + slide_generate: 3, + excalidraw_generate: 3, }, PRO: { semantic_search: 100, @@ -90,6 +92,8 @@ const TIER_LIMITS: Record brainstorm_expand: 100, brainstorm_enrich: 200, suggest_charts: 50, + slide_generate: 20, + excalidraw_generate: 20, }, BUSINESS: { semantic_search: 1000, @@ -101,6 +105,8 @@ const TIER_LIMITS: Record brainstorm_expand: 500, brainstorm_enrich: 1000, suggest_charts: 200, + slide_generate: 100, + excalidraw_generate: 100, }, ENTERPRISE: { semantic_search: 'unlimited', @@ -112,6 +118,8 @@ const TIER_LIMITS: Record brainstorm_expand: 'unlimited', brainstorm_enrich: 'unlimited', suggest_charts: 'unlimited', + slide_generate: 'unlimited', + excalidraw_generate: 'unlimited', }, };