Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release notes and more docs for v0.9.2 #1270

Merged
merged 5 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions cmd/wsh/cmd/wshcmd-ai.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ var aiCmd = &cobra.Command{
}

var aiFileFlags []string
var aiNewBlockFlag bool

func init() {
rootCmd.AddCommand(aiCmd)
aiCmd.Flags().BoolVarP(&aiNewBlockFlag, "new", "n", false, "create a new AI block")
aiCmd.Flags().StringArrayVarP(&aiFileFlags, "file", "f", nil, "attach file content (use '-' for stdin)")
}

Expand Down Expand Up @@ -69,9 +71,12 @@ func aiRun(cmd *cobra.Command, args []string) {
if isDefaultBlock {
blockArg = "view@waveai"
}

fullORef, err := resolveSimpleId(blockArg)
if err != nil && isDefaultBlock {
var fullORef *waveobj.ORef
var err error
if !aiNewBlockFlag {
fullORef, err = resolveSimpleId(blockArg)
}
if (err != nil && isDefaultBlock) || aiNewBlockFlag {
// Create new AI block if default block doesn't exist
data := &wshrpc.CommandCreateBlockData{
BlockDef: &waveobj.BlockDef{
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/config.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ wsh editconfig
| ai:preset | string | the default AI preset to use |
| ai:baseurl | string | Set the AI Base Url (must be OpenAI compatible) |
| ai:apitoken | string | your AI api token |
| ai:apitype | string | defaults to "open_ai", but can also set to "azure" for special Azure AI handling |
| ai:apitype | string | defaults to "open_ai", but can also set to "azure" (forspecial Azure AI handling) or "anthropic" |
| ai:name | string | string to display in the Wave AI block header |
| ai:model | string | model name to pass to API |
| ai:apiversion | string | for Azure AI only (when apitype is "azure", this will default to "2023-05-15") |
Expand Down
4 changes: 4 additions & 0 deletions docs/docs/customization.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,7 @@ Using widgets.json, you'll be able to remove any default widgets and add widgets
You can also suppress the help widgets in the bottom right by setting the config key `widget:showhelp` to `false`.

<div style={{ clear: "both" }} />

## Presets

For more advanced customization, to set up multiple AI models, and your own tab backgrounds, check out our [Presets Documentation](./presets).
26 changes: 25 additions & 1 deletion docs/docs/faq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,19 @@ Here are the ollma open AI compatibility docs: https://github.com/ollama/ollama/

```json
{
"ai:*": true,
"ai:baseurl": "http://localhost:11434/v1",
"ai:name": "llama3.2",
"ai:model": "llama3.2",
"ai:apitoken": "ollama"
}
```

### How can I connect to Azure AI
Note: we set the `ai:*` key to true to clear all the existing "ai" keys so this config is a clean slate.

To switch between multiple models, consider [adding AI Presets](./presets) instead.

### How can I connect to Azure AI?

Open your [config file](./config) in Wave using `wsh editconfig` (the config file is normally located
at `~/.config/waveterm/settings.json`).
Expand All @@ -44,6 +49,25 @@ You'll need to set your `ai:baseurl` to your Azure AI Base URL (do not include q
You'll also need to set `ai:apitype` to `azure`. You can then set the `ai:model`, and `ai:apitoken` appropriately
for your setup.

### How can I connect to Claude?

Open your [config file](./config) in Wave using `wsh editconfig`.

Set these keys:

```json
{
"ai:*": true,
"ai:apitype": "anthropic",
"ai:model": "claude-3-5-sonnet-latest",
"ai:apitoken": "<your anthropic API key>"
}
```

Note: we set the `ai:*` key to true to clear all the existing "ai" keys so this config is a clean slate.

To switch between models, consider [adding AI Presets](./presets) instead.

### How can I see the block numbers?

The block numbers will appear when you hold down Ctrl-Shift (and disappear once you release the key combo).
Expand Down
34 changes: 22 additions & 12 deletions docs/docs/presets.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ Presets can be used to apply multiple setting overrides at once to either a tab

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.

:::info

You can open up the main presets config file in Wave by running:

```
wsh editconfig presets.json
```

:::

### File format

Presets follow the following format:
Expand Down Expand Up @@ -76,18 +86,18 @@ The following configuration keys are available for use in presets:

#### AI configurations

| Key Name | Type | Function |
| ------------- | ------ | -------------------------------------------------------------------------------- |
| ai:preset | string | the default AI preset to use |
| ai:baseurl | string | Set the AI Base Url (must be OpenAI compatible) |
| ai:apitoken | string | your AI api token |
| ai:apitype | string | defaults to "open_ai", but can also set to "azure" for special Azure AI handling |
| ai:name | string | string to display in the Wave AI block header |
| ai:model | string | model name to pass to API |
| ai:apiversion | string | for Azure AI only (when apitype is "azure", this will default to "2023-05-15") |
| ai:orgid | string | |
| ai:maxtokens | int | max tokens to pass to API |
| ai:timeoutms | int | timeout (in milliseconds) for AI calls |
| Key Name | Type | Function |
| ------------- | ------ | -------------------------------------------------------------------------------------------------- |
| ai:preset | string | the default AI preset to use |
| ai:baseurl | string | Set the AI Base Url (must be OpenAI compatible) |
| ai:apitoken | string | your AI api token |
| ai:apitype | string | defaults to "open_ai", but can also set to "azure" (for special Azure AI handling), or "anthropic" |
| ai:name | string | string to display in the Wave AI block header |
| ai:model | string | model name to pass to API |
| ai:apiversion | string | for Azure AI only (when apitype is "azure", this will default to "2023-05-15") |
| ai:orgid | string | |
| ai:maxtokens | int | max tokens to pass to API |
| ai:timeoutms | int | timeout (in milliseconds) for AI calls |

#### Background configurations

Expand Down
14 changes: 14 additions & 0 deletions docs/docs/releasenotes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ sidebar_position: 200

# Release Notes

### v0.9.2 &mdash; Nov 11, 2024

New minor release with bug fixes and new features! Fixed the bug around making Wave fullscreen (also affecting certain window managers like Hyprland). We've also put a lot of work into the doc site (https://docs.waveterm.dev), including documenting how [Widgets](./widgets) and [Presets](./presets) work!

- Updated documentation
- Wave AI now supports the Anthropic API! Checkout the [FAQ](./faq) for how to use the Claude models with Wave AI.
- Removed defaultwidgets.json and unified it to widgets.json. Makes it more straightforward to override the default widgets.
- New resolvers for `-b` param in `wsh`. "tab:N" for accessing the nth tab, "[view]" and "[view]:N" for accessing blocks of a particlar view.
- New `wsh ai` command to send AI chats (and files) directly to a new or existing AI block
- wsh setmeta/getmeta improvements. Allow setmeta to take a json file (and also read from stdin), also better output formats for getmeta (compatible with setmeta).
- [bugfix] Set max completion tokens in the OpenAI API so we can now work with o1 models (also fallback to non-streaming mode)
- [bugfix] Fixed content resizing when entering "full screen" mode. This bug also affected certain window managers (like Hyperland)
- Lots of other small bug fixes, docs updates, and dependency bumps

### v0.9.1 &mdash; Nov 1, 2024

Minor bug fix release to follow-up on the v0.9.0 build. Lots of issues fixed (especially for Windows).
Expand Down
20 changes: 20 additions & 0 deletions docs/docs/wsh.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,26 @@ wsh getmeta -b [other-tab-id] "bg:*" --clear-prefix | wsh setmeta -b tab --json

---

## ai

Send messages to new or existing AI blocks directly from the CLI. `-f` passes a file. note that there is a maximum size of 10k for messages and files, so use a tail/grep to cut down file sizes before passing. The `-f` option works great for small files though like shell scripts or `.zshrc` etc.

By default the messages get sent to the first AI block (by blocknum). If no AI block exists, then a new one will be created. Use `-n` to force creation of a new AI block. Use `-b` to target a specific AI block.

```
wsh ai "how do i write an ls command that sorts files in reverse size order"
wsh ai -f <(tail -n 20 "my.log") -- "any idea what these error messages mean"
wsh ai -f README.md "help me update this readme file"

# creates a new AI block
wsh ai -n "tell me a story"

# targets block number 5
wsh ai -b 5 "tell me more"
```

---

## editconfig

You can easily open up any of Wave's config files using this command.
Expand Down
Loading