Skip to content

Commit a94c178

Browse files
committed
optional-context-name
1 parent 97960fa commit a94c178

File tree

5 files changed

+20
-8
lines changed

5 files changed

+20
-8
lines changed

core/config/yaml/loadYaml.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,10 @@ async function configYamlToContinueConfig(
374374
}
375375
return undefined;
376376
}
377-
const instance: IContextProvider = new cls(context.params ?? {});
377+
const instance: IContextProvider = new cls({
378+
name: context.name,
379+
...context.params,
380+
});
378381
return instance;
379382
})
380383
.filter((p) => !!p) ?? []) as IContextProvider[];

core/context/providers/ContinueProxyContextProvider.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class ContinueProxyContextProvider extends BaseContextProvider {
2424
this.options.title || ContinueProxyContextProvider.description.title,
2525
displayTitle:
2626
this.options.displayTitle ||
27+
this.options.name ||
2728
ContinueProxyContextProvider.description.displayTitle,
2829
description:
2930
this.options.description ||

core/context/providers/HttpContextProvider.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,20 @@ class HttpContextProvider extends BaseContextProvider {
1616

1717
override get description(): ContextProviderDescription {
1818
return {
19-
title: this.options.title || "http",
20-
displayTitle: this.options.displayTitle || "HTTP",
19+
title: this.options.title || HttpContextProvider.description.title,
20+
displayTitle:
21+
this.options.displayTitle ||
22+
this.options.name ||
23+
HttpContextProvider.description.displayTitle,
2124
description:
22-
this.options.description ||
23-
"Retrieve a context item from a custom server",
24-
type: "normal",
25+
this.options.description || HttpContextProvider.description.description,
26+
type: HttpContextProvider.description.type,
2527
renderInlineAs:
2628
this.options.renderInlineAs ||
2729
HttpContextProvider.description.renderInlineAs,
2830
};
2931
}
30-
32+
3133
async getContextItems(
3234
query: string,
3335
extras: ContextProviderExtras,

docs/docs/reference.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ More information about usage/params for each context provider can be found [here
220220

221221
**Properties:**
222222

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

226227
**Example:**
@@ -234,6 +235,10 @@ context:
234235
nFinal: 10
235236
- provider: docs
236237
- provider: diff
238+
- provider: http
239+
name: Context Server 1
240+
params:
241+
url: "https://api.example.com/server1"
237242
- provider: folder
238243
- provider: terminal
239244
```

packages/config-yaml/src/schemas/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { dataSchema } from "./data/index.js";
33
import { modelSchema, partialModelSchema } from "./models.js";
44

55
export const contextSchema = z.object({
6+
name: z.string().optional(),
67
provider: z.string(),
78
params: z.any().optional(),
89
});

0 commit comments

Comments
 (0)