Add SystemContextProvider to context providers so that users can use … (#988)
* Add SystemContextProvider to context providers so that users can use their own system cpu and os for a resource * change to OSContextProvider * update descriptor
This commit is contained in:
parent
9ab5d295ec
commit
60d2cb4450
7 changed files with 57 additions and 10 deletions
36
core/context/providers/OSContextProvider.ts
Normal file
36
core/context/providers/OSContextProvider.ts
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
//os.platform()
|
||||
//os.arch()
|
||||
|
||||
import { BaseContextProvider } from "..";
|
||||
import {
|
||||
ContextItem,
|
||||
ContextProviderDescription,
|
||||
ContextProviderExtras,
|
||||
} from "../..";
|
||||
import os from "os";
|
||||
|
||||
class OSContextProvider extends BaseContextProvider {
|
||||
static description: ContextProviderDescription = {
|
||||
title: "OS",
|
||||
displayTitle: "OS",
|
||||
description: "OS and CPU Information.",
|
||||
type: "normal",
|
||||
};
|
||||
|
||||
async getContextItems(
|
||||
query: string,
|
||||
extras: ContextProviderExtras,
|
||||
): Promise<ContextItem[]> {
|
||||
const cpu = os.arch();
|
||||
const platform = os.platform();
|
||||
return [
|
||||
{
|
||||
description: "Your OS and CPU",
|
||||
content: `I am running ${platform} on ${cpu}.`,
|
||||
name: "OS",
|
||||
},
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
export default OSContextProvider;
|
||||
|
|
@ -15,6 +15,7 @@ import OpenFilesContextProvider from "./OpenFilesContextProvider";
|
|||
import PostgresContextProvider from "./PostgresContextProvider";
|
||||
import ProblemsContextProvider from "./ProblemsContextProvider";
|
||||
import SearchContextProvider from "./SearchContextProvider";
|
||||
import OSContextProvider from "./OSContextProvider";
|
||||
import TerminalContextProvider from "./TerminalContextProvider";
|
||||
import LocalsProvider from "./LocalsProvider";
|
||||
import URLContextProvider from "./URLContextProvider";
|
||||
|
|
@ -31,6 +32,7 @@ const Providers: (typeof BaseContextProvider)[] = [
|
|||
OpenFilesContextProvider,
|
||||
HttpContextProvider,
|
||||
SearchContextProvider,
|
||||
OSContextProvider,
|
||||
CodebaseContextProvider,
|
||||
ProblemsContextProvider,
|
||||
FolderContextProvider,
|
||||
|
|
|
|||
3
core/index.d.ts
vendored
3
core/index.d.ts
vendored
|
|
@ -441,7 +441,8 @@ type ContextProviderName =
|
|||
| "database"
|
||||
| "code"
|
||||
| "docs"
|
||||
| "gitlab-mr";
|
||||
| "gitlab-mr"
|
||||
| "os";
|
||||
|
||||
type TemplateType =
|
||||
| "llama2"
|
||||
|
|
|
|||
6
docs/static/schemas/config.json
vendored
6
docs/static/schemas/config.json
vendored
|
|
@ -1062,7 +1062,8 @@
|
|||
"highlights",
|
||||
"outline",
|
||||
"postgres",
|
||||
"code"
|
||||
"code",
|
||||
"system"
|
||||
],
|
||||
"markdownEnumDescriptions": [
|
||||
"Reference the contents of the current changes as given by `git diff`",
|
||||
|
|
@ -1082,7 +1083,8 @@
|
|||
"Displays important snippets of code from the currently open files",
|
||||
"Displays definition lines from the currently open files",
|
||||
"References Postgres table schema and sample rows",
|
||||
"Reference specific functions and classes from throughout your codebase"
|
||||
"Reference specific functions and classes from throughout your codebase",
|
||||
"Reference your operating system and cpu"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
git st{
|
||||
"title": "config.json",
|
||||
"$ref": "#/definitions/SerializedContinueConfig",
|
||||
"definitions": {
|
||||
|
|
@ -1062,7 +1062,8 @@
|
|||
"highlights",
|
||||
"outline",
|
||||
"postgres",
|
||||
"code"
|
||||
"code",
|
||||
"OS"
|
||||
],
|
||||
"markdownEnumDescriptions": [
|
||||
"Reference the contents of the current changes as given by `git diff`",
|
||||
|
|
@ -1082,7 +1083,8 @@
|
|||
"Displays important snippets of code from the currently open files",
|
||||
"Displays definition lines from the currently open files",
|
||||
"References Postgres table schema and sample rows",
|
||||
"Reference specific functions and classes from throughout your codebase"
|
||||
"Reference specific functions and classes from throughout your codebase",
|
||||
"Reference your operating system with cpu"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1062,7 +1062,8 @@
|
|||
"highlights",
|
||||
"outline",
|
||||
"postgres",
|
||||
"code"
|
||||
"code",
|
||||
"system"
|
||||
],
|
||||
"markdownEnumDescriptions": [
|
||||
"Reference the contents of the current changes as given by `git diff`",
|
||||
|
|
@ -1082,7 +1083,8 @@
|
|||
"Displays important snippets of code from the currently open files",
|
||||
"Displays definition lines from the currently open files",
|
||||
"References Postgres table schema and sample rows",
|
||||
"Reference specific functions and classes from throughout your codebase"
|
||||
"Reference specific functions and classes from throughout your codebase",
|
||||
"Reference your operating system and cpu"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1178,7 +1178,8 @@
|
|||
"highlights",
|
||||
"outline",
|
||||
"postgres",
|
||||
"code"
|
||||
"code",
|
||||
"system"
|
||||
],
|
||||
"markdownEnumDescriptions": [
|
||||
"Reference the contents of the current changes as given by `git diff`",
|
||||
|
|
@ -1198,7 +1199,8 @@
|
|||
"Displays important snippets of code from the currently open files",
|
||||
"Displays definition lines from the currently open files",
|
||||
"References Postgres table schema and sample rows",
|
||||
"Reference specific functions and classes from throughout your codebase"
|
||||
"Reference specific functions and classes from throughout your codebase",
|
||||
"Reference your operating system and cpu"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue