Skip to content

Commit

Permalink
Merge branch 'main' into rocm-support
Browse files Browse the repository at this point in the history
# Conflicts:
#	crates/tabby/src/main.rs
  • Loading branch information
cromefire committed Jan 14, 2024
2 parents fd0891b + f51bdd6 commit b471554
Show file tree
Hide file tree
Showing 75 changed files with 1,783 additions and 259 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/autofix-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ on:
- 'Cargo.toml'
- 'Cargo.lock'
- 'crates/**'
- 'ee/tabby-webserver/**'
- 'ee/**'
- '!ee/tabby-ui/**'

permissions:
contents: read
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release-vim.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ jobs:
git config --local user.name "github-actions[bot]"
git add .
git commit -m "release: vim-tabby version ${{ steps.get_version.outputs.version }}"
git tag ${{ steps.get_version.outputs.version }}
- name: Push changes
uses: ad-m/github-push-action@master
with:
repository: TabbyML/vim-tabby
github_token: ${{ secrets.VIM_RELEASE_GH_TOKEN }}
directory: vim-tabby
force: true
tags: true
5 changes: 3 additions & 2 deletions .github/workflows/test-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ on:
- 'Cargo.toml'
- 'Cargo.lock'
- 'crates/**'
- 'ee/tabby-webserver/**'
- 'ee/**'
- '!ee/tabby-ui/**'
- '.github/workflows/test-rust.yml'

concurrency:
Expand Down Expand Up @@ -55,4 +56,4 @@ jobs:
- run: bash ./ci/prepare_build_environment.sh

- name: Run unit tests
run: cargo test --bin tabby --lib
run: cargo test --bin tabby --lib
102 changes: 102 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# 🤝 Contributing

