SPB Git forge

spb/rareindex

Public
54commits 1branches 0releases
7.1 MBsize
maindefault branch
10 days agolast push
TypeScript 61.9% HTML 37.2% SQL 0.7%
1.8 KB · 32 lines tsx
Raw Blame History
1import type { Metadata } from 'next';2import { getRouter } from '@rareindex/ai';3import { ResearchClient } from '@/components/research/research-client';4import { SUGGESTED_PROMPTS } from '@/lib/ai/research';5import { getDb, sql } from '@rareindex/database';67export const metadata: Metadata = {8  title: 'AI Research — ask questions over structured collectibles market data',9  description: 'Conversational research over RareIndex data: assets, sales, listings, indices, movers and screens. Every answer is grounded in tool queries you can inspect.',10};11export const dynamic = 'force-dynamic';1213export default async function ResearchPage({ searchParams }: { searchParams: Promise<{ asset?: string; q?: string }> }) {14  const sp = await searchParams;15  const router = getRouter();16  let prefill = sp.q ?? '';17  if (sp.asset && !prefill) {18    const [a] = (await getDb().execute(sql`select title from assets where slug = ${sp.asset} limit 1`)) as unknown as Array<{ title: string }>;19    prefill = a ? `Give me a market brief on ${a.title} (/asset/${sp.asset}): valuation with confidence, recent sales, listings vs RIV, and 30d/1y change.` : '';20  }21  return (22    <div className="mx-auto max-w-5xl">23      <header className="mb-4">24        <p className="text-[11px] font-semibold uppercase tracking-wider text-subtle">AI Research</p>25        <h1 className="mt-1 text-2xl font-semibold tracking-tight">Ask the collectibles market</h1>26        <p className="mt-2 max-w-2xl text-sm text-muted">Questions are answered only from RareIndex’s structured data through inspectable queries. When the data is not there, the answer says so.</p>27      </header>28      <ResearchClient aiReady={router.configured} model={router.configured ? router.modelFor('research') : null} suggestions={SUGGESTED_PROMPTS} prefill={prefill} />29    </div>30  );31}32