Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

1.2 KB
Raw Blame
import { t } from "ttag";

import { useSelector } from "metabase/redux";
import { getApplicationName } from "metabase/selectors/whitelabel";
import {
  SettingsPageWrapper,
  SettingsSection,
} from "metabase/settings-components";
import { TextInput } from "metabase/ui";
import { useAdminSettingWithDebouncedInput } from "metabase-enterprise/ai-controls/hooks";

import { MetabotIconField } from "./MetabotIconField";

export function MetabotCustomizationPage() {
  const applicationName = useSelector(getApplicationName);
  const { handleInputChange, inputValue: nameInput } =
    useAdminSettingWithDebouncedInput<string | null>("metabot-name");

  return (
    <SettingsPageWrapper title={t`Customization`} mt="sm">
      <SettingsSection
        description={t`Customize how ${applicationName}'s AI agent appears to users.`}
        title={t`Identity`}
      >
        <TextInput
          label={t`AI agent's name`}
          placeholder={t`Metabot`}
          mb="sm"
          value={nameInput || ""}
          onChange={(e) => handleInputChange(e.target.value)}
          error={nameInput ? undefined : t`AI agent's name is required`}
        />
        <MetabotIconField />
      </SettingsSection>
    </SettingsPageWrapper>
  );
}