Thank you for your interest in contributing to Tabby! We appreciate all contributions. For a better experience and support, join us on [Slack](https://links.tabbyml.com/join-slack)!

## Local Setup

To begin contributing to Tabby, first clone the repository locally:

```
git clone --recurse-submodules https://github.com/TabbyML/tabby
```

If you have already cloned the repository, you can initialize submodules with this command:

```
git submodule update --recursive --init
```

Make sure you have installed [Rust](https://www.rust-lang.org/learn/get-started), and one of the following dependencies may need to be installed depending on your system:

```bash
# For MacOS
brew install protobuf

# For Ubuntu / Debian
apt-get install protobuf-compiler libopenblas-dev

# For Windows 11 with Chocolatey package manager
choco install protoc
```

Before proceeding, ensure that all tests are passing locally:

```
cargo test -- --skip golden
```

Golden tests should be skipped on all platforms except Apple silicon (M1/M2), because they have not been created for other platforms yet.

This will help ensure everything is working correctly and avoid surprises with local breakages.

## Building and Running

Tabby can be run through `cargo` in much the same manner as docker:

```
cargo run serve --model TabbyML/StarCoder-1B
```

This will run Tabby locally on CPU, which is not optimal for performance. Depending on your GPU and its compatibility, you may be able to run Tabby with GPU acceleration. Please make sure you have CUDA or ROCm installed, for Nvidia or AMD graphics cards respectively. No extra library installation is necessary for Apple silicon (M1/M2) using Metal.

To run Tabby locally with CUDA (NVIDIA):

```
cargo run --features cuda serve --model TabbyML/StarCoder-1B --device cuda
```

To run Tabby locally with ROCm (AMD):

```
cargo run --features rocm serve --model TabbyML/StarCoder-1B --device rocm
```

To run Tabby locally with Metal (Apple M1/M2):

```
cargo run serve --model TabbyML/StarCoder-1B --device metal
```

After running the respective command, you should see an output similar to the below (after compilation). The demonstration is for ROCm (AMD).

![image](https://github.com/TabbyML/tabby/assets/14198267/8f21d495-882d-462c-b426-7c495f38a5d8)

By default, Tabby will start on `localhost:8080` and serve requests.

## Project Layout

Tabby is broken up into several crates, each responsible for a different part of the functionality. These crates fall into two categories: Fully open source features, and enterprise features. All open-source feature crates are located in the `/crates` folder in the repository root, and all enterprise feature crates are located in `/ee`.

### Crates
- `crates/tabby` - The core tabby application, this is the main binary crate defining CLI behavior and driving the API
- `crates/tabby-common` - Interfaces and type definitions shared across most other tabby crates, especially types used for serialization
- `crates/tabby-download` - Very small crate, responsible for downloading models at runtime
- `crates/tabby-scheduler` - Defines jobs that need to run periodically for syncing and indexing code
- `crates/tabby-inference` - Defines interfaces for interacting with text generation models
- `crates/llama-cpp-bindings` - Raw bindings to talk with the actual models in C++ from Rust
- `ee/tabby-webserver` - The webserver for Tabby with privilege management and a chatbot playground. Also includes GraphQL API implementation. Must use `--webserver` on CLI to enable
- `ee/tabby-db` - The database backing the webserver
- `ee/tabby-ui` - Frontend for the Tabby webserver

## Picking an Issue

This [search filter](https://github.com/TabbyML/tabby/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22+no%3Aassignee) will show all the issues currently marked as "open" and "good first issue" that aren't currently assigned to anyone.
Any of them would be a good choice for starting out, and choosing one that already has some conversation may help give context and ensure it's relevant.

Most issues will have a link to the related location in the code, and if they don't, you can always reach out to us on Slack or mention one of us in the issue to provide more context.

## Code Review

You can feel free to open PRs that aren't quite ready yet, to work on them. If you do this, please make sure to [mark the pull request as a draft](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-stage-of-a-pull-request).

Once your PR is ready, please request review from one of the [Tabby team members](https://github.com/orgs/TabbyML/people), and watch for replies asking for any changes. Once approved, you can merge your code into Tabby!
5 changes: 3 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2023 TabbyML, Inc.
Copyright (c) 2024 TabbyML, Inc.

Portions of this software are licensed as follows:

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ For additional options (e.g inference type, parallelism), please refer to the [d

## 🤝 Contributing

Full guide at [CONTRIBUTING.md](https://github.com/TabbyML/tabby/blob/main/CONTRIBUTING.md);

### Get the Code

```bash
Expand Down
1 change: 1 addition & 0 deletions clients/example-vscode-lsp/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.png filter=lfs diff=lfs merge=lfs -text
3 changes: 3 additions & 0 deletions clients/example-vscode-lsp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
dist
*.vsix
9 changes: 9 additions & 0 deletions clients/example-vscode-lsp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Example VSCode client for Tabby agent (LSP)

This is an example of a VSCode extension for the Tabby agent. It runs the Tabby agent as a language server and creates a client connecting to it.

![Demo](./demo.png)

For more information about Tabby agent, please refer to [Tabby agent](https://github.com/TabbyML/tabby/tree/main/clients/tabby-agent).

For more information about developing a VSCode LSP extension, please refer to [VSCode Language Extensions Guide](https://code.visualstudio.com/api/language-extensions/overview).
3 changes: 3 additions & 0 deletions clients/example-vscode-lsp/demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions clients/example-vscode-lsp/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "example-vscode-tabby-lsp-client",
"description": "Example VSCode client for Tabby agent (LSP).",
"publisher": "TabbyML",
"version": "0.0.1",
"engines": {
"vscode": "^1.82.0"
},
"main": "./dist/extension.js",
"activationEvents": [
"onLanguage"
],
"scripts": {
"build": "tsup --minify",
"watch": "tsup --watch ./ --ignore-watch ./dist"
},
"devDependencies": {
"@types/vscode": "^1.82.0",
"esbuild-plugin-copy": "^2.1.1",
"tabby-agent": "1.2.0"
},
"dependencies": {
"vscode-languageclient": "^9.0.1"
}
}
37 changes: 37 additions & 0 deletions clients/example-vscode-lsp/src/extension.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { ExtensionContext } from "vscode";
import { LanguageClient, ServerOptions, TransportKind } from "vscode-languageclient/node";

let client: LanguageClient;

export async function activate(context: ExtensionContext): Promise<void> {
console.debug("Tabby LSP Example: activate");

const serverModulePath = context.asAbsolutePath("dist/server/tabby-agent.js");
const serverOptions: ServerOptions = {
run: {
module: serverModulePath,
args: ["--lsp"],
transport: TransportKind.ipc,
},
debug: {
module: serverModulePath,
args: ["--lsp"],
transport: TransportKind.ipc,
},
};
const clientOptions = {
documentSelector: [{ pattern: "**/*" }],
};
if (!client) {
client = new LanguageClient("Tabby LSP Example", serverOptions, clientOptions);
}
return await client.start();
}

export async function deactivate(): Promise<void> {
console.debug("Tabby LSP Example: deactivate");

if (client) {
return await client.stop();
}
}
10 changes: 10 additions & 0 deletions clients/example-vscode-lsp/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "ES2020",
"lib": ["ES2020"],
"sourceMap": true,
"strict": true
},
"include": ["./src"]
}
30 changes: 30 additions & 0 deletions clients/example-vscode-lsp/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { defineConfig } from "tsup";
import { copy } from "esbuild-plugin-copy";
import { dependencies } from "./package.json";

export default () => [
defineConfig({
name: "node",
entry: ["src/extension.ts"],
outDir: "dist",
platform: "node",
target: "node18",
external: ["vscode"],
noExternal: Object.keys(dependencies),
clean: true,
esbuildPlugins: [
copy({
assets: [
{
from: "../tabby-agent/dist/cli.js",
to: "./server/tabby-agent.js",
},
{
from: "../tabby-agent/dist/wasm/*",
to: "./server/wasm",
},
],
}),
],
}),
];
25 changes: 25 additions & 0 deletions clients/intellij/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
## 1.2.0

### Features:

- Added support for partially accepting a completion.
- Use `Ctrl + Right` to accept the next word, use `Ctrl + Tab` to accept the next line.
- Keymap scheme can be selected or customized in the plugin settings page.
- Added support for setting Tabby server token in the plugin settings page.
- You can still configure the token in the agent config file, but the token set in plugin settings page will take precedence.
- A notification will now be displayed when the server requires a token.
- Removed support for automatically opening the authentication page and fetching the token when using Tabby Cloud.
- To connect to Tabby Cloud server, you need to manually set the token instead. The token already in use will remain usable.

### Fixes:

- Corrected invalid online documentation links.
- Resolved a bug that resulted in empty log files being generated even when the logging level is set to `silent`.
- Fixed bugs related to the experimental syntax-based post-processing.

## 1.1.2

### Fixes:

- Added support for IntelliJ Platform IDEs version 2023.3.x.

## 1.1.1

### Fixes:
Expand Down
2 changes: 1 addition & 1 deletion clients/intellij/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Tabby IntelliJ Platform plugin works with all [IntelliJ Platform IDEs](https://p
4. Open the settings by clicking on the Tabby plugin status bar item and select `Open Settings...`.
1. Fill in the server endpoint URL to connect the plugin to your Tabby server.
- If you are using default port `http://localhost:8080`, you can skip this step.
2. If your Tabby server requires an authentication token, set it in the [config file](https://tabby.tabbyml.com/docs/extensions/configurations).
2. If your Tabby server requires an authentication token, set your token in settings. Alternatively, you can set it in the [config file](https://tabby.tabbyml.com/docs/extensions/configurations).
3. Enter the node binary path into the designated field
- If node binary is already accessible via your `PATH` environment variable, you can skip this step.
- Remember to save the settings and restart the IDE if you made changes to this option.
Expand Down
2 changes: 1 addition & 1 deletion clients/intellij/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}

group = "com.tabbyml"
version = "1.2.0-dev"
version = "1.2.0"

repositories {
mavenCentral()
Expand Down
120 changes: 60 additions & 60 deletions clients/intellij/node_scripts/tabby-agent.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions clients/intellij/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "intellij-tabby",
"version": "1.1.1",
"version": "1.2.0",
"description": "IntelliJ plugin for Tabby AI coding assistant.",
"repository": "https://github.com/TabbyML/tabby",
"scripts": {
Expand All @@ -10,6 +10,6 @@
"devDependencies": {
"cpy-cli": "^4.2.0",
"rimraf": "^5.0.1",
"tabby-agent": "1.2.0-dev"
"tabby-agent": "1.2.0"
}
}
Loading

0 comments on commit b471554

Please sign in to comment.