Skip to content

Commit

Permalink
merge dev
Browse files Browse the repository at this point in the history
  • Loading branch information
RomneyDa committed Oct 31, 2024
2 parents 680edf3 + c3dada0 commit a51d4fc
Show file tree
Hide file tree
Showing 208 changed files with 10,435 additions and 5,437 deletions.
36 changes: 36 additions & 0 deletions .eslintrc.shared.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"plugins": ["@typescript-eslint", "import"],
"rules": {
"@typescript-eslint/semi": "warn",
"curly": "warn",
"eqeqeq": "warn",
"no-throw-literal": "warn",
"semi": "off",
"import/order": [
"warn",
{
"groups": [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
"object",
"type"
],
"alphabetize": {
"order": "asc",
"caseInsensitive": true
},
"newlines-between": "always"
}
]
},
"ignorePatterns": ["out", "dist", "**/*.d.ts"]
}
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

## Checklist

- [ ] The base branch of this PR is `dev`, rather than `main`
- [ ] The relevant docs, if any, have been updated or created
- [] The base branch of this PR is `dev`, rather than `main`
- [] The relevant docs, if any, have been updated or created

## Screenshots

Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/dev_pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ jobs:
with:
node-version-file: ".nvmrc"

- name: Cache root node_modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}

- name: Cache extension node_modules
uses: actions/cache@v3
with:
Expand All @@ -44,6 +50,10 @@ jobs:
path: binary/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('binary/package-lock.json') }}

- name: root install
run: |
npm ci
- name: extensions/vscode install
run: |
cd extensions/vscode
Expand Down Expand Up @@ -71,6 +81,7 @@ jobs:
run: |
cd extensions/vscode
npx tsc --noEmit
npm run lint
- name: core checks
run: |
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/jetbrains-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ jobs:
with:
node-version-file: ".nvmrc"

# Cache node_modules
- name: Cache core node_modules
uses: actions/cache@v3
with:
Expand Down
8 changes: 0 additions & 8 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,3 @@ jobs:
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# branch: ${{ github.ref }}

# 5 Send to Discord Webhook
- name: Discord Commits
uses: Sniddl/[email protected]
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
template: "avatar-with-link"
include-extras: true
12 changes: 12 additions & 0 deletions .github/workflows/ts-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ jobs:
with:
node-version-file: ".nvmrc"

- name: Cache root node_modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}

- name: Cache extension node_modules
uses: actions/cache@v3
with:
Expand All @@ -45,6 +51,10 @@ jobs:
path: binary/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('binary/package-lock.json') }}

- name: Install Root Dependencies
run: |
npm ci
- name: Install extension Dependencies
run: |
cd extensions/vscode
Expand Down Expand Up @@ -72,11 +82,13 @@ jobs:
run: |
cd core
npx tsc --noEmit
npm run lint
- name: tsc extensions/vscode
run: |
cd extensions/vscode
npx tsc --noEmit
npm run lint
- name: tsc binary
run: |
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,6 @@ extensions/intellij/.idea/**
**/.idea/workspace.xml
**/.idea/usage.statistics.xml
**/.idea/shelf/

extensions/intellij/bin
extensions/.continue-debug/
2 changes: 1 addition & 1 deletion .idea/.name

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

2 changes: 1 addition & 1 deletion .idea/misc.xml

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

8 changes: 0 additions & 8 deletions .idea/modules/continue-intellij-extension.iml

This file was deleted.

