File size: 2,145 Bytes
1813a37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1982de5
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
64
65
66
import {Input} from "../input";
import {Link, Thermometer, Sliders} from "preact-feather";
import {Button} from "../button";
import {useEffect, useState} from "preact/hooks";
import {fetchSettings, saveSettings, Settings as SettingsType} from "../../utils/settings";
import {Slider} from "../slider";
import {FormGroup} from "../form";

export function Settings(props: {
    settings: SettingsType,
    setSettings: (settings: SettingsType) => void,
    resetApp: () => void,
}) {
    // const [settings, setSettings] = useState(fetchSettings)
    //
    // useEffect(() => {
    //     saveSettings(settings);
    // }, [settings]);

    return <div>
        <form>
            <FormGroup>
                <label htmlFor="api">API</label>
                <Input
                    type="text"
                    placeholder="URl d'API ex: https://ouruq7zepnehg2-5000.proxy.runpod.net/"
                    icon={Link}
                    value={props.settings.apiURL}
                    onChange={(v) => props.setSettings({...props.settings, apiURL: v as string})}
                />
            </FormGroup>
            <FormGroup>
                <label for="temperature">Temperature</label>
                <Slider
                    name="temperature"
                    value={props.settings.temperature}
                    onChange={(v) => props.setSettings({...props.settings, temperature: v})}
                    min={0.1}
                    max={2}
                    step={0.1}
                />
            </FormGroup>
            <div>
                <Button
                    onClick={() => {
                        props.resetApp()
                    }}
                    secondary={true}
                    title="Tout réinitialiser"
                >
                    Réinitialiser
                </Button>
            </div>
            <br/>
            <div>
                <Button
                    onClick={() => {
                        history.go(-1)
                    }}
                >
                    Retour
                </Button>
            </div>
        </form>
    </div>
}