diff --git a/core/context/providers/OSContextProvider.ts b/core/context/providers/OSContextProvider.ts new file mode 100644 index 000000000..fd0996e94 --- /dev/null +++ b/core/context/providers/OSContextProvider.ts @@ -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 { + 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; diff --git a/core/context/providers/index.ts b/core/context/providers/index.ts index c30dc63b0..4fd950b26 100644 --- a/core/context/providers/index.ts +++ b/core/context/providers/index.ts @@ -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, diff --git a/core/index.d.ts b/core/index.d.ts index c8d03177a..5485a1d49 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -441,7 +441,8 @@ type ContextProviderName = | "database" | "code" | "docs" - | "gitlab-mr"; + | "gitlab-mr" + | "os"; type TemplateType = | "llama2" diff --git a/docs/static/schemas/config.json b/docs/static/schemas/config.json index f93ccb3ba..a8c88a803 100644 --- a/docs/static/schemas/config.json +++ b/docs/static/schemas/config.json @@ -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" }, diff --git a/extensions/intellij/src/main/resources/config_schema.json b/extensions/intellij/src/main/resources/config_schema.json index f93ccb3ba..bf9419678 100644 --- a/extensions/intellij/src/main/resources/config_schema.json +++ b/extensions/intellij/src/main/resources/config_schema.json @@ -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" }, diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index f93ccb3ba..a8c88a803 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -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" }, diff --git a/extensions/vscode/continue_rc_schema.json b/extensions/vscode/continue_rc_schema.json index 7e0a61118..67a294786 100644 --- a/extensions/vscode/continue_rc_schema.json +++ b/extensions/vscode/continue_rc_schema.json @@ -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" },