Skip to content

Commit

Permalink
Merge branch 'main' into r0.16
Browse files Browse the repository at this point in the history
  • Loading branch information
wsxiaoys committed Aug 21, 2024
2 parents d677c55 + 9bac37c commit 41950df
Show file tree
Hide file tree
Showing 230 changed files with 2,479 additions and 2,393 deletions.
66 changes: 51 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ jobs:
- x86_64-manylinux2014-vulkan
- x86_64-windows-msvc
- x86_64-windows-msvc-vulkan
- x86_64-windows-msvc-cuda117
- x86_64-windows-msvc-cuda122
# - x86_64-windows-msvc-cuda117
# - x86_64-windows-msvc-cuda122
include:
- os: macos-latest
target: aarch64-apple-darwin
Expand Down Expand Up @@ -74,18 +74,18 @@ jobs:
ext: .exe
build_args: --features vulkan,binary
vulkan_sdk: '1.3.280.0'
- os: windows-2019
target: x86_64-pc-windows-msvc
binary: x86_64-windows-msvc-cuda117
ext: .exe
build_args: --features cuda,binary
windows_cuda: '11.7.1'
- os: windows-2019
target: x86_64-pc-windows-msvc
binary: x86_64-windows-msvc-cuda122
ext: .exe
build_args: --features cuda,binary
windows_cuda: '12.2.0'
# - os: windows-2019
# target: x86_64-pc-windows-msvc
# binary: x86_64-windows-msvc-cuda117
# ext: .exe
# build_args: --features cuda,binary
# windows_cuda: '11.7.1'
# - os: windows-2019
# target: x86_64-pc-windows-msvc
# binary: x86_64-windows-msvc-cuda122
# ext: .exe
# build_args: --features cuda,binary
# windows_cuda: '12.2.0'

env:
SCCACHE_GHA_ENABLED: true
Expand Down Expand Up @@ -244,9 +244,42 @@ jobs:
retention-days: 3
name: tabby_${{ matrix.binary }}${{ matrix.ext }}
path: tabby_${{ matrix.binary }}${{ matrix.ext }}

package-win-cuda:
runs-on: ubuntu-latest
env:
LLAMA_CPP_VERSION: b3571
needs: [release-binary]
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Download all artifacts
uses: actions/download-artifact@v3

- name: Display structure of downloaded files
run: ls -R

- name: Package CUDA 11.7
run: >
LLAMA_CPP_PLATFORM=cuda-cu11.7.1-x64 OUTPUT_NAME=tabby_x86_64-windows-msvc-cuda117 ./ci/package-win.sh
- name: Package CUDA 12.2
run: >
LLAMA_CPP_PLATFORM=cuda-cu12.2.0-x64 OUTPUT_NAME=tabby_x86_64-windows-msvc-cuda122 ./ci/package-win.sh
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
retention-days: 3
name: dist
path: dist/


pre-release:
needs: [release-llama-server-binary, release-binary]
needs: [release-llama-server-binary, release-binary, package-win-cuda]
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down Expand Up @@ -291,6 +324,9 @@ jobs:
fi
done
done
- name: Display structure of created files
run: ls -R dist

- uses: ncipollo/release-action@v1
if: github.event_name == 'push'
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ caddy:
caddy run --watch --config ee/tabby-webserver/development/Caddyfile

bump-version:
cargo ws version --no-git-tag --force "*"
cargo ws version --force "*"

bump-release-version:
cargo ws version --allow-branch "r*" --no-individual-tags --force "*"
Expand Down
23 changes: 23 additions & 0 deletions ci/package-win.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

# Input variables
LLAMA_CPP_VERSION=${LLAMA_CPP_VERSION:-b3571}
LLAMA_CPP_PLATFORM=${LLAMA_CPP_PLATFORM:-cuda-cu11.7.1-x64}
OUTPUT_NAME=${OUTPUT_NAME:-tabby_x86_64-windows-msvc-cuda117}

NAME=llama-${LLAMA_CPP_VERSION}-bin-win-${LLAMA_CPP_PLATFORM}
ZIP_FILE=${NAME}.zip

curl https://github.com/ggerganov/llama.cpp/releases/download/${LLAMA_CPP_VERSION}/${ZIP_FILE} -L -o ${ZIP_FILE}
unzip ${ZIP_FILE} -d ${OUTPUT_NAME}

pushd ${OUTPUT_NAME}
rm $(ls *.exe | grep -v "llama-server")
cp ../tabby_x86_64-windows-msvc.exe/tabby_x86_64-windows-msvc.exe tabby.exe
popd

zip -r ${OUTPUT_NAME}.zip ${OUTPUT_NAME}
rm -rf ${OUTPUT_NAME}

mkdir -p dist
mv ${OUTPUT_NAME}.zip dist/
40 changes: 40 additions & 0 deletions clients/vscode/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# CONTRIBUTING

## Development

Thank you for considering contributing to Tabby VSCode Extension, to get started, use the following commands:

```bash

# Install dependencies
pnpm install

# Start VSCode in development mode, with the extension loaded
pnpm dev

# Start VSCode Webview in development mode, with the extension loaded
pnpm dev:browser
```

## Architecture

On a high level the extension is divided into the following components:

+---------------------+
| Tabby Server |
+------------------+ | +-----------------+ |
| VSCode Extension | ---->| | |
+------------------+ | | Chat UI | |
| | | | |
| | +-----------------+ |
| | |
v | +-----------------+ |
+------------------+ | | | |
| Tabby Agent | ---->| API | |
+------------------+ | | | |
| +-----------------+ |
+---------------------+

