feat: design system overhaul — sidebar, AI chats, settings, brainstorm, color cleanup
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 12s
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 12s
- Sidebar: dynamic brand-accent colors, brainstorm section restyled - AI chat general: popup panel with expand/collapse, hides when contextual AI open - AI chat contextual: tabs reordered (Actions first), X close button, height fix - Settings: all tabs restyled, 6 new color presets (sage, terracotta, iron, etc.) - Global color cleanup: emerald/orange hardcoded → brand-accent dynamic - Brainstorm page: orange → brand-accent throughout - PageEntry animation component added to key pages - Floating AI button: bg-brand-accent instead of hardcoded black - i18n: all 15 locales updated with new AI/billing keys - Billing: freemium quota tracking, BYOK, stripe subscription scaffolding - Admin: integrated into new design - AGENTS.md + CLAUDE.md project rules added
This commit is contained in:
@@ -2,10 +2,15 @@ import { NextRequest, NextResponse } from 'next/server'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { auth } from '@/auth'
|
||||
import { z } from 'zod'
|
||||
import { getTagsProvider } from '@/lib/ai/factory'
|
||||
import { runLaneWithBillingUser, willUseByokForLane } from '@/lib/ai/provider-for-user'
|
||||
import { getSystemConfig } from '@/lib/config'
|
||||
import { embeddingService } from '@/lib/ai/services/embedding.service'
|
||||
import {
|
||||
checkSessionEntitlementOrThrow,
|
||||
QuotaExceededError,
|
||||
} from '@/lib/entitlements'
|
||||
import {
|
||||
billingOwnerFromSession,
|
||||
verifyParticipant,
|
||||
resolveAiContextUserId,
|
||||
sanitizeNotesForGuest,
|
||||
@@ -182,7 +187,23 @@ export async function POST(
|
||||
return NextResponse.json({ error: 'Session not found' }, { status: 404 })
|
||||
}
|
||||
|
||||
const parentIdea = brainstormSession.ideas.find(i => i.id === ideaId)
|
||||
const { billingOwnerId, isGuestActor } = billingOwnerFromSession(
|
||||
brainstormSession.userId,
|
||||
session.user.id,
|
||||
)
|
||||
// Story 3.5: per-provider BYOK bypass
|
||||
const earlyConfig = await getSystemConfig()
|
||||
const { usedByok: willUseByok } = await willUseByokForLane('tags', earlyConfig, billingOwnerId)
|
||||
if (!willUseByok) {
|
||||
await checkSessionEntitlementOrThrow(
|
||||
billingOwnerId,
|
||||
session.user.id,
|
||||
isGuestActor,
|
||||
'brainstorm_expand',
|
||||
)
|
||||
}
|
||||
|
||||
const parentIdea = (brainstormSession.ideas || []).find(i => i.id === ideaId)
|
||||
if (!parentIdea) {
|
||||
return NextResponse.json({ error: 'Idea not found' }, { status: 404 })
|
||||
}
|
||||
@@ -205,7 +226,6 @@ export async function POST(
|
||||
}
|
||||
|
||||
const config = await getSystemConfig()
|
||||
const provider = getTagsProvider(config)
|
||||
|
||||
const prompt = buildExpandPromptV2(
|
||||
parentIdea.title,
|
||||
@@ -216,7 +236,12 @@ export async function POST(
|
||||
locale
|
||||
)
|
||||
|
||||
const llmResponse = await provider.generateText(prompt)
|
||||
const { result: llmResponse } = await runLaneWithBillingUser(
|
||||
'tags',
|
||||
config,
|
||||
billingOwnerId,
|
||||
(provider) => provider.generateText(prompt),
|
||||
)
|
||||
|
||||
let newIdeas: any[]
|
||||
try {
|
||||
@@ -311,6 +336,9 @@ export async function POST(
|
||||
|
||||
return NextResponse.json({ success: true, data: updatedSession })
|
||||
} catch (error: any) {
|
||||
if (error instanceof QuotaExceededError) {
|
||||
return NextResponse.json(error.toJSON(), { status: 402 })
|
||||
}
|
||||
if (error instanceof z.ZodError) {
|
||||
return NextResponse.json({ error: error.issues }, { status: 400 })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user