File size: 1,898 Bytes
1e22bf6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import { Alert, Button, Group, Text } from "@mantine/core";
import { IconCheck, IconInfoCircle, IconX } from "@tabler/icons-react";
import { usePubSub } from "create-pubsub/react";
import { useState } from "react";
import { addLogEntry } from "../../modules/logEntries";
import { settingsPubSub } from "../../modules/pubSub";

export default function AiModelDownloadAllowanceContent() {
  const [settings, setSettings] = usePubSub(settingsPubSub);
  const [hasDeniedDownload, setDeniedDownload] = useState(false);

  const handleAccept = () => {
    setSettings({
      ...settings,
      allowAiModelDownload: true,
    });
    addLogEntry("User allowed the AI model download");
  };

  const handleDecline = () => {
    setDeniedDownload(true);
    addLogEntry("User denied the AI model download");
  };

  return hasDeniedDownload ? null : (
    <Alert
      variant="light"
      color="blue"
      title="Allow AI model download?"
      icon={<IconInfoCircle />}
    >
      <Text size="sm" mb="md">
        To obtain AI responses, a language model needs to be downloaded to your
        browser. Enabling this option lets the app store it and load it
        instantly on subsequent uses.
      </Text>
      <Text size="sm" mb="md">
        Please note that the download size ranges from 100 MB to 4 GB, depending
        on the model you select in the Menu, so it's best to avoid using mobile
        data for this.
      </Text>
      <Group justify="flex-end" mt="md">
        <Button
          variant="subtle"
          color="gray"
          leftSection={<IconX size="1rem" />}
          onClick={handleDecline}
          size="xs"
        >
          Not now
        </Button>
        <Button
          leftSection={<IconCheck size="1rem" />}
          onClick={handleAccept}
          size="xs"
        >
          Allow download
        </Button>
      </Group>
    </Alert>
  );
}