Skip to content

Commit

Permalink
Merge pull request #281 from codefori/chatai
Browse files Browse the repository at this point in the history
Chatai
  • Loading branch information
ajshedivy authored Oct 10, 2024
2 parents 00428ed + ace6371 commit 3ed6969
Show file tree
Hide file tree
Showing 17 changed files with 1,362 additions and 1,075 deletions.
4 changes: 3 additions & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
"type": "npm",
"script": "webpack-dev",
"problemMatcher": "$ts-webpack-watch",
"isBackground": false,

"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
"isDefault": true,
}
}
]
Expand Down
1,151 changes: 300 additions & 851 deletions package-lock.json

Large diffs are not rendered by default.

144 changes: 111 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"name": "vscode-db2i",
"displayName": "Db2 for IBM i",
"description": "Db2 for IBM i tools in VS Code",
"version": "1.5.1",
"version": "1.5.2",
"engines": {
"vscode": "^1.70.0"
"vscode": "^1.90.0"
},
"icon": "media/logo.png",
"keywords": [
Expand All @@ -28,7 +28,8 @@
"onLanguage:sql"
],
"extensionDependencies": [
"halcyontechltd.code-for-ibmi"
"halcyontechltd.code-for-ibmi",
"github.copilot-chat"
],
"main": "./dist/extension.js",
"scripts": {
Expand All @@ -37,39 +38,31 @@
"language:test": "vitest",
"dsc": "mkdir -p dist && npx tsx src/dsc",
"package": "vsce package",
"vscode:prepublish": "rm -rf dist && npm run webpack && npm run dsc",
"webpack": "vscd --clean && webpack --mode development",
"webpack-dev": "vscd --clean && webpack --mode development",
"vscode:prepublish": "rm -rf dist && webpack --mode production && npm run dsc",
"webpack": "webpack --mode development",
"webpack-dev": "webpack --mode development",
"typings": "npx -p typescript tsc ./src/extension.ts --declaration --allowJs --emitDeclarationOnly --outDir types --esModuleInterop -t es2019 --moduleResolution node"
},
"devDependencies": {
"@halcyontech/vscode-ibmi-types": "^2.12.1",
"@types/glob": "^7.1.3",
"@types/node": "14.x",
"@types/vscode": "^1.70.0",
"esbuild-loader": "^3.0.1",
"eslint": "^7.32.0",
"glob": "^7.1.7",
"octokit": "^3.1.2",
"raw-loader": "^4.0.2",
"ts-loader": "^9.3.1",
"typescript": "^4.3.2",
"vitest": "^0.33.0",
"vscd": "^1.0.0",
"vscode-test": "^1.5.2",
"webpack": "^5.91.0",
"webpack-cli": "^4.5.0"
},
"dependencies": {
"@ibm/mapepire-js": "^0.3.0",
"chart.js": "^4.4.2",
"csv": "^6.1.3",
"json-to-markdown-table": "^1.0.0",
"node-fetch": "^3.3.1",
"showdown": "^2.1.0",
"sql-formatter": "^14.0.0"
},
"contributes": {
"chatParticipants": [
{
"id": "vscode-db2i.chat",
"name": "db2i",
"fullName": "Db2 for i",
"description": "Chat with the Db2 for i AI assistant",
"isSticky": true,
"commands": [
{
"name": "build",
"description": "Build an SQL statement"
},
{
"name": "activity",
"description": "Summarize the activity on the system"
}
]
}
],
"configuration": [
{
"id": "vscode-db2i",
Expand Down Expand Up @@ -128,6 +121,33 @@
}
}
},
{
"id": "vscode-db2i.ai",
"title": "Db2 for IBM i with AI",
"properties": {
"vscode-db2i.ai.provider": {
"order": 0,
"type": "string",
"description": "Model Provider",
"default": "none",
"enum": [
"none",
"Ollama",
"GitHub Copilot"
],
"enumDescriptions": [
"Ollama instance, with specific model",
"GitHub Copilot. Requires the GitHub Copilot extension to be installed"
]
},
"vscode-db2i.ai.model": {
"order": 1,
"type": "string",
"description": "Model to use with the provider",
"default": "ibm-granite"
}
}
},
{
"id": "vscode-db2i.resultsets",
"title": "Viewing Data",
Expand Down Expand Up @@ -306,6 +326,24 @@
]
},
"commands": [
{
"command": "vscode-db2i.ai.changeModel",
"title": "Change AI Model",
"category": "Db2 for i"
},
{
"command": "vscode-db2i.notebook.open",
"title": "New Notebook",
"category": "IBM i Notebooks",
"enablement": "code-for-ibmi:connected == true",
"icon": "$(notebook)"
},
{
"command": "vscode-db2i.notebook.fromSqlUri",
"title": "Open as Notebook",
"category": "IBM i Notebooks",
"icon": "$(notebook)"
},
{
"command": "vscode-db2i.json.pasteGenerator",
"title": "Paste JSON as SQL",
Expand Down Expand Up @@ -1225,6 +1263,18 @@
}
],
"snippets": [
{
"language": "sql",
"path": "snippets/scalars.code-snippets"
},
{
"language": "sql",
"path": "snippets/variables.code-snippets"
},
{
"language": "sql",
"path": "snippets/aggregates.code-snippets"
},
{
"language": "sql",
"path": "snippets/http.code-snippets"
Expand All @@ -1246,5 +1296,33 @@
"path": "snippets/aggregates.code-snippets"
}
]
},
"devDependencies": {
"@halcyontech/vscode-ibmi-types": "^2.0.0",
"@types/glob": "^7.1.3",
"@types/node": "14.x",
"@types/vscode": "^1.90.0",
"esbuild-loader": "^3.0.1",
"eslint": "^7.32.0",
"glob": "^7.1.7",
"octokit": "^3.1.2",
"raw-loader": "^4.0.2",
"ts-loader": "^9.3.1",
"typescript": "^4.3.2",
"vitest": "^0.33.0",
"vscode-test": "^1.5.2",
"webpack": "^5.91.0",
"webpack-cli": "^4.5.0"
},
"dependencies": {
"@ibm/mapepire-js": "^0.3.0",
"chart.js": "^4.4.2",
"csv": "^6.1.3",
"json-to-markdown-table": "^1.0.0",
"lru-cache": "^6.0.0",
"node-fetch": "^3.3.1",
"ollama": "^0.5.2",
"showdown": "^2.1.0",
"sql-formatter": "^14.0.0"
}
}
25 changes: 25 additions & 0 deletions src/chat/aiConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Configuration from "../configuration";

/**
* Matches config vscode-db2i.ai.provider
*/
export type AiProvider = "none"|"Ollama"|"GitHub Copilot";

export class AiConfig {

static getProvider(): AiProvider {
return Configuration.get<AiProvider>(`ai.provider`);
}

static getModel(): string {
return Configuration.get<string>("ai.model");
}

static setProvider(provider: AiProvider) {
return Configuration.set(`ai.provider`, provider);
}

static setModel(model: string) {
return Configuration.set(`ai.model`, model);
}
}
Loading

0 comments on commit 3ed6969

Please sign in to comment.