Skip to content

Optional context block name #4922

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

Merged
merged 7 commits into from
Apr 18, 2025
Merged
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
5 changes: 4 additions & 1 deletion core/config/yaml/loadYaml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,10 @@ async function configYamlToContinueConfig({
}
return undefined;
}
const instance: IContextProvider = new cls(context.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
14 changes: 8 additions & 6 deletions core/context/providers/HttpContextProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,20 @@ 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,
};
}

async getContextItems(
query: string,
extras: ContextProviderExtras,
Expand Down
7 changes: 6 additions & 1 deletion docs/docs/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ 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`).
- `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
4 changes: 2 additions & 2 deletions packages/config-yaml/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 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.78",
"version": "1.0.87",
"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