5 changes: 3 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"outFiles": ["${workspaceFolder}/extensions/vscode/out/extension.js"],
"preLaunchTask": "vscode-extension:build",
"env": {
// "staging" for the preview deployment
"CONTINUE_GLOBAL_DIR": "${workspaceFolder}/extensions/.continue-debug"
// "staging" for the preview deployment "CONTINUE_GLOBAL_DIR": "${workspaceFolder}/extensions/.continue-debug"
// "local" for entirely local development of control plane/proxy
// "CONTROL_PLANE_ENV": "staging"
}
Expand All @@ -38,7 +39,7 @@
"cwd": "${workspaceFolder}/binary",
"env": {
"CONTINUE_DEVELOPMENT": "true",
"CONTINUE_GLOBAL_DIR": "${workspaceFolder}/binary/.continue"
"CONTINUE_GLOBAL_DIR": "${workspaceFolder}/extensions/.continue-debug"
}
},
{
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"**/core/vendor/**": true,
"**/gui/dist": true,
"**/extensions/vscode/gui/**": true,
"**/extensions/vscode/out/**": true
"**/extensions/vscode/out/**": true,
"**/extensions/intellij/build/**": true
},
"eslint.workingDirectories": ["./core"]
}
7 changes: 5 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"label": "vscode-extension:build",
"dependsOn": [
// To detect compile errors
// To detect compile errors and output extensions.js
"vscode-extension:tsc",
// To build the React app that is used in the extension
"vscode-extension:continue-ui:build",
Expand All @@ -21,7 +21,10 @@
},
{
"label": "vscode-extension:esbuild",
"dependsOn": ["vscode-extension:continue-ui:build"],
"dependsOn": [
"vscode-extension:continue-ui:build",
"vscode-extension:tsc"
],
"type": "npm",
"script": "esbuild-watch",
"path": "extensions/vscode",
Expand Down
7 changes: 3 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,9 @@ Continue has support for more than a dozen different LLM "providers", making it
While any model that works with a supported provider can be used with Continue, we keep a list of recommended models that can be automatically configured from the UI or `config.json`. The following files should be updated when adding a model:

- [config_schema.json](./extensions/vscode/config_schema.json) - This is the JSON Schema definition that is used to validate `config.json`. You'll notice a number of rules defined in "definitions.ModelDescription.allOf". Here is where you write rules that can specify something like "for the provider 'anthropic', only models 'claude-2' and 'claude-instant-1' are allowed. Look through all of these rules and make sure that your model is included for providers that support it.
- [modelData.ts](./gui/src/util/modelData.ts) - This file defines that information that is shown in the model selection UI in the side bar. To add a new model:
1. create a `ModelPackage` object, following the lead of the many examples near the top of the file
2. add the `ModelPackage` to the `MODEL_INFO` array if you would like it to be displayed in the "Models" tab
3. if you would like it to be displayed as an option under any of the providers, go to the `PROVIDER_INFO` object and add it to the `packages` array for each provider that you want it to be displayed under. If it is an OS model that should be valid for most providers offering OS models, you might just be able to add it to the `osModels` array as shorthand.
- [AddNewModel page](./gui/src/pages/AddNewModel) - This directory defines which model options are shown in the side bar model selection UI. To add a new model:
1. Add a `ModelPackage` entry for the model into [configs/models.ts](./gui/src/pages/AddNewModel/configs/models.ts), following the lead of the many examples near the top of the file
2. Add the model within its provider's array to [AddNewModel.tsx](./gui/src/pages/AddNewModel/AddNewModel.tsx) (add provider if needed)
- [index.d.ts](./core/index.d.ts) - This file defines the TypeScript types used throughout Continue. You'll find a `ModelName` type. Be sure to add the name of your model to this.
- LLM Providers: Since many providers use their own custom strings to identify models, you'll have to add the translation from Continue's model name (the one you added to `index.d.ts`) and the model string for each of these providers: [Ollama](./core/llm/llms/Ollama.ts), [Together](./core/llm/llms/Together.ts), and [Replicate](./core/llm/llms/Replicate.ts). You can find their full model lists here: [Ollama](https://ollama.ai/library), [Together](https://docs.together.ai/docs/inference-models), [Replicate](https://replicate.com/collections/streaming-language-models).
- [Prompt Templates](./core/llm/index.ts) - In this file you'll find the `autodetectTemplateType` function. Make sure that for the model name you just added, this function returns the correct template type. This is assuming that the chat template for that model is already built in Continue. If not, you will have to add the template type and corresponding edit and chat templates.
Expand Down
4 changes: 1 addition & 3 deletions binary/package-lock.json

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

13 changes: 2 additions & 11 deletions core/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"extends": ["../.eslintrc.shared.json"],
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": ["@typescript-eslint", "import"],
"rules": {
"quotes": ["warn", "double", {}],
"@typescript-eslint/naming-convention": "off",
"@typescript-eslint/semi": "warn",
"curly": "warn",
"eqeqeq": "warn",
"no-throw-literal": "warn",
"semi": "off",
"@typescript-eslint/no-floating-promises": "warn"
},
"ignorePatterns": ["out", "dist", "**/*.d.ts"]
}
}
10 changes: 3 additions & 7 deletions core/autocomplete/cache.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import { Mutex } from "async-mutex";
import { open } from "sqlite";
import sqlite3 from "sqlite3";
import { DatabaseConnection } from "../indexing/refreshIndex.js";
import { DatabaseConnection, truncateSqliteLikePattern } from "../indexing/refreshIndex.js";
import { getTabAutocompleteCacheSqlitePath } from "../util/paths.js";

export class AutocompleteLruCache {
private static capacity = 1000;
private mutex = new Mutex();

db: DatabaseConnection;

constructor(db: DatabaseConnection) {
this.db = db;
}
constructor(private db: DatabaseConnection) { }

static async get(): Promise<AutocompleteLruCache> {
const db = await open({
Expand Down Expand Up @@ -41,7 +37,7 @@ export class AutocompleteLruCache {
// Have to make sure we take the key with shortest length
const result = await this.db.get(
"SELECT key, value FROM cache WHERE ? LIKE key || '%' ORDER BY LENGTH(key) DESC LIMIT 1",
prefix,
truncateSqliteLikePattern(prefix),
);

// Validate that the cached compeltion is a valid completion for the prefix
Expand Down
Loading

0 comments on commit a51d4fc

Please sign in to comment.