CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/components/account/config/system/ai.tsx
Views: 687
1
import { Space } from "antd";
2
3
import Loading from "components/share/loading";
4
import useEditTable from "lib/hooks/edit-table";
5
import register from "../register";
6
7
const desc = {
8
time_ago_absolute: `
9
You can display timestamps either as absolute points in time or relative to
10
the current time.`,
11
dark_mode: `Use Dark mode to reduce eye strain and save power by showing light text on a dark background.`,
12
extra: "dark reader",
13
};
14
15
interface Data {
16
other_settings: {
17
openai_disabled: boolean;
18
};
19
}
20
21
register({
22
path: "system/llm",
23
title: "AI Settings",
24
icon: "ai",
25
desc: "Configure AI integrations.",
26
search: desc,
27
Component: () => {
28
const { edited, original, Save, EditBoolean } = useEditTable<Data>({
29
accounts: { other_settings: null },
30
});
31
if (original == null || edited == null) {
32
return <Loading />;
33
}
34
35
return (
36
<Space direction="vertical" style={{ width: "100%" }}>
37
<Save />
38
39
<EditBoolean
40
path="other_settings.openai_disabled"
41
icon="robot"
42
title="Disable all AI integrations"
43
desc={
44
<>
45
Disable code generation, buttons in Jupyter, @chatgpt mentions,
46
etc.
47
</>
48
}
49
label="Disable all AI integrations"
50
/>
51
52
{/* TODO: insert the <ModelSwitch/> component here, which is more complex than just a plain list of options */}
53
</Space>
54
);
55
},
56
});
57
58