Skip to content

Commit

Permalink
Update login instructions for JetBrains and VS Code, add documentatio…
Browse files Browse the repository at this point in the history
…n for BYOK, and update @-command descriptions, plus minor fixes (#47)
  • Loading branch information
hazratisulton authored Sep 11, 2024
1 parent a66cade commit e4888bf
Show file tree
Hide file tree
Showing 21 changed files with 112 additions and 26 deletions.
4 changes: 4 additions & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ export default defineConfig({
label: 'Supported Models',
link: '/supported-models/',
},
{
label: 'BYOK',
link: '/byok/',
},
{
label: 'FAQ',
link: '/faq/',
Expand Down
Binary file added src/assets/byok.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/byok_login_start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/chat-commands.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/edit_byok.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/assets/jetbrains-dashboard.png
Binary file not shown.
Binary file removed src/assets/jetbrains-login.png
Binary file not shown.
Binary file added src/assets/jetbrains-login_start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/jetbrains_refact_cloud_login.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/jetbrains_refact_loggedin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/login_start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/refact_cloud_login.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/refact_loggedin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions src/content/docs/byok.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: "Bring Your Own Key (BYOK)"
---

## Introduction
Bring Your Own Key (BYOK) allows users to specify their API keys and select models for chat, completion, and embedding tasks across different AI platforms. This feature enables seamless integration with various services while maintaining control over API keys.
The Bring Your Own Key (BYOK) feature allows users to specify their API keys and select models for chat, completion, and embedding tasks across various AI platforms. This functionality ensures seamless integration with different services while providing users with control over their API keys.

## Configuration Steps

Select the **Bring Your Own Key** option and click the **Next** button.

![Refact BYOK Login page](../../assets/byok_login_start.png)

Click on **Edit BYOK file** to open the `bring-your-own-key.yaml` file:

![Refact edit BYOK](../../assets/edit_byok.png)

In the file, specify your API key, model name, and endpoints as necessary.

![Bring your own key](../../assets/byok.png)

## Additional Resources
For more examples and configurations, please visit the [Refact GitHub repository](https://github.com/smallcloudai/refact-lsp/tree/main/bring_your_own_key).
2 changes: 1 addition & 1 deletion src/content/docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Our own model is Refact 1.6B code LLM. It's State-of-the-art for the size and In
For chat we use models from the GPT family, you have the option to opt-out of them.
In the self-hosted version we also have StarCoder, Code Llama and WizardCoder models.

For a full list of our supported models and their functionality, check our [docs](https://docs.refact.ai/supported-models/supported-models/).
For a full list of our supported models and their functionality, check our [docs](https://docs.refact.ai/supported-models/).

### Do you plan to support more IDEs?

Expand Down
73 changes: 60 additions & 13 deletions src/content/docs/features/ai-chat.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,57 +8,104 @@ You can ask questions about your code in the integrated AI chat, and it can prov
### **Context Length**
Refact analyzes the code up to a certain length to provide suggestions.
Context length depends on the plan you have chosen for your account:
- **Free**: 4096 characters
- **Pro**: 16384 characters
- **Free**: 8000 tokens
- **Pro**: 32000 tokens

## Modes of Operation

With Refact.ai, you have access to three distinct modes that enhance your interaction with the AI chat: **Quick**, **Explore**, and **Agent**.

### Quick Mode
In **Quick Mode**, the model responds instantly without accessing external tools. This mode is ideal for rapid interactions and quick queries. You can enrich your experience with the following @-commands:

- **@web**: Convert any webpage into plain text for quick summarization and interaction. Simply use `@web` followed by the URL (e.g., `@web https://refact.ai/`) to fetch and convert the content into text that can be used within your chat.

- **@search**: Quickly locate similar code or text within your workspace, directory, or file. Use `@search` followed by your query (e.g., `@search create table`) to find matching content for seamless exploration and interaction.

### Explore Mode
**Explore Mode** is more advanced than Quick Mode, utilizing exploration tools to gather context about the project before answering questions. This mode automatically employs @-commands such as:

- **@definition**: Fetch definitions of symbols within the codebase.

- **@reference**: Locate usages of specific functions or classes throughout the project.

- **@tree**: View the project structure and navigate through multiple files to understand the context better.

Explore Mode allows for a deeper understanding of the codebase, enabling the model to provide more informed answers.

### Agent Mode
**Agent Mode** introduces agent capabilities that significantly enhance the way you program. While responses may take longer, this mode offers higher-quality solutions for complex challenges. Key features include:

- **Contextual Awareness**: The model can analyze and understand the broader context of your code, leading to more relevant suggestions and solutions.

- **Task Automation**: Agent Mode can assist in automating repetitive tasks, allowing you to focus on more critical aspects of your project.

- **Complex Problem Solving**: It is designed to tackle intricate programming challenges by leveraging its understanding of the codebase and available resources.

While we are still refining Agent Mode, it already provides valuable assistance for developers looking to enhance their productivity and code quality.


## @-commands

This section outlines various commands that can be used in the AI chat. Below you can find information about functionality and usage of each command.

![Chat Commands](../../../assets/chat-commands.png)

### `@workspace`
#### `@help`

- **Description**: Searches within VecDB for any specified query. This command allows you to search for any query within your repository/workspace.
- **Usage**:
- Single-line Query: Append the query directly after the command, e.g., `@workspace Something definition`.
- Multi-line Query: Type the command followed by pressing `Enter`. Subsequent lines entered will be considered part of the query, allowing for multi-line entries such as code snippets.
- **Description**: Provides information about available commands and their usage.
- **Usage**: Type `@help`.

### `@file`
#### `@file`

- **Description**: Attaches a file to the chat.
- **Usage**:
- To attach a whole file, use the command followed by the file name, e.g., `@file example.ext`.
- To specify a particular section of a file, include the line numbers, e.g., `@file large_file.ext:42` or for a range, `@file large_file.ext:42-56`.

### `@definition`
#### `@definition`

- **Description**: Retrieves the definition of a symbol.
- **Usage**: Type `@definition` followed by the symbol name, e.g., `@definition MyClass`.

### `@references`
#### `@references`

- **Description**: Returns references for a symbol, including usage examples.
- **Usage**: Type `@references` followed by the symbol name, e.g., `@references MyClass`.

### `@symbols-at`
#### `@symbols-at`

- **Description**: Searches for and adds symbols near a specified line in a file to the chat context.
- **Usage**: Specify both the file and the line number, e.g., `@symbols-at some_file.ext:42`.

#### `@search`

- **Description**: Find similar pieces of code or text using the vector database.
- **Usage**: Type `@search` followed by your query and scope, e.g., `@search "function definition" workspace`.

#### `@tree`

- **Description**: Get a files tree with symbols for the project. Use it to get familiar with the project, file names, and symbols.
- **Usage**: Type `@tree` followed by an optional path, e.g., `@tree some_directory/`.

#### `@web`

- **Description**: Fetch a web page and convert to readable plain text.
- **Usage**: Type `@web` followed by the URL, e.g., `@web http://example.com`.

## Chat Initialization Options

Upon starting a new chat, several options are available that mimic the above commands:

- `Search workspace`: Equivalent to using `@workspace`. It uses the entered query to perform a search.
- `Search workspace`: Equivalent to using `@search`. It uses the entered query to perform a search.
- `Attach current_file.ext`: Similar to the `@file` command. It attaches the file at the current cursor position (CURSOR_LINE), useful for dealing with large files.
- `Lookup symbols`: Corresponds to the `@symbols-at` command. It extracts symbols around the cursor position and searches them in the AST index.
- `Selected N lines`: Adds the currently selected lines as a snippet for analysis or modification. This is similar to embedding code within backticks ``` in the chat.

## Enabling commands

To use @-commands in the AI chat, you need to enable specific settings:
- `@workspace` - enable the `Enable embedded vecdb for search` checkbox under the `Refactai: Vecdb` section.
- `@search` - enable the `Enable vector database` checkbox under the `Refactai: Vecdb` section.
- `@definition`, `@file`, `@references`, `@symbols-at` - enable the `Enable syntax parsing` checkbox under the `Refactai: Ast` section.

Read more in the [Enabling RAG Documentation](https://docs.refact.ai/features/context/).
4 changes: 2 additions & 2 deletions src/content/docs/features/ai-toolbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: A page about functions in the Refact AI Toolbox
Refact.ai Toolbox is a set of functions that can be used to
refactor, analyze, and improve your code.

The Toolbox can be accessed by pressing `F1`. It will open a modal
The Toolbox can be accessed by pressing `Alt+T`. It will open a modal
window associated with a specific line of code or a block of code.

At the moment, AI Toolbox only works with VS Code.
Expand All @@ -28,7 +28,7 @@ The following commands are available in the Toolbox:
## Custom toolbox commands

You can also create your own toolbox commands. To do that, you need to press
`F1` and type `/help` in the Refact.ai console. At the bottom, you will see a
`Alt+T` and type `/help` in the Refact.ai console. At the bottom, you will see a
button called `Customize toolbox`. Press it and the `customization.yaml`
file will open.

Expand Down
6 changes: 3 additions & 3 deletions src/content/docs/features/code-completion.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Refact utilizes a technique called **Fill-in-the-middle** (FIM), where the conte

## Code Completion Models

- **Cloud Version**: The cloud version of Refact uses the `Refact-1.6-fim` model.
- **Cloud Version**: The cloud version of Refact uses the `Refact-1.6-fim` and `starcoder2/3b` model.
- **Self-Hosted Version**: If you opt for the self-hosted version, you have the flexibility to choose from a variety of models. For a detailed list of available models, refer to the [Supported Models](https://docs.refact.ai/supported-models/) section of the documentation.
- **Enterprise Version**: The enterprise version of Refact allows you to use the models available in the Self-hosted version and additional vLLM models.

Expand All @@ -20,8 +20,8 @@ Refact utilizes a technique called **Fill-in-the-middle** (FIM), where the conte
### **Context Length**
Refact analyzes the code up to a certain length to provide suggestions.
Context length depends on the plan you have chosen for your account:
- **Free**: 2048 characters
- **Pro**: 4096 characters
- **Free**: 2048 tokens
- **Pro**: 4096 tokens

### **Cache Mechanism**
To enhance performance, Refact caches previous computations and suggestions.
Expand Down
22 changes: 16 additions & 6 deletions src/content/docs/installation/jetbrains.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,33 @@ title: Refact for JetBrains IDEs
description: A page which explains how to install and use Refact for JetBrains IDEs
---

For JetBrains products, after installing the plugin from the [marketplace](https://plugins.jetbrains.com/plugin/20647-codify), press `Cmd + ,` to open the settings panel.
For JetBrains products, after installing the plugin from the [marketplace](https://plugins.jetbrains.com/plugin/20647-codify), press the Refact logo to open the UI of the plugin.

Find `Refact` in the list of plugins and log in to your Refact account.
Pick one of the available versions and click the **Next** button.

![JetBrains Login](../../../assets/jetbrains-login.png)
![JetBrains Login](../../../assets/jetbrains-login_start.png)

You will see your account details and privacy settings.
The quickest way to get started is with **Cloud** option. When pressing the **Next** button, you will see an interface similar to the one below:

![JetBrains Dashboard](../../../assets/jetbrains-dashboard.png)
![Refact Cloud Login](../../../assets/jetbrains_refact_cloud_login.png)

When pressing the **Login** or **Create Account** button, you will be redirected to the Refact's login page in your browser.

After completing the login process, the interface of the sidebar will change to the following:

![Refact Sidebar](../../../assets/jetbrains_refact_loggedin.png)

For the Self-hosted and Enterprise options, follow one of the following guides:

- [Self-hosted Login](https://docs.refact.ai/guides/version-specific/self-hosted/#custom-inference-setup)
- [Enterprise Login](https://docs.refact.ai/guides/version-specific/enterprise/#setting-up-the-plugins)


# Early Access Program

If you feel adventurous, add Early Access Program to your Plugins settings over here:

![Early Access Program](../../../assets/jetbrains-early-access-program.jpg)
jetbrains-early-access-program.jpg

In a small window called "Custom Plugin Repositories" add "https://plugins.jetbrains.com/plugins/eap/list",
then update the plugin.
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/installation/vs-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The quickest way to get started is with **Cloud** option. When pressing the **Ne

![Refact Cloud Login](../../../assets/refact_cloud_login.png)

When pressing the **Login/Create Account** button, you will be redirected to the Refact's login page in your browser.
When pressing the **Login** or **Create Account** button, you will be redirected to the Refact's login page in your browser.

After completing the login process, the interface of the sidebar will change to the following:

Expand Down
1 change: 1 addition & 0 deletions src/content/docs/supported-models.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ description: Supported Models in Refact

### Completion models
- Refact/1.6B
- starcoder2/3b

### Chat models
- GPT 3.5
Expand Down

0 comments on commit e4888bf

Please sign in to comment.