Skip to content

Commit 29e54c8

Browse files
authored
Move presets docs to own page (#1268)
1 parent 28d9587 commit 29e54c8

2 files changed

Lines changed: 107 additions & 97 deletions

File tree

docs/docs/config.mdx

Lines changed: 0 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -174,100 +174,3 @@ wsh editconfig termthemes.json
174174
| background | CSS color | | | background color (default when no color code is applied), must have alpha channel (#rrggbbaa) if you want the terminal to be transparent |
175175
| cursorAccent | CSS color | | | color for cursor |
176176
| selectionBackground | CSS color | | | background color for selected text |
177-
178-
## Presets
179-
180-
Presets can be used to apply multiple setting overrides to either a tab or a block. They are currently supported in two scenarios: tab backgrounds and AI models.
181-
182-
You can set presets either by placing them in `~/.config/waveterm/presets.json` or by placing them in a JSON file in the `~/.config/waveterm/presets/` directory. All presets will be aggregated regardless of which file they're placed in so you can use the `presets` directory to organize them as you see fit.
183-
184-
### File format
185-
186-
Presets follow the following format:
187-
188-
```json
189-
{
190-
...
191-
"<preset-type>@<preset-key>": {
192-
"display:name": "<Preset name>",
193-
"display:order": "<number>", // optional
194-
"<overridden-config-key-1>": "<overridden-config-value-1>"
195-
...
196-
}
197-
}
198-
```
199-
200-
A complete example of a preset for a tab background is the following:
201-
202-
```json
203-
{
204-
"bg@rainbow": {
205-
"display:name": "Rainbow",
206-
"display:order": 2.1,
207-
"bg:*": true,
208-
"bg": "linear-gradient( 226.4deg, rgba(255,26,1,1) 28.9%, rgba(254,155,1,1) 33%, rgba(255,241,0,1) 48.6%, rgba(34,218,1,1) 65.3%, rgba(0,141,254,1) 80.6%, rgba(113,63,254,1) 100.1% )",
209-
"bg:opacity": 0.3
210-
}
211-
}
212-
```
213-
214-
A complete example of a preset for an AI model is the following:
215-
216-
```json
217-
{
218-
"ai@wave": {
219-
"display:name": "Ollama - llama3.1",
220-
"display:order": 0,
221-
"ai:baseurl": "http://localhost:11434",
222-
"ai:model": "llama3.1:latest"
223-
}
224-
}
225-
```
226-
227-
### Preset type
228-
229-
The type of the preset determines where it can be discovered in the app. Currently, the two types that will be discovered in the app are `bg` and `ai`.
230-
231-
`bg` will be served in the "Backgrounds" submenu of the Tab context menu (which can be found by right-clicking on a tab).
232-
233-
![screenshot showing the default options in the backgrounds submenu of the tab context menu](./img/backgrounds-menu.png)
234-
235-
`ai` will be served in the models dropdown in the block header of the "Wave AI" widget.
236-
237-
![screenshot showing the default options in the models dropdown in the block header of the "Wave AI" widget](./img/waveai-model-dropdown.png)
238-
239-
### Available configuration keys
240-
241-
The following configuration keys are available for use in presets:
242-
243-
#### AI configurations:
244-
245-
| Key Name | Type | Function |
246-
| ------------- | ------ | -------------------------------------------------------------------------------- |
247-
| ai:preset | string | the default AI preset to use |
248-
| ai:baseurl | string | Set the AI Base Url (must be OpenAI compatible) |
249-
| ai:apitoken | string | your AI api token |
250-
| ai:apitype | string | defaults to "open_ai", but can also set to "azure" for special Azure AI handling |
251-
| ai:name | string | string to display in the Wave AI block header |
252-
| ai:model | string | model name to pass to API |
253-
| ai:apiversion | string | for Azure AI only (when apitype is "azure", this will default to "2023-05-15") |
254-
| ai:orgid | string | |
255-
| ai:maxtokens | int | max tokens to pass to API |
256-
| ai:timeoutms | int | timeout (in milliseconds) for AI calls |
257-
258-
#### Background configurations:
259-
260-
| Key Name | Type | Function |
261-
| -------------------- | ------ | ----------------------------------------------------------------------------------------------- |
262-
| bg:opacity | float | the opacity of the background |
263-
| bg:blendmode | string | the [blend mode](https://developer.mozilla.org/en-US/docs/Web/CSS/blend-mode) of the background |
264-
| bg:bordercolor | string | the color of the border |
265-
| bg:activebordercolor | string | the color of the border when a block is active |
266-
267-
#### Clear key
268-
269-
Configs in a preset are applied in order to override the default config values, which will persist for the remainder of the tab or block's lifetime. Setting `bg:*` or `ai:*` to `"true"` will clear the values of any previously overridden Background or AI configurations, respectively, setting them back to their defaults.
270-
271-
#### Unset a default value
272-
273-
To unset a default value in a preset, add an override that sets it to an empty string, like `""`.

docs/docs/presets.mdx

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
---
2+
sidebar_position: 3
3+
id: "presets"
4+
title: "Presets"
5+
---
6+
7+
Presets can be used to apply multiple setting overrides at once to either a tab or a block. They are currently supported in two scenarios: tab backgrounds and AI models.
8+
9+
You can set presets either by placing them in `~/.config/waveterm/presets.json` or by placing them in a JSON file in the `~/.config/waveterm/presets/` directory. All presets will be aggregated regardless of which file they're placed in so you can use the `presets` directory to organize them as you see fit.
10+
11+
### File format
12+
13+
Presets follow the following format:
14+
15+
```json
16+
{
17+
...
18+
"<preset-type>@<preset-key>": {
19+
"display:name": "<Preset name>",
20+
"display:order": "<number>", // optional
21+
"<overridden-config-key-1>": "<overridden-config-value-1>"
22+
...
23+
}
24+
}
25+
```
26+
27+
A complete example of a preset for a tab background is the following:
28+
29+
```json
30+
{
31+
"bg@rainbow": {
32+
"display:name": "Rainbow",
33+
"display:order": 2.1,
34+
"bg:*": true,
35+
"bg": "linear-gradient( 226.4deg, rgba(255,26,1,1) 28.9%, rgba(254,155,1,1) 33%, rgba(255,241,0,1) 48.6%, rgba(34,218,1,1) 65.3%, rgba(0,141,254,1) 80.6%, rgba(113,63,254,1) 100.1% )",
36+
"bg:opacity": 0.3
37+
}
38+
}
39+
```
40+
41+
A complete example of a preset for an AI model is the following:
42+
43+
```json
44+
{
45+
"ai@wave": {
46+
"display:name": "Ollama - llama3.1",
47+
"display:order": 0,
48+
"ai:baseurl": "http://localhost:11434",
49+
"ai:model": "llama3.1:latest"
50+
}
51+
}
52+
```
53+
54+
### Preset type
55+
56+
The type of the preset determines where it can be discovered in the app. Currently, the two types that will be discovered in the app are `bg` and `ai`.
57+
58+
`bg` will be served in the "Backgrounds" submenu of the Tab context menu (which can be found by right-clicking on a tab).
59+
60+
![screenshot showing the default options in the backgrounds submenu of the tab context menu](./img/backgrounds-menu.png)
61+
62+
`ai` will be served in the models dropdown in the block header of the "Wave AI" widget.
63+
64+
![screenshot showing the default options in the models dropdown in the block header of the "Wave AI" widget](./img/waveai-model-dropdown.png)
65+
66+
### Available configuration keys
67+
68+
The following configuration keys are available for use in presets:
69+
70+
#### Common keys
71+
72+
| Key Name | Type | Function |
73+
| ------------- | ------ | ---------------------------------------------------------------------- |
74+
| display:name | string | the name to use when displaying the preset in a menu (required) |
75+
| display:order | float | the order in which the preset should be displayed in a menu (optional) |
76+
77+
#### AI configurations
78+
79+
| Key Name | Type | Function |
80+
| ------------- | ------ | -------------------------------------------------------------------------------- |
81+
| ai:preset | string | the default AI preset to use |
82+
| ai:baseurl | string | Set the AI Base Url (must be OpenAI compatible) |
83+
| ai:apitoken | string | your AI api token |
84+
| ai:apitype | string | defaults to "open_ai", but can also set to "azure" for special Azure AI handling |
85+
| ai:name | string | string to display in the Wave AI block header |
86+
| ai:model | string | model name to pass to API |
87+
| ai:apiversion | string | for Azure AI only (when apitype is "azure", this will default to "2023-05-15") |
88+
| ai:orgid | string | |
89+
| ai:maxtokens | int | max tokens to pass to API |
90+
| ai:timeoutms | int | timeout (in milliseconds) for AI calls |
91+
92+
#### Background configurations
93+
94+
| Key Name | Type | Function |
95+
| -------------------- | ------ | ----------------------------------------------------------------------------------------------- |
96+
| bg:opacity | float | the opacity of the background |
97+
| bg:blendmode | string | the [blend mode](https://developer.mozilla.org/en-US/docs/Web/CSS/blend-mode) of the background |
98+
| bg:bordercolor | string | the color of the border |
99+
| bg:activebordercolor | string | the color of the border when a block is active |
100+
101+
#### Clear key
102+
103+
Configs in a preset are applied in order to override the default config values, which will persist for the remainder of the tab or block's lifetime. Setting `bg:*` or `ai:*` to `"true"` will clear the values of any previously overridden Background or AI configurations, respectively, setting them back to their defaults.
104+
105+
#### Unset a default value
106+
107+
To unset a default value in a preset, add an override that sets it to an empty string, like `""`.

0 commit comments

Comments
 (0)