]> git.giacomolli.uk - onechat/blob - README.rst
Read the data directory and the configuration
[onechat] / README.rst
1 #########
2 OneChat
3 #########
4
5 OneChat is a Go program. It prints its name. It is in early development.
6 Linux is supported.
7
8 ****************
9 Data directory
10 ****************
11
12 OneChat keeps its data and its token file in one directory. It uses the
13 first of these:
14
15 #. ``ONECHAT_DIR``, when it is set.
16 #. ``$XDG_DATA_HOME/onechat``, when ``XDG_DATA_HOME`` is an absolute
17 path. A relative value is ignored.
18 #. ``~/.local/share/onechat``. With no home directory, OneChat exits
19 with an error.
20
21 OneChat creates the directory with mode 0700.
22
23 ***************
24 Configuration
25 ***************
26
27 ``config.json`` in the data directory holds the settings. OneChat does
28 not create it. A missing file or field takes the default, and an unknown
29 field is an error.
30
31 .. code:: json
32
33 {
34 "endpoint": "chatgpt",
35 "compactor": {"model": "gpt-6-luna", "effort": "high"}
36 }
37
38 ``endpoint``
39 ``chatgpt`` (the default) sends model calls to the ChatGPT backend
40 with the subscription login. ``api`` sends them to the OpenAI API
41 with the key in ``OPENAI_API_KEY``, which must then be set. With
42 ``chatgpt``, OneChat ignores ``OPENAI_API_KEY``.
43
44 ``compactor``
45 The model and the reasoning effort of the summaries. The defaults are
46 ``gpt-6-luna`` and ``high``.
47
48 *************
49 Development
50 *************
51
52 Nix supplies the Go toolchain and all tools. Enter the development shell
53 with direnv:
54
55 .. code:: console
56
57 direnv allow
58
59 Or enter it directly:
60
61 .. code:: console
62
63 nix develop
64
65 The shell sets ``ONECHAT_DIR`` to ``.devenv/onechat`` in the checkout,
66 unless it is already set. Development data goes there, and Git ignores
67 ``.devenv``.
68
69 Build and run:
70
71 .. code:: console
72
73 nix build
74 ./result/bin/onechat
75
76 Format and check all files:
77
78 .. code:: console
79
80 bin/format
81 bin/check
82 nix flake check