import { getMemberToken, getApiBaseUrl } from '../../_lib/api'; import { AskChat } from './AskChat'; import Link from 'next/link'; interface Citation { messageId: string; snippet: string; senderName: string; sourceGroupName: string; approvedAt: number; } interface QA { id: string; question: string; answer: string; citations: Citation[]; createdAt: string; } async function fetchHistory(token: string): Promise { const res = await fetch(`${getApiBaseUrl()}/my/ask`, { headers: { Authorization: `Bearer ${token}` }, cache: 'no-store', }).catch(() => null); if (!res || !res.ok) return []; return (await res.json()) as QA[]; } export default async function AskPage() { const token = await getMemberToken(); if (!token) return null; const history = await fetchHistory(token); return (

Ask AI

Answers from your community's knowledge.

← Dashboard
); }