import { usePubSub } from "create-pubsub/react";
import {
disableAiResponseSettingPubSub,
summarizeLinksSettingPubSub,
useLargerModelSettingPubSub,
disableWebGpuUsageSettingPubSub,
} from "../modules/pubSub";
import { Tooltip } from "react-tooltip";
import { isWebGPUAvailable } from "../modules/webGpu";
import type { ChangeEventHandler } from "react";
export function SettingsForm() {
const [disableAiResponse, setDisableAiResponse] = usePubSub(
disableAiResponseSettingPubSub,
);
const [summarizeLinks, setSummarizeLinks] = usePubSub(
summarizeLinksSettingPubSub,
);
const [useLargerModel, setUseLargerModel] = usePubSub(
useLargerModelSettingPubSub,
);
const [disableWebGpuUsage, setDisableWebGpuUsage] = usePubSub(
disableWebGpuUsageSettingPubSub,
);
return (
Settings
setUseLargerModel(event.target.checked)}
tooltipId="use-large-model-setting-tooltip"
tooltipContent="Generates better responses, but takes longer to load"
/>
setSummarizeLinks(event.target.checked)}
tooltipId="summarize-links-setting-tooltip"
tooltipContent="Provides a short overview for each of the links from the web search results"
/>
{isWebGPUAvailable && (
setDisableWebGpuUsage(event.target.checked)}
tooltipId="use-large-model-setting-tooltip"
tooltipContent="Disables the WebGPU and run smaller AI models only using the CPU"
/>
)}
setDisableAiResponse(event.target.checked)}
tooltipId="disable-ai-setting-tooltip"
tooltipContent="Disables the AI response, in case you only want to see the links from the web search results"
/>