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

Optional context block name #4418

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
6 changes: 5 additions & 1 deletion core/config/yaml/loadYaml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,11 @@ async function configYamlToContinueConfig(
}
return undefined;
}
const instance: IContextProvider = new cls(context.params ?? {});
// Context providers are only instantiated using the params, so add top-level name to params
const instance: IContextProvider = new cls({
name: context.name,
...context.params,
});
return instance;
})
.filter((p) => !!p) ?? []) as IContextProvider[];
Expand Down
1 change: 1 addition & 0 deletions core/context/providers/ContinueProxyContextProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class ContinueProxyContextProvider extends BaseContextProvider {
this.options.title || ContinueProxyContextProvider.description.title,
displayTitle:
this.options.displayTitle ||
this.options.name ||
ContinueProxyContextProvider.description.displayTitle,
description:
this.options.description ||
Expand Down
12 changes: 7 additions & 5 deletions core/context/providers/HttpContextProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ class HttpContextProvider extends BaseContextProvider {

override get description(): ContextProviderDescription {
return {
title: this.options.title || "http",
displayTitle: this.options.displayTitle || "HTTP",
title: this.options.title || HttpContextProvider.description.title,
displayTitle:
this.options.displayTitle ||
this.options.name ||
HttpContextProvider.description.displayTitle,
description:
this.options.description ||
"Retrieve a context item from a custom server",
type: "normal",
this.options.description || HttpContextProvider.description.description,
type: HttpContextProvider.description.type,
renderInlineAs:
this.options.renderInlineAs ||
HttpContextProvider.description.renderInlineAs,
Expand Down
8 changes: 4 additions & 4 deletions core/package-lock.json

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

2 changes: 1 addition & 1 deletion core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@aws-sdk/client-sagemaker-runtime": "^3.758.0",
"@aws-sdk/credential-providers": "^3.758.0",
"@continuedev/config-types": "^1.0.13",
"@continuedev/config-yaml": "^1.0.61",
"@continuedev/config-yaml": "^1.0.62",
"@continuedev/fetch": "^1.0.4",
"@continuedev/llm-info": "^1.0.2",
"@continuedev/openai-adapters": "^1.0.10",
Expand Down
5 changes: 5 additions & 0 deletions docs/docs/yaml-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ More information about usage/params for each context provider can be found [here
**Properties:**

- `provider` (**required**): The identifier or name of the context provider (e.g., `code`, `docs`, `web`).
- `name`: Optional name for the provider
- `params`: Optional parameters to configure the context provider's behavior.

**Example:**
Expand All @@ -229,6 +230,10 @@ context:
nFinal: 10
- provider: docs
- provider: diff
- provider: http
name: Context Server 1
params:
url: "https://api.example.com/server1"
- provider: folder
- provider: terminal
```
Expand Down
10 changes: 5 additions & 5 deletions gui/package-lock.json

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

2 changes: 1 addition & 1 deletion gui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"test:watch": "vitest"
},
"dependencies": {
"@continuedev/config-yaml": "^1.0.61",
"@continuedev/config-yaml": "^1.0.62",
"@headlessui/react": "^1.7.17",
"@heroicons/react": "^2.0.18",
"@reduxjs/toolkit": "^2.3.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/config-yaml/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@continuedev/config-yaml",
"version": "1.0.61",
"version": "1.0.62",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
1 change: 1 addition & 0 deletions packages/config-yaml/src/schemas/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { dataSchema } from "./data/index.js";
import { modelSchema, partialModelSchema } from "./models.js";

export const contextSchema = z.object({
name: z.string().optional(),
provider: z.string(),
params: z.any().optional(),
});
Expand Down
Loading