- **Tabby Server**: The server component of Tabby, responsible for managing user accounts, code completions, and chat functionality.
- **Chat UI**: The web-based UI for Tabby Chat, which is embedded as a webview in the VSCode extension. It is distributed together with the Tabby Server.
- **Tabby Agent**: The LSP server of Tabby, responsible for providing code completions and other language services to the VSCode extension. It communicates with the Tabby Server via the API. For VSCode, the Tabby Agent is a library, thus it is embedded in the extension.
29 changes: 29 additions & 0 deletions clients/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@
"title": "Add Selection to Chat",
"category": "Tabby"
},
{
"command": "tabby.chat.addFileContext",
"title": "Add File to Chat",
"category": "Tabby"
},
{
"command": "tabby.chat.explainCodeBlock",
"title": "Explain This",
Expand Down Expand Up @@ -130,7 +135,25 @@
"category": "Tabby"
}
],
"submenus": [
{
"id": "tabby.submenu",
"label": "Tabby"
}
],
"menus": {
"tabby.submenu": [
{
"command": "tabby.chat.addRelevantContext",
"when": "editorHasSelection && tabby.chatEnabled",
"group": "tabby.submenu@1"
},
{
"command": "tabby.chat.addFileContext",
"when": "tabby.chatEnabled",
"group": "tabby.submenu@2"
}
],
"commandPalette": [
{
"command": "tabby.inlineCompletion.trigger",
Expand Down Expand Up @@ -176,6 +199,12 @@
"command": "tabby.chat.edit.discard",
"when": "false"
}
],
"editor/context": [
{
"submenu": "tabby.submenu",
"group": "2_tabby"
}
]
},
"walkthroughs": [
Expand Down
135 changes: 135 additions & 0 deletions clients/vscode/src/CommandPalette.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
import { commands, QuickPick, QuickPickItem, QuickPickItemKind, ThemeIcon, window } from "vscode";
import { State as LanguageClientState } from "vscode-languageclient";
import { Client } from "./lsp/Client";
import { Config } from "./Config";
import { Issues } from "./Issues";

export default class CommandPalette {
quickPick: QuickPick<CommandPaletteItem>;

constructor(
private readonly client: Client,
private readonly config: Config,
private readonly issues: Issues,
) {
this.quickPick = window.createQuickPick();
this.quickPick.title = "Tabby Command Palette";

let items: CommandPaletteItem[] = [this.itemForStatus()];

if (this.client.chat.isAvailable) {
items.push({
label: "Chat",
command: "tabby.chatView.focus",
iconPath: new ThemeIcon("comment"),
});
}

items = items.concat([
{
label: "",
kind: QuickPickItemKind.Separator,
},
{
label: this.config.inlineCompletionTriggerMode === "manual" ? "Enable Completions" : "Disable Completions",
command: "tabby.toggleInlineCompletionTriggerMode",
},
{
label: "",
kind: QuickPickItemKind.Separator,
},
{
label: "Set Credentials",
command: "tabby.setApiToken",
iconPath: new ThemeIcon("key"),
},
{
label: "Settings...",
command: "tabby.openSettings",
iconPath: new ThemeIcon("extensions-manage"),
},
{
label: "Agent Settings...",
command: "tabby.openTabbyAgentSettings",
iconPath: new ThemeIcon("console"),
},
{
label: "Show Logs...",
command: "tabby.outputPanel.focus",
},
{
label: "",
kind: QuickPickItemKind.Separator,
},
{
label: "Help",
command: "tabby.openOnlineHelp",
iconPath: new ThemeIcon("question"),
},
]);

this.quickPick.items = items;
this.quickPick.onDidAccept(this.onDidAccept, this);
this.quickPick.show();
}

onDidAccept() {
this.quickPick.hide();
const item = this.quickPick.activeItems[0];
if (item?.command) {
if (typeof item.command === "function") {
item.command();
} else {
commands.executeCommand(item.command);
}
}
}

private itemForStatus(): CommandPaletteItem {
const lspState = this.client.languageClient.state;
const agentStatus = this.client.agent.status;
const item: CommandPaletteItem = {
label: "Status",
iconPath: new ThemeIcon("warning"),
};
if (lspState === LanguageClientState.Starting || agentStatus === "notInitialized") {
item.label = "Starting...";
item.iconPath = new ThemeIcon("sync");
} else if (lspState === LanguageClientState.Stopped || agentStatus === "finalized") {
item.label = "Disabled";
item.iconPath = new ThemeIcon("circle-slash");
} else if (agentStatus === "disconnected" || this.issues.first === "connectionFailed") {
item.label = "Disconnected";
item.description = "Cannot connect to Tabby Server";
item.command = "tabby.openSettings";
} else if (agentStatus === "unauthorized") {
item.label = "Unauthorized";
item.description = "Your credentials are invalid";
item.command = "tabby.setApiToken";
} else if (this.issues.length > 0) {
switch (this.issues.first) {
case "highCompletionTimeoutRate":
item.label = "Timeout";
item.description = "Most completion requests timed out.";
break;
case "slowCompletionResponseTime":
item.label = "Slow Response";
item.description = "Completion requests appear to take too much time.";
break;
}
item.command = () => this.issues.showHelpMessage();
} else if (agentStatus === "ready") {
item.label = "Ready";
item.iconPath = new ThemeIcon("check");
item.command = "tabby.outputPanel.focus";
}

return item;
}
}

interface CommandPaletteItem extends QuickPickItem {
command?: string | CallbackCommand;
}

type CallbackCommand = () => void;
Loading

0 comments on commit 41950df

Please sign in to comment.