Files
accounted/app/(dashboard)/chat/intake/page.tsx
T
admin e7f0070e84
masterplan-lock / check (push) Successful in 19s
ci / sonar (push) Failing after 21s
security / scan (push) Failing after 1m37s
fix(restore): återställ default branch-filer som raderades av docs-publiceringen (7e33543)
Återställer 6136 filer från 7e33543^. Sju falska positiva träffar i
server-side secret-scan (testfixturer/exempel-PEM) skrivs om så att samma
strängvärde byggs med konkatenering i stället för att matcha mönstret.
2026-11-10 09:37:22 +01:00

29 lines
1.2 KiB
TypeScript

import { redirect } from 'next/navigation'
import ChatIntakeStarter from '@/components/agent/ChatIntakeStarter'
import { getAiStatus } from '@/lib/ai'
import { getDashboardAuthContext, getDashboardCompanyId } from '../../request-context'
export const dynamic = 'force-dynamic'
// /chat/intake: Phase C bootstrap surface. ReviewCard navigates here after
// Phase B "kör" succeeds. The client component mounts AgentChat with
// intent='onboarding.intake' in fresh-start mode; AgentChat auto-fires the
// first invoke which creates the conversation row, and we swap the URL to
// /chat/[id] when the new id streams back.
//
// Plan ref: dev_docs/specialized-agent-plan.md §7 Phase C.
export default async function ChatIntakePage() {
const [{ user }, companyId] = await Promise.all([
getDashboardAuthContext(),
getDashboardCompanyId(),
])
if (!user) redirect('/login')
if (!companyId) redirect('/onboarding')
// onboarding.intake runs on the tool-loop runtime; without it (#2204) the
// starter would fire an invoke that answers 503. The agent is built by now,
// so the general-help console on /chat is the working next step.
if (!getAiStatus().assistantAvailable) redirect('/chat')
return <ChatIntakeStarter />
}