import type { Metadata } from "next";
import { AI_DOC_URL } from "yt-dlp-transcript-common/lib/project";
import { currentSite } from "../../lib/site";
import { instanceMode } from "../../lib/mode";
import AskHub from "../../ask/AskHub";
import { isCitedSite } from "yt-dlp-transcript-common/lib/siteSchema";
import { NotOnCitedSite } from "../../components/reports/parts";
export const metadata: Metadata = { title: "Ask AI" };
// Static shell for the bring-your-own-key chat. All the work happens client-side
// in — retrieval over the published shards + a direct call to the
// visitor's chosen provider. The export stays fully static.
//
// In single-site mode the corpus data source (SingleSiteDataProvider) lives in
// the shared workspace layout — alongside the persistent search bar — so this
// route renders just the chat and inherits the same session the results page
// uses. Hub mode is passed through the layout untouched, so keeps its
// own MultiSiteDataProvider wiring.
export default function AskPage() {
const site = currentSite();
const isHub = instanceMode() === "hub";
const scope = isHub ? "the federation" : "the transcripts";
// A cited site has no corpus to ask about.
if (!isHub && isCitedSite(site)) return ;
return (
Ask AI · {site.headerTitle}
Ask a question about {scope}
Bring your own API key. The chat searches the transcripts in your
browser, sends the relevant excerpts to your chosen AI, and answers with
citations. Nothing is hosted here — your key and the requests stay
between your browser and the provider. See{" "}
Use with AI
{" "}
for other ways to use {isHub ? "every archive on this hub" : "this archive"}.
{/* Single-site: the chat pane (AskChat) is mounted by the workspace shell
(WorkspaceView), so this route renders only its intro header — the shell
slots it above the chat. Hub mode bypasses the shell, so AskHub renders
here with its own MultiSiteDataProvider wiring. */}
{isHub &&
}
);
}