import type { ReactNode } from "react"; import type { SectionBaseProps } from "./context"; import { useTranslation } from "react-i18next"; export interface ResearchProjectSectionProps extends SectionBaseProps { scopeBanner: ReactNode; researchLimitError: string | null; } export function ResearchProjectSection({ scopeBanner, form, setForm, researchLimitError }: ResearchProjectSectionProps) { const { t } = useTranslation("app"); const limits = form.researchSettings?.limits; const sources = form.researchSettings?.enabledSources; return (<> {scopeBanner}

{t("settings.researchProject.projectResearchSettings", "Project Research Settings")}

{t("settings.researchProject.enableResearchInThisProjectHint", "Default: enabled.")}
{t("settings.researchProject.webSearchIsAlwaysEnabledConfigureTheSearch", " Web search is always enabled. Configure the search provider under Research Defaults. ")}
{[ ["pageFetch", t("settings.researchProject.pageFetch", "Page Fetch"), "Default: enabled."], ["github", t("settings.researchProject.github", "GitHub"), "Default: disabled."], ["localDocs", t("settings.researchProject.localDocs", "Local Docs"), "Default: enabled."], ["llmSynthesis", t("settings.researchProject.llmSynthesis", "LLM Synthesis"), "Default: enabled."], ].map(([key, label, defaultHint]) => ())}
setForm((current) => ({ ...current, researchSettings: { ...(current.researchSettings ?? {}), limits: { ...(current.researchSettings?.limits ?? {}), maxConcurrentRuns: event.target.value === "" ? undefined : Number(event.target.value), }, }, }))}/> {t("settings.researchProject.maxConcurrentRunsHint", "Default: 3.")}
setForm((current) => ({ ...current, researchSettings: { ...(current.researchSettings ?? {}), limits: { ...(current.researchSettings?.limits ?? {}), maxSourcesPerRun: event.target.value === "" ? undefined : Number(event.target.value), }, }, }))}/> {t("settings.researchProject.maxSourcesPerRunHint", "Default: 20.")}
setForm((current) => ({ ...current, researchSettings: { ...(current.researchSettings ?? {}), limits: { ...(current.researchSettings?.limits ?? {}), maxDurationMs: event.target.value === "" ? undefined : Number(event.target.value), }, }, }))}/> {t("settings.researchProject.maxDurationMsHint", "Default: 300000 (5 minutes).")}
setForm((current) => ({ ...current, researchSettings: { ...(current.researchSettings ?? {}), limits: { ...(current.researchSettings?.limits ?? {}), requestTimeoutMs: event.target.value === "" ? undefined : Number(event.target.value), }, }, }))}/> {t("settings.researchProject.requestTimeoutMsHint", "Default: 30000 (30 seconds).")}
{researchLimitError && {researchLimitError}}
); } export default ResearchProjectSection;