mirror of
https://github.com/outline/outline.git
synced 2026-11-22 22:02:35 +03:00
115 lines
3.7 KiB
TypeScript
115 lines
3.7 KiB
TypeScript
import { observer } from "mobx-react";
|
|
import { CopyIcon, SparklesIcon } from "outline-icons";
|
|
import * as React from "react";
|
|
import { useTranslation, Trans } from "react-i18next";
|
|
import { toast } from "sonner";
|
|
import { TeamPreference } from "@shared/types";
|
|
import Heading from "~/components/Heading";
|
|
import Scene from "~/components/Scene";
|
|
import Switch from "~/components/Switch";
|
|
import Text from "~/components/Text";
|
|
import useCurrentTeam from "~/hooks/useCurrentTeam";
|
|
import SettingRow from "./components/SettingRow";
|
|
import Input from "~/components/Input";
|
|
import Tooltip from "~/components/Tooltip";
|
|
import CopyToClipboard from "~/components/CopyToClipboard";
|
|
import NudeButton from "~/components/NudeButton";
|
|
import { useTheme } from "styled-components";
|
|
|
|
function Features() {
|
|
const { t } = useTranslation();
|
|
const team = useCurrentTeam();
|
|
const theme = useTheme();
|
|
|
|
const handleMCPChange = React.useCallback(
|
|
async (checked: boolean) => {
|
|
team.setPreference(TeamPreference.MCP, checked);
|
|
await team.save();
|
|
toast.success(t("Settings saved"));
|
|
},
|
|
[team, t]
|
|
);
|
|
|
|
const handleCopied = React.useCallback(() => {
|
|
toast.success(t("Copied to clipboard"));
|
|
}, [t]);
|
|
|
|
const mcpEndpoint = window.location.origin + "/mcp";
|
|
|
|
return (
|
|
<Scene title={t("AI")} icon={<SparklesIcon />}>
|
|
<Heading>{t("AI")}</Heading>
|
|
<Text as="p" type="secondary">
|
|
<Trans>Manage AI and integration features for your workspace.</Trans>
|
|
</Text>
|
|
|
|
<SettingRow
|
|
name={TeamPreference.MCP}
|
|
label={t("MCP server")}
|
|
description={
|
|
<>
|
|
<Text type="secondary" as="p">
|
|
{t(
|
|
"Allow members to connect to this workspace with MCP to read and write data."
|
|
)}
|
|
</Text>
|
|
{team.getPreference(TeamPreference.MCP) && (
|
|
<>
|
|
<Text
|
|
type="secondary"
|
|
as="p"
|
|
style={{ marginTop: 8, marginBottom: 4 }}
|
|
>
|
|
<Trans
|
|
defaults="Use the following endpoint to connect to the MCP server from your app. Find out more about setup in <a>the docs</a>."
|
|
components={{
|
|
a: (
|
|
<Text
|
|
as="a"
|
|
weight="bold"
|
|
href="https://docs.getoutline.com/s/guide/doc/mcp-6j9jtENNKL"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
/>
|
|
),
|
|
}}
|
|
/>
|
|
</Text>
|
|
<Input readOnly value={mcpEndpoint}>
|
|
<Tooltip content={t("Copy URL")} placement="top">
|
|
<CopyToClipboard text={mcpEndpoint} onCopy={handleCopied}>
|
|
<NudeButton type="button" style={{ marginRight: 3 }}>
|
|
<CopyIcon color={theme.placeholder} size={18} />
|
|
</NudeButton>
|
|
</CopyToClipboard>
|
|
</Tooltip>
|
|
</Input>
|
|
</>
|
|
)}
|
|
</>
|
|
}
|
|
>
|
|
<Switch
|
|
id={TeamPreference.MCP}
|
|
name={TeamPreference.MCP}
|
|
checked={team.getPreference(TeamPreference.MCP)}
|
|
onChange={handleMCPChange}
|
|
/>
|
|
</SettingRow>
|
|
|
|
<SettingRow
|
|
name="answers"
|
|
label={t("AI answers")}
|
|
description={t(
|
|
"Use AI to get direct answers to questions in search. This feature requires a paid license."
|
|
)}
|
|
border={false}
|
|
>
|
|
<Switch disabled />
|
|
</SettingRow>
|
|
</Scene>
|
|
);
|
|
}
|
|
|
|
export default observer(Features);
|